@pdfme/generator 3.0.1-dev.2 → 3.0.1-dev.21

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.
Files changed (40) hide show
  1. package/dist/cjs/__tests__/assets/templates/index.js +23 -46
  2. package/dist/cjs/__tests__/assets/templates/index.js.map +1 -1
  3. package/dist/cjs/__tests__/generate.test.js +36 -181
  4. package/dist/cjs/__tests__/generate.test.js.map +1 -1
  5. package/dist/cjs/__tests__/integration1.test.js +44 -0
  6. package/dist/cjs/__tests__/integration1.test.js.map +1 -0
  7. package/dist/cjs/__tests__/integration2.test.js +44 -0
  8. package/dist/cjs/__tests__/integration2.test.js.map +1 -0
  9. package/dist/cjs/__tests__/integration3.test.js +44 -0
  10. package/dist/cjs/__tests__/integration3.test.js.map +1 -0
  11. package/dist/cjs/__tests__/utils.js +59 -0
  12. package/dist/cjs/__tests__/utils.js.map +1 -0
  13. package/dist/cjs/src/generate.js +14 -24
  14. package/dist/cjs/src/generate.js.map +1 -1
  15. package/dist/cjs/src/pdfUtils.js +5 -14
  16. package/dist/cjs/src/pdfUtils.js.map +1 -1
  17. package/dist/esm/__tests__/assets/templates/index.js +22 -46
  18. package/dist/esm/__tests__/assets/templates/index.js.map +1 -1
  19. package/dist/esm/__tests__/generate.test.js +29 -151
  20. package/dist/esm/__tests__/generate.test.js.map +1 -1
  21. package/dist/esm/__tests__/integration1.test.js +39 -0
  22. package/dist/esm/__tests__/integration1.test.js.map +1 -0
  23. package/dist/esm/__tests__/integration2.test.js +39 -0
  24. package/dist/esm/__tests__/integration2.test.js.map +1 -0
  25. package/dist/esm/__tests__/integration3.test.js +39 -0
  26. package/dist/esm/__tests__/integration3.test.js.map +1 -0
  27. package/dist/esm/__tests__/utils.js +29 -0
  28. package/dist/esm/__tests__/utils.js.map +1 -0
  29. package/dist/esm/src/generate.js +11 -21
  30. package/dist/esm/src/generate.js.map +1 -1
  31. package/dist/esm/src/pdfUtils.js +5 -14
  32. package/dist/esm/src/pdfUtils.js.map +1 -1
  33. package/dist/types/__tests__/assets/templates/index.d.ts +29 -83
  34. package/dist/types/__tests__/integration1.test.d.ts +1 -0
  35. package/dist/types/__tests__/integration2.test.d.ts +1 -0
  36. package/dist/types/__tests__/integration3.test.d.ts +1 -0
  37. package/dist/types/__tests__/utils.d.ts +5 -0
  38. package/package.json +6 -3
  39. package/src/generate.ts +2 -2
  40. package/teardown.js +17 -0
