@vdhewei/xlsx-template-lib 1.6.5 → 1.6.6
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/bin.js +16 -3
- package/dist/bin.js.map +1 -1
- package/dist/bin.mjs +16 -3
- package/dist/bin.mjs.map +1 -1
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -4419,6 +4419,7 @@ async function parseRulesFromFile(filePath) {
|
|
|
4419
4419
|
const lines = fileContent.split("\n");
|
|
4420
4420
|
const rules = [];
|
|
4421
4421
|
const validTypes = ["cell", "alias", "rowCell", "mergeCell"];
|
|
4422
|
+
const validRulesSet = /* @__PURE__ */ new Set();
|
|
4422
4423
|
for (let i = 0; i < lines.length; i++) {
|
|
4423
4424
|
const line = lines[i].trim();
|
|
4424
4425
|
if (!line || line.startsWith("#")) {
|
|
@@ -4430,16 +4431,28 @@ async function parseRulesFromFile(filePath) {
|
|
|
4430
4431
|
continue;
|
|
4431
4432
|
}
|
|
4432
4433
|
const type = line.substring(0, spaceIndex).trim();
|
|
4433
|
-
const
|
|
4434
|
-
if (!type
|
|
4434
|
+
const items = line.substring(spaceIndex + 1).trim().split(" ");
|
|
4435
|
+
if (!type) {
|
|
4435
4436
|
console.log(import_chalk.default.yellow(`\u26A0 Line ${i + 1}: Invalid format. Expected "<type> ruleExpr"`));
|
|
4436
4437
|
continue;
|
|
4437
4438
|
}
|
|
4439
|
+
if (!items || items.length === 0) {
|
|
4440
|
+
continue;
|
|
4441
|
+
}
|
|
4438
4442
|
if (!validTypes.includes(type)) {
|
|
4439
4443
|
console.log(import_chalk.default.yellow(`\u26A0 Line ${i + 1}: Invalid rule type "${type}". Must be one of: ${validTypes.join(", ")}`));
|
|
4440
4444
|
continue;
|
|
4441
4445
|
}
|
|
4442
|
-
|
|
4446
|
+
for (const rule of items) {
|
|
4447
|
+
let str = rule.trim();
|
|
4448
|
+
let key = `${type}:${str}`;
|
|
4449
|
+
if (validRulesSet.has(key)) {
|
|
4450
|
+
console.log(import_chalk.default.yellow(`\u26A0 Line ${i + 1}: Duplicate rule "${str}"`));
|
|
4451
|
+
continue;
|
|
4452
|
+
}
|
|
4453
|
+
validRulesSet.add(key);
|
|
4454
|
+
rules.push({ type, rule: str });
|
|
4455
|
+
}
|
|
4443
4456
|
}
|
|
4444
4457
|
if (rules.length === 0) {
|
|
4445
4458
|
throw new Error("No valid rules found in file");
|