template-replacement 3.5.2 → 3.5.3
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/main/general.js +35 -28
- package/dist/main/sign.js +37 -30
- package/package.json +2 -2
- package/replace/image.ts +9 -2
- package/replace/paramsData.ts +2 -2
package/dist/main/general.js
CHANGED
|
@@ -1761,22 +1761,22 @@ x.getAdapter = fg.getAdapter;
|
|
|
1761
1761
|
x.HttpStatusCode = hB;
|
|
1762
1762
|
x.default = x;
|
|
1763
1763
|
const {
|
|
1764
|
-
Axios:
|
|
1765
|
-
AxiosError:
|
|
1766
|
-
CanceledError:
|
|
1767
|
-
isCancel:
|
|
1768
|
-
CancelToken:
|
|
1769
|
-
VERSION:
|
|
1770
|
-
all:
|
|
1771
|
-
Cancel:
|
|
1772
|
-
isAxiosError:
|
|
1773
|
-
spread:
|
|
1774
|
-
toFormData:
|
|
1775
|
-
AxiosHeaders:
|
|
1776
|
-
HttpStatusCode:
|
|
1777
|
-
formToJSON:
|
|
1778
|
-
getAdapter:
|
|
1779
|
-
mergeConfig:
|
|
1764
|
+
Axios: BE,
|
|
1765
|
+
AxiosError: gE,
|
|
1766
|
+
CanceledError: QE,
|
|
1767
|
+
isCancel: IE,
|
|
1768
|
+
CancelToken: CE,
|
|
1769
|
+
VERSION: EE,
|
|
1770
|
+
all: DE,
|
|
1771
|
+
Cancel: wE,
|
|
1772
|
+
isAxiosError: iE,
|
|
1773
|
+
spread: oE,
|
|
1774
|
+
toFormData: GE,
|
|
1775
|
+
AxiosHeaders: NE,
|
|
1776
|
+
HttpStatusCode: ME,
|
|
1777
|
+
formToJSON: FE,
|
|
1778
|
+
getAdapter: cE,
|
|
1779
|
+
mergeConfig: kE
|
|
1780
1780
|
} = x;
|
|
1781
1781
|
let DB;
|
|
1782
1782
|
async function Ag() {
|
|
@@ -5015,16 +5015,23 @@ function Mg(B) {
|
|
|
5015
5015
|
function Fg(B) {
|
|
5016
5016
|
return B * 914400;
|
|
5017
5017
|
}
|
|
5018
|
+
function jC(B) {
|
|
5019
|
+
const A = B.split(".").pop();
|
|
5020
|
+
return A === void 0 ? "" : "." + A;
|
|
5021
|
+
}
|
|
5018
5022
|
const cg = /* @__PURE__ */ new Set([
|
|
5019
5023
|
"file",
|
|
5020
5024
|
"id",
|
|
5025
|
+
"suffix",
|
|
5021
5026
|
"wpExtent",
|
|
5022
5027
|
"textWrap",
|
|
5023
5028
|
"relationship"
|
|
5024
5029
|
]);
|
|
5025
5030
|
class RA {
|
|
5026
5031
|
constructor(A) {
|
|
5027
|
-
if (this.relationship = "image", this.textWrap = "Embed", this._awaitInitQueue = [], A instanceof
|
|
5032
|
+
if (this.relationship = "image", this.textWrap = "Embed", this._awaitInitQueue = [], A instanceof File)
|
|
5033
|
+
this.file = A, this.suffix = jC(A.name), this.init();
|
|
5034
|
+
else if (A instanceof Blob)
|
|
5028
5035
|
this.file = A, this.init();
|
|
5029
5036
|
else
|
|
5030
5037
|
throw new Error("不支持的数据类型");
|
|
@@ -5100,7 +5107,7 @@ class kg {
|
|
|
5100
5107
|
Image: {
|
|
5101
5108
|
index: o,
|
|
5102
5109
|
id: i,
|
|
5103
|
-
suffix: "",
|
|
5110
|
+
suffix: D.suffix ?? "",
|
|
5104
5111
|
wp_extent: D.wpExtent ?? { cx: 0, cy: 0 },
|
|
5105
5112
|
text_wrap: D.textWrap
|
|
5106
5113
|
}
|
|
@@ -5126,7 +5133,7 @@ class kg {
|
|
|
5126
5133
|
Image: {
|
|
5127
5134
|
index: o,
|
|
5128
5135
|
id: i,
|
|
5129
|
-
suffix: "",
|
|
5136
|
+
suffix: D.suffix ?? "",
|
|
5130
5137
|
wp_extent: D.wpExtent ?? { cx: 0, cy: 0 },
|
|
5131
5138
|
text_wrap: D.textWrap
|
|
5132
5139
|
}
|
|
@@ -5150,10 +5157,10 @@ class kg {
|
|
|
5150
5157
|
function JA(B) {
|
|
5151
5158
|
if (!B.uint8Array || !B.name)
|
|
5152
5159
|
throw new Error("模板文件信息错误");
|
|
5153
|
-
const A = new
|
|
5160
|
+
const A = new VC(void 0, void 0, B.uint8Array, B.name);
|
|
5154
5161
|
return A.isDecode = B.isDecode, A;
|
|
5155
5162
|
}
|
|
5156
|
-
class
|
|
5163
|
+
class VC {
|
|
5157
5164
|
constructor(A, g, Q, I) {
|
|
5158
5165
|
if (this.name = "", this.status = 0, this.isDecode = !1, this.tempImages = {}, this._output = void 0, this._type = void 0, Q ? (this.uint8Array = Q, this.setStatus(
|
|
5159
5166
|
1
|
|
@@ -5220,7 +5227,7 @@ class jC {
|
|
|
5220
5227
|
};
|
|
5221
5228
|
}
|
|
5222
5229
|
}
|
|
5223
|
-
class
|
|
5230
|
+
class uC {
|
|
5224
5231
|
#A;
|
|
5225
5232
|
constructor(A) {
|
|
5226
5233
|
this.#A = A;
|
|
@@ -5305,7 +5312,7 @@ class VC {
|
|
|
5305
5312
|
}
|
|
5306
5313
|
}
|
|
5307
5314
|
var XA = /* @__PURE__ */ ((B) => (B[B.replace = 0] = "replace", B[B.replaceProgress = 1] = "replaceProgress", B[B.sign = 2] = "sign", B[B.signReply = 3] = "signReply", B[B.methodCall = 4] = "methodCall", B[B.methodCallReply = 5] = "methodCallReply", B))(XA || {});
|
|
5308
|
-
const
|
|
5315
|
+
const zC = /* @__PURE__ */ new Set(["addTempFile", "extractVariables", "extractMedias", "execute", "filesEncrypt", "fileEncrypt", "executeMultipleParams"]), vC = /* @__PURE__ */ new Map([
|
|
5309
5316
|
["execute", (B, A = []) => {
|
|
5310
5317
|
for (const g in B) {
|
|
5311
5318
|
const Q = B[g];
|
|
@@ -5337,8 +5344,8 @@ const uC = /* @__PURE__ */ new Set(["addTempFile", "extractVariables", "extractM
|
|
|
5337
5344
|
}]
|
|
5338
5345
|
]), Rg = /* @__PURE__ */ new Map();
|
|
5339
5346
|
let UB;
|
|
5340
|
-
function
|
|
5341
|
-
UB = new
|
|
5347
|
+
function _C(B) {
|
|
5348
|
+
UB = new uC(B);
|
|
5342
5349
|
}
|
|
5343
5350
|
addEventListener("message", async (B) => {
|
|
5344
5351
|
const A = B.data;
|
|
@@ -5346,7 +5353,7 @@ addEventListener("message", async (B) => {
|
|
|
5346
5353
|
switch (A.type) {
|
|
5347
5354
|
case XA.methodCall:
|
|
5348
5355
|
const g = A.data, Q = g.method;
|
|
5349
|
-
if (!
|
|
5356
|
+
if (!zC.has(Q))
|
|
5350
5357
|
return;
|
|
5351
5358
|
const I = UB[Q];
|
|
5352
5359
|
if (!I)
|
|
@@ -5361,7 +5368,7 @@ addEventListener("message", async (B) => {
|
|
|
5361
5368
|
return;
|
|
5362
5369
|
const D = [];
|
|
5363
5370
|
if (C) {
|
|
5364
|
-
const w =
|
|
5371
|
+
const w = vC.get(Q);
|
|
5365
5372
|
w && w(C, D);
|
|
5366
5373
|
}
|
|
5367
5374
|
postMessage(
|
|
@@ -5386,7 +5393,7 @@ addEventListener("message", async (B) => {
|
|
|
5386
5393
|
o(A.data.result), Rg.delete(i);
|
|
5387
5394
|
}
|
|
5388
5395
|
});
|
|
5389
|
-
|
|
5396
|
+
_C(new XC());
|
|
5390
5397
|
`, Q = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", I], { type: "text/javascript;charset=utf-8" });
|
|
5391
5398
|
function E(B) {
|
|
5392
5399
|
let A;
|
package/dist/main/sign.js
CHANGED
|
@@ -1761,22 +1761,22 @@ x.getAdapter = PI.getAdapter;
|
|
|
1761
1761
|
x.HttpStatusCode = YB;
|
|
1762
1762
|
x.default = x;
|
|
1763
1763
|
const {
|
|
1764
|
-
Axios:
|
|
1765
|
-
AxiosError:
|
|
1766
|
-
CanceledError:
|
|
1767
|
-
isCancel:
|
|
1768
|
-
CancelToken:
|
|
1769
|
-
VERSION:
|
|
1770
|
-
all:
|
|
1771
|
-
Cancel:
|
|
1772
|
-
isAxiosError:
|
|
1773
|
-
spread:
|
|
1774
|
-
toFormData:
|
|
1775
|
-
AxiosHeaders:
|
|
1776
|
-
HttpStatusCode:
|
|
1777
|
-
formToJSON:
|
|
1778
|
-
getAdapter:
|
|
1779
|
-
mergeConfig:
|
|
1764
|
+
Axios: EE,
|
|
1765
|
+
AxiosError: DE,
|
|
1766
|
+
CanceledError: wE,
|
|
1767
|
+
isCancel: iE,
|
|
1768
|
+
CancelToken: oE,
|
|
1769
|
+
VERSION: GE,
|
|
1770
|
+
all: NE,
|
|
1771
|
+
Cancel: ME,
|
|
1772
|
+
isAxiosError: FE,
|
|
1773
|
+
spread: kE,
|
|
1774
|
+
toFormData: cE,
|
|
1775
|
+
AxiosHeaders: RE,
|
|
1776
|
+
HttpStatusCode: sE,
|
|
1777
|
+
formToJSON: hE,
|
|
1778
|
+
getAdapter: YE,
|
|
1779
|
+
mergeConfig: yE
|
|
1780
1780
|
} = x;
|
|
1781
1781
|
let iB;
|
|
1782
1782
|
async function gI() {
|
|
@@ -5039,16 +5039,23 @@ function cI(B) {
|
|
|
5039
5039
|
function RI(B) {
|
|
5040
5040
|
return B * 914400;
|
|
5041
5041
|
}
|
|
5042
|
+
function vC(B) {
|
|
5043
|
+
const A = B.split(".").pop();
|
|
5044
|
+
return A === void 0 ? "" : "." + A;
|
|
5045
|
+
}
|
|
5042
5046
|
const sI = /* @__PURE__ */ new Set([
|
|
5043
5047
|
"file",
|
|
5044
5048
|
"id",
|
|
5049
|
+
"suffix",
|
|
5045
5050
|
"wpExtent",
|
|
5046
5051
|
"textWrap",
|
|
5047
5052
|
"relationship"
|
|
5048
5053
|
]);
|
|
5049
5054
|
class RA {
|
|
5050
5055
|
constructor(A) {
|
|
5051
|
-
if (this.relationship = "image", this.textWrap = "Embed", this._awaitInitQueue = [], A instanceof
|
|
5056
|
+
if (this.relationship = "image", this.textWrap = "Embed", this._awaitInitQueue = [], A instanceof File)
|
|
5057
|
+
this.file = A, this.suffix = vC(A.name), this.init();
|
|
5058
|
+
else if (A instanceof Blob)
|
|
5052
5059
|
this.file = A, this.init();
|
|
5053
5060
|
else
|
|
5054
5061
|
throw new Error("不支持的数据类型");
|
|
@@ -5124,7 +5131,7 @@ class hI {
|
|
|
5124
5131
|
Image: {
|
|
5125
5132
|
index: o,
|
|
5126
5133
|
id: i,
|
|
5127
|
-
suffix: "",
|
|
5134
|
+
suffix: D.suffix ?? "",
|
|
5128
5135
|
wp_extent: D.wpExtent ?? { cx: 0, cy: 0 },
|
|
5129
5136
|
text_wrap: D.textWrap
|
|
5130
5137
|
}
|
|
@@ -5150,7 +5157,7 @@ class hI {
|
|
|
5150
5157
|
Image: {
|
|
5151
5158
|
index: o,
|
|
5152
5159
|
id: i,
|
|
5153
|
-
suffix: "",
|
|
5160
|
+
suffix: D.suffix ?? "",
|
|
5154
5161
|
wp_extent: D.wpExtent ?? { cx: 0, cy: 0 },
|
|
5155
5162
|
text_wrap: D.textWrap
|
|
5156
5163
|
}
|
|
@@ -5174,10 +5181,10 @@ class hI {
|
|
|
5174
5181
|
function KA(B) {
|
|
5175
5182
|
if (!B.uint8Array || !B.name)
|
|
5176
5183
|
throw new Error("模板文件信息错误");
|
|
5177
|
-
const A = new
|
|
5184
|
+
const A = new _C(void 0, void 0, B.uint8Array, B.name);
|
|
5178
5185
|
return A.isDecode = B.isDecode, A;
|
|
5179
5186
|
}
|
|
5180
|
-
class
|
|
5187
|
+
class _C {
|
|
5181
5188
|
constructor(A, I, g, Q) {
|
|
5182
5189
|
if (this.name = "", this.status = 0, this.isDecode = !1, this.tempImages = {}, this._output = void 0, this._type = void 0, g ? (this.uint8Array = g, this.setStatus(
|
|
5183
5190
|
1
|
|
@@ -5244,7 +5251,7 @@ class vC {
|
|
|
5244
5251
|
};
|
|
5245
5252
|
}
|
|
5246
5253
|
}
|
|
5247
|
-
class
|
|
5254
|
+
class $C {
|
|
5248
5255
|
#A;
|
|
5249
5256
|
constructor(A) {
|
|
5250
5257
|
this.#A = A;
|
|
@@ -5329,7 +5336,7 @@ class _C {
|
|
|
5329
5336
|
}
|
|
5330
5337
|
}
|
|
5331
5338
|
var eA = /* @__PURE__ */ ((B) => (B[B.replace = 0] = "replace", B[B.replaceProgress = 1] = "replaceProgress", B[B.sign = 2] = "sign", B[B.signReply = 3] = "signReply", B[B.methodCall = 4] = "methodCall", B[B.methodCallReply = 5] = "methodCallReply", B))(eA || {});
|
|
5332
|
-
const
|
|
5339
|
+
const AE = /* @__PURE__ */ new Set(["addTempFile", "extractVariables", "extractMedias", "execute", "filesEncrypt", "fileEncrypt", "executeMultipleParams"]), BE = /* @__PURE__ */ new Map([
|
|
5333
5340
|
["execute", (B, A = []) => {
|
|
5334
5341
|
for (const I in B) {
|
|
5335
5342
|
const g = B[I];
|
|
@@ -5361,10 +5368,10 @@ const $C = /* @__PURE__ */ new Set(["addTempFile", "extractVariables", "extractM
|
|
|
5361
5368
|
}]
|
|
5362
5369
|
]), LB = /* @__PURE__ */ new Map();
|
|
5363
5370
|
let tB;
|
|
5364
|
-
function
|
|
5365
|
-
tB = new
|
|
5371
|
+
function IE(B) {
|
|
5372
|
+
tB = new $C(B);
|
|
5366
5373
|
}
|
|
5367
|
-
function
|
|
5374
|
+
function gE(B, ...A) {
|
|
5368
5375
|
const I = NC();
|
|
5369
5376
|
return postMessage({
|
|
5370
5377
|
type: eA.methodCall,
|
|
@@ -5383,7 +5390,7 @@ addEventListener("message", async (B) => {
|
|
|
5383
5390
|
switch (A.type) {
|
|
5384
5391
|
case eA.methodCall:
|
|
5385
5392
|
const I = A.data, g = I.method;
|
|
5386
|
-
if (
|
|
5393
|
+
if (!AE.has(g))
|
|
5387
5394
|
return;
|
|
5388
5395
|
const Q = tB[g];
|
|
5389
5396
|
if (!Q)
|
|
@@ -5398,7 +5405,7 @@ addEventListener("message", async (B) => {
|
|
|
5398
5405
|
return;
|
|
5399
5406
|
const D = [];
|
|
5400
5407
|
if (C) {
|
|
5401
|
-
const w =
|
|
5408
|
+
const w = BE.get(g);
|
|
5402
5409
|
w && w(C, D);
|
|
5403
5410
|
}
|
|
5404
5411
|
postMessage(
|
|
@@ -5424,8 +5431,8 @@ addEventListener("message", async (B) => {
|
|
|
5424
5431
|
}
|
|
5425
5432
|
});
|
|
5426
5433
|
const Ag = new zC();
|
|
5427
|
-
|
|
5428
|
-
Ag.sign = (B) =>
|
|
5434
|
+
IE(Ag);
|
|
5435
|
+
Ag.sign = (B) => gE("sign", B);
|
|
5429
5436
|
`, g = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", Q], { type: "text/javascript;charset=utf-8" });
|
|
5430
5437
|
function E(B) {
|
|
5431
5438
|
let A;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "template-replacement",
|
|
3
3
|
"description": "模板文件替换",
|
|
4
|
-
"version": "3.5.
|
|
4
|
+
"version": "3.5.3",
|
|
5
5
|
"author": "fushiliang <994301536@qq.com>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "index.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@typescript-eslint/eslint-plugin": "^8.50.0",
|
|
25
25
|
"@typescript-eslint/parser": "^8.50.0",
|
|
26
26
|
"eslint": "^9.39.2",
|
|
27
|
-
"eslint-plugin-oxlint": "^1.
|
|
27
|
+
"eslint-plugin-oxlint": "^1.34.0",
|
|
28
28
|
"oxfmt": "^0.16.0",
|
|
29
29
|
"oxlint": "^1.34.0",
|
|
30
30
|
"terser": "^5.44.1",
|
package/replace/image.ts
CHANGED
|
@@ -12,6 +12,7 @@ export enum textWrapTypes {
|
|
|
12
12
|
aboveText = 'AboveText', //嵌于文字上方
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
//获取文件扩展名
|
|
15
16
|
function getFileExtension(filename: string): string {
|
|
16
17
|
const ext = filename.split('.').pop()
|
|
17
18
|
if (ext === undefined) {
|
|
@@ -30,10 +31,11 @@ export type extent = {
|
|
|
30
31
|
cx: number
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
//允许导出和设置的属性
|
|
34
35
|
const allowSetPropertyKeys = new Set([
|
|
35
36
|
'file',
|
|
36
37
|
'id',
|
|
38
|
+
'suffix',
|
|
37
39
|
'wpExtent',
|
|
38
40
|
'textWrap',
|
|
39
41
|
'relationship',
|
|
@@ -44,6 +46,7 @@ export default class image {
|
|
|
44
46
|
file: Blob
|
|
45
47
|
relationship = 'image'
|
|
46
48
|
id?: string
|
|
49
|
+
suffix?: string
|
|
47
50
|
|
|
48
51
|
wpExtent?: extent //图片宽高
|
|
49
52
|
textWrap = textWrapTypes.embed //文字环绕
|
|
@@ -51,7 +54,11 @@ export default class image {
|
|
|
51
54
|
private _awaitInitQueue?: ((value?: unknown) => void)[] = []
|
|
52
55
|
|
|
53
56
|
constructor(file: Blob) {
|
|
54
|
-
if (file instanceof
|
|
57
|
+
if (file instanceof File) {
|
|
58
|
+
this.file = file
|
|
59
|
+
this.suffix = getFileExtension(file.name)
|
|
60
|
+
this.init()
|
|
61
|
+
} else if (file instanceof Blob) {
|
|
55
62
|
this.file = file
|
|
56
63
|
this.init()
|
|
57
64
|
} else {
|
package/replace/paramsData.ts
CHANGED
|
@@ -62,7 +62,7 @@ export default class paramsData {
|
|
|
62
62
|
Image: {
|
|
63
63
|
index,
|
|
64
64
|
id,
|
|
65
|
-
suffix: '',
|
|
65
|
+
suffix: value.suffix ?? '',
|
|
66
66
|
wp_extent: value.wpExtent ?? { cx: 0, cy: 0 },
|
|
67
67
|
text_wrap: value.textWrap,
|
|
68
68
|
},
|
|
@@ -98,7 +98,7 @@ export default class paramsData {
|
|
|
98
98
|
Image: {
|
|
99
99
|
index,
|
|
100
100
|
id,
|
|
101
|
-
suffix: '',
|
|
101
|
+
suffix: value.suffix ?? '',
|
|
102
102
|
wp_extent: value.wpExtent ?? { cx: 0, cy: 0 },
|
|
103
103
|
text_wrap: value.textWrap,
|
|
104
104
|
},
|