@@ -1 +1 @@
1
- {"version":3,"file":"pdfUtils.js","sourceRoot":"","sources":["../../../src/pdfUtils.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAW,WAAW,EAAyC,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAC;AAGvD,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAO,GAGtD,EAAE,EAAE;IACH,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC;IAChC,IAAI,aAAa,GAAsB,EAAE,CAAC;IAC1C,IAAI,aAAa,GAAkB,EAAE,CAAC;IACtC,MAAM,WAAW,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACzF,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACrD,MAAM,aAAa,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAE1C,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACxC,QAAQ,EAAE,CAAC,CAAC,WAAW,EAAE;QACzB,QAAQ,EAAE,CAAC,CAAC,WAAW,EAAE;QACzB,OAAO,EAAE,CAAC,CAAC,UAAU,EAAE;KACxB,CAAC,CAAC,CAAC;IAEJ,MAAM,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EA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M,GAAG,CAAC,EAAE,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,MAAM,sBAAsB,GAAG,aAAa,CAAC,GAAG,CAC9C,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAyB,CACjD,CAAC;IAEF,aAAa,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,aAAa,EAAE,aAAa,EAAE,sBAAsB,CAAC,CAAC;IAE9F,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAIhC,EAAE,EAAE;IACH,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC;IAChD,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC5B,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,WAAW,CAAC;IAChE,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;IAClD,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;IAClD,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC,CAAC"}
@@ -1,25 +1,4 @@
1
- declare const _default: {
2
- test: {
3
- schemas: Record<string, import("zod").objectOutputType<{
4
- type: import("zod").ZodString;
5
- position: import("zod").ZodObject<{
6
- x: import("zod").ZodNumber;
7
- y: import("zod").ZodNumber;
8
- }, "strip", import("zod").ZodTypeAny, {
9
- x: number;
10
- y: number;
11
- }, {
12
- x: number;
13
- y: number;
14
- }>;
15
- width: import("zod").ZodNumber;
16
- height: import("zod").ZodNumber;
17
- rotate: import("zod").ZodOptional<import("zod").ZodNumber>;
18
- }, import("zod").ZodTypeAny, "passthrough">>[];
19
- basePdf: (string | ArrayBuffer | Uint8Array) & (string | ArrayBuffer | Uint8Array | undefined);
20
- sampledata?: Record<string, string>[] | undefined;
21
- columns?: string[] | undefined;
22
- };
1
+ export declare const label: {
23
2
  宛名8面: {
24
3
  schemas: Record<string, import("zod").objectOutputType<{
25
4
  type: import("zod").ZodString;
@@ -62,27 +41,6 @@ declare const _default: {
62
41
  sampledata?: Record<string, string>[] | undefined;
63
42
  columns?: string[] | undefined;
64
43
  };
65
- シンプルラベル24面BASE: {
66
- schemas: Record<string, import("zod").objectOutputType<{
67
- type: import("zod").ZodString;
68
- position: import("zod").ZodObject<{
69
- x: import("zod").ZodNumber;
70
- y: import("zod").ZodNumber;
71
- }, "strip", import("zod").ZodTypeAny, {
72
- x: number;
73
- y: number;
74
- }, {
75
- x: number;
76
- y: number;
77
- }>;
78
- width: import("zod").ZodNumber;
79
- height: import("zod").ZodNumber;
80
- rotate: import("zod").ZodOptional<import("zod").ZodNumber>;
81
- }, import("zod").ZodTypeAny, "passthrough">>[];
82
- basePdf: (string | ArrayBuffer | Uint8Array) & (string | ArrayBuffer | Uint8Array | undefined);
83
- sampledata?: Record<string, string>[] | undefined;
84
- columns?: string[] | undefined;
85
- };
86
44
  フレームラベル24面: {
87
45
  schemas: Record<string, import("zod").objectOutputType<{
88
46
  type: import("zod").ZodString;
@@ -272,28 +230,7 @@ declare const _default: {
272
230
  sampledata?: Record<string, string>[] | undefined;
273
231
  columns?: string[] | undefined;
274
232
  };
275
- 長形3号封筒: {
276
- schemas: Record<string, import("zod").objectOutputType<{
277
- type: import("zod").ZodString;
278
- position: import("zod").ZodObject<{
279
- x: import("zod").ZodNumber;
280
- y: import("zod").ZodNumber;
281
- }, "strip", import("zod").ZodTypeAny, {
282
- x: number;
283
- y: number;
284
- }, {
285
- x: number;
286
- y: number;
287
- }>;
288
- width: import("zod").ZodNumber;
289
- height: import("zod").ZodNumber;
290
- rotate: import("zod").ZodOptional<import("zod").ZodNumber>;
291
- }, import("zod").ZodTypeAny, "passthrough">>[];
292
- basePdf: (string | ArrayBuffer | Uint8Array) & (string | ArrayBuffer | Uint8Array | undefined);
293
- sampledata?: Record<string, string>[] | undefined;
294
- columns?: string[] | undefined;
295
- };
296
- 洋長3号封筒: {
233
+ ゆうパケット: {
297
234
  schemas: Record<string, import("zod").objectOutputType<{
298
235
  type: import("zod").ZodString;
299
236
  position: import("zod").ZodObject<{
@@ -314,7 +251,7 @@ declare const _default: {
314
251
  sampledata?: Record<string, string>[] | undefined;
315
252
  columns?: string[] | undefined;
316
253
  };
317
- 角形2号封筒: {
254
+ Aone72312宛名: {
318
255
  schemas: Record<string, import("zod").objectOutputType<{
319
256
  type: import("zod").ZodString;
320
257
  position: import("zod").ZodObject<{
@@ -335,7 +272,7 @@ declare const _default: {
335
272
  sampledata?: Record<string, string>[] | undefined;
336
273
  columns?: string[] | undefined;
337
274
  };
338
- BASEロゴ入り洋長3号封筒: {
275
+ 名刺サイズの名札: {
339
276
  schemas: Record<string, import("zod").objectOutputType<{
340
277
  type: import("zod").ZodString;
341
278
  position: import("zod").ZodObject<{
@@ -356,7 +293,7 @@ declare const _default: {
356
293
  sampledata?: Record<string, string>[] | undefined;
357
294
  columns?: string[] | undefined;
358
295
  };
359
- BASEロゴ入り1面: {
296
+ connpass名札: {
360
297
  schemas: Record<string, import("zod").objectOutputType<{
361
298
  type: import("zod").ZodString;
362
299
  position: import("zod").ZodObject<{
@@ -377,7 +314,9 @@ declare const _default: {
377
314
  sampledata?: Record<string, string>[] | undefined;
378
315
  columns?: string[] | undefined;
379
316
  };
380
- 名刺サイズの名札: {
317
+ };
318
+ export declare const envelope: {
319
+ 長形3号封筒: {
381
320
  schemas: Record<string, import("zod").objectOutputType<{
382
321
  type: import("zod").ZodString;
383
322
  position: import("zod").ZodObject<{
@@ -398,7 +337,7 @@ declare const _default: {
398
337
  sampledata?: Record<string, string>[] | undefined;
399
338
  columns?: string[] | undefined;
400
339
  };
401
- connpass名札: {
340
+ 洋長3号封筒: {
402
341
  schemas: Record<string, import("zod").objectOutputType<{
403
342
  type: import("zod").ZodString;
404
343
  position: import("zod").ZodObject<{
@@ -419,7 +358,7 @@ declare const _default: {
419
358
  sampledata?: Record<string, string>[] | undefined;
420
359
  columns?: string[] | undefined;
421
360
  };
422
- ゆうパケット: {
361
+ 角形2号封筒: {
423
362
  schemas: Record<string, import("zod").objectOutputType<{
424
363
  type: import("zod").ZodString;
425
364
  position: import("zod").ZodObject<{
@@ -440,6 +379,8 @@ declare const _default: {
440
379
  sampledata?: Record<string, string>[] | undefined;
441
380
  columns?: string[] | undefined;
442
381
  };
382
+ };
383
+ export declare const barcode: {
443
384
  Aone31555QRコード: {
444
385
  schemas: Record<string, import("zod").objectOutputType<{
445
386
  type: import("zod").ZodString;
@@ -524,7 +465,7 @@ declare const _default: {
524
465
  sampledata?: Record<string, string>[] | undefined;
525
466
  columns?: string[] | undefined;
526
467
  };
527
- Aone72312宛名: {
468
+ barcodes: {
528
469
  schemas: Record<string, import("zod").objectOutputType<{
529
470
  type: import("zod").ZodString;
530
471
  position: import("zod").ZodObject<{
@@ -545,6 +486,8 @@ declare const _default: {
545
486
  sampledata?: Record<string, string>[] | undefined;
546
487
  columns?: string[] | undefined;
547
488
  };
489
+ };
490
+ export declare const business: {
548
491
  領収書: {
549
492
  schemas: Record<string, import("zod").objectOutputType<{
550
493
  type: import("zod").ZodString;
@@ -734,7 +677,9 @@ declare const _default: {
734
677
  sampledata?: Record<string, string>[] | undefined;
735
678
  columns?: string[] | undefined;
736
679
  };
737
- z97mmx210mm: {
680
+ };
681
+ export declare const textType: {
682
+ dynamicFontSizeHorizontal: {
738
683
  schemas: Record<string, import("zod").objectOutputType<{
739
684
  type: import("zod").ZodString;
740
685
  position: import("zod").ZodObject<{
@@ -755,7 +700,7 @@ declare const _default: {
755
700
  sampledata?: Record<string, string>[] | undefined;
756
701
  columns?: string[] | undefined;
757
702
  };
758
- barcodes: {
703
+ dynamicFontSizeVertical: {
759
704
  schemas: Record<string, import("zod").objectOutputType<{
760
705
  type: import("zod").ZodString;
761
706
  position: import("zod").ZodObject<{
@@ -776,7 +721,7 @@ declare const _default: {
776
721
  sampledata?: Record<string, string>[] | undefined;
777
722
  columns?: string[] | undefined;
778
723
  };
779
- canvasPdf: {
724
+ verticalAlignmentTop: {
780
725
  schemas: Record<string, import("zod").objectOutputType<{
781
726
  type: import("zod").ZodString;
782
727
  position: import("zod").ZodObject<{
@@ -797,7 +742,7 @@ declare const _default: {
797
742
  sampledata?: Record<string, string>[] | undefined;
798
743
  columns?: string[] | undefined;
799
744
  };
800
- background: {
745
+ verticalAlignmentMiddle: {
801
746
  schemas: Record<string, import("zod").objectOutputType<{
802
747
  type: import("zod").ZodString;
803
748
  position: import("zod").ZodObject<{
@@ -818,7 +763,7 @@ declare const _default: {
818
763
  sampledata?: Record<string, string>[] | undefined;
819
764
  columns?: string[] | undefined;
820
765
  };
821
- dynamicFontSizeHorizontal: {
766
+ verticalAlignmentBottom: {
822
767
  schemas: Record<string, import("zod").objectOutputType<{
823
768
  type: import("zod").ZodString;
824
769
  position: import("zod").ZodObject<{
@@ -839,7 +784,9 @@ declare const _default: {
839
784
  sampledata?: Record<string, string>[] | undefined;
840
785
  columns?: string[] | undefined;
841
786
  };
842
- dynamicFontSizeVertical: {
787
+ };
788
+ export declare const other: {
789
+ test: {
843
790
  schemas: Record<string, import("zod").objectOutputType<{
844
791
  type: import("zod").ZodString;
845
792
  position: import("zod").ZodObject<{
@@ -860,7 +807,7 @@ declare const _default: {
860
807
  sampledata?: Record<string, string>[] | undefined;
861
808
  columns?: string[] | undefined;
862
809
  };
863
- rotation: {
810
+ z97mmx210mm: {
864
811
  schemas: Record<string, import("zod").objectOutputType<{
865
812
  type: import("zod").ZodString;
866
813
  position: import("zod").ZodObject<{
@@ -881,7 +828,7 @@ declare const _default: {
881
828
  sampledata?: Record<string, string>[] | undefined;
882
829
  columns?: string[] | undefined;
883
830
  };
884
- verticalAlignmentTop: {
831
+ canvasPdf: {
885
832
  schemas: Record<string, import("zod").objectOutputType<{
886
833
  type: import("zod").ZodString;
887
834
  position: import("zod").ZodObject<{
@@ -902,7 +849,7 @@ declare const _default: {
902
849
  sampledata?: Record<string, string>[] | undefined;
903
850
  columns?: string[] | undefined;
904
851
  };
905
- verticalAlignmentMiddle: {
852
+ background: {
906
853
  schemas: Record<string, import("zod").objectOutputType<{
907
854
  type: import("zod").ZodString;
908
855
  position: import("zod").ZodObject<{
@@ -923,7 +870,7 @@ declare const _default: {
923
870
  sampledata?: Record<string, string>[] | undefined;
924
871
  columns?: string[] | undefined;
925
872
  };
926
- verticalAlignmentBottom: {
873
+ rotation: {
927
874
  schemas: Record<string, import("zod").objectOutputType<{
928
875
  type: import("zod").ZodString;
929
876
  position: import("zod").ZodObject<{
@@ -945,4 +892,3 @@ declare const _default: {
945
892
  columns?: string[] | undefined;
946
893
  };
947
894
  };
948
- export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { Font } from '@pdfme/common';
2
+ export declare const getFont: () => Font;
3
+ export declare const getPdf: (pdfFilePath: string) => Promise<unknown>;
4
+ export declare const getPdfTmpPath: (fileName: string) => string;
5
+ export declare const getPdfAssertPath: (fileName: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/generator",
3
- "version": "3.0.1-dev.2",
3
+ "version": "3.0.1-dev.21",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
@@ -21,13 +21,15 @@
21
21
  "bugs": {
22
22
  "url": "https://github.com/pdfme/pdfme/issues"
23
23
  },
24
+ "type": "module",
24
25
  "main": "dist/cjs/src/index.js",
25
26
  "module": "dist/esm/src/index.js",
26
27
  "types": "dist/types/src/index.d.ts",
27
28
  "exports": {
28
29
  ".": {
29
30
  "import": "./dist/esm/src/index.js",
30
- "require": "./dist/cjs/src/index.js"
31
+ "require": "./dist/cjs/src/index.js",
32
+ "types": "./dist/types/src/index.d.ts"
31
33
  }
32
34
  },
33
35
  "engines": {
@@ -35,7 +37,7 @@
35
37
  },
36
38
  "scripts": {
37
39
  "develop": "tsc -w",
38
- "build": "npm run build:cjs && npm run build:esm",
40
+ "build": "npm-run-all --parallel build:cjs build:esm",
39
41
  "build:cjs": "tsc -p tsconfig.cjs.json",
40
42
  "build:esm": "tsc -p tsconfig.esm.json",
41
43
  "clean": "rimraf dist",
@@ -62,6 +64,7 @@
62
64
  },
63
65
  "jest": {
64
66
  "resolver": "ts-jest-resolver",
67
+ "globalTeardown": "<rootDir>/teardown.js",
65
68
  "moduleFileExtensions": [
66
69
  "js",
67
70
  "ts"
package/src/generate.ts CHANGED
@@ -3,8 +3,8 @@ import * as fontkit from 'fontkit';
3
3
  import type { GenerateProps, Template } from '@pdfme/common';
4
4
  import { checkGenerateProps } from '@pdfme/common';
5
5
  import { builtInPlugins } from '@pdfme/schemas';
6
- import { drawEmbeddedPage, getEmbeddedPagesAndEmbedPdfBoxes } from './pdfUtils';
7
- import { TOOL_NAME } from './constants';
6
+ import { drawEmbeddedPage, getEmbeddedPagesAndEmbedPdfBoxes } from './pdfUtils.js';
7
+ import { TOOL_NAME } from './constants.js';
8
8
 
9
9
  const preprocessing = async ({ template }: { template: Template }) => {
10
10
  const { basePdf } = template;
package/teardown.js ADDED
@@ -0,0 +1,17 @@
1
+ import path from 'path';
2
+ import { readdir, unlink } from 'fs/promises';
3
+
4
+ export default async () => {
5
+ const dir = path.join(path.dirname(''), '__tests__/assets/pdfs/tmp');
6
+ const files = await readdir(dir);
7
+
8
+ for (const file of files) {
9
+ if (file !== '.gitkeep') {
10
+ try {
11
+ await unlink(`${dir}/${file}`);
12
+ } catch (e) {
13
+ throw e;
14
+ }
15
+ }
16
+ }
17
+ };