@pdfme/common 5.5.9 → 5.5.10-dev.125
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 +29 -54
- package/set-version.js +9 -4
- package/src/dynamicTemplate.ts +3 -1
- package/src/expression.ts +14 -5
- package/src/helper.ts +66 -3
- package/src/index.ts +2 -0
- package/src/types.ts +9 -10
- package/src/version.ts +1 -1
- package/tsconfig.build.json +14 -0
- package/tsconfig.json +14 -4
- package/vite.config.mts +33 -0
- package/dist/cjs/__tests__/dynamicTemplate.test.js +0 -337
- package/dist/cjs/__tests__/dynamicTemplate.test.js.map +0 -1
- package/dist/cjs/__tests__/expression.test.js +0 -474
- package/dist/cjs/__tests__/expression.test.js.map +0 -1
- package/dist/cjs/__tests__/helper.test.js +0 -647
- package/dist/cjs/__tests__/helper.test.js.map +0 -1
- package/dist/cjs/__tests__/pluginRegistry.test.js +0 -83
- package/dist/cjs/__tests__/pluginRegistry.test.js.map +0 -1
- package/dist/cjs/src/constants.js +0 -27
- package/dist/cjs/src/constants.js.map +0 -1
- package/dist/cjs/src/dynamicTemplate.js +0 -228
- package/dist/cjs/src/dynamicTemplate.js.map +0 -1
- package/dist/cjs/src/expression.js +0 -463
- package/dist/cjs/src/expression.js.map +0 -1
- package/dist/cjs/src/helper.js +0 -217
- package/dist/cjs/src/helper.js.map +0 -1
- package/dist/cjs/src/index.js +0 -42
- package/dist/cjs/src/index.js.map +0 -1
- package/dist/cjs/src/pluginRegistry.js +0 -33
- package/dist/cjs/src/pluginRegistry.js.map +0 -1
- package/dist/cjs/src/schema.js +0 -190
- package/dist/cjs/src/schema.js.map +0 -1
- package/dist/cjs/src/types.js +0 -3
- package/dist/cjs/src/types.js.map +0 -1
- package/dist/cjs/src/version.js +0 -5
- package/dist/cjs/src/version.js.map +0 -1
- package/dist/esm/__tests__/dynamicTemplate.test.js +0 -302
- package/dist/esm/__tests__/dynamicTemplate.test.js.map +0 -1
- package/dist/esm/__tests__/expression.test.js +0 -472
- package/dist/esm/__tests__/expression.test.js.map +0 -1
- package/dist/esm/__tests__/helper.test.js +0 -612
- package/dist/esm/__tests__/helper.test.js.map +0 -1
- package/dist/esm/__tests__/pluginRegistry.test.js +0 -81
- package/dist/esm/__tests__/pluginRegistry.test.js.map +0 -1
- package/dist/esm/src/constants.js +0 -24
- package/dist/esm/src/constants.js.map +0 -1
- package/dist/esm/src/dynamicTemplate.js +0 -224
- package/dist/esm/src/dynamicTemplate.js.map +0 -1
- package/dist/esm/src/expression.js +0 -426
- package/dist/esm/src/expression.js.map +0 -1
- package/dist/esm/src/helper.js +0 -193
- package/dist/esm/src/helper.js.map +0 -1
- package/dist/esm/src/index.js +0 -8
- package/dist/esm/src/index.js.map +0 -1
- package/dist/esm/src/pluginRegistry.js +0 -29
- package/dist/esm/src/pluginRegistry.js.map +0 -1
- package/dist/esm/src/schema.js +0 -187
- package/dist/esm/src/schema.js.map +0 -1
- package/dist/esm/src/types.js +0 -2
- package/dist/esm/src/types.js.map +0 -1
- package/dist/esm/src/version.js +0 -2
- package/dist/esm/src/version.js.map +0 -1
- package/dist/node/__tests__/dynamicTemplate.test.js +0 -337
- package/dist/node/__tests__/dynamicTemplate.test.js.map +0 -1
- package/dist/node/__tests__/expression.test.js +0 -474
- package/dist/node/__tests__/expression.test.js.map +0 -1
- package/dist/node/__tests__/helper.test.js +0 -647
- package/dist/node/__tests__/helper.test.js.map +0 -1
- package/dist/node/__tests__/pluginRegistry.test.js +0 -83
- package/dist/node/__tests__/pluginRegistry.test.js.map +0 -1
- package/dist/node/src/constants.js +0 -27
- package/dist/node/src/constants.js.map +0 -1
- package/dist/node/src/dynamicTemplate.js +0 -228
- package/dist/node/src/dynamicTemplate.js.map +0 -1
- package/dist/node/src/expression.js +0 -463
- package/dist/node/src/expression.js.map +0 -1
- package/dist/node/src/helper.js +0 -217
- package/dist/node/src/helper.js.map +0 -1
- package/dist/node/src/index.js +0 -42
- package/dist/node/src/index.js.map +0 -1
- package/dist/node/src/pluginRegistry.js +0 -33
- package/dist/node/src/pluginRegistry.js.map +0 -1
- package/dist/node/src/schema.js +0 -190
- package/dist/node/src/schema.js.map +0 -1
- package/dist/node/src/types.js +0 -3
- package/dist/node/src/types.js.map +0 -1
- package/dist/node/src/version.js +0 -5
- package/dist/node/src/version.js.map +0 -1
- package/dist/types/__tests__/dynamicTemplate.test.d.ts +0 -1
- package/dist/types/__tests__/expression.test.d.ts +0 -1
- package/dist/types/__tests__/helper.test.d.ts +0 -1
- package/dist/types/__tests__/pluginRegistry.test.d.ts +0 -1
- package/dist/types/src/constants.d.ts +0 -20
- package/dist/types/src/dynamicTemplate.d.ts +0 -27
- package/dist/types/src/expression.d.ts +0 -6
- package/dist/types/src/helper.d.ts +0 -35
- package/dist/types/src/index.d.ts +0 -9
- package/dist/types/src/pluginRegistry.d.ts +0 -5
- package/dist/types/src/schema.d.ts +0 -820
- package/dist/types/src/types.d.ts +0 -181
- package/dist/types/src/version.d.ts +0 -1
- package/eslint.config.mjs +0 -22
- package/tsconfig.cjs.json +0 -10
- package/tsconfig.esm.json +0 -11
- package/tsconfig.node.json +0 -11
package/package.json
CHANGED
|
@@ -1,51 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdfme/common",
|
|
3
|
-
"version": "5.5.
|
|
4
|
-
"
|
|
5
|
-
"author": "hand-dot",
|
|
6
|
-
"license": "MIT",
|
|
3
|
+
"version": "5.5.10-dev.125",
|
|
4
|
+
"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
5
|
"keywords": [
|
|
8
6
|
"pdf",
|
|
9
|
-
"pdf-generation",
|
|
10
7
|
"pdf-designer",
|
|
8
|
+
"pdf-generation",
|
|
11
9
|
"pdf-viewer",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
10
|
+
"react",
|
|
11
|
+
"typescript"
|
|
14
12
|
],
|
|
15
|
-
"description": "TypeScript base PDF generator and React base UI. Open source, developed by the community, and completely free to use under the MIT license!",
|
|
16
13
|
"homepage": "https://pdfme.com",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/pdfme/pdfme/issues"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "hand-dot",
|
|
17
19
|
"repository": {
|
|
18
20
|
"type": "git",
|
|
19
21
|
"url": "git@github.com:pdfme/pdfme.git"
|
|
20
22
|
},
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"types": "dist/types/src/index.d.ts",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"main": "./dist/index.js",
|
|
26
|
+
"module": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
27
28
|
"exports": {
|
|
28
29
|
".": {
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
"require": "./dist/cjs/src/index.js",
|
|
34
|
-
"types": "./dist/types/src/index.d.ts"
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js",
|
|
32
|
+
"default": "./dist/index.js"
|
|
35
33
|
}
|
|
36
34
|
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
37
38
|
"scripts": {
|
|
38
|
-
"dev": "node set-version.js &&
|
|
39
|
-
"
|
|
40
|
-
"build": "run-p build:cjs build:esm build:node",
|
|
41
|
-
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
42
|
-
"build:esm": "tsc -p tsconfig.esm.json",
|
|
43
|
-
"build:node": "tsc -p tsconfig.node.json",
|
|
39
|
+
"dev": "node set-version.js && vite build --watch",
|
|
40
|
+
"build": "node set-version.js && vite build && tsc -p tsconfig.build.json",
|
|
44
41
|
"clean": "rimraf dist",
|
|
45
|
-
"lint": "
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"prettier": "prettier --write 'src/**/*.ts'"
|
|
42
|
+
"lint": "vp lint -c ../../.oxlintrc.json src",
|
|
43
|
+
"fmt": "vp fmt -c ../../.oxfmtrc.json src --write",
|
|
44
|
+
"test": "vitest run --config ../../vitest.config.ts"
|
|
49
45
|
},
|
|
50
46
|
"dependencies": {
|
|
51
47
|
"@pdfme/pdf-lib": "*",
|
|
@@ -53,32 +49,11 @@
|
|
|
53
49
|
"buffer": "^6.0.3",
|
|
54
50
|
"zod": "^4.3.6"
|
|
55
51
|
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/estree": "^1.0.6"
|
|
54
|
+
},
|
|
56
55
|
"peerDependencies": {
|
|
57
56
|
"antd": "^5.11.2",
|
|
58
57
|
"form-render": "^2.2.20"
|
|
59
|
-
},
|
|
60
|
-
"jest": {
|
|
61
|
-
"resolver": "ts-jest-resolver",
|
|
62
|
-
"moduleFileExtensions": [
|
|
63
|
-
"js",
|
|
64
|
-
"ts"
|
|
65
|
-
],
|
|
66
|
-
"transform": {
|
|
67
|
-
"^.+\\.ts?$": [
|
|
68
|
-
"ts-jest",
|
|
69
|
-
{
|
|
70
|
-
"tsconfig": "tsconfig.esm.json"
|
|
71
|
-
}
|
|
72
|
-
]
|
|
73
|
-
},
|
|
74
|
-
"testMatch": [
|
|
75
|
-
"**/*.test.ts"
|
|
76
|
-
]
|
|
77
|
-
},
|
|
78
|
-
"publishConfig": {
|
|
79
|
-
"access": "public"
|
|
80
|
-
},
|
|
81
|
-
"devDependencies": {
|
|
82
|
-
"@types/estree": "^1.0.6"
|
|
83
58
|
}
|
|
84
59
|
}
|
package/set-version.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { execSync } from 'node:child_process';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
4
7
|
|
|
5
8
|
const updateVersion = (version) => {
|
|
6
9
|
const filePath = path.join(__dirname, 'src/version.ts');
|
|
@@ -23,7 +26,9 @@ const updateVersion = (version) => {
|
|
|
23
26
|
};
|
|
24
27
|
|
|
25
28
|
try {
|
|
26
|
-
const gitTag = execSync('git describe --tags $(git rev-list --tags --max-count=1)', {
|
|
29
|
+
const gitTag = execSync('git describe --tags $(git rev-list --tags --max-count=1)', {
|
|
30
|
+
encoding: 'utf8',
|
|
31
|
+
}).trim();
|
|
27
32
|
updateVersion(gitTag);
|
|
28
33
|
} catch (error) {
|
|
29
34
|
console.error('Error replacing PDFME_VERSION:', error);
|
package/src/dynamicTemplate.ts
CHANGED
|
@@ -47,7 +47,9 @@ function normalizePageSchemas(
|
|
|
47
47
|
const orderMap = new Map<string, number>();
|
|
48
48
|
|
|
49
49
|
pageSchemas.forEach((schema, index) => {
|
|
50
|
-
|
|
50
|
+
// Guard against negative Y position when schema.y < paddingTop
|
|
51
|
+
// Prevents "Cannot read properties of undefined (reading 'push')" error
|
|
52
|
+
const localY = Math.max(0, schema.position.y - paddingTop);
|
|
51
53
|
items.push({
|
|
52
54
|
schema: cloneDeep(schema),
|
|
53
55
|
baseY: localY,
|
package/src/expression.ts
CHANGED
|
@@ -45,9 +45,9 @@ const safeAssign = (
|
|
|
45
45
|
if (target == null) {
|
|
46
46
|
throw new TypeError('Cannot convert undefined or null to object');
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
const to = { ...target };
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
for (const source of sources) {
|
|
52
52
|
if (source != null) {
|
|
53
53
|
for (const key in source) {
|
|
@@ -62,7 +62,7 @@ const safeAssign = (
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
|
|
66
66
|
return to;
|
|
67
67
|
};
|
|
68
68
|
|
|
@@ -134,7 +134,11 @@ const validateAST = (node: AcornNode): void => {
|
|
|
134
134
|
throw new Error('Access to prohibited property');
|
|
135
135
|
}
|
|
136
136
|
// Block prototype pollution methods
|
|
137
|
-
if (
|
|
137
|
+
if (
|
|
138
|
+
['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__'].includes(
|
|
139
|
+
propName,
|
|
140
|
+
)
|
|
141
|
+
) {
|
|
138
142
|
throw new Error(`Access to prohibited method: ${propName}`);
|
|
139
143
|
}
|
|
140
144
|
const prohibitedMethods = ['toLocaleString', 'valueOf'];
|
|
@@ -283,7 +287,12 @@ const evaluateAST = (node: AcornNode, context: Record<string, unknown>): unknown
|
|
|
283
287
|
throw new Error('Access to prohibited property');
|
|
284
288
|
}
|
|
285
289
|
// Block prototype pollution methods
|
|
286
|
-
if (
|
|
290
|
+
if (
|
|
291
|
+
typeof prop === 'string' &&
|
|
292
|
+
['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__'].includes(
|
|
293
|
+
prop,
|
|
294
|
+
)
|
|
295
|
+
) {
|
|
287
296
|
throw new Error(`Access to prohibited method: ${prop}`);
|
|
288
297
|
}
|
|
289
298
|
return obj[prop];
|
package/src/helper.ts
CHANGED
|
@@ -35,7 +35,10 @@ const uniq = <T>(array: Array<T>) => Array.from(new Set(array));
|
|
|
35
35
|
export const getFallbackFontName = (font: Font) => {
|
|
36
36
|
const initial = '';
|
|
37
37
|
const fallbackFontName = Object.entries(font).reduce((acc, cur) => {
|
|
38
|
-
const [fontName, fontValue] = cur as [
|
|
38
|
+
const [fontName, fontValue] = cur as [
|
|
39
|
+
string,
|
|
40
|
+
{ data: string | ArrayBuffer | Uint8Array; fallback?: boolean; subset?: boolean },
|
|
41
|
+
];
|
|
39
42
|
|
|
40
43
|
return !acc && fontValue.fallback ? fontName : acc;
|
|
41
44
|
}, initial);
|
|
@@ -127,6 +130,58 @@ export const getInputFromTemplate = (template: Template): { [key: string]: strin
|
|
|
127
130
|
return [input];
|
|
128
131
|
};
|
|
129
132
|
|
|
133
|
+
export const isUrlSafeToFetch = (urlString: string): boolean => {
|
|
134
|
+
let parsed: URL;
|
|
135
|
+
try {
|
|
136
|
+
parsed = new URL(urlString);
|
|
137
|
+
} catch {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const hostname = parsed.hostname.toLowerCase();
|
|
146
|
+
|
|
147
|
+
if (
|
|
148
|
+
hostname === 'localhost' ||
|
|
149
|
+
hostname === '0.0.0.0' ||
|
|
150
|
+
hostname === '[::1]' ||
|
|
151
|
+
hostname === '::1'
|
|
152
|
+
) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Block IPv6 private ranges (link-local, unique-local, IPv4-mapped)
|
|
157
|
+
const bare = hostname.replace(/^\[|\]$/g, '');
|
|
158
|
+
if (/^fe80:/i.test(bare)) return false;
|
|
159
|
+
if (/^f[cd]/i.test(bare)) return false;
|
|
160
|
+
const ipv4MappedMatch = bare.match(/^::ffff:(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/i);
|
|
161
|
+
if (ipv4MappedMatch) {
|
|
162
|
+
const a = Number(ipv4MappedMatch[1]);
|
|
163
|
+
const b = Number(ipv4MappedMatch[2]);
|
|
164
|
+
if (a === 0 || a === 10 || a === 127) return false;
|
|
165
|
+
if (a === 169 && b === 254) return false;
|
|
166
|
+
if (a === 172 && b >= 16 && b <= 31) return false;
|
|
167
|
+
if (a === 192 && b === 168) return false;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const ipv4Match = hostname.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
|
|
171
|
+
if (ipv4Match) {
|
|
172
|
+
const a = Number(ipv4Match[1]);
|
|
173
|
+
const b = Number(ipv4Match[2]);
|
|
174
|
+
if (a === 0) return false;
|
|
175
|
+
if (a === 10) return false;
|
|
176
|
+
if (a === 127) return false;
|
|
177
|
+
if (a === 169 && b === 254) return false;
|
|
178
|
+
if (a === 172 && b >= 16 && b <= 31) return false;
|
|
179
|
+
if (a === 192 && b === 168) return false;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return true;
|
|
183
|
+
};
|
|
184
|
+
|
|
130
185
|
export const getB64BasePdf = async (
|
|
131
186
|
customPdf: ArrayBuffer | Uint8Array | string,
|
|
132
187
|
): Promise<string> => {
|
|
@@ -135,6 +190,11 @@ export const getB64BasePdf = async (
|
|
|
135
190
|
!customPdf.startsWith('data:application/pdf;') &&
|
|
136
191
|
typeof window !== 'undefined'
|
|
137
192
|
) {
|
|
193
|
+
if (!isUrlSafeToFetch(customPdf)) {
|
|
194
|
+
throw Error(
|
|
195
|
+
'[@pdfme/common] Invalid or unsafe URL for basePdf. Only http: and https: URLs pointing to public hosts are allowed.',
|
|
196
|
+
);
|
|
197
|
+
}
|
|
138
198
|
const response = await fetch(customPdf);
|
|
139
199
|
const blob = await response.blob();
|
|
140
200
|
return blob2Base64Pdf(blob);
|
|
@@ -179,7 +239,10 @@ export const checkFont = (arg: { font: Font; template: Template }) => {
|
|
|
179
239
|
template: { schemas },
|
|
180
240
|
} = arg;
|
|
181
241
|
const fontValues = Object.values(font);
|
|
182
|
-
const fallbackFontNum = fontValues.reduce(
|
|
242
|
+
const fallbackFontNum = fontValues.reduce(
|
|
243
|
+
(acc, cur) => (cur.fallback ? acc + 1 : acc),
|
|
244
|
+
0 as number,
|
|
245
|
+
);
|
|
183
246
|
if (fallbackFontNum === 0) {
|
|
184
247
|
throw Error(
|
|
185
248
|
`[@pdfme/common] fallback flag is not found in font. true fallback flag must be only one.
|
|
@@ -213,7 +276,7 @@ export const checkPlugins = (arg: { plugins: Plugins; template: Template }) => {
|
|
|
213
276
|
const allSchemaTypes = uniq(schemas.map((p) => p.map((v) => v.type)).flat());
|
|
214
277
|
|
|
215
278
|
const pluginsSchemaTypes = Object.values(plugins).map((p) =>
|
|
216
|
-
p ?
|
|
279
|
+
p ? p.propPanel.defaultSchema.type : undefined,
|
|
217
280
|
);
|
|
218
281
|
|
|
219
282
|
if (allSchemaTypes.some((s) => !pluginsSchemaTypes.includes(s))) {
|
package/src/index.ts
CHANGED
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
isHexValid,
|
|
63
63
|
getInputFromTemplate,
|
|
64
64
|
isBlankPdf,
|
|
65
|
+
isUrlSafeToFetch,
|
|
65
66
|
} from './helper.js';
|
|
66
67
|
import { getDynamicTemplate } from './dynamicTemplate.js';
|
|
67
68
|
import { replacePlaceholders } from './expression.js';
|
|
@@ -100,6 +101,7 @@ export {
|
|
|
100
101
|
checkDesignerProps,
|
|
101
102
|
checkGenerateProps,
|
|
102
103
|
pluginRegistry,
|
|
104
|
+
isUrlSafeToFetch,
|
|
103
105
|
};
|
|
104
106
|
|
|
105
107
|
export type {
|
package/src/types.ts
CHANGED
|
@@ -147,16 +147,15 @@ export interface PropPanel<T extends Schema> {
|
|
|
147
147
|
* @property {string} [icon] Icon SVG for the plugin.
|
|
148
148
|
* @property {boolean} [uninterruptedEditMode] When editing in the UI, should the field avoid re-rendering while in edit mode?
|
|
149
149
|
*/
|
|
150
|
-
export
|
|
151
|
-
pdf
|
|
152
|
-
ui
|
|
150
|
+
export interface Plugin<T extends Schema = Schema> {
|
|
151
|
+
pdf(arg: PDFRenderProps<T & Schema>): Promise<void> | void;
|
|
152
|
+
ui(arg: UIRenderProps<T & Schema>): Promise<void> | void;
|
|
153
153
|
propPanel: PropPanel<T & Schema>;
|
|
154
154
|
icon?: string;
|
|
155
155
|
uninterruptedEditMode?: boolean;
|
|
156
|
-
}
|
|
156
|
+
}
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
export type Plugins = { [key: string]: Plugin<any> };
|
|
158
|
+
export type Plugins = { [key: string]: Plugin };
|
|
160
159
|
|
|
161
160
|
export interface PluginRegistry {
|
|
162
161
|
plugins: { [key: string]: Plugin };
|
|
@@ -189,10 +188,10 @@ export type CustomPdf = z.infer<typeof CustomPdf>;
|
|
|
189
188
|
export type Template = z.infer<typeof Template>;
|
|
190
189
|
export type CommonOptions = z.infer<typeof CommonOptions>;
|
|
191
190
|
export type GeneratorOptions = z.infer<typeof GeneratorOptions>;
|
|
192
|
-
export type GenerateProps = z.infer<typeof GenerateProps> & { plugins?: Plugins };
|
|
191
|
+
export type GenerateProps = Omit<z.infer<typeof GenerateProps>, 'plugins'> & { plugins?: Plugins };
|
|
193
192
|
export type UIOptions = z.infer<typeof UIOptions> & { theme?: ThemeConfig };
|
|
194
|
-
export type UIProps = z.infer<typeof UIProps> & { plugins?: Plugins };
|
|
195
|
-
export type PreviewProps = z.infer<typeof PreviewProps> & { plugins?: Plugins };
|
|
196
|
-
export type DesignerProps = z.infer<typeof DesignerProps> & { plugins?: Plugins };
|
|
193
|
+
export type UIProps = Omit<z.infer<typeof UIProps>, 'plugins'> & { plugins?: Plugins };
|
|
194
|
+
export type PreviewProps = Omit<z.infer<typeof PreviewProps>, 'plugins'> & { plugins?: Plugins };
|
|
195
|
+
export type DesignerProps = Omit<z.infer<typeof DesignerProps>, 'plugins'> & { plugins?: Plugins };
|
|
197
196
|
export type SchemaPageArray = z.infer<typeof SchemaPageArray>;
|
|
198
197
|
export type LegacySchemaPageArray = z.infer<typeof LegacySchemaPageArray>;
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PDFME_VERSION = '5.5.
|
|
1
|
+
export const PDFME_VERSION = '5.5.10';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.build.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"declarationDir": "./dist",
|
|
6
|
+
"emitDeclarationOnly": true,
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"outDir": "./dist",
|
|
10
|
+
"rootDir": "./src",
|
|
11
|
+
"skipLibCheck": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src/**/*.ts"]
|
|
14
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
"composite": true,
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"declarationDir": "./dist/typecheck",
|
|
7
|
+
"emitDeclarationOnly": true,
|
|
8
|
+
"module": "ESNext",
|
|
9
|
+
"moduleResolution": "bundler",
|
|
10
|
+
"outDir": "./dist/typecheck",
|
|
11
|
+
"tsBuildInfoFile": "./dist/typecheck/tsconfig.tsbuildinfo",
|
|
12
|
+
"skipLibCheck": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["src/**/*.ts"],
|
|
15
|
+
"references": [{ "path": "../pdf-lib" }]
|
|
16
|
+
}
|
package/vite.config.mts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { builtinModules } from 'node:module';
|
|
3
|
+
import { dirname, resolve } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { defineConfig } from 'vite';
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const packageJson = JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf8')) as {
|
|
9
|
+
dependencies?: Record<string, string>;
|
|
10
|
+
peerDependencies?: Record<string, string>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const external = [
|
|
14
|
+
...builtinModules,
|
|
15
|
+
...builtinModules.map((moduleName) => `node:${moduleName}`),
|
|
16
|
+
...Object.keys(packageJson.dependencies ?? {}),
|
|
17
|
+
...Object.keys(packageJson.peerDependencies ?? {}),
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
export default defineConfig({
|
|
21
|
+
build: {
|
|
22
|
+
lib: {
|
|
23
|
+
entry: resolve(__dirname, 'src/index.ts'),
|
|
24
|
+
fileName: 'index',
|
|
25
|
+
formats: ['es'],
|
|
26
|
+
},
|
|
27
|
+
minify: false,
|
|
28
|
+
outDir: 'dist',
|
|
29
|
+
rollupOptions: { external },
|
|
30
|
+
sourcemap: true,
|
|
31
|
+
target: 'es2020',
|
|
32
|
+
},
|
|
33
|
+
});
|