@metamask/snaps-utils 11.4.0 → 11.5.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.
Files changed (130) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/dist/base64.cjs +3 -2
  3. package/dist/base64.cjs.map +1 -1
  4. package/dist/base64.d.cts.map +1 -1
  5. package/dist/base64.d.mts.map +1 -1
  6. package/dist/base64.mjs +3 -2
  7. package/dist/base64.mjs.map +1 -1
  8. package/dist/manifest/manifest.cjs +9 -5
  9. package/dist/manifest/manifest.cjs.map +1 -1
  10. package/dist/manifest/manifest.d.cts.map +1 -1
  11. package/dist/manifest/manifest.d.mts.map +1 -1
  12. package/dist/manifest/manifest.mjs +9 -5
  13. package/dist/manifest/manifest.mjs.map +1 -1
  14. package/dist/manifest/validator-types.cjs.map +1 -1
  15. package/dist/manifest/validator-types.d.cts +4 -2
  16. package/dist/manifest/validator-types.d.cts.map +1 -1
  17. package/dist/manifest/validator-types.d.mts +4 -2
  18. package/dist/manifest/validator-types.d.mts.map +1 -1
  19. package/dist/manifest/validator-types.mjs.map +1 -1
  20. package/dist/manifest/validator.cjs +11 -2
  21. package/dist/manifest/validator.cjs.map +1 -1
  22. package/dist/manifest/validator.d.cts.map +1 -1
  23. package/dist/manifest/validator.d.mts.map +1 -1
  24. package/dist/manifest/validator.mjs +11 -2
  25. package/dist/manifest/validator.mjs.map +1 -1
  26. package/dist/manifest/validators/checksum.cjs +1 -1
  27. package/dist/manifest/validators/checksum.cjs.map +1 -1
  28. package/dist/manifest/validators/checksum.d.cts.map +1 -1
  29. package/dist/manifest/validators/checksum.d.mts.map +1 -1
  30. package/dist/manifest/validators/checksum.mjs +1 -1
  31. package/dist/manifest/validators/checksum.mjs.map +1 -1
  32. package/dist/manifest/validators/expected-files.cjs +1 -1
  33. package/dist/manifest/validators/expected-files.cjs.map +1 -1
  34. package/dist/manifest/validators/expected-files.d.cts.map +1 -1
  35. package/dist/manifest/validators/expected-files.d.mts.map +1 -1
  36. package/dist/manifest/validators/expected-files.mjs +1 -1
  37. package/dist/manifest/validators/expected-files.mjs.map +1 -1
  38. package/dist/manifest/validators/icon-declared.cjs +1 -1
  39. package/dist/manifest/validators/icon-declared.cjs.map +1 -1
  40. package/dist/manifest/validators/icon-declared.d.cts.map +1 -1
  41. package/dist/manifest/validators/icon-declared.d.mts.map +1 -1
  42. package/dist/manifest/validators/icon-declared.mjs +1 -1
  43. package/dist/manifest/validators/icon-declared.mjs.map +1 -1
  44. package/dist/manifest/validators/icon-dimensions.cjs +1 -1
  45. package/dist/manifest/validators/icon-dimensions.cjs.map +1 -1
  46. package/dist/manifest/validators/icon-dimensions.d.cts.map +1 -1
  47. package/dist/manifest/validators/icon-dimensions.d.mts.map +1 -1
  48. package/dist/manifest/validators/icon-dimensions.mjs +1 -1
  49. package/dist/manifest/validators/icon-dimensions.mjs.map +1 -1
  50. package/dist/manifest/validators/icon-missing.cjs +1 -1
  51. package/dist/manifest/validators/icon-missing.cjs.map +1 -1
  52. package/dist/manifest/validators/icon-missing.mjs +1 -1
  53. package/dist/manifest/validators/icon-missing.mjs.map +1 -1
  54. package/dist/manifest/validators/is-localization-file.cjs +1 -1
  55. package/dist/manifest/validators/is-localization-file.cjs.map +1 -1
  56. package/dist/manifest/validators/is-localization-file.d.cts.map +1 -1
  57. package/dist/manifest/validators/is-localization-file.d.mts.map +1 -1
  58. package/dist/manifest/validators/is-localization-file.mjs +1 -1
  59. package/dist/manifest/validators/is-localization-file.mjs.map +1 -1
  60. package/dist/manifest/validators/is-package-json.cjs +1 -1
  61. package/dist/manifest/validators/is-package-json.cjs.map +1 -1
  62. package/dist/manifest/validators/is-package-json.d.cts.map +1 -1
  63. package/dist/manifest/validators/is-package-json.d.mts.map +1 -1
  64. package/dist/manifest/validators/is-package-json.mjs +1 -1
  65. package/dist/manifest/validators/is-package-json.mjs.map +1 -1
  66. package/dist/manifest/validators/is-snap-icon.cjs +1 -1
  67. package/dist/manifest/validators/is-snap-icon.cjs.map +1 -1
  68. package/dist/manifest/validators/is-snap-icon.mjs +1 -1
  69. package/dist/manifest/validators/is-snap-icon.mjs.map +1 -1
  70. package/dist/manifest/validators/is-snap-manifest.cjs +1 -1
  71. package/dist/manifest/validators/is-snap-manifest.cjs.map +1 -1
  72. package/dist/manifest/validators/is-snap-manifest.d.cts.map +1 -1
  73. package/dist/manifest/validators/is-snap-manifest.d.mts.map +1 -1
  74. package/dist/manifest/validators/is-snap-manifest.mjs +1 -1
  75. package/dist/manifest/validators/is-snap-manifest.mjs.map +1 -1
  76. package/dist/manifest/validators/manifest-localization.cjs +1 -1
  77. package/dist/manifest/validators/manifest-localization.cjs.map +1 -1
  78. package/dist/manifest/validators/manifest-localization.d.cts.map +1 -1
  79. package/dist/manifest/validators/manifest-localization.d.mts.map +1 -1
  80. package/dist/manifest/validators/manifest-localization.mjs +1 -1
  81. package/dist/manifest/validators/manifest-localization.mjs.map +1 -1
  82. package/dist/manifest/validators/package-json-recommended-fields.cjs +1 -1
  83. package/dist/manifest/validators/package-json-recommended-fields.cjs.map +1 -1
  84. package/dist/manifest/validators/package-json-recommended-fields.d.cts.map +1 -1
  85. package/dist/manifest/validators/package-json-recommended-fields.d.mts.map +1 -1
  86. package/dist/manifest/validators/package-json-recommended-fields.mjs +1 -1
  87. package/dist/manifest/validators/package-json-recommended-fields.mjs.map +1 -1
  88. package/dist/manifest/validators/package-name-match.cjs +1 -1
  89. package/dist/manifest/validators/package-name-match.cjs.map +1 -1
  90. package/dist/manifest/validators/package-name-match.d.cts.map +1 -1
  91. package/dist/manifest/validators/package-name-match.d.mts.map +1 -1
  92. package/dist/manifest/validators/package-name-match.mjs +1 -1
  93. package/dist/manifest/validators/package-name-match.mjs.map +1 -1
  94. package/dist/manifest/validators/platform-version.cjs +2 -2
  95. package/dist/manifest/validators/platform-version.cjs.map +1 -1
  96. package/dist/manifest/validators/platform-version.d.cts.map +1 -1
  97. package/dist/manifest/validators/platform-version.d.mts.map +1 -1
  98. package/dist/manifest/validators/platform-version.mjs +2 -2
  99. package/dist/manifest/validators/platform-version.mjs.map +1 -1
  100. package/dist/manifest/validators/production-platform-version.cjs +1 -1
  101. package/dist/manifest/validators/production-platform-version.cjs.map +1 -1
  102. package/dist/manifest/validators/production-platform-version.d.cts.map +1 -1
  103. package/dist/manifest/validators/production-platform-version.d.mts.map +1 -1
  104. package/dist/manifest/validators/production-platform-version.mjs +1 -1
  105. package/dist/manifest/validators/production-platform-version.mjs.map +1 -1
  106. package/dist/manifest/validators/repository-match.cjs +1 -1
  107. package/dist/manifest/validators/repository-match.cjs.map +1 -1
  108. package/dist/manifest/validators/repository-match.d.cts.map +1 -1
  109. package/dist/manifest/validators/repository-match.d.mts.map +1 -1
  110. package/dist/manifest/validators/repository-match.mjs +1 -1
  111. package/dist/manifest/validators/repository-match.mjs.map +1 -1
  112. package/dist/manifest/validators/unused-exports.cjs +2 -2
  113. package/dist/manifest/validators/unused-exports.cjs.map +1 -1
  114. package/dist/manifest/validators/unused-exports.d.cts.map +1 -1
  115. package/dist/manifest/validators/unused-exports.d.mts.map +1 -1
  116. package/dist/manifest/validators/unused-exports.mjs +2 -2
  117. package/dist/manifest/validators/unused-exports.mjs.map +1 -1
  118. package/dist/manifest/validators/version-match.cjs +1 -1
  119. package/dist/manifest/validators/version-match.cjs.map +1 -1
  120. package/dist/manifest/validators/version-match.d.cts.map +1 -1
  121. package/dist/manifest/validators/version-match.d.mts.map +1 -1
  122. package/dist/manifest/validators/version-match.mjs +1 -1
  123. package/dist/manifest/validators/version-match.mjs.map +1 -1
  124. package/dist/platform-version.cjs.map +1 -1
  125. package/dist/platform-version.d.cts +2 -1
  126. package/dist/platform-version.d.cts.map +1 -1
  127. package/dist/platform-version.d.mts +2 -1
  128. package/dist/platform-version.d.mts.map +1 -1
  129. package/dist/platform-version.mjs.map +1 -1
  130. package/package.json +2 -2
