office-viewer 0.1.4 → 0.2.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/README.md +0 -2
- package/esm/Word.d.ts +9 -1
- package/esm/Word.js +92 -43
- package/esm/package/PackageParser.d.ts +4 -0
- package/esm/package/XMLPackageParser.d.ts +1 -0
- package/esm/package/ZipPackageParser.d.ts +4 -0
- package/esm/package/ZipPackageParser.js +9 -0
- package/esm/render/renderParagraph.js +21 -42
- package/esm/util/fileType.d.ts +9 -0
- package/esm/util/fileType.js +66 -0
- package/esm/util/mergeRun.js +7 -1
- package/esm/util/replaceVar.d.ts +7 -1
- package/esm/util/replaceVar.js +277 -114
- package/lib/Word.d.ts +9 -1
- package/lib/Word.js +91 -42
- package/lib/package/PackageParser.d.ts +4 -0
- package/lib/package/XMLPackageParser.d.ts +2 -1
- package/lib/package/ZipPackageParser.d.ts +5 -1
- package/lib/package/ZipPackageParser.js +9 -0
- package/lib/render/renderParagraph.js +21 -42
- package/lib/util/fileType.d.ts +9 -0
- package/lib/util/fileType.js +70 -0
- package/lib/util/mergeRun.js +7 -1
- package/lib/util/replaceVar.d.ts +7 -1
- package/lib/util/replaceVar.js +276 -113
- package/package.json +4 -2
package/lib/util/replaceVar.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
|
+
var Pic = require('../openxml/drawing/Pic.js');
|
|
6
7
|
var createObject = require('./createObject.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -34,115 +35,192 @@ function replaceText(word, text, data) {
|
|
|
34
35
|
}
|
|
35
36
|
return text;
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
// 生成的新 id
|
|
39
|
+
var newRelId = 1;
|
|
40
|
+
/**
|
|
41
|
+
* 替换图片里的变量
|
|
42
|
+
* @param replaceImage 如果为 true,则会实际替换掉 zip 里的图片,但可能影响性能所以默认不开启,只有下载的时候才开启
|
|
43
|
+
*/
|
|
44
|
+
function replaceAlt(word, cNvPr, data, replaceImage) {
|
|
45
|
+
if (replaceImage === void 0) { replaceImage = false; }
|
|
46
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
47
|
+
var alt, imageURL, parentElement, blip, newId, imageResponse, imageData, pic, blip_1;
|
|
48
|
+
return tslib.__generator(this, function (_a) {
|
|
49
|
+
switch (_a.label) {
|
|
50
|
+
case 0:
|
|
51
|
+
if (cNvPr.getAttribute('downloaded')) {
|
|
52
|
+
// 已经替换过了
|
|
53
|
+
return [2 /*return*/];
|
|
54
|
+
}
|
|
55
|
+
alt = cNvPr.getAttribute('descr') || '';
|
|
56
|
+
imageURL = replaceText(word, alt, data);
|
|
57
|
+
cNvPr.setAttribute('descrVar', imageURL);
|
|
58
|
+
if (!(replaceImage && imageURL)) return [3 /*break*/, 4];
|
|
59
|
+
parentElement = cNvPr.parentElement.parentElement;
|
|
60
|
+
blip = parentElement.getElementsByTagName('a:blip').item(0);
|
|
61
|
+
if (!blip) return [3 /*break*/, 3];
|
|
62
|
+
newId = "rIdn".concat(newRelId);
|
|
63
|
+
blip.setAttribute('r:embed', newId);
|
|
64
|
+
return [4 /*yield*/, fetch(imageURL)];
|
|
65
|
+
case 1:
|
|
66
|
+
imageResponse = _a.sent();
|
|
67
|
+
return [4 /*yield*/, imageResponse.arrayBuffer()];
|
|
68
|
+
case 2:
|
|
69
|
+
imageData = _a.sent();
|
|
70
|
+
word.saveNewImage(newId, new Uint8Array(imageData));
|
|
71
|
+
cNvPr.setAttribute('downloaded', 'true');
|
|
72
|
+
newRelId++;
|
|
73
|
+
_a.label = 3;
|
|
74
|
+
case 3:
|
|
75
|
+
pic = Pic.Pic.fromXML(word, parentElement);
|
|
76
|
+
if (pic && pic.blipFill && pic.blipFill.blip) {
|
|
77
|
+
blip_1 = pic.blipFill.blip;
|
|
78
|
+
if (blip_1.embled) ;
|
|
79
|
+
}
|
|
80
|
+
_a.label = 4;
|
|
81
|
+
case 4: return [2 /*return*/];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
40
85
|
}
|
|
41
86
|
/**
|
|
42
87
|
* 替换表格行
|
|
43
88
|
*/
|
|
44
|
-
function replaceTableRow(word, tr) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
89
|
+
function replaceTableRow(word, tr, replaceImage) {
|
|
90
|
+
if (replaceImage === void 0) { replaceImage = false; }
|
|
91
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
92
|
+
var evalVar, data, table, tcs, hasLoop, loopArray, tcs_1, tcs_1_1, tc, ts, ts_1, ts_1_1, t, text, arrayNameMatch, arrayMatchResult, arrayName, array, loopArray_1, loopArray_1_1, item, newTr, ts, rowData, ts_2, ts_2_1, t, _a, _b, cNvPr, e_1_1, e_2_1;
|
|
93
|
+
var e_3, _c, e_4, _d, e_2, _e, e_5, _f, e_1, _g;
|
|
94
|
+
return tslib.__generator(this, function (_h) {
|
|
95
|
+
switch (_h.label) {
|
|
96
|
+
case 0:
|
|
97
|
+
evalVar = word.renderOptions.evalVar;
|
|
98
|
+
data = word.renderOptions.data;
|
|
99
|
+
table = tr.parentNode;
|
|
100
|
+
tcs = tr.getElementsByTagName('w:tc');
|
|
101
|
+
hasLoop = false;
|
|
102
|
+
loopArray = [];
|
|
103
|
+
try {
|
|
104
|
+
// 查找对应的循环
|
|
105
|
+
for (tcs_1 = tslib.__values(tcs), tcs_1_1 = tcs_1.next(); !tcs_1_1.done; tcs_1_1 = tcs_1.next()) {
|
|
106
|
+
tc = tcs_1_1.value;
|
|
107
|
+
ts = tc.getElementsByTagName('w:t');
|
|
108
|
+
try {
|
|
109
|
+
for (ts_1 = (e_4 = void 0, tslib.__values(ts)), ts_1_1 = ts_1.next(); !ts_1_1.done; ts_1_1 = ts_1.next()) {
|
|
110
|
+
t = ts_1_1.value;
|
|
111
|
+
text = t.textContent || '';
|
|
112
|
+
if (text.startsWith('{{#')) {
|
|
113
|
+
arrayNameMatch = /{{#([^\}]+)}}/;
|
|
114
|
+
arrayMatchResult = arrayNameMatch.exec(text);
|
|
115
|
+
if (arrayMatchResult && arrayMatchResult.length > 0) {
|
|
116
|
+
hasLoop = true;
|
|
117
|
+
arrayName = arrayMatchResult[1];
|
|
118
|
+
array = evalVar(arrayName, data);
|
|
119
|
+
if (Array.isArray(array)) {
|
|
120
|
+
loopArray = array;
|
|
121
|
+
}
|
|
122
|
+
// 去掉这个循环变量
|
|
123
|
+
t.textContent = t.textContent.replace("{{#".concat(arrayName, "}}"), '');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (text.indexOf('{{/}}') !== -1) {
|
|
127
|
+
// 去掉结束变量
|
|
128
|
+
t.textContent = t.textContent.replace('{{/}}', '');
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
133
|
+
finally {
|
|
134
|
+
try {
|
|
135
|
+
if (ts_1_1 && !ts_1_1.done && (_d = ts_1.return)) _d.call(ts_1);
|
|
136
|
+
}
|
|
137
|
+
finally { if (e_4) throw e_4.error; }
|
|
70
138
|
}
|
|
71
|
-
// 去掉这个循环变量
|
|
72
|
-
t.textContent = t.textContent.replace("{{#".concat(arrayName, "}}"), '');
|
|
73
139
|
}
|
|
74
140
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
82
|
-
finally {
|
|
83
|
-
try {
|
|
84
|
-
if (ts_1_1 && !ts_1_1.done && (_b = ts_1.return)) _b.call(ts_1);
|
|
85
|
-
}
|
|
86
|
-
finally { if (e_2) throw e_2.error; }
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
91
|
-
finally {
|
|
92
|
-
try {
|
|
93
|
-
if (tcs_1_1 && !tcs_1_1.done && (_a = tcs_1.return)) _a.call(tcs_1);
|
|
94
|
-
}
|
|
95
|
-
finally { if (e_1) throw e_1.error; }
|
|
96
|
-
}
|
|
97
|
-
if (hasLoop) {
|
|
98
|
-
try {
|
|
99
|
-
// 有循环,复制多行
|
|
100
|
-
for (var loopArray_1 = tslib.__values(loopArray), loopArray_1_1 = loopArray_1.next(); !loopArray_1_1.done; loopArray_1_1 = loopArray_1.next()) {
|
|
101
|
-
var item = loopArray_1_1.value;
|
|
102
|
-
var newTr = cloneTr(tr);
|
|
103
|
-
var ts = newTr.getElementsByTagName('w:t');
|
|
104
|
-
// 将 item 加入上下文
|
|
105
|
-
var rowData = createObject.createObject(data, item);
|
|
106
|
-
try {
|
|
107
|
-
for (var ts_2 = (e_4 = void 0, tslib.__values(ts)), ts_2_1 = ts_2.next(); !ts_2_1.done; ts_2_1 = ts_2.next()) {
|
|
108
|
-
var t = ts_2_1.value;
|
|
109
|
-
replaceT(word, t, rowData);
|
|
141
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
142
|
+
finally {
|
|
143
|
+
try {
|
|
144
|
+
if (tcs_1_1 && !tcs_1_1.done && (_c = tcs_1.return)) _c.call(tcs_1);
|
|
145
|
+
}
|
|
146
|
+
finally { if (e_3) throw e_3.error; }
|
|
110
147
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
148
|
+
if (!hasLoop) return [3 /*break*/, 16];
|
|
149
|
+
_h.label = 1;
|
|
150
|
+
case 1:
|
|
151
|
+
_h.trys.push([1, 13, 14, 15]);
|
|
152
|
+
loopArray_1 = tslib.__values(loopArray), loopArray_1_1 = loopArray_1.next();
|
|
153
|
+
_h.label = 2;
|
|
154
|
+
case 2:
|
|
155
|
+
if (!!loopArray_1_1.done) return [3 /*break*/, 12];
|
|
156
|
+
item = loopArray_1_1.value;
|
|
157
|
+
newTr = cloneTr(tr);
|
|
158
|
+
ts = newTr.getElementsByTagName('w:t');
|
|
159
|
+
rowData = createObject.createObject(data, item);
|
|
114
160
|
try {
|
|
115
|
-
|
|
161
|
+
for (ts_2 = (e_5 = void 0, tslib.__values(ts)), ts_2_1 = ts_2.next(); !ts_2_1.done; ts_2_1 = ts_2.next()) {
|
|
162
|
+
t = ts_2_1.value;
|
|
163
|
+
replaceT(word, t, rowData);
|
|
164
|
+
}
|
|
116
165
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
replaceAlt(word, cNvPr, rowData);
|
|
166
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
167
|
+
finally {
|
|
168
|
+
try {
|
|
169
|
+
if (ts_2_1 && !ts_2_1.done && (_f = ts_2.return)) _f.call(ts_2);
|
|
170
|
+
}
|
|
171
|
+
finally { if (e_5) throw e_5.error; }
|
|
124
172
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
173
|
+
_h.label = 3;
|
|
174
|
+
case 3:
|
|
175
|
+
_h.trys.push([3, 8, 9, 10]);
|
|
176
|
+
_a = (e_1 = void 0, tslib.__values(newTr.getElementsByTagName('pic:cNvPr'))), _b = _a.next();
|
|
177
|
+
_h.label = 4;
|
|
178
|
+
case 4:
|
|
179
|
+
if (!!_b.done) return [3 /*break*/, 7];
|
|
180
|
+
cNvPr = _b.value;
|
|
181
|
+
return [4 /*yield*/, replaceAlt(word, cNvPr, rowData, replaceImage)];
|
|
182
|
+
case 5:
|
|
183
|
+
_h.sent();
|
|
184
|
+
_h.label = 6;
|
|
185
|
+
case 6:
|
|
186
|
+
_b = _a.next();
|
|
187
|
+
return [3 /*break*/, 4];
|
|
188
|
+
case 7: return [3 /*break*/, 10];
|
|
189
|
+
case 8:
|
|
190
|
+
e_1_1 = _h.sent();
|
|
191
|
+
e_1 = { error: e_1_1 };
|
|
192
|
+
return [3 /*break*/, 10];
|
|
193
|
+
case 9:
|
|
128
194
|
try {
|
|
129
|
-
if (
|
|
195
|
+
if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
|
|
130
196
|
}
|
|
131
|
-
finally { if (
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
197
|
+
finally { if (e_1) throw e_1.error; }
|
|
198
|
+
return [7 /*endfinally*/];
|
|
199
|
+
case 10:
|
|
200
|
+
table.insertBefore(newTr, tr);
|
|
201
|
+
_h.label = 11;
|
|
202
|
+
case 11:
|
|
203
|
+
loopArray_1_1 = loopArray_1.next();
|
|
204
|
+
return [3 /*break*/, 2];
|
|
205
|
+
case 12: return [3 /*break*/, 15];
|
|
206
|
+
case 13:
|
|
207
|
+
e_2_1 = _h.sent();
|
|
208
|
+
e_2 = { error: e_2_1 };
|
|
209
|
+
return [3 /*break*/, 15];
|
|
210
|
+
case 14:
|
|
211
|
+
try {
|
|
212
|
+
if (loopArray_1_1 && !loopArray_1_1.done && (_e = loopArray_1.return)) _e.call(loopArray_1);
|
|
213
|
+
}
|
|
214
|
+
finally { if (e_2) throw e_2.error; }
|
|
215
|
+
return [7 /*endfinally*/];
|
|
216
|
+
case 15:
|
|
217
|
+
// 删除原来的行
|
|
218
|
+
table.removeChild(tr);
|
|
219
|
+
_h.label = 16;
|
|
220
|
+
case 16: return [2 /*return*/];
|
|
140
221
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
// 删除原来的行
|
|
144
|
-
table.removeChild(tr);
|
|
145
|
-
}
|
|
222
|
+
});
|
|
223
|
+
});
|
|
146
224
|
}
|
|
147
225
|
/**
|
|
148
226
|
* 克隆行,并进行一些清理
|
|
@@ -195,25 +273,110 @@ function removeAllAttr(node) {
|
|
|
195
273
|
/**
|
|
196
274
|
* 替换表格,目前只支持行
|
|
197
275
|
*/
|
|
198
|
-
function replaceTable(word, documentData) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
276
|
+
function replaceTable(word, documentData, replaceImage) {
|
|
277
|
+
if (replaceImage === void 0) { replaceImage = false; }
|
|
278
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
279
|
+
var trs, trs_1, trs_1_1, tr, e_8_1;
|
|
280
|
+
var e_8, _a;
|
|
281
|
+
return tslib.__generator(this, function (_b) {
|
|
282
|
+
switch (_b.label) {
|
|
283
|
+
case 0:
|
|
284
|
+
trs = [].slice.call(documentData.getElementsByTagName('w:tr'));
|
|
285
|
+
_b.label = 1;
|
|
286
|
+
case 1:
|
|
287
|
+
_b.trys.push([1, 6, 7, 8]);
|
|
288
|
+
trs_1 = tslib.__values(trs), trs_1_1 = trs_1.next();
|
|
289
|
+
_b.label = 2;
|
|
290
|
+
case 2:
|
|
291
|
+
if (!!trs_1_1.done) return [3 /*break*/, 5];
|
|
292
|
+
tr = trs_1_1.value;
|
|
293
|
+
return [4 /*yield*/, replaceTableRow(word, tr, replaceImage)];
|
|
294
|
+
case 3:
|
|
295
|
+
_b.sent();
|
|
296
|
+
_b.label = 4;
|
|
297
|
+
case 4:
|
|
298
|
+
trs_1_1 = trs_1.next();
|
|
299
|
+
return [3 /*break*/, 2];
|
|
300
|
+
case 5: return [3 /*break*/, 8];
|
|
301
|
+
case 6:
|
|
302
|
+
e_8_1 = _b.sent();
|
|
303
|
+
e_8 = { error: e_8_1 };
|
|
304
|
+
return [3 /*break*/, 8];
|
|
305
|
+
case 7:
|
|
306
|
+
try {
|
|
307
|
+
if (trs_1_1 && !trs_1_1.done && (_a = trs_1.return)) _a.call(trs_1);
|
|
308
|
+
}
|
|
309
|
+
finally { if (e_8) throw e_8.error; }
|
|
310
|
+
return [7 /*endfinally*/];
|
|
311
|
+
case 8: return [2 /*return*/];
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
});
|
|
214
315
|
}
|
|
215
|
-
|
|
216
|
-
|
|
316
|
+
/**
|
|
317
|
+
* 替换单个图片,必须是不在表格里的
|
|
318
|
+
* @param word
|
|
319
|
+
* @param documentData
|
|
320
|
+
*/
|
|
321
|
+
function replaceSingleImage(word, documentData) {
|
|
322
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
323
|
+
var _a, _b, cNvPr, e_9_1;
|
|
324
|
+
var e_9, _c;
|
|
325
|
+
return tslib.__generator(this, function (_d) {
|
|
326
|
+
switch (_d.label) {
|
|
327
|
+
case 0:
|
|
328
|
+
_d.trys.push([0, 5, 6, 7]);
|
|
329
|
+
_a = tslib.__values(documentData.getElementsByTagName('pic:cNvPr')), _b = _a.next();
|
|
330
|
+
_d.label = 1;
|
|
331
|
+
case 1:
|
|
332
|
+
if (!!_b.done) return [3 /*break*/, 4];
|
|
333
|
+
cNvPr = _b.value;
|
|
334
|
+
return [4 /*yield*/, replaceAlt(word, cNvPr, word.renderOptions.data, true)];
|
|
335
|
+
case 2:
|
|
336
|
+
_d.sent();
|
|
337
|
+
_d.label = 3;
|
|
338
|
+
case 3:
|
|
339
|
+
_b = _a.next();
|
|
340
|
+
return [3 /*break*/, 1];
|
|
341
|
+
case 4: return [3 /*break*/, 7];
|
|
342
|
+
case 5:
|
|
343
|
+
e_9_1 = _d.sent();
|
|
344
|
+
e_9 = { error: e_9_1 };
|
|
345
|
+
return [3 /*break*/, 7];
|
|
346
|
+
case 6:
|
|
347
|
+
try {
|
|
348
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
349
|
+
}
|
|
350
|
+
finally { if (e_9) throw e_9.error; }
|
|
351
|
+
return [7 /*endfinally*/];
|
|
352
|
+
case 7: return [2 /*return*/];
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* 变量替换主入口
|
|
359
|
+
* @param word
|
|
360
|
+
* @param documentData
|
|
361
|
+
* @param replaceImage 是否替换掉图片,只有下载时才替换,避免性能问题
|
|
362
|
+
*/
|
|
363
|
+
function replaceVar(word, documentData, replaceImage) {
|
|
364
|
+
if (replaceImage === void 0) { replaceImage = false; }
|
|
365
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
366
|
+
return tslib.__generator(this, function (_a) {
|
|
367
|
+
switch (_a.label) {
|
|
368
|
+
case 0: return [4 /*yield*/, replaceTable(word, documentData, replaceImage)];
|
|
369
|
+
case 1:
|
|
370
|
+
_a.sent();
|
|
371
|
+
if (!replaceImage) return [3 /*break*/, 3];
|
|
372
|
+
return [4 /*yield*/, replaceSingleImage(word, documentData)];
|
|
373
|
+
case 2:
|
|
374
|
+
_a.sent();
|
|
375
|
+
_a.label = 3;
|
|
376
|
+
case 3: return [2 /*return*/];
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
});
|
|
217
380
|
}
|
|
218
381
|
|
|
219
382
|
exports.replaceT = replaceT;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "office-viewer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "office 文档在线预览",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"dev": "vite",
|
|
10
10
|
"build": "npm run clean-dist && cross-env NODE_ENV=production rollup -c ",
|
|
11
|
+
"build-esm": "npm run clean-dist && cross-env NODE_ENV=production rollup -c rollup.esm.config.js",
|
|
11
12
|
"test": "jest",
|
|
12
13
|
"lib": "npm run clean-dist && cross-env NODE_ENV=production IS_LIB=1 rollup -c",
|
|
13
14
|
"update-snapshot": "jest --updateSnapshot",
|
|
@@ -49,8 +50,9 @@
|
|
|
49
50
|
"@rollup/plugin-json": "^4.1.0",
|
|
50
51
|
"@rollup/plugin-node-resolve": "^14.1.0",
|
|
51
52
|
"@rollup/plugin-typescript": "^8.3.4",
|
|
52
|
-
"@types/jest": "^28.1.0",
|
|
53
53
|
"@testing-library/jest-dom": "^5.16.4",
|
|
54
|
+
"@types/jest": "^28.1.0",
|
|
55
|
+
"@types/prettier": "^2.7.3",
|
|
54
56
|
"amis-formula": "^2.7.2",
|
|
55
57
|
"fast-xml-parser": "4.1.3",
|
|
56
58
|
"jest": "^29.0.3",
|