@vdhewei/xlsx-template-lib 1.5.1 → 1.6.1
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 +1012 -2
- package/README.zh-CN.md +1016 -0
- package/dist/bin.js +3015 -36
- package/dist/bin.js.map +1 -1
- package/dist/bin.mjs +334 -14
- package/dist/bin.mjs.map +1 -1
- package/dist/chunk-3GDQP6AS.mjs +16 -0
- package/dist/chunk-3GDQP6AS.mjs.map +1 -0
- package/dist/{chunk-X6Y7DXP6.mjs → chunk-NSFBG6PV.mjs} +24 -3
- package/dist/{chunk-X6Y7DXP6.mjs.map → chunk-NSFBG6PV.mjs.map} +1 -1
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/main-UKT22V6T.mjs +400 -0
- package/dist/main-UKT22V6T.mjs.map +1 -0
- package/package.json +3 -1
package/dist/bin.mjs
CHANGED
|
@@ -1,21 +1,341 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
XlsxRender,
|
|
4
|
+
compileAll,
|
|
5
|
+
compileRuleSheetName,
|
|
6
|
+
loadWorkbook
|
|
7
|
+
} from "./chunk-NSFBG6PV.mjs";
|
|
8
|
+
import "./chunk-3GDQP6AS.mjs";
|
|
5
9
|
|
|
6
10
|
// src/bin.ts
|
|
7
|
-
import
|
|
11
|
+
import chalk2 from "chalk";
|
|
8
12
|
import { Command } from "commander";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
import * as fs2 from "fs/promises";
|
|
14
|
+
import { existsSync as existsSync2 } from "fs";
|
|
15
|
+
import * as path2 from "path";
|
|
16
|
+
|
|
17
|
+
// src/bin-helpers.ts
|
|
18
|
+
import * as path from "path";
|
|
19
|
+
import * as url from "url";
|
|
20
|
+
import { existsSync } from "fs";
|
|
21
|
+
import * as fs from "fs/promises";
|
|
22
|
+
import chalk from "chalk";
|
|
23
|
+
function generateOutputFilename(inputFile) {
|
|
24
|
+
const basename2 = path.basename(inputFile, path.extname(inputFile));
|
|
25
|
+
const timestamp = Date.now();
|
|
26
|
+
return `${basename2}_${timestamp}.xlsx`;
|
|
27
|
+
}
|
|
28
|
+
async function resolveFilePath(filePath) {
|
|
29
|
+
const resolvedPath = path.resolve(filePath);
|
|
30
|
+
if (existsSync(resolvedPath)) {
|
|
31
|
+
return resolvedPath;
|
|
32
|
+
}
|
|
33
|
+
const scriptDir = path.dirname(url.fileURLToPath(import.meta.url));
|
|
34
|
+
const relativePath = path.resolve(scriptDir, filePath);
|
|
35
|
+
if (existsSync(relativePath)) {
|
|
36
|
+
return relativePath;
|
|
37
|
+
}
|
|
38
|
+
throw new Error(`File not found: ${filePath}`);
|
|
39
|
+
}
|
|
40
|
+
async function parseRenderData(dataOption) {
|
|
41
|
+
if (!dataOption) {
|
|
42
|
+
return {};
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
return JSON.parse(dataOption);
|
|
46
|
+
} catch (e) {
|
|
47
|
+
try {
|
|
48
|
+
const filePath = await resolveFilePath(dataOption);
|
|
49
|
+
const fileContent = await fs.readFile(filePath, "utf-8");
|
|
50
|
+
return JSON.parse(fileContent);
|
|
51
|
+
} catch (e2) {
|
|
52
|
+
if (dataOption.startsWith("http://") || dataOption.startsWith("https://")) {
|
|
53
|
+
let fetch;
|
|
54
|
+
try {
|
|
55
|
+
fetch = globalThis.fetch;
|
|
56
|
+
} catch (e3) {
|
|
57
|
+
try {
|
|
58
|
+
const nodeFetch = await import("node-fetch");
|
|
59
|
+
fetch = nodeFetch.default;
|
|
60
|
+
} catch (e4) {
|
|
61
|
+
throw new Error("Remote URLs require Node.js 18+ or node-fetch package");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const response = await fetch(dataOption);
|
|
65
|
+
return response.json();
|
|
66
|
+
}
|
|
67
|
+
throw new Error(`Failed to parse render data from: ${dataOption}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function checkSheetAndPlaceholders(xlsx, sheetName) {
|
|
72
|
+
const sheets = xlsx.getSheets();
|
|
73
|
+
const sheet = sheets.find((s) => s.name === sheetName);
|
|
74
|
+
if (!sheet) {
|
|
75
|
+
throw new Error(`Sheet "${sheetName}" not found in Excel file`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async function addRuleToSheet(xlsxBuffer, ruleType, ruleExpr, sheetName = "export_metadata.config") {
|
|
79
|
+
const workbook = await loadWorkbook(xlsxBuffer);
|
|
80
|
+
let worksheet = workbook.getWorksheet(sheetName);
|
|
81
|
+
if (!worksheet) {
|
|
82
|
+
worksheet = workbook.addWorksheet(sheetName);
|
|
83
|
+
console.log(chalk.gray(`Created new sheet: ${sheetName}`));
|
|
84
|
+
}
|
|
85
|
+
let startRow = 1;
|
|
86
|
+
let currentRow = 1;
|
|
87
|
+
let columnCount = 0;
|
|
88
|
+
worksheet.eachRow((row, rowNumber) => {
|
|
89
|
+
const cell = row.getCell(1);
|
|
90
|
+
const cellValue = cell.value?.toString().trim();
|
|
91
|
+
if (!cellValue) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (cellValue.toLowerCase() === ruleType.toLowerCase()) {
|
|
95
|
+
let col = 2;
|
|
96
|
+
while (col <= 4) {
|
|
97
|
+
const ruleCell = row.getCell(col);
|
|
98
|
+
if (ruleCell.value) {
|
|
99
|
+
columnCount++;
|
|
100
|
+
}
|
|
101
|
+
col++;
|
|
102
|
+
}
|
|
103
|
+
if (columnCount < 4) {
|
|
104
|
+
currentRow = rowNumber;
|
|
105
|
+
startRow = rowNumber;
|
|
106
|
+
} else {
|
|
107
|
+
currentRow = rowNumber + 1;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
if (startRow === 1 && currentRow === 1 && worksheet.rowCount === 0) {
|
|
112
|
+
currentRow = 1;
|
|
113
|
+
}
|
|
114
|
+
let targetRow = worksheet.getRow(currentRow);
|
|
115
|
+
if (!targetRow.getCell(1).value) {
|
|
116
|
+
const typeCell = targetRow.getCell(1);
|
|
117
|
+
typeCell.value = ruleType;
|
|
118
|
+
typeCell.font = { bold: true };
|
|
119
|
+
typeCell.alignment = { horizontal: "center", vertical: "middle" };
|
|
120
|
+
}
|
|
121
|
+
let ruleCol = 2;
|
|
122
|
+
while (ruleCol <= 4) {
|
|
123
|
+
const existingCell = targetRow.getCell(ruleCol);
|
|
124
|
+
if (!existingCell.value) {
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
ruleCol++;
|
|
128
|
+
}
|
|
129
|
+
if (ruleCol <= 4) {
|
|
130
|
+
const ruleCell = targetRow.getCell(ruleCol);
|
|
131
|
+
ruleCell.value = ruleExpr;
|
|
132
|
+
ruleCell.alignment = { vertical: "middle" };
|
|
133
|
+
const column = worksheet.getColumn(ruleCol);
|
|
134
|
+
column.width = Math.max(column.width || 10, ruleExpr.length + 2);
|
|
135
|
+
console.log(chalk.gray(`Added rule ${ruleType} at row ${currentRow}, column ${ruleCol}`));
|
|
136
|
+
} else {
|
|
137
|
+
throw new Error(`Cannot add more than 4 rules for type: ${ruleType}`);
|
|
138
|
+
}
|
|
139
|
+
const buffer = await workbook.xlsx.writeBuffer();
|
|
140
|
+
return Buffer.from(buffer);
|
|
141
|
+
}
|
|
142
|
+
async function parseRulesFromFile(filePath) {
|
|
143
|
+
const resolvedPath = await resolveFilePath(filePath);
|
|
144
|
+
const fileContent = await fs.readFile(resolvedPath, "utf-8");
|
|
145
|
+
const lines = fileContent.split("\n");
|
|
146
|
+
const rules = [];
|
|
147
|
+
const validTypes = ["cell", "alias", "rowCell", "mergeCell"];
|
|
148
|
+
for (let i = 0; i < lines.length; i++) {
|
|
149
|
+
const line = lines[i].trim();
|
|
150
|
+
if (!line || line.startsWith("#")) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
const spaceIndex = line.indexOf(" ");
|
|
154
|
+
if (spaceIndex === -1) {
|
|
155
|
+
console.log(chalk.yellow(`\u26A0 Line ${i + 1}: Invalid format. Expected "<type> ruleExpr"`));
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
const type = line.substring(0, spaceIndex).trim();
|
|
159
|
+
const rule = line.substring(spaceIndex + 1).trim();
|
|
160
|
+
if (!type || !rule) {
|
|
161
|
+
console.log(chalk.yellow(`\u26A0 Line ${i + 1}: Invalid format. Expected "<type> ruleExpr"`));
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (!validTypes.includes(type)) {
|
|
165
|
+
console.log(chalk.yellow(`\u26A0 Line ${i + 1}: Invalid rule type "${type}". Must be one of: ${validTypes.join(", ")}`));
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
rules.push({ type, rule });
|
|
169
|
+
}
|
|
170
|
+
if (rules.length === 0) {
|
|
171
|
+
throw new Error("No valid rules found in file");
|
|
172
|
+
}
|
|
173
|
+
return rules;
|
|
174
|
+
}
|
|
175
|
+
async function addMultipleRulesToSheet(xlsxBuffer, rules) {
|
|
176
|
+
let buffer = xlsxBuffer;
|
|
177
|
+
for (const { type, rule } of rules) {
|
|
178
|
+
console.log(chalk.gray(`Adding ${type} rule: ${rule}`));
|
|
179
|
+
buffer = await addRuleToSheet(buffer, type, rule);
|
|
180
|
+
}
|
|
181
|
+
return buffer;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// src/bin.ts
|
|
185
|
+
async function main() {
|
|
186
|
+
let version = "1.0.0";
|
|
187
|
+
try {
|
|
188
|
+
const possiblePaths = [
|
|
189
|
+
path2.join(process.cwd(), "package.json"),
|
|
190
|
+
path2.join(process.cwd(), "..", "package.json")
|
|
191
|
+
];
|
|
192
|
+
for (const packagePath of possiblePaths) {
|
|
193
|
+
if (existsSync2(packagePath)) {
|
|
194
|
+
const packageJson = JSON.parse(await fs2.readFile(packagePath, "utf-8"));
|
|
195
|
+
version = packageJson.version;
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
} catch (e) {
|
|
200
|
+
}
|
|
201
|
+
const envPath = path2.join(process.cwd(), ".env");
|
|
202
|
+
if (existsSync2(envPath)) {
|
|
203
|
+
try {
|
|
204
|
+
const dotenv = (await import("./main-UKT22V6T.mjs")).default;
|
|
205
|
+
dotenv.config({ debug: false, path: envPath });
|
|
206
|
+
} catch (e) {
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const program = new Command();
|
|
210
|
+
program.name("xlsx-cli").version(version);
|
|
211
|
+
program.command("compile").argument("<string>", "xlsx file path").option("-s,--save <string>", "save compiled xlsx file to user dir").option("-n,--sheet-name <string>", "compile xlsx sheet name when xlsx has multiple sheets").option("-r,--remove", "remove configure rules sheet", false).action(async (xlsxFile, options) => {
|
|
212
|
+
try {
|
|
213
|
+
console.log(chalk2.green("\u{1F4C4} Compiling Excel file..."));
|
|
214
|
+
const filePath = await resolveFilePath(xlsxFile);
|
|
215
|
+
console.log(chalk2.gray(`Loading file: ${filePath}`));
|
|
216
|
+
const buffer = await fs2.readFile(filePath);
|
|
217
|
+
const xlsx = await XlsxRender.create(buffer);
|
|
218
|
+
const sheets = xlsx.getSheets();
|
|
219
|
+
const sheetName = options.sheetName || sheets[0].name;
|
|
220
|
+
console.log(chalk2.gray(`Target sheet: ${sheetName}`));
|
|
221
|
+
const ruleSheetName = options.sheetName || compileRuleSheetName;
|
|
222
|
+
console.log(chalk2.gray("Compiling rules..."));
|
|
223
|
+
const compiledBuffer = await compileAll(buffer, {
|
|
224
|
+
sheetName: ruleSheetName,
|
|
225
|
+
remove: options.remove || false
|
|
226
|
+
});
|
|
227
|
+
console.log(chalk2.green("\u2713 Compilation completed"));
|
|
228
|
+
const outputFile = options.save || path2.join(process.cwd(), generateOutputFilename(xlsxFile));
|
|
229
|
+
console.log(chalk2.gray(`Saving to: ${outputFile}`));
|
|
230
|
+
await fs2.writeFile(outputFile, compiledBuffer);
|
|
231
|
+
console.log(chalk2.green("\u2713 Excel file compiled successfully!"));
|
|
232
|
+
console.log(chalk2.green(`\u{1F4C1} Output: ${outputFile}`));
|
|
233
|
+
} catch (error) {
|
|
234
|
+
console.error(chalk2.red("\u2717 Compilation failed:"));
|
|
235
|
+
console.error(chalk2.red(error instanceof Error ? error.message : String(error)));
|
|
236
|
+
process.exit(1);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
program.command("render").argument("<string>", "xlsx file path").option("-c,--compile", "auto compile flag", false).option("-n,--sheet-name <string>", "render xlsx sheet name when xlsx has multiple sheets").option("-s,--save <string>", "save render xlsx file to user dir").option("-d,--data <string>", "render xlsx file data from").action(async (xlsxFile, options) => {
|
|
240
|
+
try {
|
|
241
|
+
console.log(chalk2.green("\u{1F4C4} Rendering Excel template..."));
|
|
242
|
+
const filePath = await resolveFilePath(xlsxFile);
|
|
243
|
+
console.log(chalk2.gray(`Loading file: ${filePath}`));
|
|
244
|
+
let buffer = await fs2.readFile(filePath);
|
|
245
|
+
let xlsx = await XlsxRender.create(buffer);
|
|
246
|
+
const sheets = xlsx.getSheets();
|
|
247
|
+
const sheetName = options.sheetName || sheets[0].name;
|
|
248
|
+
console.log(chalk2.gray(`Target sheet: ${sheetName}`));
|
|
249
|
+
checkSheetAndPlaceholders(xlsx, sheetName);
|
|
250
|
+
console.log(chalk2.gray("Sheet validation passed"));
|
|
251
|
+
const renderData = await parseRenderData(options.data);
|
|
252
|
+
if (Object.keys(renderData).length > 0) {
|
|
253
|
+
console.log(chalk2.gray(`Render data loaded with ${Object.keys(renderData).length} keys`));
|
|
254
|
+
}
|
|
255
|
+
if (options.compile) {
|
|
256
|
+
console.log(chalk2.gray("Auto-compiling rules..."));
|
|
257
|
+
const ruleSheetName = options.sheetName || compileRuleSheetName;
|
|
258
|
+
const compiledResult = await compileAll(buffer, {
|
|
259
|
+
sheetName: ruleSheetName,
|
|
260
|
+
remove: false
|
|
261
|
+
// Don't remove rule sheet during render
|
|
262
|
+
});
|
|
263
|
+
buffer = Buffer.from(compiledResult);
|
|
264
|
+
xlsx = await XlsxRender.create(buffer);
|
|
265
|
+
console.log(chalk2.green("\u2713 Auto-compilation completed"));
|
|
266
|
+
}
|
|
267
|
+
console.log(chalk2.gray("Rendering template..."));
|
|
268
|
+
await xlsx.render(renderData, sheetName);
|
|
269
|
+
const outputBuffer = await xlsx.generate({
|
|
270
|
+
type: "nodebuffer" /* NodeBuffer */,
|
|
271
|
+
compression: "DEFLATE",
|
|
272
|
+
compressionOptions: {
|
|
273
|
+
level: 9
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
const outputFile = options.save || path2.join(process.cwd(), generateOutputFilename(xlsxFile));
|
|
277
|
+
console.log(chalk2.gray(`Saving to: ${outputFile}`));
|
|
278
|
+
await fs2.writeFile(outputFile, outputBuffer);
|
|
279
|
+
console.log(chalk2.green("\u2713 Excel template rendered successfully!"));
|
|
280
|
+
console.log(chalk2.green(`\u{1F4C1} Output: ${outputFile}`));
|
|
281
|
+
} catch (error) {
|
|
282
|
+
console.error(chalk2.red("\u2717 Rendering failed:"));
|
|
283
|
+
console.error(chalk2.red(error instanceof Error ? error.message : String(error)));
|
|
284
|
+
process.exit(1);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
program.command("rules").argument("<string>", "xlsx compile rules setting").option("-t,--type <string>", "xlsx compile rule type <cell,alias,rowCell,mergeCell> (optional when using -f)").option("-r,--rule <string>", "xlsx compile rule expr (can be specified multiple times)").option("-f,--file <string>", "read rules from file (format: <type> ruleExpr per line)").option("-s,--save <string>", "save compiled xlsx file to user dir").action(async (xlsxFile, options) => {
|
|
288
|
+
try {
|
|
289
|
+
console.log(chalk2.green("\u{1F4DD} Adding rule configuration..."));
|
|
290
|
+
const validTypes = ["cell", "alias", "rowCell", "mergeCell"];
|
|
291
|
+
let rules = [];
|
|
292
|
+
if (options.file) {
|
|
293
|
+
console.log(chalk2.gray(`Reading rules from file: ${options.file}`));
|
|
294
|
+
rules = await parseRulesFromFile(options.file);
|
|
295
|
+
console.log(chalk2.green(`\u2713 Loaded ${rules.length} rules from file`));
|
|
296
|
+
} else if (options.rule) {
|
|
297
|
+
const ruleArray = Array.isArray(options.rule) ? options.rule : [options.rule];
|
|
298
|
+
if (options.type) {
|
|
299
|
+
if (!validTypes.includes(options.type)) {
|
|
300
|
+
console.error(chalk2.red(`Invalid rule type: ${options.type}. Must be one of: ${validTypes.join(", ")}`));
|
|
301
|
+
process.exit(1);
|
|
302
|
+
}
|
|
303
|
+
for (const rule of ruleArray) {
|
|
304
|
+
rules.push({ type: options.type, rule });
|
|
305
|
+
}
|
|
306
|
+
} else {
|
|
307
|
+
console.error(chalk2.red("Error: -t,--type is required when using -r,--rule"));
|
|
308
|
+
process.exit(1);
|
|
309
|
+
}
|
|
310
|
+
console.log(chalk2.green(`\u2713 Loaded ${rules.length} rules from command line`));
|
|
311
|
+
} else {
|
|
312
|
+
console.error(chalk2.red("Error: Either -f,--file or -r,--rule must be specified"));
|
|
313
|
+
process.exit(1);
|
|
314
|
+
}
|
|
315
|
+
if (rules.length === 0) {
|
|
316
|
+
console.error(chalk2.red("Error: No rules to add"));
|
|
317
|
+
process.exit(1);
|
|
318
|
+
}
|
|
319
|
+
const filePath = await resolveFilePath(xlsxFile);
|
|
320
|
+
console.log(chalk2.gray(`Loading file: ${filePath}`));
|
|
321
|
+
const buffer = await fs2.readFile(filePath);
|
|
322
|
+
const updatedBuffer = await addMultipleRulesToSheet(buffer, rules);
|
|
323
|
+
const outputFile = options.save || path2.join(process.cwd(), generateOutputFilename(xlsxFile));
|
|
324
|
+
console.log(chalk2.gray(`Saving to: ${outputFile}`));
|
|
325
|
+
await fs2.writeFile(outputFile, updatedBuffer);
|
|
326
|
+
console.log(chalk2.green("\u2713 All rules added successfully!"));
|
|
327
|
+
console.log(chalk2.green(`\u{1F4C1} Output: ${outputFile}`));
|
|
328
|
+
} catch (error) {
|
|
329
|
+
console.error(chalk2.red("\u2717 Failed to add rule configuration:"));
|
|
330
|
+
console.error(chalk2.red(error instanceof Error ? error.message : String(error)));
|
|
331
|
+
process.exit(1);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
program.parse(process.argv);
|
|
335
|
+
}
|
|
336
|
+
main().catch((error) => {
|
|
337
|
+
console.error(chalk2.red("\u2717 Fatal error:"));
|
|
338
|
+
console.error(chalk2.red(error instanceof Error ? error.message : String(error)));
|
|
339
|
+
process.exit(1);
|
|
19
340
|
});
|
|
20
|
-
program.parse(process.argv);
|
|
21
341
|
//# sourceMappingURL=bin.mjs.map
|
package/dist/bin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\nimport {Command} from 'commander';\nimport * as engine from './index';\n\nconst program = new Command();\nprogram\n .name('xlsx-cli')\n .version('1.0.0');\n\nprogram.command('compile')\n .argument('<string>', \"xlsx file path\")\n .option('-s,--save <string>', \"save compiled xlsx file to user dir\")\n .option('-r,--remove', 'remove configure rules sheet', false)\n .action((cmd: Command, xlsxFile: string, options: { [key: string]: any }) => {\n const resolver = engine.ExprResolver;\n console.log(chalk.green('xlsxFile %s'),xlsxFile);\n console.log(chalk.red('options %s'), options);\n });\n\nprogram.command(\"render\")\n .argument('<string>', \"xlsx file path\")\n .option('-c,--compile', \"auto compile flag\", false)\n .option('-s,--save <string>', \"save render xlsx file to user dir\")\n .action((cmd: Command, xlsxFile: string, options: { [key: string]: any }) => {\n console.log(chalk.green('xlsxFile %s'),xlsxFile);\n console.log(chalk.red('options %s'), options);\n });\n\nprogram.parse(process.argv);"],"mappings":";;;;;;AACA,OAAO,WAAW;AAClB,SAAQ,eAAc;AAGtB,IAAM,UAAU,IAAI,QAAQ;AAC5B,QACK,KAAK,UAAU,EACf,QAAQ,OAAO;AAEpB,QAAQ,QAAQ,SAAS,EACpB,SAAS,YAAY,gBAAgB,EACrC,OAAO,sBAAsB,qCAAqC,EAClE,OAAO,eAAe,gCAAgC,KAAK,EAC3D,OAAO,CAAC,KAAc,UAAkB,YAAoC;AACzE,QAAM,WAAkB;AACxB,UAAQ,IAAI,MAAM,MAAM,aAAa,GAAE,QAAQ;AAC/C,UAAQ,IAAI,MAAM,IAAI,YAAY,GAAG,OAAO;AAChD,CAAC;AAEL,QAAQ,QAAQ,QAAQ,EACnB,SAAS,YAAY,gBAAgB,EACrC,OAAO,gBAAgB,qBAAqB,KAAK,EACjD,OAAO,sBAAsB,mCAAmC,EAChE,OAAO,CAAC,KAAc,UAAkB,YAAoC;AACzE,UAAQ,IAAI,MAAM,MAAM,aAAa,GAAE,QAAQ;AAC/C,UAAQ,IAAI,MAAM,IAAI,YAAY,GAAG,OAAO;AAChD,CAAC;AAEL,QAAQ,MAAM,QAAQ,IAAI;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/bin.ts","../src/bin-helpers.ts"],"sourcesContent":["#!/usr/bin/env node\r\nimport chalk from 'chalk';\r\nimport {Command} from 'commander';\r\nimport * as fs from 'node:fs/promises';\r\nimport {existsSync} from 'node:fs';\r\nimport * as path from 'node:path';\r\nimport {\r\n XlsxRender,\r\n BufferType,\r\n compileAll,\r\n compileRuleSheetName,\r\n AutoOptions,\r\n} from './index';\r\nimport {\r\n generateOutputFilename,\r\n resolveFilePath,\r\n parseRenderData,\r\n checkSheetAndPlaceholders,\r\n addRuleToSheet,\r\n parseRulesFromFile,\r\n addMultipleRulesToSheet,\r\n} from './bin-helpers';\r\n\r\nasync function main() {\r\n // Load package.json version\r\n let version = '1.0.0';\r\n try {\r\n // Try multiple possible paths for package.json\r\n const possiblePaths = [\r\n path.join(process.cwd(), 'package.json'),\r\n path.join(process.cwd(), '..', 'package.json'),\r\n ];\r\n\r\n for (const packagePath of possiblePaths) {\r\n if (existsSync(packagePath)) {\r\n const packageJson = JSON.parse(await fs.readFile(packagePath, 'utf-8'));\r\n version = packageJson.version;\r\n break;\r\n }\r\n }\r\n } catch (e) {\r\n // Fallback to default version\r\n }\r\n\r\n // Load .env if exists\r\n const envPath = path.join(process.cwd(), '.env');\r\n if (existsSync(envPath)) {\r\n try {\r\n const dotenv = (await import('dotenv')).default;\r\n dotenv.config({debug: false, path: envPath});\r\n } catch (e) {\r\n // dotenv is optional\r\n }\r\n }\r\n\r\n const program = new Command();\r\n program\r\n .name('xlsx-cli')\r\n .version(version);\r\n\r\n// 编译存在规则的xlsx 输出 编译后带占位符 的 xlsx\r\n// 为指定 --sheet-name , 默认取 第一个 sheet 名称\r\n// 则自动寻找 export_metadata.config 配置文件,并进行编译替换到指定的sheet 文件中, 不存在则不进行编译\r\n// --remove 启用时,编译后的 xlsx 文件,移除 export_metadata.config 配置文件(可以调用ExprResolver.removeUnExportSheets)\r\n// 以上都成功 则 输出 渲染后的 xlsx 文件 , 有指定 --save 参数 则输出到指定目录,否则输出到当前目录\r\nprogram.command('compile')\r\n .argument('<string>', \"xlsx file path\")\r\n .option('-s,--save <string>', \"save compiled xlsx file to user dir\")\r\n .option('-n,--sheet-name <string>', \"compile xlsx sheet name when xlsx has multiple sheets\")\r\n .option('-r,--remove', 'remove configure rules sheet', false)\r\n .action(async (xlsxFile: string, options: { [key: string]: any }) => {\r\n try {\r\n console.log(chalk.green('📄 Compiling Excel file...'));\r\n\r\n // Resolve file path\r\n const filePath = await resolveFilePath(xlsxFile);\r\n console.log(chalk.gray(`Loading file: ${filePath}`));\r\n\r\n // Read file buffer\r\n const buffer = await fs.readFile(filePath);\r\n\r\n // Determine sheet name\r\n const xlsx = await XlsxRender.create(buffer);\r\n const sheets = xlsx.getSheets();\r\n const sheetName = options.sheetName || sheets[0].name;\r\n console.log(chalk.gray(`Target sheet: ${sheetName}`));\r\n\r\n // Check if rule sheet exists\r\n const ruleSheetName = options.sheetName || compileRuleSheetName;\r\n\r\n // Compile file\r\n console.log(chalk.gray('Compiling rules...'));\r\n const compiledBuffer = await compileAll(buffer, {\r\n sheetName: ruleSheetName,\r\n remove: options.remove || false,\r\n } as unknown as AutoOptions);\r\n console.log(chalk.green('✓ Compilation completed'));\r\n\r\n // Determine output path\r\n const outputFile = options.save || path.join(process.cwd(), generateOutputFilename(xlsxFile));\r\n console.log(chalk.gray(`Saving to: ${outputFile}`));\r\n\r\n // Write output file\r\n await fs.writeFile(outputFile, compiledBuffer);\r\n\r\n console.log(chalk.green('✓ Excel file compiled successfully!'));\r\n console.log(chalk.green(`📁 Output: ${outputFile}`));\r\n } catch (error) {\r\n console.error(chalk.red('✗ Compilation failed:'));\r\n console.error(chalk.red(error instanceof Error ? error.message : String(error)));\r\n process.exit(1);\r\n }\r\n });\r\n\r\n// 渲染占位符 xlsx template 文件\r\n// 为指定 --sheet-name , 默认取 第一个 sheet 名称\r\n// 检查 xlsx 对应 sheet 是否存在,检查 对应sheet 是否存在 变量占位符\r\n// 以上检查满足后 渲染 xlsx 文件,不满足 提示 无效的 xlsx 文件或者 sheet不存在\r\n// 渲染的 --data 参数支持 本地文件 json 文件/ json 字符串 / 远程 json 文件\r\n// --compile 参数开启, 则自动寻找 export_metadata.config 配置文件,并进行编译替换到指定的sheet 文件中, 不存在则不进行编译\r\n// 无编译 逻辑,则直接 解析 data 进行 xlsx sheet 渲染\r\n// 以上有任意异常,都输出异常提示 并终止 业务逻辑\r\n// 以上都成功 则 输出 渲染后的 xlsx 文件 , 有指定 --save 参数 则输出到指定目录,否则输出到当前目录\r\nprogram.command(\"render\")\r\n .argument('<string>', \"xlsx file path\")\r\n .option('-c,--compile', \"auto compile flag\", false)\r\n .option('-n,--sheet-name <string>', \"render xlsx sheet name when xlsx has multiple sheets\")\r\n .option('-s,--save <string>', \"save render xlsx file to user dir\")\r\n .option('-d,--data <string>', \"render xlsx file data from\")\r\n .action(async (xlsxFile: string, options: { [key: string]: any }) => {\r\n try {\r\n console.log(chalk.green('📄 Rendering Excel template...'));\r\n\r\n // Resolve file path\r\n const filePath = await resolveFilePath(xlsxFile);\r\n console.log(chalk.gray(`Loading file: ${filePath}`));\r\n\r\n // Read file buffer\r\n let buffer = await fs.readFile(filePath);\r\n\r\n // Determine sheet name\r\n let xlsx = await XlsxRender.create(buffer);\r\n const sheets = xlsx.getSheets();\r\n const sheetName = options.sheetName || sheets[0].name;\r\n console.log(chalk.gray(`Target sheet: ${sheetName}`));\r\n\r\n // Check sheet exists and has placeholders\r\n checkSheetAndPlaceholders(xlsx, sheetName);\r\n console.log(chalk.gray('Sheet validation passed'));\r\n\r\n // Parse render data\r\n const renderData = await parseRenderData(options.data);\r\n if (Object.keys(renderData).length > 0) {\r\n console.log(chalk.gray(`Render data loaded with ${Object.keys(renderData).length} keys`));\r\n }\r\n\r\n // Compile if needed\r\n if (options.compile) {\r\n console.log(chalk.gray('Auto-compiling rules...'));\r\n const ruleSheetName = options.sheetName || compileRuleSheetName;\r\n\r\n const compiledResult = await compileAll(buffer, {\r\n sheetName: ruleSheetName,\r\n remove: false, // Don't remove rule sheet during render\r\n } as unknown as AutoOptions);\r\n buffer = Buffer.from(compiledResult);\r\n xlsx = await XlsxRender.create(buffer);\r\n console.log(chalk.green('✓ Auto-compilation completed'));\r\n }\r\n\r\n // Render sheet\r\n console.log(chalk.gray('Rendering template...'));\r\n await xlsx.render(renderData, sheetName);\r\n\r\n // Generate output\r\n const outputBuffer = await xlsx.generate({\r\n type: BufferType.NodeBuffer,\r\n compression: \"DEFLATE\",\r\n compressionOptions: {\r\n level: 9\r\n }\r\n });\r\n\r\n // Determine output path\r\n const outputFile = options.save || path.join(process.cwd(), generateOutputFilename(xlsxFile));\r\n console.log(chalk.gray(`Saving to: ${outputFile}`));\r\n\r\n // Write output file\r\n await fs.writeFile(outputFile, outputBuffer);\r\n\r\n console.log(chalk.green('✓ Excel template rendered successfully!'));\r\n console.log(chalk.green(`📁 Output: ${outputFile}`));\r\n } catch (error) {\r\n console.error(chalk.red('✗ Rendering failed:'));\r\n console.error(chalk.red(error instanceof Error ? error.message : String(error)));\r\n process.exit(1);\r\n }\r\n });\r\n\r\n// 添加规则配置\r\n// xlsx 不存存在 export_metadata.config sheet 则添加\r\n// 检查 对应 配置 是否存在 , 如果不存在则添加\r\n// 对应 类型 type 规则添加 超过 4列就添加一行,到新行配置记录\r\n// 配置行 都是以 类型 type 值 开头的行 <cell,alias,rowCell,mergeCell>\r\n// 样式要求: type 值为 加粗 居中,配置等式 上下 居中,cell 宽 自适应\r\nprogram.command(\"rules\")\r\n .argument('<string>', \"xlsx compile rules setting\")\r\n .option('-t,--type <string>', \"xlsx compile rule type <cell,alias,rowCell,mergeCell> (optional when using -f)\")\r\n .option('-r,--rule <string>', \"xlsx compile rule expr (can be specified multiple times)\")\r\n .option('-f,--file <string>', \"read rules from file (format: <type> ruleExpr per line)\")\r\n .option('-s,--save <string>', \"save compiled xlsx file to user dir\")\r\n .action(async (xlsxFile: string, options: { [key: string]: any }) => {\r\n try {\r\n console.log(chalk.green('📝 Adding rule configuration...'));\r\n\r\n const validTypes = ['cell', 'alias', 'rowCell', 'mergeCell'];\r\n let rules: { type: string; rule: string }[] = [];\r\n\r\n // Mode 1: Read from file\r\n if (options.file) {\r\n console.log(chalk.gray(`Reading rules from file: ${options.file}`));\r\n rules = await parseRulesFromFile(options.file);\r\n console.log(chalk.green(`✓ Loaded ${rules.length} rules from file`));\r\n }\r\n // Mode 2: Read from command line\r\n else if (options.rule) {\r\n // Normalize to array if single rule\r\n const ruleArray = Array.isArray(options.rule) ? options.rule : [options.rule];\r\n\r\n // Validate type if specified\r\n if (options.type) {\r\n if (!validTypes.includes(options.type)) {\r\n console.error(chalk.red(`Invalid rule type: ${options.type}. Must be one of: ${validTypes.join(', ')}`));\r\n process.exit(1);\r\n }\r\n // Add all rules with same type\r\n for (const rule of ruleArray) {\r\n rules.push({ type: options.type, rule });\r\n }\r\n } else {\r\n console.error(chalk.red('Error: -t,--type is required when using -r,--rule'));\r\n process.exit(1);\r\n }\r\n console.log(chalk.green(`✓ Loaded ${rules.length} rules from command line`));\r\n } else {\r\n console.error(chalk.red('Error: Either -f,--file or -r,--rule must be specified'));\r\n process.exit(1);\r\n }\r\n\r\n if (rules.length === 0) {\r\n console.error(chalk.red('Error: No rules to add'));\r\n process.exit(1);\r\n }\r\n\r\n // Resolve file path\r\n const filePath = await resolveFilePath(xlsxFile);\r\n console.log(chalk.gray(`Loading file: ${filePath}`));\r\n\r\n // Read file buffer\r\n const buffer = await fs.readFile(filePath);\r\n\r\n // Add all rules to export_metadata.config sheet\r\n const updatedBuffer = await addMultipleRulesToSheet(buffer, rules);\r\n\r\n // Determine output path\r\n const outputFile = options.save || path.join(process.cwd(), generateOutputFilename(xlsxFile));\r\n console.log(chalk.gray(`Saving to: ${outputFile}`));\r\n\r\n // Write output file\r\n await fs.writeFile(outputFile, updatedBuffer);\r\n\r\n console.log(chalk.green('✓ All rules added successfully!'));\r\n console.log(chalk.green(`📁 Output: ${outputFile}`));\r\n } catch (error) {\r\n console.error(chalk.red('✗ Failed to add rule configuration:'));\r\n console.error(chalk.red(error instanceof Error ? error.message : String(error)));\r\n process.exit(1);\r\n }\r\n });\r\n\r\n program.parse(process.argv);\r\n}\r\n\r\nmain().catch(error => {\r\n console.error(chalk.red('✗ Fatal error:'));\r\n console.error(chalk.red(error instanceof Error ? error.message : String(error)));\r\n process.exit(1);\r\n});\r\n","import * as path from 'node:path';\r\nimport * as url from 'node:url';\r\nimport {existsSync} from 'node:fs';\r\nimport * as fs from 'node:fs/promises';\r\nimport {XlsxRender} from './biz';\r\nimport {loadWorkbook, parseWorkSheetRules, RuleToken} from './helper';\r\nimport exceljs from 'exceljs';\r\nimport chalk from 'chalk';\r\n\r\n/**\r\n * Helper function to generate output filename\r\n * Format: <basename>_<timestamp>.xlsx\r\n */\r\nexport function generateOutputFilename(inputFile: string): string {\r\n const basename = path.basename(inputFile, path.extname(inputFile));\r\n const timestamp = Date.now();\r\n return `${basename}_${timestamp}.xlsx`;\r\n}\r\n\r\n/**\r\n * Helper function to resolve file path\r\n * Tries absolute/relative to cwd, then script directory\r\n */\r\nexport async function resolveFilePath(filePath: string): Promise<string> {\r\n // Try as absolute or relative to cwd\r\n const resolvedPath = path.resolve(filePath);\r\n if (existsSync(resolvedPath)) {\r\n return resolvedPath;\r\n }\r\n // Try relative to script directory\r\n const scriptDir = path.dirname(url.fileURLToPath(import.meta.url));\r\n const relativePath = path.resolve(scriptDir, filePath);\r\n if (existsSync(relativePath)) {\r\n return relativePath;\r\n }\r\n throw new Error(`File not found: ${filePath}`);\r\n}\r\n\r\n/**\r\n * Helper function to parse render data\r\n * Supports: JSON string, file path, or URL\r\n */\r\nexport async function parseRenderData(dataOption: string | undefined): Promise<Record<string, any>> {\r\n if (!dataOption) {\r\n return {};\r\n }\r\n\r\n try {\r\n // Try as JSON string first\r\n return JSON.parse(dataOption);\r\n } catch (e) {\r\n // Try as file path\r\n try {\r\n const filePath = await resolveFilePath(dataOption);\r\n const fileContent = await fs.readFile(filePath, 'utf-8');\r\n return JSON.parse(fileContent);\r\n } catch (e2) {\r\n // Try as remote URL\r\n if (dataOption.startsWith('http://') || dataOption.startsWith('https://')) {\r\n let fetch;\r\n // Try to import fetch from native fetch (Node.js 18+) or node-fetch\r\n try {\r\n fetch = globalThis.fetch;\r\n } catch (e3) {\r\n try {\r\n // @ts-expect-error - node-fetch is optional dependency\r\n const nodeFetch = await import('node-fetch');\r\n fetch = nodeFetch.default;\r\n } catch (e4) {\r\n throw new Error('Remote URLs require Node.js 18+ or node-fetch package');\r\n }\r\n }\r\n const response = await fetch(dataOption);\r\n return response.json();\r\n }\r\n throw new Error(`Failed to parse render data from: ${dataOption}`);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Helper function to check sheet exists\r\n * Throws error if sheet not found\r\n */\r\nexport function checkSheetAndPlaceholders(xlsx: XlsxRender, sheetName: string): void {\r\n const sheets = xlsx.getSheets();\r\n const sheet = sheets.find(s => s.name === sheetName);\r\n\r\n if (!sheet) {\r\n throw new Error(`Sheet \"${sheetName}\" not found in Excel file`);\r\n }\r\n}\r\n\r\n/**\r\n * Helper function to add rule to export_metadata.config sheet\r\n * Creates sheet if not exists, adds rule with proper styling\r\n */\r\nexport async function addRuleToSheet(\r\n xlsxBuffer: Buffer,\r\n ruleType: string,\r\n ruleExpr: string,\r\n sheetName: string = 'export_metadata.config'\r\n): Promise<Buffer> {\r\n const workbook = await loadWorkbook(xlsxBuffer);\r\n let worksheet = workbook.getWorksheet(sheetName);\r\n\r\n // Create sheet if not exists\r\n if (!worksheet) {\r\n worksheet = workbook.addWorksheet(sheetName);\r\n console.log(chalk.gray(`Created new sheet: ${sheetName}`));\r\n }\r\n\r\n // Find the next available row for the given rule type\r\n let startRow = 1;\r\n let currentRow = 1;\r\n let columnCount = 0;\r\n\r\n // Scan existing rules to find where to add new rule\r\n worksheet.eachRow((row, rowNumber) => {\r\n const cell = row.getCell(1);\r\n const cellValue = cell.value?.toString().trim();\r\n\r\n // Skip empty rows\r\n if (!cellValue) {\r\n return;\r\n }\r\n\r\n // Check if this is our rule type row\r\n if (cellValue.toLowerCase() === ruleType.toLowerCase()) {\r\n // Check how many rules are in this row\r\n let col = 2;\r\n while (col <= 4) {\r\n const ruleCell = row.getCell(col);\r\n if (ruleCell.value) {\r\n columnCount++;\r\n }\r\n col++;\r\n }\r\n\r\n // If we have less than 4 rules, add to this row\r\n if (columnCount < 4) {\r\n currentRow = rowNumber;\r\n startRow = rowNumber;\r\n } else {\r\n // Need to create a new row\r\n currentRow = rowNumber + 1;\r\n }\r\n }\r\n });\r\n\r\n // If no existing rule type found, start from row 1\r\n if (startRow === 1 && currentRow === 1 && worksheet.rowCount === 0) {\r\n currentRow = 1;\r\n }\r\n\r\n // Ensure we have the target row\r\n let targetRow = worksheet.getRow(currentRow);\r\n if (!targetRow.getCell(1).value) {\r\n // New row - set the type header\r\n const typeCell = targetRow.getCell(1);\r\n typeCell.value = ruleType;\r\n typeCell.font = { bold: true };\r\n typeCell.alignment = { horizontal: 'center', vertical: 'middle' };\r\n }\r\n\r\n // Determine column to add rule (skip column 1 which contains type)\r\n let ruleCol = 2;\r\n while (ruleCol <= 4) {\r\n const existingCell = targetRow.getCell(ruleCol);\r\n if (!existingCell.value) {\r\n break;\r\n }\r\n ruleCol++;\r\n }\r\n\r\n // Add rule expression\r\n if (ruleCol <= 4) {\r\n const ruleCell = targetRow.getCell(ruleCol);\r\n ruleCell.value = ruleExpr;\r\n ruleCell.alignment = { vertical: 'middle' };\r\n\r\n // Auto-fit column width\r\n const column = worksheet.getColumn(ruleCol);\r\n column.width = Math.max(column.width || 10, ruleExpr.length + 2);\r\n\r\n console.log(chalk.gray(`Added rule ${ruleType} at row ${currentRow}, column ${ruleCol}`));\r\n } else {\r\n throw new Error(`Cannot add more than 4 rules for type: ${ruleType}`);\r\n }\r\n\r\n // Write buffer\r\n const buffer = await workbook.xlsx.writeBuffer();\r\n return Buffer.from(buffer);\r\n}\r\n\r\n/**\r\n * Helper function to parse rules from file\r\n * File format: <type> ruleExpr\r\n * Lines starting with # are treated as comments\r\n * @param filePath - Path to rules file\r\n * @returns Array of {type, rule} objects\r\n */\r\nexport async function parseRulesFromFile(filePath: string): Promise<{ type: string; rule: string }[]> {\r\n const resolvedPath = await resolveFilePath(filePath);\r\n const fileContent = await fs.readFile(resolvedPath, 'utf-8');\r\n const lines = fileContent.split('\\n');\r\n const rules: { type: string; rule: string }[] = [];\r\n const validTypes = ['cell', 'alias', 'rowCell', 'mergeCell'];\r\n\r\n for (let i = 0; i < lines.length; i++) {\r\n const line = lines[i].trim();\r\n\r\n // Skip empty lines and comments\r\n if (!line || line.startsWith('#')) {\r\n continue;\r\n }\r\n\r\n // Parse line: <type> ruleExpr\r\n const spaceIndex = line.indexOf(' ');\r\n if (spaceIndex === -1) {\r\n console.log(chalk.yellow(`⚠ Line ${i + 1}: Invalid format. Expected \"<type> ruleExpr\"`));\r\n continue;\r\n }\r\n\r\n const type = line.substring(0, spaceIndex).trim();\r\n const rule = line.substring(spaceIndex + 1).trim();\r\n\r\n if (!type || !rule) {\r\n console.log(chalk.yellow(`⚠ Line ${i + 1}: Invalid format. Expected \"<type> ruleExpr\"`));\r\n continue;\r\n }\r\n\r\n // Validate rule type\r\n if (!validTypes.includes(type)) {\r\n console.log(chalk.yellow(`⚠ Line ${i + 1}: Invalid rule type \"${type}\". Must be one of: ${validTypes.join(', ')}`));\r\n continue;\r\n }\r\n\r\n rules.push({ type, rule });\r\n }\r\n\r\n if (rules.length === 0) {\r\n throw new Error('No valid rules found in file');\r\n }\r\n\r\n return rules;\r\n}\r\n\r\n/**\r\n * Helper function to add multiple rules to sheet\r\n * @param xlsxBuffer - Excel file buffer\r\n * @param rules - Array of {type, rule} objects\r\n * @returns Updated Excel buffer\r\n */\r\nexport async function addMultipleRulesToSheet(\r\n xlsxBuffer: Buffer,\r\n rules: { type: string; rule: string }[]\r\n): Promise<Buffer> {\r\n let buffer = xlsxBuffer;\r\n\r\n for (const { type, rule } of rules) {\r\n console.log(chalk.gray(`Adding ${type} rule: ${rule}`));\r\n buffer = await addRuleToSheet(buffer, type, rule);\r\n }\r\n\r\n return buffer;\r\n}\r\n"],"mappings":";;;;;;;;;;AACA,OAAOA,YAAW;AAClB,SAAQ,eAAc;AACtB,YAAYC,SAAQ;AACpB,SAAQ,cAAAC,mBAAiB;AACzB,YAAYC,WAAU;;;ACLtB,YAAY,UAAU;AACtB,YAAY,SAAS;AACrB,SAAQ,kBAAiB;AACzB,YAAY,QAAQ;AAIpB,OAAO,WAAW;AAMX,SAAS,uBAAuB,WAA2B;AAC9D,QAAMC,YAAgB,cAAS,WAAgB,aAAQ,SAAS,CAAC;AACjE,QAAM,YAAY,KAAK,IAAI;AAC3B,SAAO,GAAGA,SAAQ,IAAI,SAAS;AACnC;AAMA,eAAsB,gBAAgB,UAAmC;AAErE,QAAM,eAAoB,aAAQ,QAAQ;AAC1C,MAAI,WAAW,YAAY,GAAG;AAC1B,WAAO;AAAA,EACX;AAEA,QAAM,YAAiB,aAAY,kBAAc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AAI,0CAAqC,CAAC;AAC9D,cAAQ,MAAMA,OAAM,IAAI,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,CAAC;AAC/E,cAAQ,KAAK,CAAC;AAAA,IAClB;AAAA,EACJ,CAAC;AAED,UAAQ,MAAM,QAAQ,IAAI;AAC9B;AAEA,KAAK,EAAE,MAAM,WAAS;AAClB,UAAQ,MAAMA,OAAM,IAAI,qBAAgB,CAAC;AACzC,UAAQ,MAAMA,OAAM,IAAI,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,CAAC;AAC/E,UAAQ,KAAK,CAAC;AAClB,CAAC;","names":["chalk","fs","existsSync","path","basename","existsSync","chalk"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
4
|
+
}) : x)(function(x) {
|
|
5
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
6
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
+
});
|
|
8
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
__require,
|
|
14
|
+
__commonJS
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=chunk-3GDQP6AS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -2966,6 +2966,14 @@ var resolveCompileMacroGen = (ctx, expr, currentCellIndex) => {
|
|
|
2966
2966
|
parts.push(resolveAliasExpr(ctx, item.value, currentCellIndex));
|
|
2967
2967
|
}
|
|
2968
2968
|
}
|
|
2969
|
+
if (parts.length === 1) {
|
|
2970
|
+
return parts[0];
|
|
2971
|
+
}
|
|
2972
|
+
let end = parts[parts.length - 1];
|
|
2973
|
+
if (end.startsWith('"') && end.length >= 3 && end.endsWith('"')) {
|
|
2974
|
+
join2 = end;
|
|
2975
|
+
return parts.slice(0, parts.length - 1).join(join2);
|
|
2976
|
+
}
|
|
2969
2977
|
return parts.join(join2);
|
|
2970
2978
|
};
|
|
2971
2979
|
var getExprEnd = function(macroExpr, matchIndex, rparenToken) {
|
|
@@ -3014,7 +3022,17 @@ var __codeKey = (str, expr) => {
|
|
|
3014
3022
|
return str.toUpperCase();
|
|
3015
3023
|
};
|
|
3016
3024
|
var __numberKey = (str, expr) => {
|
|
3017
|
-
|
|
3025
|
+
if (str === "NaN" || str === "Infinity" || str === "null" || str === "[object object]") {
|
|
3026
|
+
return str;
|
|
3027
|
+
}
|
|
3028
|
+
if (str.startsWith("0x")) {
|
|
3029
|
+
return str.substring(2);
|
|
3030
|
+
}
|
|
3031
|
+
let v = Number.parseInt(str, 10);
|
|
3032
|
+
if (isNaN(v)) {
|
|
3033
|
+
return str;
|
|
3034
|
+
}
|
|
3035
|
+
return v.toString();
|
|
3018
3036
|
};
|
|
3019
3037
|
var __codeAliasKey = (str, expr) => {
|
|
3020
3038
|
const key = __codeKey(str);
|
|
@@ -3643,7 +3661,7 @@ var fetchAlias = (m) => {
|
|
|
3643
3661
|
return alias;
|
|
3644
3662
|
};
|
|
3645
3663
|
var removeUnExportSheets = (w, options) => {
|
|
3646
|
-
|
|
3664
|
+
let removes = [];
|
|
3647
3665
|
if (typeof options.skipRemoveUnExportSheet === "boolean" && options.skipRemoveUnExportSheet === true) {
|
|
3648
3666
|
return w;
|
|
3649
3667
|
}
|
|
@@ -3661,6 +3679,9 @@ var removeUnExportSheets = (w, options) => {
|
|
|
3661
3679
|
}
|
|
3662
3680
|
}
|
|
3663
3681
|
}
|
|
3682
|
+
if (removes.length === w.worksheets.length && w.worksheets[0].name === removes[0]) {
|
|
3683
|
+
removes = removes.slice(1, removes.length);
|
|
3684
|
+
}
|
|
3664
3685
|
for (const [_, name] of removes.entries()) {
|
|
3665
3686
|
w.removeWorksheet(name);
|
|
3666
3687
|
}
|
|
@@ -4196,4 +4217,4 @@ export {
|
|
|
4196
4217
|
XlsxRender,
|
|
4197
4218
|
ZipXlsxTemplateApp
|
|
4198
4219
|
};
|
|
4199
|
-
//# sourceMappingURL=chunk-
|
|
4220
|
+
//# sourceMappingURL=chunk-NSFBG6PV.mjs.map
|