@@ -13,12 +13,21 @@ class Context {
13
13
  constructor(options) {
14
14
  this.#options = options;
15
15
  }
16
- report(message, fix) {
16
+ /**
17
+ * Report a validation error or warning.
18
+ *
19
+ * @param id - The unique identifier for the report.
20
+ * @param message - The message describing the validation issue.
21
+ * @param fix - An optional fix function that can be used to automatically
22
+ * resolve the issue.
23
+ */
24
+ report(id, message, fix) {
17
25
  assert(this.#nextSeverity !== undefined);
18
26
  this.reports.push({
19
- severity: this.#nextSeverity,
27
+ id,
20
28
  message,
21
29
  fix,
30
+ severity: this.#nextSeverity,
22
31
  });
23
32
  }
24
33
  prepareForValidator(settings) {
@@ -1 +1 @@
1
- {"version":3,"file":"validator.mjs","sourceRoot":"","sources":["../../src/manifest/validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,wBAAwB;AAUzC,OAAO,KAAK,iBAAiB,+BAAqB;AAQlD,MAAM,OAAO;IACX,OAAO,GAAsB,EAAE,CAAC;IAEvB,QAAQ,GAA4B,EAAE,CAAC;IAEhD,aAAa,GAAuB,SAAS,CAAC;IAE9C;;;;;OAKG;IACH,YAAY,OAAgC;QAC1C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,OAAe,EAAE,GAAkB;QACxC,MAAM,CAAC,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC;QACzC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAChB,QAAQ,EAAE,IAAI,CAAC,aAAa;YAC5B,OAAO;YACP,GAAG;SACJ,CAAC,CAAC;IACL,CAAC;IAED,mBAAmB,CAAC,QAAyC;QAC3D,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC,QAAQ,CAAC;IACzC,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,iEAAiE;AACjE,8DAA8D;AAC9D,+BAA+B;AAC/B,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,KAA2B,EAC3B,QAAyB,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,EACzD,UAAmC,EAAE;IAErC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAErC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,mBAAmB,CAAC;YAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACtB,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC;IACJ,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,mBAAmB,CAAC;YAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC,KAAkB,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO;QACL,KAAK,EAAE,KAAkB;QACzB,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,MAAuB,EAAE,UAAoB;IAC3E,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,UAAU,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC;AAC7E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CACtB,OAAyB,EACzB,UAAoB;IAEpB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAC/E,CAAC","sourcesContent":["import { assert } from '@metamask/utils';\n\nimport type {\n ValidatorContext,\n ValidatorContextOptions,\n ValidatorFix,\n ValidatorMeta,\n ValidatorReport,\n ValidatorSeverity,\n} from './validator-types';\nimport * as defaultValidators from './validators';\nimport type { SnapFiles, UnvalidatedSnapFiles } from '../types';\n\nexport type ValidatorResults = {\n files?: SnapFiles;\n reports: ValidatorReport[];\n};\n\nclass Context implements ValidatorContext {\n reports: ValidatorReport[] = [];\n\n readonly #options: ValidatorContextOptions = {};\n\n #nextSeverity?: ValidatorSeverity = undefined;\n\n /**\n * Construct a new validator context.\n *\n * @param options - The options for the validator context.\n * @param options.exports - Exports detected by evaluating the bundle.\n */\n constructor(options: ValidatorContextOptions) {\n this.#options = options;\n }\n\n report(message: string, fix?: ValidatorFix): void {\n assert(this.#nextSeverity !== undefined);\n this.reports.push({\n severity: this.#nextSeverity,\n message,\n fix,\n });\n }\n\n prepareForValidator(settings: { severity: ValidatorSeverity }) {\n this.#nextSeverity = settings.severity;\n }\n\n get hasErrors() {\n return this.reports.some((report) => report.severity === 'error');\n }\n\n get options() {\n return this.#options;\n }\n}\n\n/**\n * Verify that snap files are completely valid.\n * First it runs validators on unparsed files to check structure.\n * Secondly it runs validators on parsed files to check semantics.\n *\n * @param files - All files required to run a snap.\n * @param rules - Validators to run.\n * @param options - Options for the validation.\n * @param options.exports - Exports detected by evaluating the bundle.\n * @returns The validation results.\n */\n// TODO(ritave): snap.manifest.json and package.json should check\n// json parsing as well instead of assuming it's\n// already parsed\nexport async function runValidators(\n files: UnvalidatedSnapFiles,\n rules: ValidatorMeta[] = Object.values(defaultValidators),\n options: ValidatorContextOptions = {},\n): Promise<ValidatorResults> {\n const context = new Context(options);\n\n for (const rule of rules) {\n context.prepareForValidator({\n severity: rule.severity,\n });\n await rule.structureCheck?.(files, context);\n }\n\n if (context.hasErrors) {\n return {\n reports: context.reports,\n };\n }\n\n for (const rule of rules) {\n context.prepareForValidator({\n severity: rule.severity,\n });\n await rule.semanticCheck?.(files as SnapFiles, context);\n }\n\n return {\n files: files as SnapFiles,\n reports: context.reports,\n };\n}\n\n/**\n * Check whether a report is fixable.\n *\n * @param report - The report to check.\n * @param errorsOnly - Whether to only consider errors for fixability.\n * @returns Whether the report is fixable.\n */\nexport function isReportFixable(report: ValidatorReport, errorsOnly?: boolean) {\n return Boolean(report.fix && (!errorsOnly || report.severity === 'error'));\n}\n\n/**\n * Get whether any reports has pending fixes.\n *\n * @param results - Results of the validation run.\n * @param errorsOnly - Whether to only consider errors for pending fixes.\n * @returns Whether there are fixes pending.\n */\nexport function hasFixes(\n results: ValidatorResults,\n errorsOnly?: boolean,\n): boolean {\n return results.reports.some((report) => isReportFixable(report, errorsOnly));\n}\n"]}
1
+ {"version":3,"file":"validator.mjs","sourceRoot":"","sources":["../../src/manifest/validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,wBAAwB;AAUzC,OAAO,KAAK,iBAAiB,+BAAqB;AAQlD,MAAM,OAAO;IACX,OAAO,GAAsB,EAAE,CAAC;IAEvB,QAAQ,GAA4B,EAAE,CAAC;IAEhD,aAAa,GAAuB,SAAS,CAAC;IAE9C;;;;;OAKG;IACH,YAAY,OAAgC;QAC1C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,EAAU,EAAE,OAAe,EAAE,GAAkB;QACpD,MAAM,CAAC,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC;QAEzC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAChB,EAAE;YACF,OAAO;YACP,GAAG;YACH,QAAQ,EAAE,IAAI,CAAC,aAAa;SAC7B,CAAC,CAAC;IACL,CAAC;IAED,mBAAmB,CAAC,QAAyC;QAC3D,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC,QAAQ,CAAC;IACzC,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,iEAAiE;AACjE,8DAA8D;AAC9D,+BAA+B;AAC/B,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,KAA2B,EAC3B,QAAyB,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,EACzD,UAAmC,EAAE;IAErC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAErC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,mBAAmB,CAAC;YAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACtB,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC;IACJ,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,mBAAmB,CAAC;YAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC,KAAkB,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO;QACL,KAAK,EAAE,KAAkB;QACzB,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,MAAuB,EAAE,UAAoB;IAC3E,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,UAAU,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC;AAC7E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CACtB,OAAyB,EACzB,UAAoB;IAEpB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAC/E,CAAC","sourcesContent":["import { assert } from '@metamask/utils';\n\nimport type {\n ValidatorContext,\n ValidatorContextOptions,\n ValidatorFix,\n ValidatorMeta,\n ValidatorReport,\n ValidatorSeverity,\n} from './validator-types';\nimport * as defaultValidators from './validators';\nimport type { SnapFiles, UnvalidatedSnapFiles } from '../types';\n\nexport type ValidatorResults = {\n files?: SnapFiles;\n reports: ValidatorReport[];\n};\n\nclass Context implements ValidatorContext {\n reports: ValidatorReport[] = [];\n\n readonly #options: ValidatorContextOptions = {};\n\n #nextSeverity?: ValidatorSeverity = undefined;\n\n /**\n * Construct a new validator context.\n *\n * @param options - The options for the validator context.\n * @param options.exports - Exports detected by evaluating the bundle.\n */\n constructor(options: ValidatorContextOptions) {\n this.#options = options;\n }\n\n /**\n * Report a validation error or warning.\n *\n * @param id - The unique identifier for the report.\n * @param message - The message describing the validation issue.\n * @param fix - An optional fix function that can be used to automatically\n * resolve the issue.\n */\n report(id: string, message: string, fix?: ValidatorFix): void {\n assert(this.#nextSeverity !== undefined);\n\n this.reports.push({\n id,\n message,\n fix,\n severity: this.#nextSeverity,\n });\n }\n\n prepareForValidator(settings: { severity: ValidatorSeverity }) {\n this.#nextSeverity = settings.severity;\n }\n\n get hasErrors() {\n return this.reports.some((report) => report.severity === 'error');\n }\n\n get options() {\n return this.#options;\n }\n}\n\n/**\n * Verify that snap files are completely valid.\n * First it runs validators on unparsed files to check structure.\n * Secondly it runs validators on parsed files to check semantics.\n *\n * @param files - All files required to run a snap.\n * @param rules - Validators to run.\n * @param options - Options for the validation.\n * @param options.exports - Exports detected by evaluating the bundle.\n * @returns The validation results.\n */\n// TODO(ritave): snap.manifest.json and package.json should check\n// json parsing as well instead of assuming it's\n// already parsed\nexport async function runValidators(\n files: UnvalidatedSnapFiles,\n rules: ValidatorMeta[] = Object.values(defaultValidators),\n options: ValidatorContextOptions = {},\n): Promise<ValidatorResults> {\n const context = new Context(options);\n\n for (const rule of rules) {\n context.prepareForValidator({\n severity: rule.severity,\n });\n\n await rule.structureCheck?.(files, context);\n }\n\n if (context.hasErrors) {\n return {\n reports: context.reports,\n };\n }\n\n for (const rule of rules) {\n context.prepareForValidator({\n severity: rule.severity,\n });\n\n await rule.semanticCheck?.(files as SnapFiles, context);\n }\n\n return {\n files: files as SnapFiles,\n reports: context.reports,\n };\n}\n\n/**\n * Check whether a report is fixable.\n *\n * @param report - The report to check.\n * @param errorsOnly - Whether to only consider errors for fixability.\n * @returns Whether the report is fixable.\n */\nexport function isReportFixable(report: ValidatorReport, errorsOnly?: boolean) {\n return Boolean(report.fix && (!errorsOnly || report.severity === 'error'));\n}\n\n/**\n * Get whether any reports has pending fixes.\n *\n * @param results - Results of the validation run.\n * @param errorsOnly - Whether to only consider errors for pending fixes.\n * @returns Whether there are fixes pending.\n */\nexport function hasFixes(\n results: ValidatorResults,\n errorsOnly?: boolean,\n): boolean {\n return results.reports.some((report) => isReportFixable(report, errorsOnly));\n}\n"]}
@@ -13,7 +13,7 @@ exports.checksum = {
13
13
  const gotChecksum = files.manifest.result.source.shasum;
14
14
  const expectedChecksum = await (0, snaps_1.getSnapChecksum)(fetchedFiles);
15
15
  if (gotChecksum !== expectedChecksum) {
16
- context.report(`"${types_1.NpmSnapFileNames.Manifest}" "shasum" field does not match computed shasum. Got "${gotChecksum}", expected "${expectedChecksum}".`, async ({ manifest }) => {
16
+ context.report('checksum', `"${types_1.NpmSnapFileNames.Manifest}" "shasum" field does not match computed shasum. Got "${gotChecksum}", expected "${expectedChecksum}".`, async ({ manifest }) => {
17
17
  manifest.source.shasum = expectedChecksum;
18
18
  return { manifest };
19
19
  });
@@ -1 +1 @@
1
- {"version":3,"file":"checksum.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/checksum.ts"],"names":[],"mappings":";;;AAAA,2CAA8C;AAE9C,2CAA+C;AAG/C;;GAEG;AACU,QAAA,QAAQ,GAAkB;IACrC,QAAQ,EAAE,OAAO;IACjB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO;QAChC,MAAM,YAAY,GAAqB,KAAK,CAAC;QAC7C,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QACxD,MAAM,gBAAgB,GAAG,MAAM,IAAA,uBAAe,EAAC,YAAY,CAAC,CAAC;QAC7D,IAAI,WAAW,KAAK,gBAAgB,EAAE,CAAC;YACrC,OAAO,CAAC,MAAM,CACZ,IAAI,wBAAgB,CAAC,QAAQ,yDAAyD,WAAW,gBAAgB,gBAAgB,IAAI,EACrI,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACrB,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,gBAAgB,CAAC;gBAC1C,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { getSnapChecksum } from '../../snaps';\nimport type { FetchedSnapFiles } from '../../types';\nimport { NpmSnapFileNames } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if the checksum in manifest matches computed value.\n */\nexport const checksum: ValidatorMeta = {\n severity: 'error',\n async semanticCheck(files, context) {\n const fetchedFiles: FetchedSnapFiles = files;\n const gotChecksum = files.manifest.result.source.shasum;\n const expectedChecksum = await getSnapChecksum(fetchedFiles);\n if (gotChecksum !== expectedChecksum) {\n context.report(\n `\"${NpmSnapFileNames.Manifest}\" \"shasum\" field does not match computed shasum. Got \"${gotChecksum}\", expected \"${expectedChecksum}\".`,\n async ({ manifest }) => {\n manifest.source.shasum = expectedChecksum;\n return { manifest };\n },\n );\n }\n },\n};\n"]}
1
+ {"version":3,"file":"checksum.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/checksum.ts"],"names":[],"mappings":";;;AAAA,2CAA8C;AAE9C,2CAA+C;AAG/C;;GAEG;AACU,QAAA,QAAQ,GAAkB;IACrC,QAAQ,EAAE,OAAO;IACjB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO;QAChC,MAAM,YAAY,GAAqB,KAAK,CAAC;QAC7C,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QACxD,MAAM,gBAAgB,GAAG,MAAM,IAAA,uBAAe,EAAC,YAAY,CAAC,CAAC;QAC7D,IAAI,WAAW,KAAK,gBAAgB,EAAE,CAAC;YACrC,OAAO,CAAC,MAAM,CACZ,UAAU,EACV,IAAI,wBAAgB,CAAC,QAAQ,yDAAyD,WAAW,gBAAgB,gBAAgB,IAAI,EACrI,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACrB,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,gBAAgB,CAAC;gBAC1C,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { getSnapChecksum } from '../../snaps';\nimport type { FetchedSnapFiles } from '../../types';\nimport { NpmSnapFileNames } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if the checksum in manifest matches computed value.\n */\nexport const checksum: ValidatorMeta = {\n severity: 'error',\n async semanticCheck(files, context) {\n const fetchedFiles: FetchedSnapFiles = files;\n const gotChecksum = files.manifest.result.source.shasum;\n const expectedChecksum = await getSnapChecksum(fetchedFiles);\n if (gotChecksum !== expectedChecksum) {\n context.report(\n 'checksum',\n `\"${NpmSnapFileNames.Manifest}\" \"shasum\" field does not match computed shasum. Got \"${gotChecksum}\", expected \"${expectedChecksum}\".`,\n async ({ manifest }) => {\n manifest.source.shasum = expectedChecksum;\n return { manifest };\n },\n );\n }\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"checksum.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/checksum.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,aAgBtB,CAAC"}
1
+ {"version":3,"file":"checksum.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/checksum.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,aAiBtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"checksum.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/checksum.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,aAgBtB,CAAC"}
1
+ {"version":3,"file":"checksum.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/checksum.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,aAiBtB,CAAC"}
@@ -10,7 +10,7 @@ export const checksum = {
10
10
  const gotChecksum = files.manifest.result.source.shasum;
11
11
  const expectedChecksum = await getSnapChecksum(fetchedFiles);
12
12
  if (gotChecksum !== expectedChecksum) {
13
- context.report(`"${NpmSnapFileNames.Manifest}" "shasum" field does not match computed shasum. Got "${gotChecksum}", expected "${expectedChecksum}".`, async ({ manifest }) => {
13
+ context.report('checksum', `"${NpmSnapFileNames.Manifest}" "shasum" field does not match computed shasum. Got "${gotChecksum}", expected "${expectedChecksum}".`, async ({ manifest }) => {
14
14
  manifest.source.shasum = expectedChecksum;
15
15
  return { manifest };
16
16
  });
@@ -1 +1 @@
1
- {"version":3,"file":"checksum.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/checksum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,wBAAoB;AAE9C,OAAO,EAAE,gBAAgB,EAAE,wBAAoB;AAG/C;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAkB;IACrC,QAAQ,EAAE,OAAO;IACjB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO;QAChC,MAAM,YAAY,GAAqB,KAAK,CAAC;QAC7C,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QACxD,MAAM,gBAAgB,GAAG,MAAM,eAAe,CAAC,YAAY,CAAC,CAAC;QAC7D,IAAI,WAAW,KAAK,gBAAgB,EAAE,CAAC;YACrC,OAAO,CAAC,MAAM,CACZ,IAAI,gBAAgB,CAAC,QAAQ,yDAAyD,WAAW,gBAAgB,gBAAgB,IAAI,EACrI,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACrB,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,gBAAgB,CAAC;gBAC1C,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { getSnapChecksum } from '../../snaps';\nimport type { FetchedSnapFiles } from '../../types';\nimport { NpmSnapFileNames } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if the checksum in manifest matches computed value.\n */\nexport const checksum: ValidatorMeta = {\n severity: 'error',\n async semanticCheck(files, context) {\n const fetchedFiles: FetchedSnapFiles = files;\n const gotChecksum = files.manifest.result.source.shasum;\n const expectedChecksum = await getSnapChecksum(fetchedFiles);\n if (gotChecksum !== expectedChecksum) {\n context.report(\n `\"${NpmSnapFileNames.Manifest}\" \"shasum\" field does not match computed shasum. Got \"${gotChecksum}\", expected \"${expectedChecksum}\".`,\n async ({ manifest }) => {\n manifest.source.shasum = expectedChecksum;\n return { manifest };\n },\n );\n }\n },\n};\n"]}
1
+ {"version":3,"file":"checksum.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/checksum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,wBAAoB;AAE9C,OAAO,EAAE,gBAAgB,EAAE,wBAAoB;AAG/C;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAkB;IACrC,QAAQ,EAAE,OAAO;IACjB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO;QAChC,MAAM,YAAY,GAAqB,KAAK,CAAC;QAC7C,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QACxD,MAAM,gBAAgB,GAAG,MAAM,eAAe,CAAC,YAAY,CAAC,CAAC;QAC7D,IAAI,WAAW,KAAK,gBAAgB,EAAE,CAAC;YACrC,OAAO,CAAC,MAAM,CACZ,UAAU,EACV,IAAI,gBAAgB,CAAC,QAAQ,yDAAyD,WAAW,gBAAgB,gBAAgB,IAAI,EACrI,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACrB,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,gBAAgB,CAAC;gBAC1C,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { getSnapChecksum } from '../../snaps';\nimport type { FetchedSnapFiles } from '../../types';\nimport { NpmSnapFileNames } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if the checksum in manifest matches computed value.\n */\nexport const checksum: ValidatorMeta = {\n severity: 'error',\n async semanticCheck(files, context) {\n const fetchedFiles: FetchedSnapFiles = files;\n const gotChecksum = files.manifest.result.source.shasum;\n const expectedChecksum = await getSnapChecksum(fetchedFiles);\n if (gotChecksum !== expectedChecksum) {\n context.report(\n 'checksum',\n `\"${NpmSnapFileNames.Manifest}\" \"shasum\" field does not match computed shasum. Got \"${gotChecksum}\", expected \"${expectedChecksum}\".`,\n async ({ manifest }) => {\n manifest.source.shasum = expectedChecksum;\n return { manifest };\n },\n );\n }\n },\n};\n"]}
@@ -16,7 +16,7 @@ exports.expectedFiles = {
16
16
  structureCheck(files, context) {
17
17
  for (const expectedFile of EXPECTED_SNAP_FILES) {
18
18
  if (!files[expectedFile]) {
19
- context.report(`Missing file "${SnapFileNameFromKey[expectedFile]}".`);
19
+ context.report(`expected-files-${expectedFile}`, `Missing file "${SnapFileNameFromKey[expectedFile]}".`);
20
20
  }
21
21
  }
22
22
  },
@@ -1 +1 @@
1
- {"version":3,"file":"expected-files.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/expected-files.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAG/C,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,aAAa,EAAE,YAAY,CAAU,CAAC;AAE/E,MAAM,mBAAmB,GAAG;IAC1B,QAAQ,EAAE,wBAAgB,CAAC,QAAQ;IACnC,WAAW,EAAE,wBAAgB,CAAC,WAAW;IACzC,UAAU,EAAE,oBAAoB;CACxB,CAAC;AAEX;;GAEG;AACU,QAAA,aAAa,GAAkB;IAC1C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,KAAK,MAAM,YAAY,IAAI,mBAAmB,EAAE,CAAC;YAC/C,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;gBACzB,OAAO,CAAC,MAAM,CAAC,iBAAiB,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { NpmSnapFileNames } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\nconst EXPECTED_SNAP_FILES = ['manifest', 'packageJson', 'sourceCode'] as const;\n\nconst SnapFileNameFromKey = {\n manifest: NpmSnapFileNames.Manifest,\n packageJson: NpmSnapFileNames.PackageJson,\n sourceCode: 'source code bundle',\n} as const;\n\n/**\n * Check if all the required files are included.\n */\nexport const expectedFiles: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n for (const expectedFile of EXPECTED_SNAP_FILES) {\n if (!files[expectedFile]) {\n context.report(`Missing file \"${SnapFileNameFromKey[expectedFile]}\".`);\n }\n }\n },\n};\n"]}
1
+ {"version":3,"file":"expected-files.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/expected-files.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAG/C,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,aAAa,EAAE,YAAY,CAAU,CAAC;AAE/E,MAAM,mBAAmB,GAAG;IAC1B,QAAQ,EAAE,wBAAgB,CAAC,QAAQ;IACnC,WAAW,EAAE,wBAAgB,CAAC,WAAW;IACzC,UAAU,EAAE,oBAAoB;CACxB,CAAC;AAEX;;GAEG;AACU,QAAA,aAAa,GAAkB;IAC1C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,KAAK,MAAM,YAAY,IAAI,mBAAmB,EAAE,CAAC;YAC/C,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;gBACzB,OAAO,CAAC,MAAM,CACZ,kBAAkB,YAAY,EAAE,EAChC,iBAAiB,mBAAmB,CAAC,YAAY,CAAC,IAAI,CACvD,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { NpmSnapFileNames } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\nconst EXPECTED_SNAP_FILES = ['manifest', 'packageJson', 'sourceCode'] as const;\n\nconst SnapFileNameFromKey = {\n manifest: NpmSnapFileNames.Manifest,\n packageJson: NpmSnapFileNames.PackageJson,\n sourceCode: 'source code bundle',\n} as const;\n\n/**\n * Check if all the required files are included.\n */\nexport const expectedFiles: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n for (const expectedFile of EXPECTED_SNAP_FILES) {\n if (!files[expectedFile]) {\n context.report(\n `expected-files-${expectedFile}`,\n `Missing file \"${SnapFileNameFromKey[expectedFile]}\".`,\n );\n }\n }\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"expected-files.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/expected-files.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAUxD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,aAS3B,CAAC"}
1
+ {"version":3,"file":"expected-files.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/expected-files.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAUxD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,aAY3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"expected-files.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/expected-files.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAUxD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,aAS3B,CAAC"}
1
+ {"version":3,"file":"expected-files.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/expected-files.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAUxD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,aAY3B,CAAC"}
@@ -13,7 +13,7 @@ export const expectedFiles = {
13
13
  structureCheck(files, context) {
14
14
  for (const expectedFile of EXPECTED_SNAP_FILES) {
15
15
  if (!files[expectedFile]) {
16
- context.report(`Missing file "${SnapFileNameFromKey[expectedFile]}".`);
16
+ context.report(`expected-files-${expectedFile}`, `Missing file "${SnapFileNameFromKey[expectedFile]}".`);
17
17
  }
18
18
  }
19
19
  },
@@ -1 +1 @@
1
- {"version":3,"file":"expected-files.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/expected-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,wBAAoB;AAG/C,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,aAAa,EAAE,YAAY,CAAU,CAAC;AAE/E,MAAM,mBAAmB,GAAG;IAC1B,QAAQ,EAAE,gBAAgB,CAAC,QAAQ;IACnC,WAAW,EAAE,gBAAgB,CAAC,WAAW;IACzC,UAAU,EAAE,oBAAoB;CACxB,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAkB;IAC1C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,KAAK,MAAM,YAAY,IAAI,mBAAmB,EAAE,CAAC;YAC/C,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;gBACzB,OAAO,CAAC,MAAM,CAAC,iBAAiB,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { NpmSnapFileNames } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\nconst EXPECTED_SNAP_FILES = ['manifest', 'packageJson', 'sourceCode'] as const;\n\nconst SnapFileNameFromKey = {\n manifest: NpmSnapFileNames.Manifest,\n packageJson: NpmSnapFileNames.PackageJson,\n sourceCode: 'source code bundle',\n} as const;\n\n/**\n * Check if all the required files are included.\n */\nexport const expectedFiles: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n for (const expectedFile of EXPECTED_SNAP_FILES) {\n if (!files[expectedFile]) {\n context.report(`Missing file \"${SnapFileNameFromKey[expectedFile]}\".`);\n }\n }\n },\n};\n"]}
1
+ {"version":3,"file":"expected-files.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/expected-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,wBAAoB;AAG/C,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,aAAa,EAAE,YAAY,CAAU,CAAC;AAE/E,MAAM,mBAAmB,GAAG;IAC1B,QAAQ,EAAE,gBAAgB,CAAC,QAAQ;IACnC,WAAW,EAAE,gBAAgB,CAAC,WAAW;IACzC,UAAU,EAAE,oBAAoB;CACxB,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAkB;IAC1C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,KAAK,MAAM,YAAY,IAAI,mBAAmB,EAAE,CAAC;YAC/C,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;gBACzB,OAAO,CAAC,MAAM,CACZ,kBAAkB,YAAY,EAAE,EAChC,iBAAiB,mBAAmB,CAAC,YAAY,CAAC,IAAI,CACvD,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { NpmSnapFileNames } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\nconst EXPECTED_SNAP_FILES = ['manifest', 'packageJson', 'sourceCode'] as const;\n\nconst SnapFileNameFromKey = {\n manifest: NpmSnapFileNames.Manifest,\n packageJson: NpmSnapFileNames.PackageJson,\n sourceCode: 'source code bundle',\n} as const;\n\n/**\n * Check if all the required files are included.\n */\nexport const expectedFiles: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n for (const expectedFile of EXPECTED_SNAP_FILES) {\n if (!files[expectedFile]) {\n context.report(\n `expected-files-${expectedFile}`,\n `Missing file \"${SnapFileNameFromKey[expectedFile]}\".`,\n );\n }\n }\n },\n};\n"]}
@@ -8,7 +8,7 @@ exports.iconDeclared = {
8
8
  severity: 'warning',
9
9
  semanticCheck(files, context) {
10
10
  if (!files.manifest.result.source.location.npm.iconPath) {
11
- context.report('No icon found in the Snap manifest. It is recommended to include an icon for the Snap. See https://docs.metamask.io/snaps/how-to/design-a-snap/#guidelines-at-a-glance for more information.');
11
+ context.report('icon-declared', 'No icon found in the Snap manifest. It is recommended to include an icon for the Snap. See https://docs.metamask.io/snaps/how-to/design-a-snap/#guidelines-at-a-glance for more information.');
12
12
  }
13
13
  },
14
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"icon-declared.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/icon-declared.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,YAAY,GAAkB;IACzC,QAAQ,EAAE,SAAS;IACnB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;YACxD,OAAO,CAAC,MAAM,CACZ,8LAA8L,CAC/L,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type { ValidatorMeta } from '../validator-types';\n\n/**\n * Suggest including an icon if not found in manifest.\n */\nexport const iconDeclared: ValidatorMeta = {\n severity: 'warning',\n semanticCheck(files, context) {\n if (!files.manifest.result.source.location.npm.iconPath) {\n context.report(\n 'No icon found in the Snap manifest. It is recommended to include an icon for the Snap. See https://docs.metamask.io/snaps/how-to/design-a-snap/#guidelines-at-a-glance for more information.',\n );\n }\n },\n};\n"]}
1
+ {"version":3,"file":"icon-declared.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/icon-declared.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,YAAY,GAAkB;IACzC,QAAQ,EAAE,SAAS;IACnB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;YACxD,OAAO,CAAC,MAAM,CACZ,eAAe,EACf,8LAA8L,CAC/L,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type { ValidatorMeta } from '../validator-types';\n\n/**\n * Suggest including an icon if not found in manifest.\n */\nexport const iconDeclared: ValidatorMeta = {\n severity: 'warning',\n semanticCheck(files, context) {\n if (!files.manifest.result.source.location.npm.iconPath) {\n context.report(\n 'icon-declared',\n 'No icon found in the Snap manifest. It is recommended to include an icon for the Snap. See https://docs.metamask.io/snaps/how-to/design-a-snap/#guidelines-at-a-glance for more information.',\n );\n }\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"icon-declared.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/icon-declared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,aAS1B,CAAC"}
1
+ {"version":3,"file":"icon-declared.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/icon-declared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,aAU1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"icon-declared.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/icon-declared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,aAS1B,CAAC"}
1
+ {"version":3,"file":"icon-declared.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/icon-declared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,aAU1B,CAAC"}
@@ -5,7 +5,7 @@ export const iconDeclared = {
5
5
  severity: 'warning',
6
6
  semanticCheck(files, context) {
7
7
  if (!files.manifest.result.source.location.npm.iconPath) {
8
- context.report('No icon found in the Snap manifest. It is recommended to include an icon for the Snap. See https://docs.metamask.io/snaps/how-to/design-a-snap/#guidelines-at-a-glance for more information.');
8
+ context.report('icon-declared', 'No icon found in the Snap manifest. It is recommended to include an icon for the Snap. See https://docs.metamask.io/snaps/how-to/design-a-snap/#guidelines-at-a-glance for more information.');
9
9
  }
10
10
  },
11
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"icon-declared.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/icon-declared.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAkB;IACzC,QAAQ,EAAE,SAAS;IACnB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;YACxD,OAAO,CAAC,MAAM,CACZ,8LAA8L,CAC/L,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type { ValidatorMeta } from '../validator-types';\n\n/**\n * Suggest including an icon if not found in manifest.\n */\nexport const iconDeclared: ValidatorMeta = {\n severity: 'warning',\n semanticCheck(files, context) {\n if (!files.manifest.result.source.location.npm.iconPath) {\n context.report(\n 'No icon found in the Snap manifest. It is recommended to include an icon for the Snap. See https://docs.metamask.io/snaps/how-to/design-a-snap/#guidelines-at-a-glance for more information.',\n );\n }\n },\n};\n"]}
1
+ {"version":3,"file":"icon-declared.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/icon-declared.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAkB;IACzC,QAAQ,EAAE,SAAS;IACnB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;YACxD,OAAO,CAAC,MAAM,CACZ,eAAe,EACf,8LAA8L,CAC/L,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type { ValidatorMeta } from '../validator-types';\n\n/**\n * Suggest including an icon if not found in manifest.\n */\nexport const iconDeclared: ValidatorMeta = {\n severity: 'warning',\n semanticCheck(files, context) {\n if (!files.manifest.result.source.location.npm.iconPath) {\n context.report(\n 'icon-declared',\n 'No icon found in the Snap manifest. It is recommended to include an icon for the Snap. See https://docs.metamask.io/snaps/how-to/design-a-snap/#guidelines-at-a-glance for more information.',\n );\n }\n },\n};\n"]}
@@ -13,7 +13,7 @@ exports.iconDimensions = {
13
13
  }
14
14
  const dimensions = (0, icon_1.getSvgDimensions)(files.svgIcon.toString());
15
15
  if (dimensions && dimensions?.height !== dimensions.width) {
16
- context.report('The icon in the Snap manifest is not square. It is recommended to use a square icon for the Snap.');
16
+ context.report('icon-dimensions', 'The icon in the Snap manifest is not square. It is recommended to use a square icon for the Snap.');
17
17
  }
18
18
  },
19
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"icon-dimensions.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/icon-dimensions.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAG9C;;GAEG;AACU,QAAA,cAAc,GAAkB;IAC3C,QAAQ,EAAE,SAAS;IACnB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,MAAM,UAAU,GAAG,IAAA,uBAAgB,EAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9D,IAAI,UAAU,IAAI,UAAU,EAAE,MAAM,KAAK,UAAU,CAAC,KAAK,EAAE,CAAC;YAC1D,OAAO,CAAC,MAAM,CACZ,mGAAmG,CACpG,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { getSvgDimensions } from '../../icon';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the icon is square.\n */\nexport const iconDimensions: ValidatorMeta = {\n severity: 'warning',\n semanticCheck(files, context) {\n if (!files.svgIcon) {\n return;\n }\n\n const dimensions = getSvgDimensions(files.svgIcon.toString());\n if (dimensions && dimensions?.height !== dimensions.width) {\n context.report(\n 'The icon in the Snap manifest is not square. It is recommended to use a square icon for the Snap.',\n );\n }\n },\n};\n"]}
1
+ {"version":3,"file":"icon-dimensions.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/icon-dimensions.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAG9C;;GAEG;AACU,QAAA,cAAc,GAAkB;IAC3C,QAAQ,EAAE,SAAS;IACnB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,MAAM,UAAU,GAAG,IAAA,uBAAgB,EAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9D,IAAI,UAAU,IAAI,UAAU,EAAE,MAAM,KAAK,UAAU,CAAC,KAAK,EAAE,CAAC;YAC1D,OAAO,CAAC,MAAM,CACZ,iBAAiB,EACjB,mGAAmG,CACpG,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { getSvgDimensions } from '../../icon';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the icon is square.\n */\nexport const iconDimensions: ValidatorMeta = {\n severity: 'warning',\n semanticCheck(files, context) {\n if (!files.svgIcon) {\n return;\n }\n\n const dimensions = getSvgDimensions(files.svgIcon.toString());\n if (dimensions && dimensions?.height !== dimensions.width) {\n context.report(\n 'icon-dimensions',\n 'The icon in the Snap manifest is not square. It is recommended to use a square icon for the Snap.',\n );\n }\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"icon-dimensions.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/icon-dimensions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,aAc5B,CAAC"}
1
+ {"version":3,"file":"icon-dimensions.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/icon-dimensions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,aAe5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"icon-dimensions.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/icon-dimensions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,aAc5B,CAAC"}
1
+ {"version":3,"file":"icon-dimensions.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/icon-dimensions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,aAe5B,CAAC"}
@@ -10,7 +10,7 @@ export const iconDimensions = {
10
10
  }
11
11
  const dimensions = getSvgDimensions(files.svgIcon.toString());
12
12
  if (dimensions && dimensions?.height !== dimensions.width) {
13
- context.report('The icon in the Snap manifest is not square. It is recommended to use a square icon for the Snap.');
13
+ context.report('icon-dimensions', 'The icon in the Snap manifest is not square. It is recommended to use a square icon for the Snap.');
14
14
  }
15
15
  },
16
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"icon-dimensions.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/icon-dimensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,uBAAmB;AAG9C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC3C,QAAQ,EAAE,SAAS;IACnB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,MAAM,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9D,IAAI,UAAU,IAAI,UAAU,EAAE,MAAM,KAAK,UAAU,CAAC,KAAK,EAAE,CAAC;YAC1D,OAAO,CAAC,MAAM,CACZ,mGAAmG,CACpG,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { getSvgDimensions } from '../../icon';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the icon is square.\n */\nexport const iconDimensions: ValidatorMeta = {\n severity: 'warning',\n semanticCheck(files, context) {\n if (!files.svgIcon) {\n return;\n }\n\n const dimensions = getSvgDimensions(files.svgIcon.toString());\n if (dimensions && dimensions?.height !== dimensions.width) {\n context.report(\n 'The icon in the Snap manifest is not square. It is recommended to use a square icon for the Snap.',\n );\n }\n },\n};\n"]}
1
+ {"version":3,"file":"icon-dimensions.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/icon-dimensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,uBAAmB;AAG9C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC3C,QAAQ,EAAE,SAAS;IACnB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,MAAM,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9D,IAAI,UAAU,IAAI,UAAU,EAAE,MAAM,KAAK,UAAU,CAAC,KAAK,EAAE,CAAC;YAC1D,OAAO,CAAC,MAAM,CACZ,iBAAiB,EACjB,mGAAmG,CACpG,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { getSvgDimensions } from '../../icon';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the icon is square.\n */\nexport const iconDimensions: ValidatorMeta = {\n severity: 'warning',\n semanticCheck(files, context) {\n if (!files.svgIcon) {\n return;\n }\n\n const dimensions = getSvgDimensions(files.svgIcon.toString());\n if (dimensions && dimensions?.height !== dimensions.width) {\n context.report(\n 'icon-dimensions',\n 'The icon in the Snap manifest is not square. It is recommended to use a square icon for the Snap.',\n );\n }\n },\n};\n"]}
@@ -9,7 +9,7 @@ exports.iconMissing = {
9
9
  semanticCheck(files, context) {
10
10
  const { iconPath } = files.manifest.result.source.location.npm;
11
11
  if (iconPath && !files.svgIcon) {
12
- context.report(`Could not find icon "${iconPath}".`);
12
+ context.report('icon-missing', `Could not find icon "${iconPath}".`);
13
13
  }
14
14
  },
15
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"icon-missing.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/icon-missing.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,WAAW,GAAkB;IACxC,QAAQ,EAAE,OAAO;IACjB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC/D,IAAI,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YAC/B,OAAO,CAAC,MAAM,CAAC,wBAAwB,QAAQ,IAAI,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if declared icon exists on filesystem.\n */\nexport const iconMissing: ValidatorMeta = {\n severity: 'error',\n semanticCheck(files, context) {\n const { iconPath } = files.manifest.result.source.location.npm;\n if (iconPath && !files.svgIcon) {\n context.report(`Could not find icon \"${iconPath}\".`);\n }\n },\n};\n"]}
1
+ {"version":3,"file":"icon-missing.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/icon-missing.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,WAAW,GAAkB;IACxC,QAAQ,EAAE,OAAO;IACjB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC/D,IAAI,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YAC/B,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,wBAAwB,QAAQ,IAAI,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if declared icon exists on filesystem.\n */\nexport const iconMissing: ValidatorMeta = {\n severity: 'error',\n semanticCheck(files, context) {\n const { iconPath } = files.manifest.result.source.location.npm;\n if (iconPath && !files.svgIcon) {\n context.report('icon-missing', `Could not find icon \"${iconPath}\".`);\n }\n },\n};\n"]}
@@ -6,7 +6,7 @@ export const iconMissing = {
6
6
  semanticCheck(files, context) {
7
7
  const { iconPath } = files.manifest.result.source.location.npm;
8
8
  if (iconPath && !files.svgIcon) {
9
- context.report(`Could not find icon "${iconPath}".`);
9
+ context.report('icon-missing', `Could not find icon "${iconPath}".`);
10
10
  }
11
11
  },
12
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"icon-missing.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/icon-missing.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAkB;IACxC,QAAQ,EAAE,OAAO;IACjB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC/D,IAAI,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YAC/B,OAAO,CAAC,MAAM,CAAC,wBAAwB,QAAQ,IAAI,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if declared icon exists on filesystem.\n */\nexport const iconMissing: ValidatorMeta = {\n severity: 'error',\n semanticCheck(files, context) {\n const { iconPath } = files.manifest.result.source.location.npm;\n if (iconPath && !files.svgIcon) {\n context.report(`Could not find icon \"${iconPath}\".`);\n }\n },\n};\n"]}
1
+ {"version":3,"file":"icon-missing.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/icon-missing.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAkB;IACxC,QAAQ,EAAE,OAAO;IACjB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC/D,IAAI,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YAC/B,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,wBAAwB,QAAQ,IAAI,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if declared icon exists on filesystem.\n */\nexport const iconMissing: ValidatorMeta = {\n severity: 'error',\n semanticCheck(files, context) {\n const { iconPath } = files.manifest.result.source.location.npm;\n if (iconPath && !files.svgIcon) {\n context.report('icon-missing', `Could not find icon \"${iconPath}\".`);\n }\n },\n};\n"]}
@@ -14,7 +14,7 @@ exports.isLocalizationFile = {
14
14
  const [error] = (0, superstruct_1.validate)(file.result, localization_1.LocalizationFileStruct);
15
15
  if (error) {
16
16
  for (const failure of error.failures()) {
17
- context.report(`Failed to validate localization file "${file.path}": ${(0, structs_1.getStructFailureMessage)(localization_1.LocalizationFileStruct, failure, false)}`);
17
+ context.report(`is-localization-file-${file.path}-${failure.type}-${failure.path.join('-')}`, `Failed to validate localization file "${file.path}": ${(0, structs_1.getStructFailureMessage)(localization_1.LocalizationFileStruct, failure, false)}`);
18
18
  }
19
19
  }
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"is-localization-file.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-localization-file.ts"],"names":[],"mappings":";;;AAAA,uDAAiD;AAEjD,yDAA4D;AAC5D,+CAAwD;AAGxD;;GAEG;AACU,QAAA,kBAAkB,GAAkB;IAC/C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,GAAG,IAAA,sBAAQ,EAAC,IAAI,CAAC,MAAM,EAAE,qCAAsB,CAAC,CAAC;YAE9D,IAAI,KAAK,EAAE,CAAC;gBACV,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;oBACvC,OAAO,CAAC,MAAM,CACZ,yCACE,IAAI,CAAC,IACP,MAAM,IAAA,iCAAuB,EAC3B,qCAAsB,EACtB,OAAO,EACP,KAAK,CACN,EAAE,CACJ,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { validate } from '@metamask/superstruct';\n\nimport { LocalizationFileStruct } from '../../localization';\nimport { getStructFailureMessage } from '../../structs';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of localization files.\n */\nexport const isLocalizationFile: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n for (const file of files.localizationFiles) {\n const [error] = validate(file.result, LocalizationFileStruct);\n\n if (error) {\n for (const failure of error.failures()) {\n context.report(\n `Failed to validate localization file \"${\n file.path\n }\": ${getStructFailureMessage(\n LocalizationFileStruct,\n failure,\n false,\n )}`,\n );\n }\n }\n }\n },\n};\n"]}
1
+ {"version":3,"file":"is-localization-file.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-localization-file.ts"],"names":[],"mappings":";;;AAAA,uDAAiD;AAEjD,yDAA4D;AAC5D,+CAAwD;AAGxD;;GAEG;AACU,QAAA,kBAAkB,GAAkB;IAC/C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,GAAG,IAAA,sBAAQ,EAAC,IAAI,CAAC,MAAM,EAAE,qCAAsB,CAAC,CAAC;YAE9D,IAAI,KAAK,EAAE,CAAC;gBACV,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;oBACvC,OAAO,CAAC,MAAM,CACZ,wBAAwB,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAC7E,yCACE,IAAI,CAAC,IACP,MAAM,IAAA,iCAAuB,EAC3B,qCAAsB,EACtB,OAAO,EACP,KAAK,CACN,EAAE,CACJ,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { validate } from '@metamask/superstruct';\n\nimport { LocalizationFileStruct } from '../../localization';\nimport { getStructFailureMessage } from '../../structs';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of localization files.\n */\nexport const isLocalizationFile: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n for (const file of files.localizationFiles) {\n const [error] = validate(file.result, LocalizationFileStruct);\n\n if (error) {\n for (const failure of error.failures()) {\n context.report(\n `is-localization-file-${file.path}-${failure.type}-${failure.path.join('-')}`,\n `Failed to validate localization file \"${\n file.path\n }\": ${getStructFailureMessage(\n LocalizationFileStruct,\n failure,\n false,\n )}`,\n );\n }\n }\n }\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"is-localization-file.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/is-localization-file.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAqBhC,CAAC"}
1
+ {"version":3,"file":"is-localization-file.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/is-localization-file.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAsBhC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-localization-file.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/is-localization-file.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAqBhC,CAAC"}
1
+ {"version":3,"file":"is-localization-file.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/is-localization-file.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAsBhC,CAAC"}
@@ -11,7 +11,7 @@ export const isLocalizationFile = {
11
11
  const [error] = validate(file.result, LocalizationFileStruct);
12
12
  if (error) {
13
13
  for (const failure of error.failures()) {
14
- context.report(`Failed to validate localization file "${file.path}": ${getStructFailureMessage(LocalizationFileStruct, failure, false)}`);
14
+ context.report(`is-localization-file-${file.path}-${failure.type}-${failure.path.join('-')}`, `Failed to validate localization file "${file.path}": ${getStructFailureMessage(LocalizationFileStruct, failure, false)}`);
15
15
  }
16
16
  }
17
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"is-localization-file.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-localization-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,8BAA8B;AAEjD,OAAO,EAAE,sBAAsB,EAAE,+BAA2B;AAC5D,OAAO,EAAE,uBAAuB,EAAE,0BAAsB;AAGxD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAkB;IAC/C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;YAE9D,IAAI,KAAK,EAAE,CAAC;gBACV,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;oBACvC,OAAO,CAAC,MAAM,CACZ,yCACE,IAAI,CAAC,IACP,MAAM,uBAAuB,CAC3B,sBAAsB,EACtB,OAAO,EACP,KAAK,CACN,EAAE,CACJ,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { validate } from '@metamask/superstruct';\n\nimport { LocalizationFileStruct } from '../../localization';\nimport { getStructFailureMessage } from '../../structs';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of localization files.\n */\nexport const isLocalizationFile: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n for (const file of files.localizationFiles) {\n const [error] = validate(file.result, LocalizationFileStruct);\n\n if (error) {\n for (const failure of error.failures()) {\n context.report(\n `Failed to validate localization file \"${\n file.path\n }\": ${getStructFailureMessage(\n LocalizationFileStruct,\n failure,\n false,\n )}`,\n );\n }\n }\n }\n },\n};\n"]}
1
+ {"version":3,"file":"is-localization-file.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-localization-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,8BAA8B;AAEjD,OAAO,EAAE,sBAAsB,EAAE,+BAA2B;AAC5D,OAAO,EAAE,uBAAuB,EAAE,0BAAsB;AAGxD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAkB;IAC/C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;YAE9D,IAAI,KAAK,EAAE,CAAC;gBACV,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;oBACvC,OAAO,CAAC,MAAM,CACZ,wBAAwB,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAC7E,yCACE,IAAI,CAAC,IACP,MAAM,uBAAuB,CAC3B,sBAAsB,EACtB,OAAO,EACP,KAAK,CACN,EAAE,CACJ,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { validate } from '@metamask/superstruct';\n\nimport { LocalizationFileStruct } from '../../localization';\nimport { getStructFailureMessage } from '../../structs';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of localization files.\n */\nexport const isLocalizationFile: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n for (const file of files.localizationFiles) {\n const [error] = validate(file.result, LocalizationFileStruct);\n\n if (error) {\n for (const failure of error.failures()) {\n context.report(\n `is-localization-file-${file.path}-${failure.type}-${failure.path.join('-')}`,\n `Failed to validate localization file \"${\n file.path\n }\": ${getStructFailureMessage(\n LocalizationFileStruct,\n failure,\n false,\n )}`,\n );\n }\n }\n }\n },\n};\n"]}
@@ -16,7 +16,7 @@ exports.isPackageJson = {
16
16
  const [error] = (0, superstruct_1.validate)(files.packageJson.result, types_1.NpmSnapPackageJsonStruct);
17
17
  if (error) {
18
18
  for (const failure of error.failures()) {
19
- context.report(`"${types_1.NpmSnapFileNames.PackageJson}" is invalid: ${(0, structs_1.getStructFailureMessage)(types_1.NpmSnapPackageJsonStruct, failure, false)}`);
19
+ context.report(`is-package-json-${failure.type}-${failure.path.join('-')}`, `"${types_1.NpmSnapFileNames.PackageJson}" is invalid: ${(0, structs_1.getStructFailureMessage)(types_1.NpmSnapPackageJsonStruct, failure, false)}`);
20
20
  }
21
21
  }
22
22
  },
