@posx/core 5.5.327 → 5.5.329
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/CLAUDE.md +23 -23
- package/LICENSE +21 -21
- package/README.md +85 -85
- package/build/index.d.ts +2 -0
- package/build/index.js +191 -12
- package/jest.config.cjs +36 -36
- package/jest.setup.cjs +80 -80
- package/package.json +1 -1
- package/package.publish.json +120 -120
- package/tsdown.config.ts +18 -18
- package/vite.config.ts +86 -86
package/CLAUDE.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# Claude AI Development Guidelines
|
|
2
|
-
|
|
3
|
-
## Rules you have to follow strictly
|
|
4
|
-
|
|
5
|
-
- You are top-notch programmer who always write simplest code to achieve the ideal result
|
|
6
|
-
- you are one liner engineers and we believe "The Great Tao is Simple", so try to keep changes small and focused
|
|
7
|
-
- keep the changes as minimal as possible
|
|
8
|
-
- if or else has one line of code, then { } are not needed and it should be wrote into same line
|
|
9
|
-
- DO NOT write uncessary comment do not make newlines within a function and try to make the code compact
|
|
10
|
-
- All crucial code should have proper explanation in English
|
|
11
|
-
- Keep the simplifications as small and focused within the function or scope.
|
|
12
|
-
- Do not overhaul the whole file or codebase which is irrelevant to the current task.
|
|
13
|
-
|
|
14
|
-
## Best Practices for AI-Assisted Development
|
|
15
|
-
|
|
16
|
-
1. **在开始编码前先充分讨论和规划架构,确保理解用户的真实需求和使用场景,避免过度设计。**
|
|
17
|
-
|
|
18
|
-
2. **不要急于提交代码,应该等待用户明确指示后再进行 commit 和 push 操作。**
|
|
19
|
-
|
|
20
|
-
3. **优先选择简洁的实现方式(如函数导出而非类),并删除冗余的中间层方法以保持代码清晰。**
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
1
|
+
# Claude AI Development Guidelines
|
|
2
|
+
|
|
3
|
+
## Rules you have to follow strictly
|
|
4
|
+
|
|
5
|
+
- You are top-notch programmer who always write simplest code to achieve the ideal result
|
|
6
|
+
- you are one liner engineers and we believe "The Great Tao is Simple", so try to keep changes small and focused
|
|
7
|
+
- keep the changes as minimal as possible
|
|
8
|
+
- if or else has one line of code, then { } are not needed and it should be wrote into same line
|
|
9
|
+
- DO NOT write uncessary comment do not make newlines within a function and try to make the code compact
|
|
10
|
+
- All crucial code should have proper explanation in English
|
|
11
|
+
- Keep the simplifications as small and focused within the function or scope.
|
|
12
|
+
- Do not overhaul the whole file or codebase which is irrelevant to the current task.
|
|
13
|
+
|
|
14
|
+
## Best Practices for AI-Assisted Development
|
|
15
|
+
|
|
16
|
+
1. **在开始编码前先充分讨论和规划架构,确保理解用户的真实需求和使用场景,避免过度设计。**
|
|
17
|
+
|
|
18
|
+
2. **不要急于提交代码,应该等待用户明确指示后再进行 commit 和 push 操作。**
|
|
19
|
+
|
|
20
|
+
3. **优先选择简洁的实现方式(如函数导出而非类),并删除冗余的中间层方法以保持代码清晰。**
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
24
|
*This file contains guidelines learned from AI-human collaboration to improve development efficiency and code quality.*
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 Francisco Hodge
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Francisco Hodge
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
# 第一阶段
|
|
2
|
-
- 1. 创建,更新,删除都是通过 -> Http API
|
|
3
|
-
- 2. 读取是通过本地数据库 -> 本地, (例外:订单从云端读取)
|
|
4
|
-
|
|
5
|
-
# 第二阶段 (单机版)
|
|
6
|
-
1. 创建,更新,删除,读取都通过本地数据库,然后进行数据和云端同步(Web Worker)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<div align="center">
|
|
19
|
-
<img align="center" width="230" src="https://i.imgur.com/iHgtvmg.png" />
|
|
20
|
-
<h2>Typescript Library Boilerplate Basic</h2>
|
|
21
|
-
<blockquote>Minimal Library Starter Kit for your Typescript projects</blockquote>
|
|
22
|
-
|
|
23
|
-
<a href="https://www.npmjs.com/package/@hodgef/ts-library-boilerplate-basic"><img src="https://badgen.net/npm/v/@hodgef/ts-library-boilerplate-basic?color=blue" alt="npm version"></a> <a href="https://github.com/hodgef/ts-library-boilerplate"><img src="https://img.shields.io/github/last-commit/hodgef/ts-library-boilerplate" alt="latest commit"></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"><img alt="Build Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Build/badge.svg?color=green" /></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"> <img alt="Publish Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Publish/badge.svg?color=green" /></a>
|
|
24
|
-
|
|
25
|
-
<strong>For a plain Javascript alternative, check out [js-library-boilerplate-basic](https://github.com/hodgef/js-library-boilerplate-basic).</strong>
|
|
26
|
-
|
|
27
|
-
</div>
|
|
28
|
-
|
|
29
|
-
## ⭐️ Features
|
|
30
|
-
|
|
31
|
-
- Webpack 5
|
|
32
|
-
- Babel 7
|
|
33
|
-
- Hot reloading (`npm start`)
|
|
34
|
-
- Automatic Types file generation (index.d.ts)
|
|
35
|
-
- UMD exports, so your library works everywhere.
|
|
36
|
-
- Jest unit testing
|
|
37
|
-
- Customizable file headers for your build [(Example 1)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/index.js) [(Example2)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/css/index.css)
|
|
38
|
-
- Daily [dependabot](https://dependabot.com) dependency updates
|
|
39
|
-
|
|
40
|
-
## 📦 Getting Started
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
git clone https://github.com/hodgef/ts-library-boilerplate-basic.git myLibrary
|
|
44
|
-
npm install
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## 💎 Customization
|
|
48
|
-
|
|
49
|
-
> Before shipping, make sure to:
|
|
50
|
-
|
|
51
|
-
1. Edit `LICENSE` file
|
|
52
|
-
2. Edit `package.json` information (These will be used to generate the headers for your built files)
|
|
53
|
-
3. Edit `library: "MyLibrary"` with your library's export name in `./webpack.config.js`
|
|
54
|
-
|
|
55
|
-
## 🚀 Deployment
|
|
56
|
-
|
|
57
|
-
1. `npm publish`
|
|
58
|
-
2. Your users can include your library as usual
|
|
59
|
-
|
|
60
|
-
### npm
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
import MyLibrary from 'my-library';
|
|
64
|
-
const libraryInstance = new MyLibrary();
|
|
65
|
-
...
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### self-host/cdn
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
<script src="build/index.js"></script>
|
|
72
|
-
|
|
73
|
-
const MyLibrary = window.MyLibrary.default;
|
|
74
|
-
const libraryInstance = new MyLibrary();
|
|
75
|
-
...
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## ✅ Libraries built with this boilerplate
|
|
79
|
-
|
|
80
|
-
> Made a library using this starter kit? Share it here by [submitting a pull request](https://github.com/hodgef/ts-library-boilerplate-basic/pulls)!
|
|
81
|
-
|
|
82
|
-
- [simple-keyboard](https://github.com/hodgef/simple-keyboard) - Javascript Virtual Keyboard
|
|
83
|
-
- [react-simple-keyboard](https://github.com/hodgef/react-simple-keyboard) - React Virtual Keyboard
|
|
84
|
-
- [simple-keyboard-layouts](https://github.com/hodgef/simple-keyboard-layouts) - Keyboard layouts for simple-keyboard
|
|
85
|
-
- [atlas-monaco](https://github.com/datdao/atlas-monaco) - AtlasHCL for monaco editor
|
|
1
|
+
# 第一阶段
|
|
2
|
+
- 1. 创建,更新,删除都是通过 -> Http API
|
|
3
|
+
- 2. 读取是通过本地数据库 -> 本地, (例外:订单从云端读取)
|
|
4
|
+
|
|
5
|
+
# 第二阶段 (单机版)
|
|
6
|
+
1. 创建,更新,删除,读取都通过本地数据库,然后进行数据和云端同步(Web Worker)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
<div align="center">
|
|
19
|
+
<img align="center" width="230" src="https://i.imgur.com/iHgtvmg.png" />
|
|
20
|
+
<h2>Typescript Library Boilerplate Basic</h2>
|
|
21
|
+
<blockquote>Minimal Library Starter Kit for your Typescript projects</blockquote>
|
|
22
|
+
|
|
23
|
+
<a href="https://www.npmjs.com/package/@hodgef/ts-library-boilerplate-basic"><img src="https://badgen.net/npm/v/@hodgef/ts-library-boilerplate-basic?color=blue" alt="npm version"></a> <a href="https://github.com/hodgef/ts-library-boilerplate"><img src="https://img.shields.io/github/last-commit/hodgef/ts-library-boilerplate" alt="latest commit"></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"><img alt="Build Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Build/badge.svg?color=green" /></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"> <img alt="Publish Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Publish/badge.svg?color=green" /></a>
|
|
24
|
+
|
|
25
|
+
<strong>For a plain Javascript alternative, check out [js-library-boilerplate-basic](https://github.com/hodgef/js-library-boilerplate-basic).</strong>
|
|
26
|
+
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
## ⭐️ Features
|
|
30
|
+
|
|
31
|
+
- Webpack 5
|
|
32
|
+
- Babel 7
|
|
33
|
+
- Hot reloading (`npm start`)
|
|
34
|
+
- Automatic Types file generation (index.d.ts)
|
|
35
|
+
- UMD exports, so your library works everywhere.
|
|
36
|
+
- Jest unit testing
|
|
37
|
+
- Customizable file headers for your build [(Example 1)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/index.js) [(Example2)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/css/index.css)
|
|
38
|
+
- Daily [dependabot](https://dependabot.com) dependency updates
|
|
39
|
+
|
|
40
|
+
## 📦 Getting Started
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
git clone https://github.com/hodgef/ts-library-boilerplate-basic.git myLibrary
|
|
44
|
+
npm install
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 💎 Customization
|
|
48
|
+
|
|
49
|
+
> Before shipping, make sure to:
|
|
50
|
+
|
|
51
|
+
1. Edit `LICENSE` file
|
|
52
|
+
2. Edit `package.json` information (These will be used to generate the headers for your built files)
|
|
53
|
+
3. Edit `library: "MyLibrary"` with your library's export name in `./webpack.config.js`
|
|
54
|
+
|
|
55
|
+
## 🚀 Deployment
|
|
56
|
+
|
|
57
|
+
1. `npm publish`
|
|
58
|
+
2. Your users can include your library as usual
|
|
59
|
+
|
|
60
|
+
### npm
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
import MyLibrary from 'my-library';
|
|
64
|
+
const libraryInstance = new MyLibrary();
|
|
65
|
+
...
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### self-host/cdn
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
<script src="build/index.js"></script>
|
|
72
|
+
|
|
73
|
+
const MyLibrary = window.MyLibrary.default;
|
|
74
|
+
const libraryInstance = new MyLibrary();
|
|
75
|
+
...
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## ✅ Libraries built with this boilerplate
|
|
79
|
+
|
|
80
|
+
> Made a library using this starter kit? Share it here by [submitting a pull request](https://github.com/hodgef/ts-library-boilerplate-basic/pulls)!
|
|
81
|
+
|
|
82
|
+
- [simple-keyboard](https://github.com/hodgef/simple-keyboard) - Javascript Virtual Keyboard
|
|
83
|
+
- [react-simple-keyboard](https://github.com/hodgef/react-simple-keyboard) - React Virtual Keyboard
|
|
84
|
+
- [simple-keyboard-layouts](https://github.com/hodgef/simple-keyboard-layouts) - Keyboard layouts for simple-keyboard
|
|
85
|
+
- [atlas-monaco](https://github.com/datdao/atlas-monaco) - AtlasHCL for monaco editor
|
package/build/index.d.ts
CHANGED
|
@@ -4039,6 +4039,7 @@ declare class PrintTemplateCore implements IPrintTemplateCore {
|
|
|
4039
4039
|
}
|
|
4040
4040
|
type IPrintTemplate = IPrintTemplateCore & IAppBaseModel & {
|
|
4041
4041
|
printer_type: PrinterType;
|
|
4042
|
+
codepage?: Codepages;
|
|
4042
4043
|
report_code_name: string;
|
|
4043
4044
|
};
|
|
4044
4045
|
declare class PrintTemplate extends AppBaseModel implements IPrintTemplate {
|
|
@@ -4047,6 +4048,7 @@ declare class PrintTemplate extends AppBaseModel implements IPrintTemplate {
|
|
|
4047
4048
|
footer: string;
|
|
4048
4049
|
commands: string;
|
|
4049
4050
|
printer_type: PrinterType;
|
|
4051
|
+
codepage?: Codepages;
|
|
4050
4052
|
uid: string;
|
|
4051
4053
|
report_code_name: string;
|
|
4052
4054
|
constructor();
|
package/build/index.js
CHANGED
|
@@ -733,6 +733,159 @@ _defineProperty(ElectronSocket, "State", {
|
|
|
733
733
|
});
|
|
734
734
|
_defineProperty(ElectronSocket, "electronSocket", null);
|
|
735
735
|
|
|
736
|
+
//#endregion
|
|
737
|
+
//#region src/libs/viscii.encoding.ts
|
|
738
|
+
const VISCII_CODEPAGE = "69";
|
|
739
|
+
function isVISCIICodepage(codepage) {
|
|
740
|
+
return codepage === VISCII_CODEPAGE;
|
|
741
|
+
}
|
|
742
|
+
const VISCII_TABLE = {
|
|
743
|
+
"Ẳ": 2,
|
|
744
|
+
"Ẵ": 5,
|
|
745
|
+
"Ẫ": 6,
|
|
746
|
+
"Ỷ": 20,
|
|
747
|
+
"Ỹ": 25,
|
|
748
|
+
"Ỵ": 30,
|
|
749
|
+
"Ạ": 128,
|
|
750
|
+
"Ắ": 129,
|
|
751
|
+
"Ằ": 130,
|
|
752
|
+
"Ặ": 131,
|
|
753
|
+
"Ấ": 132,
|
|
754
|
+
"Ầ": 133,
|
|
755
|
+
"Ẩ": 134,
|
|
756
|
+
"Ậ": 135,
|
|
757
|
+
"Ẽ": 136,
|
|
758
|
+
"Ẹ": 137,
|
|
759
|
+
"Ế": 138,
|
|
760
|
+
"Ề": 139,
|
|
761
|
+
"Ể": 140,
|
|
762
|
+
"Ễ": 141,
|
|
763
|
+
"Ệ": 142,
|
|
764
|
+
"Ố": 143,
|
|
765
|
+
"Ồ": 144,
|
|
766
|
+
"Ổ": 145,
|
|
767
|
+
"Ỗ": 146,
|
|
768
|
+
"Ộ": 147,
|
|
769
|
+
"Ợ": 148,
|
|
770
|
+
"Ớ": 149,
|
|
771
|
+
"Ờ": 150,
|
|
772
|
+
"Ở": 151,
|
|
773
|
+
"Ị": 152,
|
|
774
|
+
"Ỏ": 153,
|
|
775
|
+
"Ọ": 154,
|
|
776
|
+
"Ỉ": 155,
|
|
777
|
+
"Ủ": 156,
|
|
778
|
+
"Ũ": 157,
|
|
779
|
+
"Ụ": 158,
|
|
780
|
+
"Ỳ": 159,
|
|
781
|
+
"Õ": 160,
|
|
782
|
+
"ắ": 161,
|
|
783
|
+
"ằ": 162,
|
|
784
|
+
"ặ": 163,
|
|
785
|
+
"ấ": 164,
|
|
786
|
+
"ầ": 165,
|
|
787
|
+
"ẩ": 166,
|
|
788
|
+
"ậ": 167,
|
|
789
|
+
"ẽ": 168,
|
|
790
|
+
"ẹ": 169,
|
|
791
|
+
"ế": 170,
|
|
792
|
+
"ề": 171,
|
|
793
|
+
"ể": 172,
|
|
794
|
+
"ễ": 173,
|
|
795
|
+
"ệ": 174,
|
|
796
|
+
"ố": 175,
|
|
797
|
+
"ồ": 176,
|
|
798
|
+
"ổ": 177,
|
|
799
|
+
"ỗ": 178,
|
|
800
|
+
"Ỡ": 179,
|
|
801
|
+
"Ơ": 180,
|
|
802
|
+
"ộ": 181,
|
|
803
|
+
"ờ": 182,
|
|
804
|
+
"ở": 183,
|
|
805
|
+
"ị": 184,
|
|
806
|
+
"Ự": 185,
|
|
807
|
+
"Ứ": 186,
|
|
808
|
+
"Ừ": 187,
|
|
809
|
+
"Ử": 188,
|
|
810
|
+
"ơ": 189,
|
|
811
|
+
"ớ": 190,
|
|
812
|
+
"Ư": 191,
|
|
813
|
+
"À": 192,
|
|
814
|
+
"Á": 193,
|
|
815
|
+
"Â": 194,
|
|
816
|
+
"Ã": 195,
|
|
817
|
+
"Ả": 196,
|
|
818
|
+
"Ă": 197,
|
|
819
|
+
"ẳ": 198,
|
|
820
|
+
"ẵ": 199,
|
|
821
|
+
"È": 200,
|
|
822
|
+
"É": 201,
|
|
823
|
+
"Ê": 202,
|
|
824
|
+
"Ẻ": 203,
|
|
825
|
+
"Ì": 204,
|
|
826
|
+
"Í": 205,
|
|
827
|
+
"Ĩ": 206,
|
|
828
|
+
"ỳ": 207,
|
|
829
|
+
"Đ": 208,
|
|
830
|
+
"ứ": 209,
|
|
831
|
+
"Ò": 210,
|
|
832
|
+
"Ó": 211,
|
|
833
|
+
"Ô": 212,
|
|
834
|
+
"ạ": 213,
|
|
835
|
+
"ỷ": 214,
|
|
836
|
+
"ừ": 215,
|
|
837
|
+
"ử": 216,
|
|
838
|
+
"Ù": 217,
|
|
839
|
+
"Ú": 218,
|
|
840
|
+
"ỹ": 219,
|
|
841
|
+
"ỵ": 220,
|
|
842
|
+
"Ý": 221,
|
|
843
|
+
"ỡ": 222,
|
|
844
|
+
"ư": 223,
|
|
845
|
+
"à": 224,
|
|
846
|
+
"á": 225,
|
|
847
|
+
"â": 226,
|
|
848
|
+
"ã": 227,
|
|
849
|
+
"ả": 228,
|
|
850
|
+
"ă": 229,
|
|
851
|
+
"ữ": 230,
|
|
852
|
+
"ẫ": 231,
|
|
853
|
+
"è": 232,
|
|
854
|
+
"é": 233,
|
|
855
|
+
"ê": 234,
|
|
856
|
+
"ẻ": 235,
|
|
857
|
+
"ì": 236,
|
|
858
|
+
"í": 237,
|
|
859
|
+
"ĩ": 238,
|
|
860
|
+
"ỉ": 239,
|
|
861
|
+
"đ": 240,
|
|
862
|
+
"ự": 241,
|
|
863
|
+
"ò": 242,
|
|
864
|
+
"ó": 243,
|
|
865
|
+
"ô": 244,
|
|
866
|
+
"õ": 245,
|
|
867
|
+
"ỏ": 246,
|
|
868
|
+
"ọ": 247,
|
|
869
|
+
"ụ": 248,
|
|
870
|
+
"ù": 249,
|
|
871
|
+
"ú": 250,
|
|
872
|
+
"ũ": 251,
|
|
873
|
+
"ủ": 252,
|
|
874
|
+
"ý": 253,
|
|
875
|
+
"ợ": 254,
|
|
876
|
+
"Ữ": 255
|
|
877
|
+
};
|
|
878
|
+
function utf8ToVISCII(text, fallback = 63) {
|
|
879
|
+
const bytes = [];
|
|
880
|
+
for (const ch of text) if (VISCII_TABLE[ch] !== void 0) bytes.push(VISCII_TABLE[ch]);
|
|
881
|
+
else {
|
|
882
|
+
const code = ch.charCodeAt(0);
|
|
883
|
+
if (code <= 127) bytes.push(code);
|
|
884
|
+
else bytes.push(fallback);
|
|
885
|
+
}
|
|
886
|
+
return Uint8Array.from(bytes);
|
|
887
|
+
}
|
|
888
|
+
|
|
736
889
|
//#endregion
|
|
737
890
|
//#region src/libs/escpos.printer.ts
|
|
738
891
|
function getSocket() {
|
|
@@ -810,7 +963,20 @@ var EscPosPrinter = class {
|
|
|
810
963
|
});
|
|
811
964
|
}
|
|
812
965
|
async interpret(template) {
|
|
813
|
-
const
|
|
966
|
+
const encoder = new EscPosEncoder();
|
|
967
|
+
const printing = encoder.initialize();
|
|
968
|
+
if (template.codepage && !Object.values(Codepages).includes(template.codepage)) {
|
|
969
|
+
const codepageNum = parseInt(template.codepage, 10);
|
|
970
|
+
printing.raw([
|
|
971
|
+
31,
|
|
972
|
+
27,
|
|
973
|
+
31,
|
|
974
|
+
255,
|
|
975
|
+
codepageNum,
|
|
976
|
+
10,
|
|
977
|
+
0
|
|
978
|
+
]);
|
|
979
|
+
} else if (template.codepage && Object.values(Codepages).includes(template.codepage)) encoder.codepage(template.codepage);
|
|
814
980
|
for (const printItem of template.items) {
|
|
815
981
|
if (!printItem) throw new Error("Item is undefined or null");
|
|
816
982
|
switch (printItem.style) {
|
|
@@ -842,7 +1008,10 @@ var EscPosPrinter = class {
|
|
|
842
1008
|
sizeValue
|
|
843
1009
|
]);
|
|
844
1010
|
} else if (printItem.item.size) printing.size(printItem.item.size);
|
|
845
|
-
|
|
1011
|
+
if (isVISCIICodepage(template.codepage)) {
|
|
1012
|
+
const visciiBytes = utf8ToVISCII(printItem.item.text);
|
|
1013
|
+
printing.raw(Array.from(visciiBytes));
|
|
1014
|
+
} else printing.text(printItem.item.text, printItem.item.line_width ?? 48);
|
|
846
1015
|
if (printItem.item.size === PrintSize.Custom) printing.raw([
|
|
847
1016
|
29,
|
|
848
1017
|
33,
|
|
@@ -862,7 +1031,10 @@ var EscPosPrinter = class {
|
|
|
862
1031
|
]);
|
|
863
1032
|
} else if (printItem.table.size) printing.size(printItem.table.size);
|
|
864
1033
|
this.formatTable(printItem.table.items, printItem.table.line_width ?? 48).forEach((line) => {
|
|
865
|
-
|
|
1034
|
+
if (isVISCIICodepage(template.codepage)) {
|
|
1035
|
+
const visciiBytes = utf8ToVISCII(line);
|
|
1036
|
+
printing.raw(Array.from(visciiBytes));
|
|
1037
|
+
} else printing.text(line, printItem.table.line_width ?? 48);
|
|
866
1038
|
printing.newline();
|
|
867
1039
|
});
|
|
868
1040
|
if (printItem.table.size === PrintSize.Custom) printing.raw([
|
|
@@ -1206,6 +1378,7 @@ var PrintTemplate = class extends AppBaseModel {
|
|
|
1206
1378
|
_defineProperty(this, "footer", "");
|
|
1207
1379
|
_defineProperty(this, "commands", "");
|
|
1208
1380
|
_defineProperty(this, "printer_type", PrinterType.ReceiptPrinter);
|
|
1381
|
+
_defineProperty(this, "codepage", void 0);
|
|
1209
1382
|
_defineProperty(this, "uid", ModelPrefix.PrintTemplate + nanoid());
|
|
1210
1383
|
_defineProperty(this, "report_code_name", "");
|
|
1211
1384
|
}
|
|
@@ -5092,8 +5265,8 @@ var PrintTemplateService = class extends AppRemoteService {
|
|
|
5092
5265
|
}
|
|
5093
5266
|
async renderPrintTemplate(invoice, config, template, options = new RenderPrintTemplateOptions()) {
|
|
5094
5267
|
const printCommand = new PrintCommand();
|
|
5095
|
-
printCommand.codepage = this.getCodepageByCountryCode(config.
|
|
5096
|
-
|
|
5268
|
+
if (template.printer_type == PrinterType.KitchenPrinter || template.printer_type == PrinterType.OrderPrinter) printCommand.codepage = template.codepage || this.getCodepageByCountryCode(config.kitchen.language);
|
|
5269
|
+
else printCommand.codepage = template.codepage || this.getCodepageByCountryCode(config.receipt.language);
|
|
5097
5270
|
const templateData = new TemplateData();
|
|
5098
5271
|
templateData.invoice = invoice;
|
|
5099
5272
|
templateData.config = config;
|
|
@@ -5109,7 +5282,6 @@ var PrintTemplateService = class extends AppRemoteService {
|
|
|
5109
5282
|
const templateData = new TemplateData();
|
|
5110
5283
|
templateData.report_data = reportData;
|
|
5111
5284
|
templateData.config = config;
|
|
5112
|
-
printCommand.codepage = Codepages.SimplifiedChinese;
|
|
5113
5285
|
printCommand.items.push(...await this.renderPrintCommand(template.header, templateData));
|
|
5114
5286
|
printCommand.items.push(...await this.renderPrintCommand(template.body, templateData));
|
|
5115
5287
|
printCommand.items.push(...await this.renderPrintCommand(template.footer, templateData));
|
|
@@ -5129,32 +5301,39 @@ var PrintTemplateService = class extends AppRemoteService {
|
|
|
5129
5301
|
getCodepageByCountryCode(countryCode) {
|
|
5130
5302
|
const countryCodeToCodepage = {
|
|
5131
5303
|
US: Codepages.English,
|
|
5304
|
+
GR: Codepages.Greek,
|
|
5132
5305
|
DE: Codepages.WesternEurope,
|
|
5133
5306
|
LT: Codepages.BalticRim,
|
|
5134
5307
|
PL: Codepages.CentralEurope,
|
|
5135
5308
|
RU: Codepages.Cyrillic,
|
|
5309
|
+
TR: Codepages.Turkish,
|
|
5310
|
+
EU: Codepages.MultilingualLatin1WithEuro,
|
|
5136
5311
|
PT: Codepages.Portuguese,
|
|
5137
5312
|
IS: Codepages.Icelandic,
|
|
5313
|
+
IL: Codepages.Hebrew,
|
|
5138
5314
|
CA: Codepages.FrenchCanadian,
|
|
5139
5315
|
EG: Codepages.Arabic,
|
|
5140
5316
|
NO: Codepages.Nordic,
|
|
5141
|
-
|
|
5317
|
+
BY: Codepages.Russian,
|
|
5318
|
+
MK: Codepages.ModernGreek,
|
|
5319
|
+
CN: Codepages.SimplifiedChinese,
|
|
5142
5320
|
KR: Codepages.Korean,
|
|
5143
5321
|
TW: Codepages.TraditionalChinese,
|
|
5144
5322
|
FR: Codepages.WesternEuropeanLatin,
|
|
5323
|
+
AE: Codepages.ArabicISO,
|
|
5145
5324
|
JP: Codepages.Japanese,
|
|
5146
5325
|
CZ: Codepages.CentralEuropeanLatinWindows,
|
|
5147
5326
|
BG: Codepages.CyrillicWindows,
|
|
5148
5327
|
ES: Codepages.WesternEuropeanLatinWindows,
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5328
|
+
CY: Codepages.GreekWindows,
|
|
5329
|
+
AZ: Codepages.TurkishWindows,
|
|
5330
|
+
PS: Codepages.HebrewWindows,
|
|
5152
5331
|
SA: Codepages.ArabicWindows,
|
|
5153
5332
|
LV: Codepages.BalticWindows,
|
|
5154
5333
|
VN: Codepages.Vietnamese
|
|
5155
5334
|
};
|
|
5156
|
-
if (!countryCode) return countryCodeToCodepage["
|
|
5157
|
-
return countryCodeToCodepage[countryCode.toUpperCase()] || countryCodeToCodepage["
|
|
5335
|
+
if (!countryCode) return countryCodeToCodepage["CN"];
|
|
5336
|
+
return countryCodeToCodepage[countryCode.toUpperCase()] || countryCodeToCodepage["CN"];
|
|
5158
5337
|
}
|
|
5159
5338
|
async renderPrintCommand(template, data) {
|
|
5160
5339
|
try {
|
package/jest.config.cjs
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
// jest.config.js
|
|
2
|
-
module.exports = {
|
|
3
|
-
preset: 'ts-jest',
|
|
4
|
-
testEnvironment: 'jsdom',
|
|
5
|
-
setupFilesAfterEnv: ['<rootDir>/jest.setup.cjs'],
|
|
6
|
-
transform: {
|
|
7
|
-
'^.+\\.ts$': ['ts-jest', {
|
|
8
|
-
tsconfig: {
|
|
9
|
-
module: 'commonjs',
|
|
10
|
-
esModuleInterop: true,
|
|
11
|
-
}
|
|
12
|
-
}],
|
|
13
|
-
'^.+\\.(mjs|js)$': ['ts-jest', {
|
|
14
|
-
tsconfig: {
|
|
15
|
-
allowJs: true,
|
|
16
|
-
module: 'commonjs',
|
|
17
|
-
esModuleInterop: true,
|
|
18
|
-
}
|
|
19
|
-
}]
|
|
20
|
-
},
|
|
21
|
-
transformIgnorePatterns: [
|
|
22
|
-
'node_modules/(?!(.pnpm|nanoid|@litepos|dexie)/)', // Transform ESM packages
|
|
23
|
-
],
|
|
24
|
-
testMatch: [
|
|
25
|
-
'<rootDir>/src/test/**/*.test.ts'
|
|
26
|
-
],
|
|
27
|
-
moduleNameMapper: {
|
|
28
|
-
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/scripts/testMock.cjs',
|
|
29
|
-
'\\.(css|less)$': '<rootDir>/scripts/testMock.cjs',
|
|
30
|
-
'^nanoid$': '<rootDir>/src/test/__mocks__/nanoid.js',
|
|
31
|
-
'^dexie$': '<rootDir>/src/test/__mocks__/dexie.js',
|
|
32
|
-
'^@awesome-cordova-plugins/network-interface$': '<rootDir>/src/test/__mocks__/@awesome-cordova-plugins/network-interface.js',
|
|
33
|
-
'^canvas$': '<rootDir>/scripts/testMock.cjs'
|
|
34
|
-
},
|
|
35
|
-
moduleFileExtensions: ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx', 'node'],
|
|
36
|
-
};
|
|
1
|
+
// jest.config.js
|
|
2
|
+
module.exports = {
|
|
3
|
+
preset: 'ts-jest',
|
|
4
|
+
testEnvironment: 'jsdom',
|
|
5
|
+
setupFilesAfterEnv: ['<rootDir>/jest.setup.cjs'],
|
|
6
|
+
transform: {
|
|
7
|
+
'^.+\\.ts$': ['ts-jest', {
|
|
8
|
+
tsconfig: {
|
|
9
|
+
module: 'commonjs',
|
|
10
|
+
esModuleInterop: true,
|
|
11
|
+
}
|
|
12
|
+
}],
|
|
13
|
+
'^.+\\.(mjs|js)$': ['ts-jest', {
|
|
14
|
+
tsconfig: {
|
|
15
|
+
allowJs: true,
|
|
16
|
+
module: 'commonjs',
|
|
17
|
+
esModuleInterop: true,
|
|
18
|
+
}
|
|
19
|
+
}]
|
|
20
|
+
},
|
|
21
|
+
transformIgnorePatterns: [
|
|
22
|
+
'node_modules/(?!(.pnpm|nanoid|@litepos|dexie)/)', // Transform ESM packages
|
|
23
|
+
],
|
|
24
|
+
testMatch: [
|
|
25
|
+
'<rootDir>/src/test/**/*.test.ts'
|
|
26
|
+
],
|
|
27
|
+
moduleNameMapper: {
|
|
28
|
+
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/scripts/testMock.cjs',
|
|
29
|
+
'\\.(css|less)$': '<rootDir>/scripts/testMock.cjs',
|
|
30
|
+
'^nanoid$': '<rootDir>/src/test/__mocks__/nanoid.js',
|
|
31
|
+
'^dexie$': '<rootDir>/src/test/__mocks__/dexie.js',
|
|
32
|
+
'^@awesome-cordova-plugins/network-interface$': '<rootDir>/src/test/__mocks__/@awesome-cordova-plugins/network-interface.js',
|
|
33
|
+
'^canvas$': '<rootDir>/scripts/testMock.cjs'
|
|
34
|
+
},
|
|
35
|
+
moduleFileExtensions: ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx', 'node'],
|
|
36
|
+
};
|
package/jest.setup.cjs
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
// Jest setup file to polyfill File and Blob APIs
|
|
2
|
-
// This ensures consistent behavior across different Node.js versions and test environments
|
|
3
|
-
|
|
4
|
-
// Polyfill Blob.text() if not available
|
|
5
|
-
if (typeof Blob !== 'undefined' && !Blob.prototype.text) {
|
|
6
|
-
Blob.prototype.text = async function() {
|
|
7
|
-
const reader = new FileReader();
|
|
8
|
-
return new Promise((resolve, reject) => {
|
|
9
|
-
reader.onload = () => resolve(reader.result);
|
|
10
|
-
reader.onerror = reject;
|
|
11
|
-
reader.readAsText(this);
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Polyfill FileReader if not available
|
|
17
|
-
if (typeof FileReader === 'undefined') {
|
|
18
|
-
global.FileReader = class FileReader {
|
|
19
|
-
result = null;
|
|
20
|
-
error = null;
|
|
21
|
-
onload = null;
|
|
22
|
-
onerror = null;
|
|
23
|
-
|
|
24
|
-
readAsText(blob) {
|
|
25
|
-
try {
|
|
26
|
-
// For our polyfilled Blob
|
|
27
|
-
if (blob.parts) {
|
|
28
|
-
this.result = blob.parts.join('');
|
|
29
|
-
} else if (typeof blob === 'string') {
|
|
30
|
-
this.result = blob;
|
|
31
|
-
} else {
|
|
32
|
-
this.result = String(blob);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (this.onload) {
|
|
36
|
-
setTimeout(() => this.onload({ target: this }), 0);
|
|
37
|
-
}
|
|
38
|
-
} catch (err) {
|
|
39
|
-
this.error = err;
|
|
40
|
-
if (this.onerror) {
|
|
41
|
-
setTimeout(() => this.onerror({ target: this }), 0);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Polyfill Blob if not available (for Node.js < 18)
|
|
49
|
-
if (typeof Blob === 'undefined') {
|
|
50
|
-
global.Blob = class Blob {
|
|
51
|
-
constructor(parts = [], options = {}) {
|
|
52
|
-
this.parts = parts;
|
|
53
|
-
this.type = options.type || '';
|
|
54
|
-
this.size = parts.reduce((acc, part) => {
|
|
55
|
-
return acc + (typeof part === 'string' ? part.length : part.length || 0);
|
|
56
|
-
}, 0);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async text() {
|
|
60
|
-
return this.parts.join('');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async arrayBuffer() {
|
|
64
|
-
const text = await this.text();
|
|
65
|
-
const buffer = Buffer.from(text);
|
|
66
|
-
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Polyfill File if not available (for Node.js < 18)
|
|
72
|
-
if (typeof File === 'undefined') {
|
|
73
|
-
global.File = class File extends global.Blob {
|
|
74
|
-
constructor(bits, name, options = {}) {
|
|
75
|
-
super(bits, options);
|
|
76
|
-
this.name = name;
|
|
77
|
-
this.lastModified = options.lastModified || Date.now();
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}
|
|
1
|
+
// Jest setup file to polyfill File and Blob APIs
|
|
2
|
+
// This ensures consistent behavior across different Node.js versions and test environments
|
|
3
|
+
|
|
4
|
+
// Polyfill Blob.text() if not available
|
|
5
|
+
if (typeof Blob !== 'undefined' && !Blob.prototype.text) {
|
|
6
|
+
Blob.prototype.text = async function() {
|
|
7
|
+
const reader = new FileReader();
|
|
8
|
+
return new Promise((resolve, reject) => {
|
|
9
|
+
reader.onload = () => resolve(reader.result);
|
|
10
|
+
reader.onerror = reject;
|
|
11
|
+
reader.readAsText(this);
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Polyfill FileReader if not available
|
|
17
|
+
if (typeof FileReader === 'undefined') {
|
|
18
|
+
global.FileReader = class FileReader {
|
|
19
|
+
result = null;
|
|
20
|
+
error = null;
|
|
21
|
+
onload = null;
|
|
22
|
+
onerror = null;
|
|
23
|
+
|
|
24
|
+
readAsText(blob) {
|
|
25
|
+
try {
|
|
26
|
+
// For our polyfilled Blob
|
|
27
|
+
if (blob.parts) {
|
|
28
|
+
this.result = blob.parts.join('');
|
|
29
|
+
} else if (typeof blob === 'string') {
|
|
30
|
+
this.result = blob;
|
|
31
|
+
} else {
|
|
32
|
+
this.result = String(blob);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (this.onload) {
|
|
36
|
+
setTimeout(() => this.onload({ target: this }), 0);
|
|
37
|
+
}
|
|
38
|
+
} catch (err) {
|
|
39
|
+
this.error = err;
|
|
40
|
+
if (this.onerror) {
|
|
41
|
+
setTimeout(() => this.onerror({ target: this }), 0);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Polyfill Blob if not available (for Node.js < 18)
|
|
49
|
+
if (typeof Blob === 'undefined') {
|
|
50
|
+
global.Blob = class Blob {
|
|
51
|
+
constructor(parts = [], options = {}) {
|
|
52
|
+
this.parts = parts;
|
|
53
|
+
this.type = options.type || '';
|
|
54
|
+
this.size = parts.reduce((acc, part) => {
|
|
55
|
+
return acc + (typeof part === 'string' ? part.length : part.length || 0);
|
|
56
|
+
}, 0);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async text() {
|
|
60
|
+
return this.parts.join('');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async arrayBuffer() {
|
|
64
|
+
const text = await this.text();
|
|
65
|
+
const buffer = Buffer.from(text);
|
|
66
|
+
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Polyfill File if not available (for Node.js < 18)
|
|
72
|
+
if (typeof File === 'undefined') {
|
|
73
|
+
global.File = class File extends global.Blob {
|
|
74
|
+
constructor(bits, name, options = {}) {
|
|
75
|
+
super(bits, options);
|
|
76
|
+
this.name = name;
|
|
77
|
+
this.lastModified = options.lastModified || Date.now();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
package/package.json
CHANGED
package/package.publish.json
CHANGED
|
@@ -1,120 +1,120 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@posx/core",
|
|
3
|
-
"version": "5.5.
|
|
4
|
-
"description": "POSX core libraries",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./build/index.js",
|
|
7
|
-
"module": "./build/index.js",
|
|
8
|
-
"types": "./build/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"import": "./build/index.js",
|
|
12
|
-
"types": "./build/index.d.ts"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"build"
|
|
17
|
-
],
|
|
18
|
-
"scripts": {
|
|
19
|
-
"up": "node ./scripts/upload-to-s3.cjs --trace-warnings",
|
|
20
|
-
"start": "tsdown --watch",
|
|
21
|
-
"build": "tsdown",
|
|
22
|
-
"build:dts": "tsdown --dts-only",
|
|
23
|
-
"post:build": "node ./scripts/clean-build.cjs",
|
|
24
|
-
"mvm": "mv build/*.map scripts/sourcemaps/ && mv build/**/*.map scripts/sourcemaps/ && find build -name '*.map' -type f -delete",
|
|
25
|
-
"build:demo": "vite build --mode demo",
|
|
26
|
-
"test": "jest",
|
|
27
|
-
"test:watch": "jest --watch",
|
|
28
|
-
"publish": "node ./scripts/publish.cjs",
|
|
29
|
-
"p": "pnpm i && npm test && npm run up:p && npm run build && npm run post:build && npm run publish && rm -rf build",
|
|
30
|
-
"debug": "npm run build && npm run post:build",
|
|
31
|
-
"coverage": "jest --coverage",
|
|
32
|
-
"trypublish": "npm publish || true",
|
|
33
|
-
"gen:index": "node ./scriptswc/generateIndex.cjs",
|
|
34
|
-
"up:p": "npm version patch && git push",
|
|
35
|
-
"up:m": "npm version minor && git push",
|
|
36
|
-
"docs": "typedoc --out docs src --excludePrivate --exclude '**/demo/**/*' --exclude '**/*+(interface|function|enum).ts'",
|
|
37
|
-
"see": "node ./scripts/lookup-sm.cjs"
|
|
38
|
-
},
|
|
39
|
-
"repository": {
|
|
40
|
-
"type": "git"
|
|
41
|
-
},
|
|
42
|
-
"author": "Steven Lee",
|
|
43
|
-
"license": "UNLICENSED",
|
|
44
|
-
"bugs": {
|
|
45
|
-
"url": ""
|
|
46
|
-
},
|
|
47
|
-
"homepage": "",
|
|
48
|
-
"keywords": [
|
|
49
|
-
"library",
|
|
50
|
-
"starter",
|
|
51
|
-
"es6"
|
|
52
|
-
],
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
"@capacitor/core": "5.4.2",
|
|
55
|
-
"@litepos/autoquery": "5.0.6",
|
|
56
|
-
"@types/bcryptjs": "2.4.6",
|
|
57
|
-
"@types/jest": "30.0.0",
|
|
58
|
-
"@types/lodash": "4.14.199",
|
|
59
|
-
"@types/node": "20.8.2",
|
|
60
|
-
"@types/uuid": "9.0.4",
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
62
|
-
"@typescript-eslint/parser": "^4.33.0",
|
|
63
|
-
"@vitest/coverage-v8": "^2.1.0",
|
|
64
|
-
"ajv": "8.17.1",
|
|
65
|
-
"aws-sdk": "2.1550.0",
|
|
66
|
-
"colors": "1.4.0",
|
|
67
|
-
"eslint": "^7.32.0",
|
|
68
|
-
"fs-extra": "11.1.1",
|
|
69
|
-
"glob": "10.3.10",
|
|
70
|
-
"jest": "30.2.0",
|
|
71
|
-
"jest-environment-jsdom": "30.2.0",
|
|
72
|
-
"jsdom": "27.1.0",
|
|
73
|
-
"prompt-sync": "4.2.0",
|
|
74
|
-
"rollup-plugin-obfuscator": "^1.1.0",
|
|
75
|
-
"sqlite3": "5.1.6",
|
|
76
|
-
"terser": "^5.36.0",
|
|
77
|
-
"ts-jest": "29.4.5",
|
|
78
|
-
"tsdown": "0.16.1",
|
|
79
|
-
"typedoc": "^0.26.0",
|
|
80
|
-
"typescript": "^5.6.3",
|
|
81
|
-
"vite": "^5.4.11",
|
|
82
|
-
"vite-plugin-bundle-obfuscator": "1.8.0",
|
|
83
|
-
"vite-plugin-dts": "^4.3.0",
|
|
84
|
-
"vitest": "^2.1.0"
|
|
85
|
-
},
|
|
86
|
-
"dependencies": {
|
|
87
|
-
"@awesome-cordova-plugins/core": "6.6.0",
|
|
88
|
-
"@awesome-cordova-plugins/network-interface": "6.6.0",
|
|
89
|
-
"@microsoft/signalr": "7.0.11",
|
|
90
|
-
"axios": "1.5.1",
|
|
91
|
-
"bcryptjs": "2.4.3",
|
|
92
|
-
"buffer": "6.0.3",
|
|
93
|
-
"crypto-browserify": "3.12.0",
|
|
94
|
-
"crypto-js": "4.2.0",
|
|
95
|
-
"dayjs": "1.11.10",
|
|
96
|
-
"dexie": "3.2.4",
|
|
97
|
-
"esc-pos-encoder-ionic": "1.1.3",
|
|
98
|
-
"handlebars": "4.7.8",
|
|
99
|
-
"lodash": "4.17.21",
|
|
100
|
-
"mathjs": "12.3.2",
|
|
101
|
-
"nanoid": "3.3.4",
|
|
102
|
-
"save": "2.9.0",
|
|
103
|
-
"selecttransform": "1.6.1",
|
|
104
|
-
"sockets-for-cordova": "1.0.0",
|
|
105
|
-
"stream-browserify": "3.0.0",
|
|
106
|
-
"uuid": "9.0.1",
|
|
107
|
-
"vm-browserify": "1.1.2",
|
|
108
|
-
"wcwidth": "1.0.1",
|
|
109
|
-
"zod": "3.23.8"
|
|
110
|
-
},
|
|
111
|
-
"peerDependencies": {
|
|
112
|
-
"@litepos/autoquery": "^5.0.6",
|
|
113
|
-
"rxjs": "^7.0.0"
|
|
114
|
-
},
|
|
115
|
-
"peerDependenciesMeta": {
|
|
116
|
-
"rxjs": {
|
|
117
|
-
"optional": true
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@posx/core",
|
|
3
|
+
"version": "5.5.329",
|
|
4
|
+
"description": "POSX core libraries",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./build/index.js",
|
|
7
|
+
"module": "./build/index.js",
|
|
8
|
+
"types": "./build/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./build/index.js",
|
|
12
|
+
"types": "./build/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"build"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"up": "node ./scripts/upload-to-s3.cjs --trace-warnings",
|
|
20
|
+
"start": "tsdown --watch",
|
|
21
|
+
"build": "tsdown",
|
|
22
|
+
"build:dts": "tsdown --dts-only",
|
|
23
|
+
"post:build": "node ./scripts/clean-build.cjs",
|
|
24
|
+
"mvm": "mv build/*.map scripts/sourcemaps/ && mv build/**/*.map scripts/sourcemaps/ && find build -name '*.map' -type f -delete",
|
|
25
|
+
"build:demo": "vite build --mode demo",
|
|
26
|
+
"test": "jest",
|
|
27
|
+
"test:watch": "jest --watch",
|
|
28
|
+
"publish": "node ./scripts/publish.cjs",
|
|
29
|
+
"p": "pnpm i && npm test && npm run up:p && npm run build && npm run post:build && npm run publish && rm -rf build",
|
|
30
|
+
"debug": "npm run build && npm run post:build",
|
|
31
|
+
"coverage": "jest --coverage",
|
|
32
|
+
"trypublish": "npm publish || true",
|
|
33
|
+
"gen:index": "node ./scriptswc/generateIndex.cjs",
|
|
34
|
+
"up:p": "npm version patch && git push",
|
|
35
|
+
"up:m": "npm version minor && git push",
|
|
36
|
+
"docs": "typedoc --out docs src --excludePrivate --exclude '**/demo/**/*' --exclude '**/*+(interface|function|enum).ts'",
|
|
37
|
+
"see": "node ./scripts/lookup-sm.cjs"
|
|
38
|
+
},
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git"
|
|
41
|
+
},
|
|
42
|
+
"author": "Steven Lee",
|
|
43
|
+
"license": "UNLICENSED",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": ""
|
|
46
|
+
},
|
|
47
|
+
"homepage": "",
|
|
48
|
+
"keywords": [
|
|
49
|
+
"library",
|
|
50
|
+
"starter",
|
|
51
|
+
"es6"
|
|
52
|
+
],
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@capacitor/core": "5.4.2",
|
|
55
|
+
"@litepos/autoquery": "5.0.6",
|
|
56
|
+
"@types/bcryptjs": "2.4.6",
|
|
57
|
+
"@types/jest": "30.0.0",
|
|
58
|
+
"@types/lodash": "4.14.199",
|
|
59
|
+
"@types/node": "20.8.2",
|
|
60
|
+
"@types/uuid": "9.0.4",
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
62
|
+
"@typescript-eslint/parser": "^4.33.0",
|
|
63
|
+
"@vitest/coverage-v8": "^2.1.0",
|
|
64
|
+
"ajv": "8.17.1",
|
|
65
|
+
"aws-sdk": "2.1550.0",
|
|
66
|
+
"colors": "1.4.0",
|
|
67
|
+
"eslint": "^7.32.0",
|
|
68
|
+
"fs-extra": "11.1.1",
|
|
69
|
+
"glob": "10.3.10",
|
|
70
|
+
"jest": "30.2.0",
|
|
71
|
+
"jest-environment-jsdom": "30.2.0",
|
|
72
|
+
"jsdom": "27.1.0",
|
|
73
|
+
"prompt-sync": "4.2.0",
|
|
74
|
+
"rollup-plugin-obfuscator": "^1.1.0",
|
|
75
|
+
"sqlite3": "5.1.6",
|
|
76
|
+
"terser": "^5.36.0",
|
|
77
|
+
"ts-jest": "29.4.5",
|
|
78
|
+
"tsdown": "0.16.1",
|
|
79
|
+
"typedoc": "^0.26.0",
|
|
80
|
+
"typescript": "^5.6.3",
|
|
81
|
+
"vite": "^5.4.11",
|
|
82
|
+
"vite-plugin-bundle-obfuscator": "1.8.0",
|
|
83
|
+
"vite-plugin-dts": "^4.3.0",
|
|
84
|
+
"vitest": "^2.1.0"
|
|
85
|
+
},
|
|
86
|
+
"dependencies": {
|
|
87
|
+
"@awesome-cordova-plugins/core": "6.6.0",
|
|
88
|
+
"@awesome-cordova-plugins/network-interface": "6.6.0",
|
|
89
|
+
"@microsoft/signalr": "7.0.11",
|
|
90
|
+
"axios": "1.5.1",
|
|
91
|
+
"bcryptjs": "2.4.3",
|
|
92
|
+
"buffer": "6.0.3",
|
|
93
|
+
"crypto-browserify": "3.12.0",
|
|
94
|
+
"crypto-js": "4.2.0",
|
|
95
|
+
"dayjs": "1.11.10",
|
|
96
|
+
"dexie": "3.2.4",
|
|
97
|
+
"esc-pos-encoder-ionic": "1.1.3",
|
|
98
|
+
"handlebars": "4.7.8",
|
|
99
|
+
"lodash": "4.17.21",
|
|
100
|
+
"mathjs": "12.3.2",
|
|
101
|
+
"nanoid": "3.3.4",
|
|
102
|
+
"save": "2.9.0",
|
|
103
|
+
"selecttransform": "1.6.1",
|
|
104
|
+
"sockets-for-cordova": "1.0.0",
|
|
105
|
+
"stream-browserify": "3.0.0",
|
|
106
|
+
"uuid": "9.0.1",
|
|
107
|
+
"vm-browserify": "1.1.2",
|
|
108
|
+
"wcwidth": "1.0.1",
|
|
109
|
+
"zod": "3.23.8"
|
|
110
|
+
},
|
|
111
|
+
"peerDependencies": {
|
|
112
|
+
"@litepos/autoquery": "^5.0.6",
|
|
113
|
+
"rxjs": "^7.0.0"
|
|
114
|
+
},
|
|
115
|
+
"peerDependenciesMeta": {
|
|
116
|
+
"rxjs": {
|
|
117
|
+
"optional": true
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
package/tsdown.config.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineConfig } from 'tsdown'
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
entry: 'src/index.ts',
|
|
5
|
-
outDir: 'build',
|
|
6
|
-
format: 'esm',
|
|
7
|
-
platform: 'neutral',
|
|
8
|
-
target: 'es2020',
|
|
9
|
-
clean: true,
|
|
10
|
-
sourcemap: true,
|
|
11
|
-
dts: {
|
|
12
|
-
resolve: true,
|
|
13
|
-
},
|
|
14
|
-
external: [
|
|
15
|
-
'@litepos/autoquery',
|
|
16
|
-
'rxjs',
|
|
17
|
-
],
|
|
18
|
-
})
|
|
1
|
+
import { defineConfig } from 'tsdown'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: 'src/index.ts',
|
|
5
|
+
outDir: 'build',
|
|
6
|
+
format: 'esm',
|
|
7
|
+
platform: 'neutral',
|
|
8
|
+
target: 'es2020',
|
|
9
|
+
clean: true,
|
|
10
|
+
sourcemap: true,
|
|
11
|
+
dts: {
|
|
12
|
+
resolve: true,
|
|
13
|
+
},
|
|
14
|
+
external: [
|
|
15
|
+
'@litepos/autoquery',
|
|
16
|
+
'rxjs',
|
|
17
|
+
],
|
|
18
|
+
})
|
package/vite.config.ts
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
import { defineConfig, Plugin } from 'vite'
|
|
2
|
-
import { resolve } from 'path'
|
|
3
|
-
import vitePluginBundleObfuscator from 'vite-plugin-bundle-obfuscator'
|
|
4
|
-
import { getBanner } from './scripts/getBanner.mjs'
|
|
5
|
-
|
|
6
|
-
const bannerPlugin = (): Plugin => ({
|
|
7
|
-
name: 'banner-plugin',
|
|
8
|
-
generateBundle(_, bundle) {
|
|
9
|
-
for (const chunk of Object.values(bundle)) {
|
|
10
|
-
if (chunk.type === 'chunk' && chunk.fileName === 'index.js') {
|
|
11
|
-
chunk.code = getBanner() + '\n' + chunk.code
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
export default defineConfig({
|
|
18
|
-
plugins: [
|
|
19
|
-
bannerPlugin(),
|
|
20
|
-
vitePluginBundleObfuscator({
|
|
21
|
-
enable: true,
|
|
22
|
-
log: false,
|
|
23
|
-
autoExcludeNodeModules: true,
|
|
24
|
-
threadPool: { enable: true, size: 4 },
|
|
25
|
-
options: {
|
|
26
|
-
compact: true,
|
|
27
|
-
controlFlowFlattening: false,
|
|
28
|
-
deadCodeInjection: false,
|
|
29
|
-
debugProtection: false,
|
|
30
|
-
identifierNamesGenerator: 'hexadecimal',
|
|
31
|
-
renameGlobals: false,
|
|
32
|
-
selfDefending: false,
|
|
33
|
-
simplify: true,
|
|
34
|
-
stringArray: true,
|
|
35
|
-
stringArrayRotate: true,
|
|
36
|
-
stringArrayShuffle: true,
|
|
37
|
-
stringArrayIndexShift: true,
|
|
38
|
-
stringArrayThreshold: 0.6,
|
|
39
|
-
unicodeEscapeSequence: false,
|
|
40
|
-
},
|
|
41
|
-
}),
|
|
42
|
-
],
|
|
43
|
-
build: {
|
|
44
|
-
outDir: 'build',
|
|
45
|
-
lib: {
|
|
46
|
-
entry: resolve(__dirname, 'src/index.ts'),
|
|
47
|
-
name: '@posx/core',
|
|
48
|
-
formats: ['es'],
|
|
49
|
-
fileName: () => 'index.js',
|
|
50
|
-
},
|
|
51
|
-
rollupOptions: {
|
|
52
|
-
external: [
|
|
53
|
-
'@litepos/autoquery',
|
|
54
|
-
'rxjs',
|
|
55
|
-
],
|
|
56
|
-
output: {
|
|
57
|
-
preserveModules: false,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
sourcemap: true,
|
|
61
|
-
minify: 'terser',
|
|
62
|
-
terserOptions: {
|
|
63
|
-
compress: {
|
|
64
|
-
drop_console: true,
|
|
65
|
-
drop_debugger: true,
|
|
66
|
-
pure_funcs: ['console.log', 'console.info', 'console.debug', 'console.warn'],
|
|
67
|
-
passes: 2,
|
|
68
|
-
},
|
|
69
|
-
mangle: true,
|
|
70
|
-
format: {
|
|
71
|
-
comments: false,
|
|
72
|
-
beautify: false,
|
|
73
|
-
semicolons: true,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
cssMinify: true,
|
|
77
|
-
},
|
|
78
|
-
resolve: {
|
|
79
|
-
alias: {
|
|
80
|
-
buffer: 'buffer/',
|
|
81
|
-
crypto: 'crypto-browserify',
|
|
82
|
-
stream: 'stream-browserify',
|
|
83
|
-
vm: 'vm-browserify',
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
})
|
|
1
|
+
import { defineConfig, Plugin } from 'vite'
|
|
2
|
+
import { resolve } from 'path'
|
|
3
|
+
import vitePluginBundleObfuscator from 'vite-plugin-bundle-obfuscator'
|
|
4
|
+
import { getBanner } from './scripts/getBanner.mjs'
|
|
5
|
+
|
|
6
|
+
const bannerPlugin = (): Plugin => ({
|
|
7
|
+
name: 'banner-plugin',
|
|
8
|
+
generateBundle(_, bundle) {
|
|
9
|
+
for (const chunk of Object.values(bundle)) {
|
|
10
|
+
if (chunk.type === 'chunk' && chunk.fileName === 'index.js') {
|
|
11
|
+
chunk.code = getBanner() + '\n' + chunk.code
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export default defineConfig({
|
|
18
|
+
plugins: [
|
|
19
|
+
bannerPlugin(),
|
|
20
|
+
vitePluginBundleObfuscator({
|
|
21
|
+
enable: true,
|
|
22
|
+
log: false,
|
|
23
|
+
autoExcludeNodeModules: true,
|
|
24
|
+
threadPool: { enable: true, size: 4 },
|
|
25
|
+
options: {
|
|
26
|
+
compact: true,
|
|
27
|
+
controlFlowFlattening: false,
|
|
28
|
+
deadCodeInjection: false,
|
|
29
|
+
debugProtection: false,
|
|
30
|
+
identifierNamesGenerator: 'hexadecimal',
|
|
31
|
+
renameGlobals: false,
|
|
32
|
+
selfDefending: false,
|
|
33
|
+
simplify: true,
|
|
34
|
+
stringArray: true,
|
|
35
|
+
stringArrayRotate: true,
|
|
36
|
+
stringArrayShuffle: true,
|
|
37
|
+
stringArrayIndexShift: true,
|
|
38
|
+
stringArrayThreshold: 0.6,
|
|
39
|
+
unicodeEscapeSequence: false,
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
build: {
|
|
44
|
+
outDir: 'build',
|
|
45
|
+
lib: {
|
|
46
|
+
entry: resolve(__dirname, 'src/index.ts'),
|
|
47
|
+
name: '@posx/core',
|
|
48
|
+
formats: ['es'],
|
|
49
|
+
fileName: () => 'index.js',
|
|
50
|
+
},
|
|
51
|
+
rollupOptions: {
|
|
52
|
+
external: [
|
|
53
|
+
'@litepos/autoquery',
|
|
54
|
+
'rxjs',
|
|
55
|
+
],
|
|
56
|
+
output: {
|
|
57
|
+
preserveModules: false,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
sourcemap: true,
|
|
61
|
+
minify: 'terser',
|
|
62
|
+
terserOptions: {
|
|
63
|
+
compress: {
|
|
64
|
+
drop_console: true,
|
|
65
|
+
drop_debugger: true,
|
|
66
|
+
pure_funcs: ['console.log', 'console.info', 'console.debug', 'console.warn'],
|
|
67
|
+
passes: 2,
|
|
68
|
+
},
|
|
69
|
+
mangle: true,
|
|
70
|
+
format: {
|
|
71
|
+
comments: false,
|
|
72
|
+
beautify: false,
|
|
73
|
+
semicolons: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
cssMinify: true,
|
|
77
|
+
},
|
|
78
|
+
resolve: {
|
|
79
|
+
alias: {
|
|
80
|
+
buffer: 'buffer/',
|
|
81
|
+
crypto: 'crypto-browserify',
|
|
82
|
+
stream: 'stream-browserify',
|
|
83
|
+
vm: 'vm-browserify',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
})
|