@posx/core 5.5.317 → 5.5.320

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.
@@ -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.317",
3
+ "version": "5.5.320",
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",
@@ -1,28 +1,37 @@
1
1
  {
2
2
  "name": "@posx/core",
3
- "version": "5.5.317",
3
+ "version": "5.5.320",
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.js --trace-warnings",
9
- "start": "webpack serve --config webpack.config.demo.js",
10
- "build": "webpack && tsc",
11
- "build:dts": "npm-dts generate -o build/index.d.ts -L debug",
12
- "post:build": "node ./scripts/clean-build.js",
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": "webpack --config webpack.config.demo.js",
22
+ "build:demo": "vite build --mode demo",
15
23
  "test": "jest",
16
- "publish": "node ./scripts/publish.js",
17
- "p": "npm test && npm run up:p && npm run build && npm run build:dts && npm run post:build && npm run publish && rm -rf build",
18
- "debug": "npm run build && npm run build:dts && npm run post:build",
19
- "coverage": "npm run test --coverage",
24
+ "test:watch": "jest --watch",
25
+ "publish": "node ./scripts/publish.cjs",
26
+ "p": "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.js",
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.js"
34
+ "see": "node ./scripts/lookup-sm.cjs"
26
35
  },
27
36
  "repository": {
28
37
  "type": "git"
@@ -39,59 +48,38 @@
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": "^29.5.4",
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",
58
61
  "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
62
  "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
63
  "eslint": "^7.32.0",
68
- "file-loader": "^6.2.0",
69
64
  "fs-extra": "11.1.1",
70
65
  "glob": "10.3.10",
71
- "html-webpack-plugin": "^5.5.3",
72
- "jest": "^29.6.4",
73
- "jest-environment-jsdom": "29.7.0",
74
- "mini-css-extract-plugin": "^2.7.6",
75
- "npm-dts": "1.3.12",
76
- "path": "0.12.7",
66
+ "jest": "30.2.0",
67
+ "jest-environment-jsdom": "30.2.0",
68
+ "jsdom": "27.1.0",
77
69
  "prompt-sync": "4.2.0",
78
- "source-map": "0.5.3",
70
+ "rollup-plugin-obfuscator": "^1.1.0",
79
71
  "sqlite3": "5.1.6",
80
- "style-loader": "^3.3.2",
81
- "terser-webpack-plugin": "^5.3.9",
82
- "ts-jest": "29.1.1",
72
+ "terser": "^5.36.0",
73
+ "ts-jest": "29.4.5",
83
74
  "typedoc": "0.25.3",
84
- "typescript": "^4.9.5",
85
- "url-loader": "^4.1.1",
86
- "webpack": "^5.88.2",
87
- "webpack-cli": "^5.1.4",
88
- "webpack-dev-server": "4.13.3",
89
- "webpack-obfuscator": "3.5.1"
75
+ "typescript": "^5.6.3",
76
+ "vite": "^5.4.11",
77
+ "vite-plugin-dts": "^4.3.0",
78
+ "vitest": "^2.1.0"
90
79
  },
91
80
  "dependencies": {
92
81
  "@awesome-cordova-plugins/core": "6.6.0",
93
82
  "@awesome-cordova-plugins/network-interface": "6.6.0",
94
- "@litepos/autoquery": "5.0.6",
95
83
  "@microsoft/signalr": "7.0.11",
96
84
  "axios": "1.5.1",
97
85
  "bcryptjs": "2.4.3",
@@ -113,5 +101,8 @@
113
101
  "vm-browserify": "1.1.2",
114
102
  "wcwidth": "1.0.1",
115
103
  "zod": "3.23.8"
104
+ },
105
+ "peerDependencies": {
106
+ "@litepos/autoquery": "^5.0.6"
116
107
  }
117
108
  }
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vite").UserConfig;
2
+ export default _default;
package/vite.config.ts ADDED
@@ -0,0 +1,44 @@
1
+ import { defineConfig } from 'vite'
2
+ import { resolve } from 'path'
3
+ import dts from 'vite-plugin-dts'
4
+
5
+ export default defineConfig({
6
+ plugins: [
7
+ dts({
8
+ outDir: 'build',
9
+ insertTypesEntry: true,
10
+ rollupTypes: true,
11
+ exclude: ['src/test/**', 'src/tests/**', '**/*.test.ts', '**/*.spec.ts'],
12
+ }),
13
+ ],
14
+ build: {
15
+ outDir: 'build',
16
+ lib: {
17
+ entry: resolve(__dirname, 'src/index.ts'),
18
+ name: '@posx/core',
19
+ formats: ['es'],
20
+ fileName: () => 'index.js',
21
+ },
22
+ rollupOptions: {
23
+ external: ['@litepos/autoquery'],
24
+ output: {
25
+ preserveModules: false,
26
+ },
27
+ },
28
+ sourcemap: true,
29
+ minify: 'terser',
30
+ terserOptions: {
31
+ compress: {
32
+ drop_console: true,
33
+ },
34
+ },
35
+ },
36
+ resolve: {
37
+ alias: {
38
+ buffer: 'buffer/',
39
+ crypto: 'crypto-browserify',
40
+ stream: 'stream-browserify',
41
+ vm: 'vm-browserify',
42
+ },
43
+ },
44
+ })
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vite").UserConfig;
2
+ export default _default;
@@ -0,0 +1,21 @@
1
+ import { defineConfig } from 'vitest/config'
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ environment: 'jsdom',
7
+ setupFiles: ['./src/test/setup.ts'],
8
+ coverage: {
9
+ provider: 'v8',
10
+ reporter: ['text', 'json', 'html'],
11
+ },
12
+ },
13
+ resolve: {
14
+ alias: {
15
+ buffer: 'buffer/',
16
+ crypto: 'crypto-browserify',
17
+ stream: 'stream-browserify',
18
+ vm: 'vm-browserify',
19
+ },
20
+ },
21
+ })
File without changes