@@ -1 +1 @@
1
- {"version":3,"file":"is-package-json.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-package-json.ts"],"names":[],"mappings":";;;AAAA,uDAAiD;AAEjD,+CAAwD;AACxD,2CAAyE;AAGzE;;GAEG;AACU,QAAA,aAAa,GAAkB;IAC1C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YACvB,OAAO;QACT,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,GAAG,IAAA,sBAAQ,EACtB,KAAK,CAAC,WAAW,CAAC,MAAM,EACxB,gCAAwB,CACzB,CAAC;QACF,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACvC,OAAO,CAAC,MAAM,CACZ,IACE,wBAAgB,CAAC,WACnB,iBAAiB,IAAA,iCAAuB,EACtC,gCAAwB,EACxB,OAAO,EACP,KAAK,CACN,EAAE,CACJ,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { validate } from '@metamask/superstruct';\n\nimport { getStructFailureMessage } from '../../structs';\nimport { NpmSnapFileNames, NpmSnapPackageJsonStruct } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of package.json.\n */\nexport const isPackageJson: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n if (!files.packageJson) {\n return;\n }\n const [error] = validate(\n files.packageJson.result,\n NpmSnapPackageJsonStruct,\n );\n if (error) {\n for (const failure of error.failures()) {\n context.report(\n `\"${\n NpmSnapFileNames.PackageJson\n }\" is invalid: ${getStructFailureMessage(\n NpmSnapPackageJsonStruct,\n failure,\n false,\n )}`,\n );\n }\n }\n },\n};\n"]}
1
+ {"version":3,"file":"is-package-json.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-package-json.ts"],"names":[],"mappings":";;;AAAA,uDAAiD;AAEjD,+CAAwD;AACxD,2CAAyE;AAGzE;;GAEG;AACU,QAAA,aAAa,GAAkB;IAC1C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YACvB,OAAO;QACT,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,GAAG,IAAA,sBAAQ,EACtB,KAAK,CAAC,WAAW,CAAC,MAAM,EACxB,gCAAwB,CACzB,CAAC;QACF,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACvC,OAAO,CAAC,MAAM,CACZ,mBAAmB,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAC3D,IACE,wBAAgB,CAAC,WACnB,iBAAiB,IAAA,iCAAuB,EACtC,gCAAwB,EACxB,OAAO,EACP,KAAK,CACN,EAAE,CACJ,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { validate } from '@metamask/superstruct';\n\nimport { getStructFailureMessage } from '../../structs';\nimport { NpmSnapFileNames, NpmSnapPackageJsonStruct } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of package.json.\n */\nexport const isPackageJson: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n if (!files.packageJson) {\n return;\n }\n const [error] = validate(\n files.packageJson.result,\n NpmSnapPackageJsonStruct,\n );\n if (error) {\n for (const failure of error.failures()) {\n context.report(\n `is-package-json-${failure.type}-${failure.path.join('-')}`,\n `\"${\n NpmSnapFileNames.PackageJson\n }\" is invalid: ${getStructFailureMessage(\n NpmSnapPackageJsonStruct,\n failure,\n false,\n )}`,\n );\n }\n }\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"is-package-json.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/is-package-json.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,aAwB3B,CAAC"}
1
+ {"version":3,"file":"is-package-json.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/is-package-json.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,aAyB3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-package-json.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/is-package-json.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,aAwB3B,CAAC"}
1
+ {"version":3,"file":"is-package-json.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/is-package-json.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,aAyB3B,CAAC"}
@@ -13,7 +13,7 @@ export const isPackageJson = {
13
13
  const [error] = validate(files.packageJson.result, NpmSnapPackageJsonStruct);
14
14
  if (error) {
15
15
  for (const failure of error.failures()) {
16
- context.report(`"${NpmSnapFileNames.PackageJson}" is invalid: ${getStructFailureMessage(NpmSnapPackageJsonStruct, failure, false)}`);
16
+ context.report(`is-package-json-${failure.type}-${failure.path.join('-')}`, `"${NpmSnapFileNames.PackageJson}" is invalid: ${getStructFailureMessage(NpmSnapPackageJsonStruct, failure, false)}`);
17
17
  }
18
18
  }
19
19
  },
