@nekosu/maa-checker 1.0.4 → 1.0.5
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.js +57 -5
- package/dist/main.js.map +2 -2
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -5834,7 +5834,7 @@ var InterfaceBundle = class extends import_node_events3.default {
|
|
|
5834
5834
|
// pkgs/maa-checker/package.json
|
|
5835
5835
|
var package_default = {
|
|
5836
5836
|
name: "@nekosu/maa-checker",
|
|
5837
|
-
version: "1.0.
|
|
5837
|
+
version: "1.0.5",
|
|
5838
5838
|
bin: {
|
|
5839
5839
|
"maa-checker": "bin/maa-checker"
|
|
5840
5840
|
},
|
|
@@ -5867,13 +5867,59 @@ function calucateLocation(content, offset) {
|
|
|
5867
5867
|
}
|
|
5868
5868
|
return [line + 1, offset - last];
|
|
5869
5869
|
}
|
|
5870
|
+
var allTypes = [
|
|
5871
|
+
"conflict-task",
|
|
5872
|
+
"duplicate-next",
|
|
5873
|
+
"unknown-task",
|
|
5874
|
+
"dynamic-image",
|
|
5875
|
+
"image-path-back-slash",
|
|
5876
|
+
"image-path-dot-slash",
|
|
5877
|
+
"image-path-missing-png",
|
|
5878
|
+
"unknown-image",
|
|
5879
|
+
"unknown-anchor",
|
|
5880
|
+
"unknown-attr",
|
|
5881
|
+
"int-conflict-controller",
|
|
5882
|
+
"int-unknown-controller",
|
|
5883
|
+
"int-conflict-resource",
|
|
5884
|
+
"int-unknown-resource",
|
|
5885
|
+
"int-conflict-option",
|
|
5886
|
+
"int-unknown-option",
|
|
5887
|
+
"int-conflict-case",
|
|
5888
|
+
"int-unknown-case",
|
|
5889
|
+
"int-switch-name-invalid",
|
|
5890
|
+
"int-switch-missing",
|
|
5891
|
+
"int-switch-should-fixed",
|
|
5892
|
+
"int-unknown-entry-task",
|
|
5893
|
+
"int-override-unknown-task"
|
|
5894
|
+
];
|
|
5870
5895
|
async function main() {
|
|
5871
5896
|
if (process.argv.length < 3) {
|
|
5872
|
-
console.log(`Usage: npx ${package_default.name} <interface path> [
|
|
5897
|
+
console.log(`Usage: npx ${package_default.name} <interface path> [options...]
|
|
5898
|
+
|
|
5899
|
+
Options:
|
|
5900
|
+
--raw Output diagnostic json only
|
|
5901
|
+
--github=<repo> Output github actions compatible warning & error messages, with repository folder <repo>.
|
|
5902
|
+
--ignore=<type> Ignore <type>
|
|
5903
|
+
Known types: ${allTypes.join(", ")}
|
|
5904
|
+
`);
|
|
5873
5905
|
process.exit(1);
|
|
5874
5906
|
}
|
|
5875
5907
|
const interfacePath = path5.resolve(process.argv[2]);
|
|
5876
|
-
|
|
5908
|
+
let rawMode = false;
|
|
5909
|
+
let githubMode = false;
|
|
5910
|
+
let repoFolder = process.cwd();
|
|
5911
|
+
const ignoreTypes = [];
|
|
5912
|
+
rawMode = process.argv[3] === "--raw";
|
|
5913
|
+
for (const opt of process.argv.slice(3)) {
|
|
5914
|
+
if (opt === "--raw") {
|
|
5915
|
+
rawMode = true;
|
|
5916
|
+
} else if (opt.startsWith("--github=")) {
|
|
5917
|
+
githubMode = true;
|
|
5918
|
+
repoFolder = path5.resolve(opt.slice("--github=".length));
|
|
5919
|
+
} else if (opt.startsWith("--ignore=")) {
|
|
5920
|
+
ignoreTypes.push(opt.slice("--ignore=".length));
|
|
5921
|
+
}
|
|
5922
|
+
}
|
|
5877
5923
|
const bundle = new InterfaceBundle(
|
|
5878
5924
|
new FsContentLoader(),
|
|
5879
5925
|
new FsContentWatcher(),
|
|
@@ -5897,7 +5943,7 @@ async function main() {
|
|
|
5897
5943
|
await new Promise((resolve4) => {
|
|
5898
5944
|
bundle.once("bundleReloaded", resolve4);
|
|
5899
5945
|
});
|
|
5900
|
-
const diags = performDiagnostic(bundle);
|
|
5946
|
+
const diags = performDiagnostic(bundle).filter((diag) => !ignoreTypes.includes(diag.type));
|
|
5901
5947
|
outputs.push(...diags);
|
|
5902
5948
|
if (rawMode) {
|
|
5903
5949
|
continue;
|
|
@@ -6008,7 +6054,13 @@ async function main() {
|
|
|
6008
6054
|
brief = `Overriding Unknown task \`${diag.task}\``;
|
|
6009
6055
|
break;
|
|
6010
6056
|
}
|
|
6011
|
-
|
|
6057
|
+
if (githubMode) {
|
|
6058
|
+
console.log(
|
|
6059
|
+
`::${level} file=${path5.relative(repoFolder, diag.file)},line=${line},endLine=${line},col=${col},endColumn=${col + diag.length}::${brief}`
|
|
6060
|
+
);
|
|
6061
|
+
} else {
|
|
6062
|
+
console.log(` ${level} ${relative5}:${line}:${col} ${brief}`);
|
|
6063
|
+
}
|
|
6012
6064
|
}
|
|
6013
6065
|
}
|
|
6014
6066
|
if (rawMode) {
|