expo-hiu-print 0.1.0 → 0.1.1

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,4 @@
1
+ import type { ExpoHiuPrintModuleType } from "./types";
2
+ declare const ExpoHiuPrintModule: ExpoHiuPrintModuleType;
3
+ export default ExpoHiuPrintModule;
4
+ //# sourceMappingURL=ExpoHiuPrintModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoHiuPrintModule.d.ts","sourceRoot":"","sources":["../src/ExpoHiuPrintModule.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,QAAA,MAAM,kBAAkB,wBACqC,CAAC;AAE9D,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { requireNativeModule } from "expo";
2
+ const ExpoHiuPrintModule = requireNativeModule("ExpoHiuPrint");
3
+ export default ExpoHiuPrintModule;
4
+ //# sourceMappingURL=ExpoHiuPrintModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoHiuPrintModule.js","sourceRoot":"","sources":["../src/ExpoHiuPrintModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAG3C,MAAM,kBAAkB,GACtB,mBAAmB,CAAyB,cAAc,CAAC,CAAC;AAE9D,eAAe,kBAAkB,CAAC","sourcesContent":["import { requireNativeModule } from \"expo\";\nimport type { ExpoHiuPrintModuleType } from \"./types\";\n\nconst ExpoHiuPrintModule =\n requireNativeModule<ExpoHiuPrintModuleType>(\"ExpoHiuPrint\");\n\nexport default ExpoHiuPrintModule;\n"]}
package/build/api.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { PrintJob, Printer } from "./types";
2
+ export declare function print(job: PrintJob): Promise<void>;
3
+ export declare function openCashBox(job: {
4
+ printers: Printer[];
5
+ }): Promise<void>;
6
+ export declare function checkPrinterStatus(printer: Printer): Promise<"connected" | "disconnected">;
7
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEjD,wBAAgB,KAAK,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAElD;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE;IAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvE;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,WAAW,GAAG,cAAc,CAAC,CAEvC"}
package/build/api.js ADDED
@@ -0,0 +1,12 @@
1
+ // API wrapper for expo-hiu-print
2
+ import ExpoHiuPrintModule from "./ExpoHiuPrintModule";
3
+ export function print(job) {
4
+ return ExpoHiuPrintModule.print(job);
5
+ }
6
+ export function openCashBox(job) {
7
+ return ExpoHiuPrintModule.openCashBox(job);
8
+ }
9
+ export function checkPrinterStatus(printer) {
10
+ return ExpoHiuPrintModule.checkPrinterStatus(printer);
11
+ }
12
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAGtD,MAAM,UAAU,KAAK,CAAC,GAAa;IACjC,OAAO,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAA4B;IACtD,OAAO,kBAAkB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,OAAgB;IAEhB,OAAO,kBAAkB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;AACxD,CAAC","sourcesContent":["// API wrapper for expo-hiu-print\nimport ExpoHiuPrintModule from \"./ExpoHiuPrintModule\";\nimport type { PrintJob, Printer } from \"./types\";\n\nexport function print(job: PrintJob): Promise<void> {\n return ExpoHiuPrintModule.print(job);\n}\n\nexport function openCashBox(job: { printers: Printer[] }): Promise<void> {\n return ExpoHiuPrintModule.openCashBox(job);\n}\n\nexport function checkPrinterStatus(\n printer: Printer,\n): Promise<\"connected\" | \"disconnected\"> {\n return ExpoHiuPrintModule.checkPrinterStatus(printer);\n}\n"]}
@@ -0,0 +1,39 @@
1
+ import { NativeModule } from "react-native";
2
+ export interface Printer {
3
+ name: string;
4
+ host: string;
5
+ port: number;
6
+ paperWidth: number;
7
+ }
8
+ export interface PrintElement {
9
+ type: "text" | "line" | "table" | "qr" | "feed" | "cut";
10
+ value?: string;
11
+ align?: "left" | "center" | "right";
12
+ bold?: boolean;
13
+ size?: "small" | "normal" | "large";
14
+ headers?: {
15
+ text: string;
16
+ align?: "left" | "center" | "right";
17
+ bold?: boolean;
18
+ }[];
19
+ rows?: {
20
+ text: string;
21
+ align?: "left" | "center" | "right";
22
+ bold?: boolean;
23
+ }[][];
24
+ data?: string;
25
+ lines?: number;
26
+ widthPercent?: number;
27
+ }
28
+ export interface PrintJob {
29
+ printers: Printer[];
30
+ elements: PrintElement[];
31
+ }
32
+ export interface ExpoHiuPrintModuleType extends NativeModule {
33
+ print(job: PrintJob): Promise<void>;
34
+ openCashBox(job: {
35
+ printers: Printer[];
36
+ }): Promise<void>;
37
+ checkPrinterStatus(printer: Printer): Promise<"connected" | "disconnected">;
38
+ }
39
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,M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G,OAAO,CAAC,WAAW,GAAG,cAAc,CAAC,CAAC;CAC7E"}
package/build/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["// Types for expo-hiu-print\nimport { NativeModule } from \"react-native\";\n\nexport interface Printer {\n name: string;\n host: string;\n port: number;\n paperWidth: number;\n}\n\nexport interface PrintElement {\n type: \"text\" | \"line\" | \"table\" | \"qr\" | \"feed\" | \"cut\";\n value?: string;\n align?: \"left\" | \"center\" | \"right\";\n bold?: boolean;\n size?: \"small\" | \"normal\" | \"large\";\n headers?: {\n text: string;\n align?: \"left\" | \"center\" | \"right\";\n bold?: boolean;\n }[];\n rows?: {\n text: string;\n align?: \"left\" | \"center\" | \"right\";\n bold?: boolean;\n }[][];\n data?: string;\n lines?: number;\n widthPercent?: number;\n}\n\nexport interface PrintJob {\n printers: Printer[];\n elements: PrintElement[];\n}\n\nexport interface ExpoHiuPrintModuleType extends NativeModule {\n print(job: PrintJob): Promise<void>;\n openCashBox(job: { printers: Printer[] }): Promise<void>;\n checkPrinterStatus(printer: Printer): Promise<\"connected\" | \"disconnected\">;\n}\n"]}
package/jest.config.js ADDED
@@ -0,0 +1,24 @@
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
2
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
3
+ module.exports = {
4
+ preset: 'ts-jest',
5
+ testEnvironment: 'node',
6
+ testMatch: ['**/__tests__/**/*.ts'],
7
+ moduleFileExtensions: ['ts', 'js', 'json', 'node'],
8
+ transform: {
9
+ '^.+\\.(ts|tsx)$': 'ts-jest',
10
+ '^.+\\.js$': 'babel-jest',
11
+ },
12
+ transformIgnorePatterns: [
13
+ '/node_modules/(?!(expo|@expo|react-native|@react-native|@unimodules|unimodules|@babel|@react-navigation)/)'
14
+ ],
15
+ globals: {
16
+ 'ts-jest': {
17
+ tsconfig: 'tsconfig.json',
18
+ useESM: true,
19
+ },
20
+ },
21
+ moduleNameMapper: {
22
+ '^expo$': '<rootDir>/__mocks__/expo.js',
23
+ },
24
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-hiu-print",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Connect printer ",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -28,11 +28,13 @@
28
28
  "author": "hiun <hieufix1710@gmail.com> (https://github.com/hieufix1710)",
29
29
  "license": "MIT",
30
30
  "homepage": "https://github.com/hieufix1710/expo-hiu-print#readme",
31
- "dependencies": {},
31
+ "dependencies": {
32
+ "jest": "^29.7.0"
33
+ },
32
34
  "devDependencies": {
33
35
  "@types/react": "~19.1.0",
34
- "expo-module-scripts": "^5.0.8",
35
36
  "expo": "^54.0.27",
37
+ "expo-module-scripts": "^5.0.8",
36
38
  "react-native": "0.81.5"
37
39
  },
38
40
  "peerDependencies": {
package/tsconfig.json CHANGED
@@ -1,7 +1,8 @@
1
+ // filepath: tsconfig.json
1
2
  {
2
3
  "extends": "expo-module-scripts/tsconfig.base",
3
4
  "compilerOptions": {
4
- "outDir": "./src",
5
+ "outDir": "./build",
5
6
  "rootDir": "./src"
6
7
  },
7
8
  "include": ["./src"],