@@ -1 +1 @@
1
- {"version":3,"file":"is-package-json.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-package-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,8BAA8B;AAEjD,OAAO,EAAE,uBAAuB,EAAE,0BAAsB;AACxD,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,wBAAoB;AAGzE;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAkB;IAC1C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YACvB,OAAO;QACT,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CACtB,KAAK,CAAC,WAAW,CAAC,MAAM,EACxB,wBAAwB,CACzB,CAAC;QACF,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACvC,OAAO,CAAC,MAAM,CACZ,IACE,gBAAgB,CAAC,WACnB,iBAAiB,uBAAuB,CACtC,wBAAwB,EACxB,OAAO,EACP,KAAK,CACN,EAAE,CACJ,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { validate } from '@metamask/superstruct';\n\nimport { getStructFailureMessage } from '../../structs';\nimport { NpmSnapFileNames, NpmSnapPackageJsonStruct } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of package.json.\n */\nexport const isPackageJson: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n if (!files.packageJson) {\n return;\n }\n const [error] = validate(\n files.packageJson.result,\n NpmSnapPackageJsonStruct,\n );\n if (error) {\n for (const failure of error.failures()) {\n context.report(\n `\"${\n NpmSnapFileNames.PackageJson\n }\" is invalid: ${getStructFailureMessage(\n NpmSnapPackageJsonStruct,\n failure,\n false,\n )}`,\n );\n }\n }\n },\n};\n"]}
1
+ {"version":3,"file":"is-package-json.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-package-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,8BAA8B;AAEjD,OAAO,EAAE,uBAAuB,EAAE,0BAAsB;AACxD,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,wBAAoB;AAGzE;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAkB;IAC1C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YACvB,OAAO;QACT,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CACtB,KAAK,CAAC,WAAW,CAAC,MAAM,EACxB,wBAAwB,CACzB,CAAC;QACF,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACvC,OAAO,CAAC,MAAM,CACZ,mBAAmB,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAC3D,IACE,gBAAgB,CAAC,WACnB,iBAAiB,uBAAuB,CACtC,wBAAwB,EACxB,OAAO,EACP,KAAK,CACN,EAAE,CACJ,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { validate } from '@metamask/superstruct';\n\nimport { getStructFailureMessage } from '../../structs';\nimport { NpmSnapFileNames, NpmSnapPackageJsonStruct } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of package.json.\n */\nexport const isPackageJson: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n if (!files.packageJson) {\n return;\n }\n const [error] = validate(\n files.packageJson.result,\n NpmSnapPackageJsonStruct,\n );\n if (error) {\n for (const failure of error.failures()) {\n context.report(\n `is-package-json-${failure.type}-${failure.path.join('-')}`,\n `\"${\n NpmSnapFileNames.PackageJson\n }\" is invalid: ${getStructFailureMessage(\n NpmSnapPackageJsonStruct,\n failure,\n false,\n )}`,\n );\n }\n }\n },\n};\n"]}
@@ -17,7 +17,7 @@ exports.isSnapIcon = {
17
17
  }
