@pdfme/common 1.0.0-beta.5 → 1.0.0-beta.9

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/package.json CHANGED
@@ -1,22 +1,25 @@
1
1
  {
2
2
  "name": "@pdfme/common",
3
- "version": "1.0.0-beta.5",
3
+ "version": "1.0.0-beta.9",
4
4
  "author": "hand-dot",
5
5
  "license": "MIT",
6
6
  "description": "TypeScript base PDF generator and React base UI. Open source, developed by the community, and completely free to use under the MIT license!",
7
7
  "homepage": "https://pdfme.com",
8
- "repository": "git@github.com:pdfme/pdfme.git",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git@github.com:pdfme/pdfme.git"
11
+ },
9
12
  "bugs": {
10
13
  "url": "https://github.com/pdfme/pdfme/issues"
11
14
  },
12
15
  "main": "dist/index.js",
13
- "module": "src/index.ts",
16
+ "module": "dist/index.js",
14
17
  "types": "dist/types/index.d.ts",
15
18
  "engines": {
16
19
  "node": ">=14"
17
20
  },
18
21
  "scripts": {
19
- "develop": "webpack-dev-server --mode development",
22
+ "develop": "webpack --watch --mode development",
20
23
  "build": "NODE_ENV=production webpack --mode production",
21
24
  "clean": "rimraf dist",
22
25
  "lint": "tsc --noEmit",
@@ -50,6 +53,5 @@
50
53
  },
51
54
  "publishConfig": {
52
55
  "access": "public"
53
- },
54
- "stableVersion": "1.0.0-beta.4"
55
- }
56
+ }
57
+ }
package/src/helper.ts CHANGED
@@ -40,13 +40,18 @@ export const getB64BasePdf = (basePdf: BasePdf) => {
40
40
  return basePdf as string;
41
41
  };
42
42
 
43
+ const getByteString = (base64: string) => {
44
+ if (typeof window !== 'undefined' && window.atob) {
45
+ return window.atob(base64);
46
+ } else {
47
+ return Buffer.from(base64, 'base64').toString('binary');
48
+ }
49
+ };
50
+
43
51
  export const b64toUint8Array = (base64: string) => {
44
52
  const data = base64.split(';base64,')[1] ? base64.split(';base64,')[1] : base64;
45
53
 
46
- const byteString =
47
- typeof window !== 'undefined'
48
- ? window.atob(data)
49
- : Buffer.from(data, 'base64').toString('binary');
54
+ const byteString = getByteString(data);
50
55
 
51
56
  const unit8arr = new Uint8Array(byteString.length);
52
57
  for (let i = 0; i < byteString.length; i += 1) {
package/src/schema.ts CHANGED
@@ -37,10 +37,8 @@ export const TextSchema = CommonSchema.extend({
37
37
  });
38
38
 
39
39
  export const ImageSchema = CommonSchema.extend({ type: z.literal(SchemaType.Enum.image) });
40
- type ImageSchema = z.infer<typeof ImageSchema>;
41
40
 
42
41
  export const BarcodeSchema = CommonSchema.extend({ type: BarcodeSchemaType });
43
- type BarcodeSchema = z.infer<typeof BarcodeSchema>;
44
42
 
45
43
  export const Schema = z.union([TextSchema, ImageSchema, BarcodeSchema]);
46
44
 
package/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "noImplicitAny": true,
4
- "target": "es5",
4
+ "target": "ES2015",
5
5
  "esModuleInterop": true,
6
6
  "isolatedModules": true,
7
7
  "declaration": true,
package/webpack.config.js CHANGED
@@ -35,7 +35,6 @@ const config = {
35
35
  filename: 'index.js',
36
36
  globalObject: 'this',
37
37
  library: {
38
- name: pkg.name,
39
38
  type: 'umd',
40
39
  },
41
40
  },