@posx/core 5.5.508 → 5.5.509
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 +3 -0
- package/build/index.js +2 -2
- package/dev/.stfolder/syncthing-folder-9a95b7.txt +5 -0
- package/dev/98894488.xlsx +0 -0
- package/dev/HappyThaiSembawang.csv +336 -0
- package/dev/KB/create-new-model.md +34 -0
- package/dev/KB/markdown-lint.md +14 -0
- package/dev/KB/readmefirst.md +6 -0
- package/dev/Merchants/HappyThaiSembawang.csv +400 -0
- package/dev/Merchants/HappyThaiSembawang.xlsx +0 -0
- package/dev/Product_Import_Template.xlsx +0 -0
- package/dev/XPOS Invoice Module.pdf +232 -0
- package/dev/data/invoice.json +1 -0
- package/dev/escpos/receipt.bin +0 -0
- package/dev/escpos/receipt.hex +1 -0
- package/dev/escpos/receipt.json +1 -0
- package/dev/escpos-cli-usage.md +103 -0
- package/dev/harbor-harness-deployment.md +78 -0
- package/dev/nginx-harbor-harness.conf +84 -0
- package/dev/px-cli.md +97 -0
- package/dev/test-logs/2026-02.md +5 -0
- package/dev/tmp/xpos_product_import(1).csv +338 -0
- package/dev/tmp/xpos_product_import_fixed.csv +338 -0
- package/dev//344/272/247/345/223/201/345/257/274/345/205/245/346/250/241/346/235/277.xlsx +0 -0
- package/jest.config.cjs +36 -36
- package/jest.setup.cjs +80 -80
- package/package.json +1 -1
- package/package.publish.json +121 -121
- package/tsdown.config.ts +21 -21
- package/vite.config.ts +86 -86
- package/AGENTS.md +0 -24
- package/memo/technical-docs/01_ARCHITECTURE.md +0 -147
- package/memo/technical-docs/02_CORE_BUSINESS.md +0 -292
- package/memo/technical-docs/03_UI_COMPONENTS.md +0 -59
- package/memo/technical-docs/04_VIEWS.md +0 -82
- package/memo/technical-docs/05_DATA_LAYER.md +0 -375
- package/memo/technical-docs/06_CROSS_PLATFORM.md +0 -246
- package/memo/technical-docs/07_SIMILARITY_INDEX.md +0 -195
- package/memo/technical-docs/CHECKPOINT.md +0 -46
- package/memo/technical-docs/PROJECT_OVERVIEW.md +0 -122
- package/memo/technical-docs/TECHNICAL_DOCS_PLAN.md +0 -77
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,121 +1,121 @@
|
|
|
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 --maxWorkers=2",
|
|
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
|
-
"escpos": "node ./scripts/generate-escpos-bytes.mjs"
|
|
39
|
-
},
|
|
40
|
-
"repository": {
|
|
41
|
-
"type": "git"
|
|
42
|
-
},
|
|
43
|
-
"author": "Steven Lee",
|
|
44
|
-
"license": "UNLICENSED",
|
|
45
|
-
"bugs": {
|
|
46
|
-
"url": ""
|
|
47
|
-
},
|
|
48
|
-
"homepage": "",
|
|
49
|
-
"keywords": [
|
|
50
|
-
"library",
|
|
51
|
-
"starter",
|
|
52
|
-
"es6"
|
|
53
|
-
],
|
|
54
|
-
"devDependencies": {
|
|
55
|
-
"@capacitor/core": "5.4.2",
|
|
56
|
-
"@litepos/autoquery": "5.0.10",
|
|
57
|
-
"@types/bcryptjs": "2.4.6",
|
|
58
|
-
"@types/jest": "30.0.0",
|
|
59
|
-
"@types/lodash": "^4.17.12",
|
|
60
|
-
"@types/node": "20.8.2",
|
|
61
|
-
"@types/uuid": "9.0.4",
|
|
62
|
-
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
63
|
-
"@typescript-eslint/parser": "^4.33.0",
|
|
64
|
-
"@vitest/coverage-v8": "^2.1.0",
|
|
65
|
-
"ajv": "8.17.1",
|
|
66
|
-
"aws-sdk": "2.1550.0",
|
|
67
|
-
"colors": "1.4.0",
|
|
68
|
-
"eslint": "^7.32.0",
|
|
69
|
-
"fs-extra": "11.1.1",
|
|
70
|
-
"glob": "10.3.10",
|
|
71
|
-
"jest": "30.2.0",
|
|
72
|
-
"jest-environment-jsdom": "30.2.0",
|
|
73
|
-
"jsdom": "27.1.0",
|
|
74
|
-
"prompt-sync": "4.2.0",
|
|
75
|
-
"rollup-plugin-obfuscator": "^1.1.0",
|
|
76
|
-
"sqlite3": "5.1.6",
|
|
77
|
-
"terser": "^5.36.0",
|
|
78
|
-
"ts-jest": "29.4.5",
|
|
79
|
-
"tsdown": "0.16.1",
|
|
80
|
-
"typedoc": "^0.26.0",
|
|
81
|
-
"typescript": "^5.6.3",
|
|
82
|
-
"vite": "^5.4.11",
|
|
83
|
-
"vite-plugin-bundle-obfuscator": "1.8.0",
|
|
84
|
-
"vite-plugin-dts": "^4.3.0",
|
|
85
|
-
"vitest": "^2.1.0",
|
|
86
|
-
"xlsx": "^0.18.5"
|
|
87
|
-
},
|
|
88
|
-
"dependencies": {
|
|
89
|
-
"@awesome-cordova-plugins/core": "6.6.0",
|
|
90
|
-
"@awesome-cordova-plugins/network-interface": "6.6.0",
|
|
91
|
-
"@microsoft/signalr": "7.0.11",
|
|
92
|
-
"axios": "1.5.1",
|
|
93
|
-
"bcryptjs": "2.4.3",
|
|
94
|
-
"buffer": "6.0.3",
|
|
95
|
-
"crypto-browserify": "3.12.0",
|
|
96
|
-
"crypto-js": "4.2.0",
|
|
97
|
-
"dayjs": "^1.11.10",
|
|
98
|
-
"dexie": "4.3.0",
|
|
99
|
-
"esc-pos-encoder-ionic": "1.1.3",
|
|
100
|
-
"handlebars": "4.7.8",
|
|
101
|
-
"lodash": "^4.17.21",
|
|
102
|
-
"nanoid": "3.3.4",
|
|
103
|
-
"save": "2.9.0",
|
|
104
|
-
"selecttransform": "1.6.1",
|
|
105
|
-
"sockets-for-cordova": "1.0.0",
|
|
106
|
-
"stream-browserify": "3.0.0",
|
|
107
|
-
"uuid": "9.0.1",
|
|
108
|
-
"vm-browserify": "1.1.2",
|
|
109
|
-
"wcwidth": "1.0.1",
|
|
110
|
-
"zod": "3.23.8"
|
|
111
|
-
},
|
|
112
|
-
"peerDependencies": {
|
|
113
|
-
"@litepos/autoquery": "5.0.10",
|
|
114
|
-
"rxjs": "^7.0.0"
|
|
115
|
-
},
|
|
116
|
-
"peerDependenciesMeta": {
|
|
117
|
-
"rxjs": {
|
|
118
|
-
"optional": true
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@posx/core",
|
|
3
|
+
"version": "5.5.509",
|
|
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 --maxWorkers=2",
|
|
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
|
+
"escpos": "node ./scripts/generate-escpos-bytes.mjs"
|
|
39
|
+
},
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git"
|
|
42
|
+
},
|
|
43
|
+
"author": "Steven Lee",
|
|
44
|
+
"license": "UNLICENSED",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": ""
|
|
47
|
+
},
|
|
48
|
+
"homepage": "",
|
|
49
|
+
"keywords": [
|
|
50
|
+
"library",
|
|
51
|
+
"starter",
|
|
52
|
+
"es6"
|
|
53
|
+
],
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@capacitor/core": "5.4.2",
|
|
56
|
+
"@litepos/autoquery": "5.0.10",
|
|
57
|
+
"@types/bcryptjs": "2.4.6",
|
|
58
|
+
"@types/jest": "30.0.0",
|
|
59
|
+
"@types/lodash": "^4.17.12",
|
|
60
|
+
"@types/node": "20.8.2",
|
|
61
|
+
"@types/uuid": "9.0.4",
|
|
62
|
+
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
63
|
+
"@typescript-eslint/parser": "^4.33.0",
|
|
64
|
+
"@vitest/coverage-v8": "^2.1.0",
|
|
65
|
+
"ajv": "8.17.1",
|
|
66
|
+
"aws-sdk": "2.1550.0",
|
|
67
|
+
"colors": "1.4.0",
|
|
68
|
+
"eslint": "^7.32.0",
|
|
69
|
+
"fs-extra": "11.1.1",
|
|
70
|
+
"glob": "10.3.10",
|
|
71
|
+
"jest": "30.2.0",
|
|
72
|
+
"jest-environment-jsdom": "30.2.0",
|
|
73
|
+
"jsdom": "27.1.0",
|
|
74
|
+
"prompt-sync": "4.2.0",
|
|
75
|
+
"rollup-plugin-obfuscator": "^1.1.0",
|
|
76
|
+
"sqlite3": "5.1.6",
|
|
77
|
+
"terser": "^5.36.0",
|
|
78
|
+
"ts-jest": "29.4.5",
|
|
79
|
+
"tsdown": "0.16.1",
|
|
80
|
+
"typedoc": "^0.26.0",
|
|
81
|
+
"typescript": "^5.6.3",
|
|
82
|
+
"vite": "^5.4.11",
|
|
83
|
+
"vite-plugin-bundle-obfuscator": "1.8.0",
|
|
84
|
+
"vite-plugin-dts": "^4.3.0",
|
|
85
|
+
"vitest": "^2.1.0",
|
|
86
|
+
"xlsx": "^0.18.5"
|
|
87
|
+
},
|
|
88
|
+
"dependencies": {
|
|
89
|
+
"@awesome-cordova-plugins/core": "6.6.0",
|
|
90
|
+
"@awesome-cordova-plugins/network-interface": "6.6.0",
|
|
91
|
+
"@microsoft/signalr": "7.0.11",
|
|
92
|
+
"axios": "1.5.1",
|
|
93
|
+
"bcryptjs": "2.4.3",
|
|
94
|
+
"buffer": "6.0.3",
|
|
95
|
+
"crypto-browserify": "3.12.0",
|
|
96
|
+
"crypto-js": "4.2.0",
|
|
97
|
+
"dayjs": "^1.11.10",
|
|
98
|
+
"dexie": "4.3.0",
|
|
99
|
+
"esc-pos-encoder-ionic": "1.1.3",
|
|
100
|
+
"handlebars": "4.7.8",
|
|
101
|
+
"lodash": "^4.17.21",
|
|
102
|
+
"nanoid": "3.3.4",
|
|
103
|
+
"save": "2.9.0",
|
|
104
|
+
"selecttransform": "1.6.1",
|
|
105
|
+
"sockets-for-cordova": "1.0.0",
|
|
106
|
+
"stream-browserify": "3.0.0",
|
|
107
|
+
"uuid": "9.0.1",
|
|
108
|
+
"vm-browserify": "1.1.2",
|
|
109
|
+
"wcwidth": "1.0.1",
|
|
110
|
+
"zod": "3.23.8"
|
|
111
|
+
},
|
|
112
|
+
"peerDependencies": {
|
|
113
|
+
"@litepos/autoquery": "5.0.10",
|
|
114
|
+
"rxjs": "^7.0.0"
|
|
115
|
+
},
|
|
116
|
+
"peerDependenciesMeta": {
|
|
117
|
+
"rxjs": {
|
|
118
|
+
"optional": true
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
package/tsdown.config.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
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
|
-
minify: true,
|
|
12
|
-
dts: {
|
|
13
|
-
resolve: true,
|
|
14
|
-
},
|
|
15
|
-
external: [
|
|
16
|
-
'@litepos/autoquery',
|
|
17
|
-
'lodash',
|
|
18
|
-
'rxjs',
|
|
19
|
-
'axios',
|
|
20
|
-
],
|
|
21
|
-
})
|
|
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
|
+
minify: true,
|
|
12
|
+
dts: {
|
|
13
|
+
resolve: true,
|
|
14
|
+
},
|
|
15
|
+
external: [
|
|
16
|
+
'@litepos/autoquery',
|
|
17
|
+
'lodash',
|
|
18
|
+
'rxjs',
|
|
19
|
+
'axios',
|
|
20
|
+
],
|
|
21
|
+
})
|
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
|
+
})
|
package/AGENTS.md
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Codex 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
|
-
*This file contains guidelines learned from AI-human collaboration to improve development efficiency and code quality.*
|