18
18
  catch (error) {
19
19
  (0, utils_1.assert)(error instanceof Error);
20
- context.report(error.message);
20
+ context.report('is-snap-icon', error.message);
21
21
  }
22
22
  },
23
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"is-snap-icon.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-snap-icon.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAEzC,yCAA8C;AAG9C;;GAEG;AACU,QAAA,UAAU,GAAkB;IACvC,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,IAAA,uBAAgB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAA,cAAM,EAAC,KAAK,YAAY,KAAK,CAAC,CAAC;YAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { assert } from '@metamask/utils';\n\nimport { assertIsSnapIcon } from '../../icon';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of the snap icon.\n */\nexport const isSnapIcon: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n if (!files.svgIcon) {\n return;\n }\n\n try {\n assertIsSnapIcon(files.svgIcon);\n } catch (error) {\n assert(error instanceof Error);\n context.report(error.message);\n }\n },\n};\n"]}
1
+ {"version":3,"file":"is-snap-icon.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-snap-icon.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAEzC,yCAA8C;AAG9C;;GAEG;AACU,QAAA,UAAU,GAAkB;IACvC,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,IAAA,uBAAgB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAA,cAAM,EAAC,KAAK,YAAY,KAAK,CAAC,CAAC;YAC/B,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { assert } from '@metamask/utils';\n\nimport { assertIsSnapIcon } from '../../icon';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of the snap icon.\n */\nexport const isSnapIcon: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n if (!files.svgIcon) {\n return;\n }\n\n try {\n assertIsSnapIcon(files.svgIcon);\n } catch (error) {\n assert(error instanceof Error);\n context.report('is-snap-icon', error.message);\n }\n },\n};\n"]}
@@ -14,7 +14,7 @@ export const isSnapIcon = {
14
14
  }
