@nam088/zca-js 1.0.0

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,27 @@
1
+ import js from "@eslint/js";
2
+ import globals from "globals";
3
+ import tseslint from "typescript-eslint";
4
+ import { defineConfig, globalIgnores } from "eslint/config";
5
+
6
+ export default defineConfig([
7
+ {
8
+ files: ["**/*.{js,ts}"],
9
+ plugins: { js },
10
+ extends: ["js/recommended"],
11
+ languageOptions: { globals: globals.node },
12
+ },
13
+ tseslint.configs.recommended,
14
+ {
15
+ rules: {
16
+ "@typescript-eslint/consistent-type-imports": "error",
17
+ "no-extra-boolean-cast": "off",
18
+ },
19
+ },
20
+ {
21
+ files: ["rollup.config.js"],
22
+ rules: {
23
+ "@typescript-eslint/no-require-imports": "off",
24
+ },
25
+ },
26
+ globalIgnores(["dist/*"]),
27
+ ]);
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./dist";
2
+ export as namespace Zalo;
package/package.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "@nam088/zca-js",
3
+ "version": "1.0.0",
4
+ "description": "Unofficial Zalo API for JavaScript",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "development": "./dist/index.js",
12
+ "default": "./dist/index.min.js"
13
+ },
14
+ "require": {
15
+ "development": "./dist/index.cjs",
16
+ "default": "./dist/index.min.cjs"
17
+ },
18
+ "types": "./dist/index.d.ts"
19
+ }
20
+ },
21
+ "scripts": {
22
+ "build:clean": "rimraf dist",
23
+ "build": "npm run build:clean && rollup -c",
24
+ "test:feat": "node --loader ts-node/esm test/feat.ts",
25
+ "prettier": "prettier --write .",
26
+ "lint": "eslint .",
27
+ "lint:fix": "eslint . --fix",
28
+ "prepare": "husky"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/Nam088/zca-js.git"
33
+ },
34
+ "homepage": "https://github.com/Nam088/zca-js",
35
+ "bugs": {
36
+ "url": "https://github.com/Nam088/zca-js/issues"
37
+ },
38
+ "engines": {
39
+ "node": ">=18.0.0"
40
+ },
41
+ "keywords": [
42
+ "chatbot",
43
+ "zalo",
44
+ "api"
45
+ ],
46
+ "author": "Nam088",
47
+ "license": "MIT",
48
+ "dependencies": {
49
+ "crypto-js": "^4.2.0",
50
+ "form-data": "^4.0.4",
51
+ "json-bigint": "^1.0.0",
52
+ "pako": "^2.1.0",
53
+ "semver": "^7.6.3",
54
+ "spark-md5": "^3.0.2",
55
+ "tough-cookie": "^5.0.0",
56
+ "ws": "^8.18.0"
57
+ },
58
+ "devDependencies": {
59
+ "@eslint/js": "^9.34.0",
60
+ "@rollup/plugin-commonjs": "^28.0.6",
61
+ "@rollup/plugin-node-resolve": "^16.0.2",
62
+ "@rollup/plugin-terser": "^0.4.4",
63
+ "@rollup/plugin-typescript": "^12.1.4",
64
+ "@types/crypto-js": "^4.2.2",
65
+ "@types/json-bigint": "^1.0.4",
66
+ "@types/lodash": "^4.17.20",
67
+ "@types/node": "^20.14.10",
68
+ "@types/pako": "^2.0.3",
69
+ "@types/semver": "^7.5.8",
70
+ "@types/spark-md5": "^3.0.4",
71
+ "@types/ws": "^8.5.11",
72
+ "eslint": "^9.34.0",
73
+ "globals": "^16.3.0",
74
+ "husky": "^9.1.7",
75
+ "lint-staged": "^16.1.5",
76
+ "lodash": "^4.17.21",
77
+ "prettier": "^3.3.3",
78
+ "rimraf": "^5.0.10",
79
+ "rollup": "^4.52.4",
80
+ "rollup-plugin-dts": "^6.2.3",
81
+ "ts-node": "^10.9.2",
82
+ "typescript": "^5.5.3",
83
+ "typescript-eslint": "^8.41.0"
84
+ },
85
+ "lint-staged": {
86
+ "*.{js,ts}": "npx eslint"
87
+ }
88
+ }
@@ -0,0 +1,110 @@
1
+ const typescript = require('@rollup/plugin-typescript');
2
+ const resolve = require('@rollup/plugin-node-resolve');
3
+ const commonjs = require('@rollup/plugin-commonjs');
4
+ const dts = require('rollup-plugin-dts').default;
5
+ const terser = require('@rollup/plugin-terser');
6
+
7
+ // Auto-detect external dependencies from package.json
8
+ const pkg = require('./package.json');
9
+ const external = [
10
+ ...Object.keys(pkg.dependencies || {}),
11
+ ...Object.keys(pkg.peerDependencies || {}),
12
+ 'node:crypto',
13
+ 'node:fs',
14
+ 'node:path',
15
+ 'http',
16
+ 'events'
17
+ ];
18
+
19
+ // Shared plugins
20
+ const sharedPlugins = [
21
+ resolve({
22
+ preferBuiltins: true
23
+ }),
24
+ commonjs(),
25
+ typescript({
26
+ tsconfig: './tsconfig.json',
27
+ declaration: false,
28
+ declarationMap: false,
29
+ sourceMap: true
30
+ })
31
+ ];
32
+
33
+ module.exports = [
34
+ // ESM build (development)
35
+ {
36
+ input: 'src/index.ts',
37
+ output: {
38
+ file: 'dist/index.js',
39
+ format: 'esm',
40
+ sourcemap: true,
41
+ generatedCode: 'es2015'
42
+ },
43
+ external,
44
+ plugins: sharedPlugins
45
+ },
46
+ // ESM build (production - minified)
47
+ {
48
+ input: 'src/index.ts',
49
+ output: {
50
+ file: 'dist/index.min.js',
51
+ format: 'esm',
52
+ sourcemap: true,
53
+ generatedCode: 'es2015'
54
+ },
55
+ external,
56
+ plugins: [
57
+ ...sharedPlugins,
58
+ terser({
59
+ compress: {
60
+ drop_console: true,
61
+ drop_debugger: true
62
+ }
63
+ })
64
+ ]
65
+ },
66
+ // CJS build (development)
67
+ {
68
+ input: 'src/index.ts',
69
+ output: {
70
+ file: 'dist/index.cjs',
71
+ format: 'cjs',
72
+ sourcemap: true,
73
+ exports: 'named',
74
+ generatedCode: 'es5'
75
+ },
76
+ external,
77
+ plugins: sharedPlugins
78
+ },
79
+ // CJS build (production - minified)
80
+ {
81
+ input: 'src/index.ts',
82
+ output: {
83
+ file: 'dist/index.min.cjs',
84
+ format: 'cjs',
85
+ sourcemap: true,
86
+ exports: 'named',
87
+ generatedCode: 'es5'
88
+ },
89
+ external,
90
+ plugins: [
91
+ ...sharedPlugins,
92
+ terser({
93
+ compress: {
94
+ drop_console: true,
95
+ drop_debugger: true
96
+ }
97
+ })
98
+ ]
99
+ },
100
+ // Types
101
+ {
102
+ input: 'src/index.ts',
103
+ output: {
104
+ file: 'dist/index.d.ts',
105
+ format: 'esm'
106
+ },
107
+ external,
108
+ plugins: [dts()]
109
+ }
110
+ ];