@pdfme/generator 1.0.18 → 1.1.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.
- package/dist/cjs/__tests__/assets/templates/index.js +111 -0
- package/dist/cjs/__tests__/assets/templates/index.js.map +1 -0
- package/dist/cjs/__tests__/generate.test.js +362 -0
- package/dist/cjs/__tests__/generate.test.js.map +1 -0
- package/dist/cjs/__tests__/helper.test.js +53 -0
- package/dist/cjs/__tests__/helper.test.js.map +1 -0
- package/dist/cjs/src/constants.js +5 -0
- package/dist/cjs/src/constants.js.map +1 -0
- package/dist/cjs/src/generate.js +75 -0
- package/dist/cjs/src/generate.js.map +1 -0
- package/dist/cjs/src/helper.js +296 -0
- package/dist/cjs/src/helper.js.map +1 -0
- package/dist/cjs/src/index.js +20 -0
- package/dist/cjs/src/index.js.map +1 -0
- package/dist/esm/__tests__/assets/templates/index.js +109 -0
- package/dist/esm/__tests__/assets/templates/index.js.map +1 -0
- package/dist/esm/__tests__/generate.test.js +334 -0
- package/dist/esm/__tests__/generate.test.js.map +1 -0
- package/dist/esm/__tests__/helper.test.js +48 -0
- package/dist/esm/__tests__/helper.test.js.map +1 -0
- package/dist/esm/src/constants.js +2 -0
- package/dist/esm/src/constants.js.map +1 -0
- package/dist/esm/src/generate.js +70 -0
- package/dist/esm/src/generate.js.map +1 -0
- package/dist/esm/src/helper.js +285 -0
- package/dist/esm/src/helper.js.map +1 -0
- package/dist/esm/src/index.js +4 -0
- package/dist/esm/src/index.js.map +1 -0
- package/dist/types/__tests__/assets/templates/index.d.ts +1563 -0
- package/dist/types/__tests__/generate.test.d.ts +1 -0
- package/dist/types/__tests__/helper.test.d.ts +1 -0
- package/dist/types/{constants.d.ts → src/constants.d.ts} +0 -0
- package/dist/types/{generate.d.ts → src/generate.d.ts} +0 -0
- package/dist/types/{helper.d.ts → src/helper.d.ts} +1 -0
- package/dist/types/{index.d.ts → src/index.d.ts} +1 -1
- package/package.json +18 -12
- package/src/generate.ts +2 -2
- package/src/helper.ts +3 -5
- package/src/index.ts +1 -1
- package/tsconfig.cjs.json +9 -0
- package/tsconfig.esm.json +9 -0
- package/declaration.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/index.js.LICENSE.txt +0 -43
- package/dist/index.js.map +0 -1
- package/tsconfig.json +0 -21
- package/webpack.config.js +0 -59
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
File without changes
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import generate from './generate';
|
1
|
+
import generate from './generate.js';
|
2
2
|
export { generate };
|
3
3
|
export type { Lang, Size, Alignment, SchemaType, BarCodeType, TextSchema, ImageSchema, BarcodeSchema, Schema, SchemaForUI, Font, BasePdf, Template, CommonProps, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps, } from '@pdfme/common';
|
4
4
|
export { BLANK_PDF, isTextSchema, isImageSchema, isBarcodeSchema, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, validateBarcodeInput, } from '@pdfme/common';
|
package/package.json
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pdfme/generator",
|
3
|
-
"version": "1.0
|
3
|
+
"version": "1.1.0",
|
4
|
+
"sideEffects": false,
|
4
5
|
"author": "hand-dot",
|
5
6
|
"license": "MIT",
|
6
7
|
"keywords": [
|
@@ -20,15 +21,23 @@
|
|
20
21
|
"bugs": {
|
21
22
|
"url": "https://github.com/pdfme/pdfme/issues"
|
22
23
|
},
|
23
|
-
"main": "dist/index.js",
|
24
|
-
"module": "dist/index.js",
|
25
|
-
"types": "dist/types/index.d.ts",
|
24
|
+
"main": "dist/cjs/src/index.js",
|
25
|
+
"module": "dist/esm/src/index.js",
|
26
|
+
"types": "dist/types/src/index.d.ts",
|
27
|
+
"exports": {
|
28
|
+
".": {
|
29
|
+
"import": "./dist/esm/src/index.js",
|
30
|
+
"require": "./dist/cjs/src/index.js"
|
31
|
+
}
|
32
|
+
},
|
26
33
|
"engines": {
|
27
34
|
"node": ">=14"
|
28
35
|
},
|
29
36
|
"scripts": {
|
30
|
-
"develop": "
|
31
|
-
"build": "
|
37
|
+
"develop": "tsc -w",
|
38
|
+
"build": "npm run build:cjs && npm run build:esm",
|
39
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
40
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
32
41
|
"clean": "rimraf dist",
|
33
42
|
"lint": "tsc --noEmit",
|
34
43
|
"test": "jest",
|
@@ -40,21 +49,18 @@
|
|
40
49
|
"@pdf-lib/fontkit": "^1.1.1",
|
41
50
|
"@pdfme/common": "^1.0.0",
|
42
51
|
"atob": "^2.1.2",
|
43
|
-
"bwip-js": "^2.
|
52
|
+
"bwip-js": "^3.2.2",
|
44
53
|
"pdf-lib": "^1.17.1"
|
45
54
|
},
|
46
55
|
"devDependencies": {
|
47
56
|
"@types/bwip-js": "^3.0.0",
|
48
57
|
"@types/pngjs": "^6.0.1",
|
49
58
|
"jsqr": "^1.4.0",
|
50
|
-
"node-polyfill-webpack-plugin": "^1.1.4",
|
51
59
|
"pdf2json": "^2.0.0",
|
52
60
|
"pngjs": "^6.0.0"
|
53
61
|
},
|
54
62
|
"jest": {
|
55
|
-
"
|
56
|
-
"\\.(ttf)$": "<rootDir>/../../fontTransformer.js"
|
57
|
-
},
|
63
|
+
"resolver": "ts-jest-resolver",
|
58
64
|
"moduleFileExtensions": [
|
59
65
|
"js",
|
60
66
|
"ts"
|
@@ -64,7 +70,7 @@
|
|
64
70
|
},
|
65
71
|
"globals": {
|
66
72
|
"ts-jest": {
|
67
|
-
"tsconfig": "tsconfig.json"
|
73
|
+
"tsconfig": "tsconfig.esm.json"
|
68
74
|
}
|
69
75
|
},
|
70
76
|
"testMatch": [
|
package/src/generate.ts
CHANGED
@@ -8,8 +8,8 @@ import {
|
|
8
8
|
drawEmbeddedPage,
|
9
9
|
embedAndGetFontObj,
|
10
10
|
InputImageCache,
|
11
|
-
} from './helper';
|
12
|
-
import { TOOL_NAME } from './constants';
|
11
|
+
} from './helper.js';
|
12
|
+
import { TOOL_NAME } from './constants.js';
|
13
13
|
|
14
14
|
const preprocessing = async (arg: {
|
15
15
|
inputs: { [key: string]: string }[];
|
package/src/helper.ts
CHANGED
@@ -9,9 +9,7 @@ import {
|
|
9
9
|
setCharacterSpacing,
|
10
10
|
TransformationMatrix,
|
11
11
|
} from 'pdf-lib';
|
12
|
-
import { ToBufferOptions } from 'bwip-js';
|
13
|
-
import bwipjsNode from 'bwip-js/dist/node-bwipjs';
|
14
|
-
import bwipjsBrowser from 'bwip-js/dist/bwip-js';
|
12
|
+
import bwipjs, { ToBufferOptions } from 'bwip-js';
|
15
13
|
import {
|
16
14
|
getB64BasePdf,
|
17
15
|
b64toUint8Array,
|
@@ -60,11 +58,11 @@ export const createBarCode = async (arg: {
|
|
60
58
|
|
61
59
|
if (typeof window !== 'undefined') {
|
62
60
|
const canvas = document.createElement('canvas');
|
63
|
-
|
61
|
+
bwipjs.toCanvas(canvas, bwipjsArg);
|
64
62
|
const dataUrl = canvas.toDataURL('image/png');
|
65
63
|
res = b64toUint8Array(dataUrl).buffer as Buffer;
|
66
64
|
} else {
|
67
|
-
res = await
|
65
|
+
res = await bwipjs.toBuffer(bwipjsArg);
|
68
66
|
}
|
69
67
|
|
70
68
|
return res;
|
package/src/index.ts
CHANGED
package/declaration.d.ts
DELETED