15
15
  catch (error) {
16
16
  assert(error instanceof Error);
17
- context.report(error.message);
17
+ context.report('is-snap-icon', error.message);
18
18
  }
19
19
  },
20
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"is-snap-icon.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-snap-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,wBAAwB;AAEzC,OAAO,EAAE,gBAAgB,EAAE,uBAAmB;AAG9C;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAkB;IACvC,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC;YAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { assert } from '@metamask/utils';\n\nimport { assertIsSnapIcon } from '../../icon';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of the snap icon.\n */\nexport const isSnapIcon: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n if (!files.svgIcon) {\n return;\n }\n\n try {\n assertIsSnapIcon(files.svgIcon);\n } catch (error) {\n assert(error instanceof Error);\n context.report(error.message);\n }\n },\n};\n"]}
1
+ {"version":3,"file":"is-snap-icon.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-snap-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,wBAAwB;AAEzC,OAAO,EAAE,gBAAgB,EAAE,uBAAmB;AAG9C;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAkB;IACvC,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC;YAC/B,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { assert } from '@metamask/utils';\n\nimport { assertIsSnapIcon } from '../../icon';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of the snap icon.\n */\nexport const isSnapIcon: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n if (!files.svgIcon) {\n return;\n }\n\n try {\n assertIsSnapIcon(files.svgIcon);\n } catch (error) {\n assert(error instanceof Error);\n context.report('is-snap-icon', error.message);\n }\n },\n};\n"]}
@@ -17,7 +17,7 @@ exports.isSnapManifest = {
17
17
  const [error] = (0, superstruct_1.validate)(files.manifest.result, validation_1.SnapManifestStruct);
18
18
  if (error) {
19
19
  for (const failure of error.failures()) {
20
- context.report(`"${types_1.NpmSnapFileNames.Manifest}" is invalid: ${(0, structs_1.getStructFailureMessage)(validation_1.SnapManifestStruct, failure, false)}`);
20
+ context.report(`is-snap-manifest-${failure.type}-${failure.path.join('-')}`, `"${types_1.NpmSnapFileNames.Manifest}" is invalid: ${(0, structs_1.getStructFailureMessage)(validation_1.SnapManifestStruct, failure, false)}`);
21
21
  }
22
22
  }
23
23
  },
