@posx/core 5.5.318 → 5.5.321
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/build/index.d.ts +5275 -5499
- package/build/index.js +36174 -1
- package/jest.config.cjs +36 -0
- package/package.json +1 -2
- package/package.publish.json +47 -48
- package/vite.config.ts +93 -0
- /package/{jest.setup.js → jest.setup.cjs} +0 -0
package/jest.config.cjs
ADDED
|
@@ -0,0 +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
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posx/core",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.321",
|
|
4
4
|
"description": "POSX core libraries",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"author": "Steven Lee",
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@awesome-cordova-plugins/core": "6.6.0",
|
|
15
15
|
"@awesome-cordova-plugins/network-interface": "6.6.0",
|
|
16
|
-
"@litepos/autoquery": "5.0.6",
|
|
17
16
|
"@microsoft/signalr": "7.0.11",
|
|
18
17
|
"axios": "1.5.1",
|
|
19
18
|
"bcryptjs": "2.4.3",
|
package/package.publish.json
CHANGED
|
@@ -1,28 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posx/core",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.321",
|
|
4
4
|
"description": "POSX core libraries",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "build/index.js",
|
|
7
|
+
"module": "build/index.js",
|
|
6
8
|
"types": "build/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./build/index.js",
|
|
12
|
+
"types": "./build/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
7
15
|
"scripts": {
|
|
8
|
-
"up": "node ./scripts/upload-to-s3.
|
|
9
|
-
"start": "
|
|
10
|
-
"build": "
|
|
11
|
-
"build:dts": "
|
|
12
|
-
"post:build": "node ./scripts/clean-build.
|
|
16
|
+
"up": "node ./scripts/upload-to-s3.cjs --trace-warnings",
|
|
17
|
+
"start": "vite",
|
|
18
|
+
"build": "vite build",
|
|
19
|
+
"build:dts": "vite build",
|
|
20
|
+
"post:build": "node ./scripts/clean-build.cjs",
|
|
13
21
|
"mvm": "mv build/*.map scripts/sourcemaps/ && mv build/**/*.map scripts/sourcemaps/ && find build -name '*.map' -type f -delete",
|
|
14
|
-
"build:demo": "
|
|
22
|
+
"build:demo": "vite build --mode demo",
|
|
15
23
|
"test": "jest",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
24
|
+
"test:watch": "jest --watch",
|
|
25
|
+
"publish": "node ./scripts/publish.cjs",
|
|
26
|
+
"p": "pnpm i && npm test && npm run up:p && npm run build && npm run post:build && npm run publish && rm -rf build",
|
|
27
|
+
"debug": "npm run build && npm run post:build",
|
|
28
|
+
"coverage": "jest --coverage",
|
|
20
29
|
"trypublish": "npm publish || true",
|
|
21
|
-
"gen:index": "node ./scriptswc/generateIndex.
|
|
30
|
+
"gen:index": "node ./scriptswc/generateIndex.cjs",
|
|
22
31
|
"up:p": "npm version patch && git push",
|
|
23
32
|
"up:m": "npm version minor && git push",
|
|
24
33
|
"docs": "typedoc --out docs src --excludePrivate --exclude '**/demo/**/*' --exclude '**/*+(interface|function|enum).ts'",
|
|
25
|
-
"see": "node ./scripts/lookup-sm.
|
|
34
|
+
"see": "node ./scripts/lookup-sm.cjs"
|
|
26
35
|
},
|
|
27
36
|
"repository": {
|
|
28
37
|
"type": "git"
|
|
@@ -39,59 +48,40 @@
|
|
|
39
48
|
"es6"
|
|
40
49
|
],
|
|
41
50
|
"devDependencies": {
|
|
42
|
-
"@babel/cli": "^7.22.15",
|
|
43
|
-
"@babel/core": "^7.22.11",
|
|
44
|
-
"@babel/plugin-proposal-decorators": "7.23.0",
|
|
45
|
-
"@babel/plugin-transform-class-properties": "7.22.5",
|
|
46
|
-
"@babel/plugin-transform-typescript": "^7.22.15",
|
|
47
|
-
"@babel/polyfill": "^7.12.1",
|
|
48
|
-
"@babel/preset-env": "^7.22.15",
|
|
49
|
-
"@babel/preset-typescript": "^7.23.0",
|
|
50
51
|
"@capacitor/core": "5.4.2",
|
|
52
|
+
"@litepos/autoquery": "5.0.6",
|
|
51
53
|
"@types/bcryptjs": "2.4.6",
|
|
52
|
-
"@types/jest": "
|
|
54
|
+
"@types/jest": "30.0.0",
|
|
53
55
|
"@types/lodash": "4.14.199",
|
|
54
56
|
"@types/node": "20.8.2",
|
|
55
57
|
"@types/uuid": "9.0.4",
|
|
56
58
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
57
59
|
"@typescript-eslint/parser": "^4.33.0",
|
|
60
|
+
"@vitest/coverage-v8": "^2.1.0",
|
|
61
|
+
"ajv": "8.17.1",
|
|
58
62
|
"aws-sdk": "2.1550.0",
|
|
59
|
-
"babel-eslint": "^10.1.0",
|
|
60
|
-
"babel-loader": "^9.1.3",
|
|
61
|
-
"babel-preset-minify": "^0.5.2",
|
|
62
|
-
"clean-webpack-plugin": "4.0.0",
|
|
63
63
|
"colors": "1.4.0",
|
|
64
|
-
"copy-webpack-plugin": "12.0.2",
|
|
65
|
-
"css-loader": "^6.8.1",
|
|
66
|
-
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
67
64
|
"eslint": "^7.32.0",
|
|
68
|
-
"file-loader": "^6.2.0",
|
|
69
65
|
"fs-extra": "11.1.1",
|
|
70
66
|
"glob": "10.3.10",
|
|
71
|
-
"
|
|
72
|
-
"jest": "
|
|
73
|
-
"
|
|
74
|
-
"mini-css-extract-plugin": "^2.7.6",
|
|
75
|
-
"npm-dts": "1.3.12",
|
|
76
|
-
"path": "0.12.7",
|
|
67
|
+
"jest": "30.2.0",
|
|
68
|
+
"jest-environment-jsdom": "30.2.0",
|
|
69
|
+
"jsdom": "27.1.0",
|
|
77
70
|
"prompt-sync": "4.2.0",
|
|
78
|
-
"
|
|
71
|
+
"rollup-plugin-obfuscator": "^1.1.0",
|
|
79
72
|
"sqlite3": "5.1.6",
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"webpack-dev-server": "4.13.3",
|
|
89
|
-
"webpack-obfuscator": "3.5.1"
|
|
73
|
+
"terser": "^5.36.0",
|
|
74
|
+
"ts-jest": "29.4.5",
|
|
75
|
+
"typedoc": "^0.26.0",
|
|
76
|
+
"typescript": "^5.6.3",
|
|
77
|
+
"vite": "^5.4.11",
|
|
78
|
+
"vite-plugin-bundle-obfuscator": "1.8.0",
|
|
79
|
+
"vite-plugin-dts": "^4.3.0",
|
|
80
|
+
"vitest": "^2.1.0"
|
|
90
81
|
},
|
|
91
82
|
"dependencies": {
|
|
92
83
|
"@awesome-cordova-plugins/core": "6.6.0",
|
|
93
84
|
"@awesome-cordova-plugins/network-interface": "6.6.0",
|
|
94
|
-
"@litepos/autoquery": "5.0.6",
|
|
95
85
|
"@microsoft/signalr": "7.0.11",
|
|
96
86
|
"axios": "1.5.1",
|
|
97
87
|
"bcryptjs": "2.4.3",
|
|
@@ -113,5 +103,14 @@
|
|
|
113
103
|
"vm-browserify": "1.1.2",
|
|
114
104
|
"wcwidth": "1.0.1",
|
|
115
105
|
"zod": "3.23.8"
|
|
106
|
+
},
|
|
107
|
+
"peerDependencies": {
|
|
108
|
+
"@litepos/autoquery": "^5.0.6",
|
|
109
|
+
"rxjs": "^7.0.0"
|
|
110
|
+
},
|
|
111
|
+
"peerDependenciesMeta": {
|
|
112
|
+
"rxjs": {
|
|
113
|
+
"optional": true
|
|
114
|
+
}
|
|
116
115
|
}
|
|
117
116
|
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { defineConfig, Plugin } from 'vite'
|
|
2
|
+
import { resolve } from 'path'
|
|
3
|
+
import dts from 'vite-plugin-dts'
|
|
4
|
+
import vitePluginBundleObfuscator from 'vite-plugin-bundle-obfuscator'
|
|
5
|
+
import { getBanner } from './scripts/getBanner.mjs'
|
|
6
|
+
|
|
7
|
+
const bannerPlugin = (): Plugin => ({
|
|
8
|
+
name: 'banner-plugin',
|
|
9
|
+
generateBundle(_, bundle) {
|
|
10
|
+
for (const chunk of Object.values(bundle)) {
|
|
11
|
+
if (chunk.type === 'chunk' && chunk.fileName === 'index.js') {
|
|
12
|
+
chunk.code = getBanner() + '\n' + chunk.code
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export default defineConfig({
|
|
19
|
+
plugins: [
|
|
20
|
+
dts({
|
|
21
|
+
outDir: 'build',
|
|
22
|
+
insertTypesEntry: true,
|
|
23
|
+
rollupTypes: true,
|
|
24
|
+
include: ['src/**/*.ts'],
|
|
25
|
+
exclude: ['src/test/**', 'src/tests/**', '**/*.test.ts', '**/*.spec.ts'],
|
|
26
|
+
}),
|
|
27
|
+
bannerPlugin(),
|
|
28
|
+
vitePluginBundleObfuscator({
|
|
29
|
+
enable: true,
|
|
30
|
+
log: false,
|
|
31
|
+
autoExcludeNodeModules: true,
|
|
32
|
+
threadPool: { enable: true, size: 4 },
|
|
33
|
+
options: {
|
|
34
|
+
compact: true,
|
|
35
|
+
controlFlowFlattening: false,
|
|
36
|
+
deadCodeInjection: false,
|
|
37
|
+
debugProtection: false,
|
|
38
|
+
identifierNamesGenerator: 'hexadecimal',
|
|
39
|
+
renameGlobals: false,
|
|
40
|
+
selfDefending: false,
|
|
41
|
+
simplify: true,
|
|
42
|
+
stringArray: true,
|
|
43
|
+
stringArrayRotate: true,
|
|
44
|
+
stringArrayShuffle: true,
|
|
45
|
+
stringArrayIndexShift: true,
|
|
46
|
+
stringArrayThreshold: 0.6,
|
|
47
|
+
unicodeEscapeSequence: false,
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
50
|
+
],
|
|
51
|
+
build: {
|
|
52
|
+
outDir: 'build',
|
|
53
|
+
lib: {
|
|
54
|
+
entry: resolve(__dirname, 'src/index.ts'),
|
|
55
|
+
name: '@posx/core',
|
|
56
|
+
formats: ['es'],
|
|
57
|
+
fileName: () => 'index.js',
|
|
58
|
+
},
|
|
59
|
+
rollupOptions: {
|
|
60
|
+
external: [
|
|
61
|
+
'@litepos/autoquery',
|
|
62
|
+
'rxjs',
|
|
63
|
+
],
|
|
64
|
+
output: {
|
|
65
|
+
preserveModules: false,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
sourcemap: true,
|
|
69
|
+
minify: 'terser',
|
|
70
|
+
terserOptions: {
|
|
71
|
+
compress: {
|
|
72
|
+
drop_console: false,
|
|
73
|
+
drop_debugger: true,
|
|
74
|
+
passes: 2,
|
|
75
|
+
},
|
|
76
|
+
mangle: true,
|
|
77
|
+
format: {
|
|
78
|
+
comments: false,
|
|
79
|
+
beautify: false,
|
|
80
|
+
semicolons: true,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
cssMinify: true,
|
|
84
|
+
},
|
|
85
|
+
resolve: {
|
|
86
|
+
alias: {
|
|
87
|
+
buffer: 'buffer/',
|
|
88
|
+
crypto: 'crypto-browserify',
|
|
89
|
+
stream: 'stream-browserify',
|
|
90
|
+
vm: 'vm-browserify',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
})
|
|
File without changes
|