@@ -1 +1 @@
1
- {"version":3,"file":"is-snap-manifest.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-snap-manifest.ts"],"names":[],"mappings":";;;AAAA,uDAAiD;AAEjD,+CAAwD;AACxD,2CAA+C;AAC/C,kDAAmD;AAGnD;;GAEG;AACU,QAAA,cAAc,GAAkB;IAC3C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,GAAG,IAAA,sBAAQ,EAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,+BAAkB,CAAC,CAAC;QACpE,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACvC,OAAO,CAAC,MAAM,CACZ,IAAI,wBAAgB,CAAC,QAAQ,iBAAiB,IAAA,iCAAuB,EACnE,+BAAkB,EAClB,OAAO,EACP,KAAK,CACN,EAAE,CACJ,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { validate } from '@metamask/superstruct';\n\nimport { getStructFailureMessage } from '../../structs';\nimport { NpmSnapFileNames } from '../../types';\nimport { SnapManifestStruct } from '../validation';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of snap.manifest.json.\n */\nexport const isSnapManifest: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n if (!files.manifest) {\n return;\n }\n const [error] = validate(files.manifest.result, SnapManifestStruct);\n if (error) {\n for (const failure of error.failures()) {\n context.report(\n `\"${NpmSnapFileNames.Manifest}\" is invalid: ${getStructFailureMessage(\n SnapManifestStruct,\n failure,\n false,\n )}`,\n );\n }\n }\n },\n};\n"]}
1
+ {"version":3,"file":"is-snap-manifest.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-snap-manifest.ts"],"names":[],"mappings":";;;AAAA,uDAAiD;AAEjD,+CAAwD;AACxD,2CAA+C;AAC/C,kDAAmD;AAGnD;;GAEG;AACU,QAAA,cAAc,GAAkB;IAC3C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,GAAG,IAAA,sBAAQ,EAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,+BAAkB,CAAC,CAAC;QACpE,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACvC,OAAO,CAAC,MAAM,CACZ,oBAAoB,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAC5D,IAAI,wBAAgB,CAAC,QAAQ,iBAAiB,IAAA,iCAAuB,EACnE,+BAAkB,EAClB,OAAO,EACP,KAAK,CACN,EAAE,CACJ,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { validate } from '@metamask/superstruct';\n\nimport { getStructFailureMessage } from '../../structs';\nimport { NpmSnapFileNames } from '../../types';\nimport { SnapManifestStruct } from '../validation';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of snap.manifest.json.\n */\nexport const isSnapManifest: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n if (!files.manifest) {\n return;\n }\n const [error] = validate(files.manifest.result, SnapManifestStruct);\n if (error) {\n for (const failure of error.failures()) {\n context.report(\n `is-snap-manifest-${failure.type}-${failure.path.join('-')}`,\n `\"${NpmSnapFileNames.Manifest}\" is invalid: ${getStructFailureMessage(\n SnapManifestStruct,\n failure,\n false,\n )}`,\n );\n }\n }\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"is-snap-manifest.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/is-snap-manifest.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,aAmB5B,CAAC"}
1
+ {"version":3,"file":"is-snap-manifest.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/is-snap-manifest.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,aAoB5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-snap-manifest.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/is-snap-manifest.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,aAmB5B,CAAC"}
1
+ {"version":3,"file":"is-snap-manifest.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/is-snap-manifest.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,aAoB5B,CAAC"}
@@ -14,7 +14,7 @@ export const isSnapManifest = {
14
14
  const [error] = validate(files.manifest.result, SnapManifestStruct);
15
15
  if (error) {
16
16
  for (const failure of error.failures()) {
17
- context.report(`"${NpmSnapFileNames.Manifest}" is invalid: ${getStructFailureMessage(SnapManifestStruct, failure, false)}`);
17
+ context.report(`is-snap-manifest-${failure.type}-${failure.path.join('-')}`, `"${NpmSnapFileNames.Manifest}" is invalid: ${getStructFailureMessage(SnapManifestStruct, failure, false)}`);
18
18
  }
19
19
  }
20
20
  },
@@ -1 +1 @@
1
- {"version":3,"file":"is-snap-manifest.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-snap-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,8BAA8B;AAEjD,OAAO,EAAE,uBAAuB,EAAE,0BAAsB;AACxD,OAAO,EAAE,gBAAgB,EAAE,wBAAoB;AAC/C,OAAO,EAAE,kBAAkB,EAAE,0BAAsB;AAGnD;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC3C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;QACpE,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACvC,OAAO,CAAC,MAAM,CACZ,IAAI,gBAAgB,CAAC,QAAQ,iBAAiB,uBAAuB,CACnE,kBAAkB,EAClB,OAAO,EACP,KAAK,CACN,EAAE,CACJ,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { validate } from '@metamask/superstruct';\n\nimport { getStructFailureMessage } from '../../structs';\nimport { NpmSnapFileNames } from '../../types';\nimport { SnapManifestStruct } from '../validation';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of snap.manifest.json.\n */\nexport const isSnapManifest: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n if (!files.manifest) {\n return;\n }\n const [error] = validate(files.manifest.result, SnapManifestStruct);\n if (error) {\n for (const failure of error.failures()) {\n context.report(\n `\"${NpmSnapFileNames.Manifest}\" is invalid: ${getStructFailureMessage(\n SnapManifestStruct,\n failure,\n false,\n )}`,\n );\n }\n }\n },\n};\n"]}
1
+ {"version":3,"file":"is-snap-manifest.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/is-snap-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,8BAA8B;AAEjD,OAAO,EAAE,uBAAuB,EAAE,0BAAsB;AACxD,OAAO,EAAE,gBAAgB,EAAE,wBAAoB;AAC/C,OAAO,EAAE,kBAAkB,EAAE,0BAAsB;AAGnD;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC3C,QAAQ,EAAE,OAAO;IACjB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC3B,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;QACpE,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACvC,OAAO,CAAC,MAAM,CACZ,oBAAoB,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAC5D,IAAI,gBAAgB,CAAC,QAAQ,iBAAiB,uBAAuB,CACnE,kBAAkB,EAClB,OAAO,EACP,KAAK,CACN,EAAE,CACJ,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { validate } from '@metamask/superstruct';\n\nimport { getStructFailureMessage } from '../../structs';\nimport { NpmSnapFileNames } from '../../types';\nimport { SnapManifestStruct } from '../validation';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify the structure of snap.manifest.json.\n */\nexport const isSnapManifest: ValidatorMeta = {\n severity: 'error',\n structureCheck(files, context) {\n if (!files.manifest) {\n return;\n }\n const [error] = validate(files.manifest.result, SnapManifestStruct);\n if (error) {\n for (const failure of error.failures()) {\n context.report(\n `is-snap-manifest-${failure.type}-${failure.path.join('-')}`,\n `\"${NpmSnapFileNames.Manifest}\" is invalid: ${getStructFailureMessage(\n SnapManifestStruct,\n failure,\n false,\n )}`,\n );\n }\n }\n },\n};\n"]}
@@ -22,7 +22,7 @@ exports.manifestLocalization = {
22
22
  (0, localization_1.getLocalizedSnapManifest)(manifest, locale, localizations);
23
23
  }
24
24
  catch (error) {
25
- context.report(`Failed to localize Snap manifest: ${(0, snaps_sdk_1.getErrorMessage)(error)}`);
25
+ context.report('manifest-localization', `Failed to localize Snap manifest: ${(0, snaps_sdk_1.getErrorMessage)(error)}`);
26
26
  }
27
27
  }
28
28
  },
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-localization.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/manifest-localization.ts"],"names":[],"mappings":";;;AAAA,mDAAsD;AAGtD,yDAA8D;AAG9D;;GAEG;AACU,QAAA,oBAAoB,GAAkB;IACjD,QAAQ,EAAE,OAAO;IACjB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;QACvC,MAAM,aAAa,GAAuB,KAAK,CAAC,iBAAiB,CAAC,GAAG,CACnE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CACtB,CAAC;QACF,MAAM,OAAO,GAAG;YACd,IAAI,EAAE,wDAAwD;YAC9D,GAAG,aAAa;iBACb,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC;iBAC3B,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC;SACvC,CAAC;QAEF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC;gBACH,IAAA,uCAAwB,EAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;YAC5D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,MAAM,CACZ,qCAAqC,IAAA,2BAAe,EAAC,KAAK,CAAC,EAAE,CAC9D,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\n\nimport type { LocalizationFile } from '../../localization';\nimport { getLocalizedSnapManifest } from '../../localization';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify whether the localization files localize the manifest correctly.\n */\nexport const manifestLocalization: ValidatorMeta = {\n severity: 'error',\n semanticCheck(files, context) {\n const manifest = files.manifest.result;\n const localizations: LocalizationFile[] = files.localizationFiles.map(\n (file) => file.result,\n );\n const locales = [\n 'en', // The manifest must be able to be localized in English.\n ...localizations\n .map(({ locale }) => locale)\n .filter((locale) => locale !== 'en'),\n ];\n\n for (const locale of locales) {\n try {\n getLocalizedSnapManifest(manifest, locale, localizations);\n } catch (error) {\n context.report(\n `Failed to localize Snap manifest: ${getErrorMessage(error)}`,\n );\n }\n }\n },\n};\n"]}
1
+ {"version":3,"file":"manifest-localization.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/manifest-localization.ts"],"names":[],"mappings":";;;AAAA,mDAAsD;AAGtD,yDAA8D;AAG9D;;GAEG;AACU,QAAA,oBAAoB,GAAkB;IACjD,QAAQ,EAAE,OAAO;IACjB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;QACvC,MAAM,aAAa,GAAuB,KAAK,CAAC,iBAAiB,CAAC,GAAG,CACnE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CACtB,CAAC;QACF,MAAM,OAAO,GAAG;YACd,IAAI,EAAE,wDAAwD;YAC9D,GAAG,aAAa;iBACb,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC;iBAC3B,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC;SACvC,CAAC;QAEF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC;gBACH,IAAA,uCAAwB,EAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;YAC5D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,MAAM,CACZ,uBAAuB,EACvB,qCAAqC,IAAA,2BAAe,EAAC,KAAK,CAAC,EAAE,CAC9D,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\n\nimport type { LocalizationFile } from '../../localization';\nimport { getLocalizedSnapManifest } from '../../localization';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify whether the localization files localize the manifest correctly.\n */\nexport const manifestLocalization: ValidatorMeta = {\n severity: 'error',\n semanticCheck(files, context) {\n const manifest = files.manifest.result;\n const localizations: LocalizationFile[] = files.localizationFiles.map(\n (file) => file.result,\n );\n const locales = [\n 'en', // The manifest must be able to be localized in English.\n ...localizations\n .map(({ locale }) => locale)\n .filter((locale) => locale !== 'en'),\n ];\n\n for (const locale of locales) {\n try {\n getLocalizedSnapManifest(manifest, locale, localizations);\n } catch (error) {\n context.report(\n 'manifest-localization',\n `Failed to localize Snap manifest: ${getErrorMessage(error)}`,\n );\n }\n }\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-localization.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/manifest-localization.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAwBlC,CAAC"}
1
+ {"version":3,"file":"manifest-localization.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/manifest-localization.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAyBlC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-localization.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/manifest-localization.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAwBlC,CAAC"}
1
+ {"version":3,"file":"manifest-localization.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/manifest-localization.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAyBlC,CAAC"}
@@ -19,7 +19,7 @@ export const manifestLocalization = {
19
19
  getLocalizedSnapManifest(manifest, locale, localizations);
20
20
  }
21
21
  catch (error) {
22
- context.report(`Failed to localize Snap manifest: ${getErrorMessage(error)}`);
22
+ context.report('manifest-localization', `Failed to localize Snap manifest: ${getErrorMessage(error)}`);
23
23
  }
24
24
  }
25
25
  },
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-localization.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/manifest-localization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,4BAA4B;AAGtD,OAAO,EAAE,wBAAwB,EAAE,+BAA2B;AAG9D;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkB;IACjD,QAAQ,EAAE,OAAO;IACjB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;QACvC,MAAM,aAAa,GAAuB,KAAK,CAAC,iBAAiB,CAAC,GAAG,CACnE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CACtB,CAAC;QACF,MAAM,OAAO,GAAG;YACd,IAAI,EAAE,wDAAwD;YAC9D,GAAG,aAAa;iBACb,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC;iBAC3B,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC;SACvC,CAAC;QAEF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC;gBACH,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;YAC5D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,MAAM,CACZ,qCAAqC,eAAe,CAAC,KAAK,CAAC,EAAE,CAC9D,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\n\nimport type { LocalizationFile } from '../../localization';\nimport { getLocalizedSnapManifest } from '../../localization';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify whether the localization files localize the manifest correctly.\n */\nexport const manifestLocalization: ValidatorMeta = {\n severity: 'error',\n semanticCheck(files, context) {\n const manifest = files.manifest.result;\n const localizations: LocalizationFile[] = files.localizationFiles.map(\n (file) => file.result,\n );\n const locales = [\n 'en', // The manifest must be able to be localized in English.\n ...localizations\n .map(({ locale }) => locale)\n .filter((locale) => locale !== 'en'),\n ];\n\n for (const locale of locales) {\n try {\n getLocalizedSnapManifest(manifest, locale, localizations);\n } catch (error) {\n context.report(\n `Failed to localize Snap manifest: ${getErrorMessage(error)}`,\n );\n }\n }\n },\n};\n"]}
1
+ {"version":3,"file":"manifest-localization.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/manifest-localization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,4BAA4B;AAGtD,OAAO,EAAE,wBAAwB,EAAE,+BAA2B;AAG9D;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkB;IACjD,QAAQ,EAAE,OAAO;IACjB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;QACvC,MAAM,aAAa,GAAuB,KAAK,CAAC,iBAAiB,CAAC,GAAG,CACnE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CACtB,CAAC;QACF,MAAM,OAAO,GAAG;YACd,IAAI,EAAE,wDAAwD;YAC9D,GAAG,aAAa;iBACb,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC;iBAC3B,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC;SACvC,CAAC;QAEF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC;gBACH,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;YAC5D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,MAAM,CACZ,uBAAuB,EACvB,qCAAqC,eAAe,CAAC,KAAK,CAAC,EAAE,CAC9D,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\n\nimport type { LocalizationFile } from '../../localization';\nimport { getLocalizedSnapManifest } from '../../localization';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Verify whether the localization files localize the manifest correctly.\n */\nexport const manifestLocalization: ValidatorMeta = {\n severity: 'error',\n semanticCheck(files, context) {\n const manifest = files.manifest.result;\n const localizations: LocalizationFile[] = files.localizationFiles.map(\n (file) => file.result,\n );\n const locales = [\n 'en', // The manifest must be able to be localized in English.\n ...localizations\n .map(({ locale }) => locale)\n .filter((locale) => locale !== 'en'),\n ];\n\n for (const locale of locales) {\n try {\n getLocalizedSnapManifest(manifest, locale, localizations);\n } catch (error) {\n context.report(\n 'manifest-localization',\n `Failed to localize Snap manifest: ${getErrorMessage(error)}`,\n );\n }\n }\n },\n};\n"]}