@metamask/snaps-utils 11.4.0 → 11.6.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 (144) hide show
  1. package/CHANGELOG.md +24 -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/derivation-paths.cjs +5 -0
  9. package/dist/derivation-paths.cjs.map +1 -1
  10. package/dist/derivation-paths.d.cts.map +1 -1
  11. package/dist/derivation-paths.d.mts.map +1 -1
  12. package/dist/derivation-paths.mjs +5 -0
  13. package/dist/derivation-paths.mjs.map +1 -1
  14. package/dist/json.cjs +5 -4
  15. package/dist/json.cjs.map +1 -1
  16. package/dist/json.d.cts +3 -2
  17. package/dist/json.d.cts.map +1 -1
  18. package/dist/json.d.mts +3 -2
  19. package/dist/json.d.mts.map +1 -1
  20. package/dist/json.mjs +5 -4
  21. package/dist/json.mjs.map +1 -1
  22. package/dist/manifest/manifest.cjs +9 -5
  23. package/dist/manifest/manifest.cjs.map +1 -1
  24. package/dist/manifest/manifest.d.cts.map +1 -1
  25. package/dist/manifest/manifest.d.mts.map +1 -1
  26. package/dist/manifest/manifest.mjs +9 -5
  27. package/dist/manifest/manifest.mjs.map +1 -1
  28. package/dist/manifest/validator-types.cjs.map +1 -1
  29. package/dist/manifest/validator-types.d.cts +4 -2
  30. package/dist/manifest/validator-types.d.cts.map +1 -1
  31. package/dist/manifest/validator-types.d.mts +4 -2
  32. package/dist/manifest/validator-types.d.mts.map +1 -1
  33. package/dist/manifest/validator-types.mjs.map +1 -1
  34. package/dist/manifest/validator.cjs +11 -2
  35. package/dist/manifest/validator.cjs.map +1 -1
  36. package/dist/manifest/validator.d.cts.map +1 -1
  37. package/dist/manifest/validator.d.mts.map +1 -1
  38. package/dist/manifest/validator.mjs +11 -2
  39. package/dist/manifest/validator.mjs.map +1 -1
  40. package/dist/manifest/validators/checksum.cjs +1 -1
  41. package/dist/manifest/validators/checksum.cjs.map +1 -1
  42. package/dist/manifest/validators/checksum.d.cts.map +1 -1
  43. package/dist/manifest/validators/checksum.d.mts.map +1 -1
  44. package/dist/manifest/validators/checksum.mjs +1 -1
  45. package/dist/manifest/validators/checksum.mjs.map +1 -1
  46. package/dist/manifest/validators/expected-files.cjs +1 -1
  47. package/dist/manifest/validators/expected-files.cjs.map +1 -1
  48. package/dist/manifest/validators/expected-files.d.cts.map +1 -1
  49. package/dist/manifest/validators/expected-files.d.mts.map +1 -1
  50. package/dist/manifest/validators/expected-files.mjs +1 -1
  51. package/dist/manifest/validators/expected-files.mjs.map +1 -1
  52. package/dist/manifest/validators/icon-declared.cjs +1 -1
  53. package/dist/manifest/validators/icon-declared.cjs.map +1 -1
  54. package/dist/manifest/validators/icon-declared.d.cts.map +1 -1
  55. package/dist/manifest/validators/icon-declared.d.mts.map +1 -1
  56. package/dist/manifest/validators/icon-declared.mjs +1 -1
  57. package/dist/manifest/validators/icon-declared.mjs.map +1 -1
  58. package/dist/manifest/validators/icon-dimensions.cjs +1 -1
  59. package/dist/manifest/validators/icon-dimensions.cjs.map +1 -1
  60. package/dist/manifest/validators/icon-dimensions.d.cts.map +1 -1
  61. package/dist/manifest/validators/icon-dimensions.d.mts.map +1 -1
  62. package/dist/manifest/validators/icon-dimensions.mjs +1 -1
  63. package/dist/manifest/validators/icon-dimensions.mjs.map +1 -1
  64. package/dist/manifest/validators/icon-missing.cjs +1 -1
  65. package/dist/manifest/validators/icon-missing.cjs.map +1 -1
  66. package/dist/manifest/validators/icon-missing.mjs +1 -1
  67. package/dist/manifest/validators/icon-missing.mjs.map +1 -1
  68. package/dist/manifest/validators/is-localization-file.cjs +1 -1
  69. package/dist/manifest/validators/is-localization-file.cjs.map +1 -1
  70. package/dist/manifest/validators/is-localization-file.d.cts.map +1 -1
  71. package/dist/manifest/validators/is-localization-file.d.mts.map +1 -1
  72. package/dist/manifest/validators/is-localization-file.mjs +1 -1
  73. package/dist/manifest/validators/is-localization-file.mjs.map +1 -1
  74. package/dist/manifest/validators/is-package-json.cjs +1 -1
  75. package/dist/manifest/validators/is-package-json.cjs.map +1 -1
  76. package/dist/manifest/validators/is-package-json.d.cts.map +1 -1
  77. package/dist/manifest/validators/is-package-json.d.mts.map +1 -1
  78. package/dist/manifest/validators/is-package-json.mjs +1 -1
  79. package/dist/manifest/validators/is-package-json.mjs.map +1 -1
  80. package/dist/manifest/validators/is-snap-icon.cjs +1 -1
  81. package/dist/manifest/validators/is-snap-icon.cjs.map +1 -1
  82. package/dist/manifest/validators/is-snap-icon.mjs +1 -1
  83. package/dist/manifest/validators/is-snap-icon.mjs.map +1 -1
  84. package/dist/manifest/validators/is-snap-manifest.cjs +1 -1
  85. package/dist/manifest/validators/is-snap-manifest.cjs.map +1 -1
  86. package/dist/manifest/validators/is-snap-manifest.d.cts.map +1 -1
  87. package/dist/manifest/validators/is-snap-manifest.d.mts.map +1 -1
  88. package/dist/manifest/validators/is-snap-manifest.mjs +1 -1
  89. package/dist/manifest/validators/is-snap-manifest.mjs.map +1 -1
  90. package/dist/manifest/validators/manifest-localization.cjs +1 -1
  91. package/dist/manifest/validators/manifest-localization.cjs.map +1 -1
  92. package/dist/manifest/validators/manifest-localization.d.cts.map +1 -1
  93. package/dist/manifest/validators/manifest-localization.d.mts.map +1 -1
  94. package/dist/manifest/validators/manifest-localization.mjs +1 -1
  95. package/dist/manifest/validators/manifest-localization.mjs.map +1 -1
  96. package/dist/manifest/validators/package-json-recommended-fields.cjs +1 -1
  97. package/dist/manifest/validators/package-json-recommended-fields.cjs.map +1 -1
  98. package/dist/manifest/validators/package-json-recommended-fields.d.cts.map +1 -1
  99. package/dist/manifest/validators/package-json-recommended-fields.d.mts.map +1 -1
  100. package/dist/manifest/validators/package-json-recommended-fields.mjs +1 -1
  101. package/dist/manifest/validators/package-json-recommended-fields.mjs.map +1 -1
  102. package/dist/manifest/validators/package-name-match.cjs +1 -1
  103. package/dist/manifest/validators/package-name-match.cjs.map +1 -1
  104. package/dist/manifest/validators/package-name-match.d.cts.map +1 -1
  105. package/dist/manifest/validators/package-name-match.d.mts.map +1 -1
  106. package/dist/manifest/validators/package-name-match.mjs +1 -1
  107. package/dist/manifest/validators/package-name-match.mjs.map +1 -1
  108. package/dist/manifest/validators/platform-version.cjs +2 -2
  109. package/dist/manifest/validators/platform-version.cjs.map +1 -1
  110. package/dist/manifest/validators/platform-version.d.cts.map +1 -1
  111. package/dist/manifest/validators/platform-version.d.mts.map +1 -1
  112. package/dist/manifest/validators/platform-version.mjs +2 -2
  113. package/dist/manifest/validators/platform-version.mjs.map +1 -1
  114. package/dist/manifest/validators/production-platform-version.cjs +1 -1
  115. package/dist/manifest/validators/production-platform-version.cjs.map +1 -1
  116. package/dist/manifest/validators/production-platform-version.d.cts.map +1 -1
  117. package/dist/manifest/validators/production-platform-version.d.mts.map +1 -1
  118. package/dist/manifest/validators/production-platform-version.mjs +1 -1
  119. package/dist/manifest/validators/production-platform-version.mjs.map +1 -1
  120. package/dist/manifest/validators/repository-match.cjs +1 -1
  121. package/dist/manifest/validators/repository-match.cjs.map +1 -1
  122. package/dist/manifest/validators/repository-match.d.cts.map +1 -1
  123. package/dist/manifest/validators/repository-match.d.mts.map +1 -1
  124. package/dist/manifest/validators/repository-match.mjs +1 -1
  125. package/dist/manifest/validators/repository-match.mjs.map +1 -1
  126. package/dist/manifest/validators/unused-exports.cjs +2 -2
  127. package/dist/manifest/validators/unused-exports.cjs.map +1 -1
  128. package/dist/manifest/validators/unused-exports.d.cts.map +1 -1
  129. package/dist/manifest/validators/unused-exports.d.mts.map +1 -1
  130. package/dist/manifest/validators/unused-exports.mjs +2 -2
  131. package/dist/manifest/validators/unused-exports.mjs.map +1 -1
  132. package/dist/manifest/validators/version-match.cjs +1 -1
  133. package/dist/manifest/validators/version-match.cjs.map +1 -1
  134. package/dist/manifest/validators/version-match.d.cts.map +1 -1
  135. package/dist/manifest/validators/version-match.d.mts.map +1 -1
  136. package/dist/manifest/validators/version-match.mjs +1 -1
  137. package/dist/manifest/validators/version-match.mjs.map +1 -1
  138. package/dist/platform-version.cjs.map +1 -1
  139. package/dist/platform-version.d.cts +2 -1
  140. package/dist/platform-version.d.cts.map +1 -1
  141. package/dist/platform-version.d.mts +2 -1
  142. package/dist/platform-version.d.mts.map +1 -1
  143. package/dist/platform-version.mjs.map +1 -1
  144. package/package.json +6 -6
@@ -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"]}
@@ -10,7 +10,7 @@ exports.packageJsonRecommendedFields = {
10
10
  semanticCheck(files, context) {
11
11
  for (const recommendedField of RECOMMENDED_FIELDS) {
12
12
  if (!files.packageJson.result[recommendedField]) {
13
- context.report(`Missing recommended package.json property: "${recommendedField}".`);
13
+ context.report(`package-json-recommended-fields-${recommendedField}`, `Missing recommended package.json property: "${recommendedField}".`);
14
14
  }
15
15
  }
16
16
  },
@@ -1 +1 @@
1
- {"version":3,"file":"package-json-recommended-fields.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/package-json-recommended-fields.ts"],"names":[],"mappings":";;;AAEA,MAAM,kBAAkB,GAAG,CAAC,YAAY,CAAU,CAAC;AAEnD;;GAEG;AACU,QAAA,4BAA4B,GAAkB;IACzD,QAAQ,EAAE,SAAS;IACnB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,KAAK,MAAM,gBAAgB,IAAI,kBAAkB,EAAE,CAAC;YAClD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;gBAChD,OAAO,CAAC,MAAM,CACZ,+CAA+C,gBAAgB,IAAI,CACpE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type { ValidatorMeta } from '../validator-types';\n\nconst RECOMMENDED_FIELDS = ['repository'] as const;\n\n/**\n * Check if package.json contains recommended fields.\n */\nexport const packageJsonRecommendedFields: ValidatorMeta = {\n severity: 'warning',\n semanticCheck(files, context) {\n for (const recommendedField of RECOMMENDED_FIELDS) {\n if (!files.packageJson.result[recommendedField]) {\n context.report(\n `Missing recommended package.json property: \"${recommendedField}\".`,\n );\n }\n }\n },\n};\n"]}
1
+ {"version":3,"file":"package-json-recommended-fields.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/package-json-recommended-fields.ts"],"names":[],"mappings":";;;AAEA,MAAM,kBAAkB,GAAG,CAAC,YAAY,CAAU,CAAC;AAEnD;;GAEG;AACU,QAAA,4BAA4B,GAAkB;IACzD,QAAQ,EAAE,SAAS;IACnB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,KAAK,MAAM,gBAAgB,IAAI,kBAAkB,EAAE,CAAC;YAClD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;gBAChD,OAAO,CAAC,MAAM,CACZ,mCAAmC,gBAAgB,EAAE,EACrD,+CAA+C,gBAAgB,IAAI,CACpE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type { ValidatorMeta } from '../validator-types';\n\nconst RECOMMENDED_FIELDS = ['repository'] as const;\n\n/**\n * Check if package.json contains recommended fields.\n */\nexport const packageJsonRecommendedFields: ValidatorMeta = {\n severity: 'warning',\n semanticCheck(files, context) {\n for (const recommendedField of RECOMMENDED_FIELDS) {\n if (!files.packageJson.result[recommendedField]) {\n context.report(\n `package-json-recommended-fields-${recommendedField}`,\n `Missing recommended package.json property: \"${recommendedField}\".`,\n );\n }\n }\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"package-json-recommended-fields.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/package-json-recommended-fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAIxD;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,aAW1C,CAAC"}
1
+ {"version":3,"file":"package-json-recommended-fields.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/package-json-recommended-fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAIxD;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,aAY1C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"package-json-recommended-fields.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/package-json-recommended-fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAIxD;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,aAW1C,CAAC"}
1
+ {"version":3,"file":"package-json-recommended-fields.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/package-json-recommended-fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAIxD;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,aAY1C,CAAC"}
@@ -7,7 +7,7 @@ export const packageJsonRecommendedFields = {
7
7
  semanticCheck(files, context) {
8
8
  for (const recommendedField of RECOMMENDED_FIELDS) {
9
9
  if (!files.packageJson.result[recommendedField]) {
10
- context.report(`Missing recommended package.json property: "${recommendedField}".`);
10
+ context.report(`package-json-recommended-fields-${recommendedField}`, `Missing recommended package.json property: "${recommendedField}".`);
11
11
  }
12
12
  }
13
13
  },
@@ -1 +1 @@
1
- {"version":3,"file":"package-json-recommended-fields.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/package-json-recommended-fields.ts"],"names":[],"mappings":"AAEA,MAAM,kBAAkB,GAAG,CAAC,YAAY,CAAU,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAkB;IACzD,QAAQ,EAAE,SAAS;IACnB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,KAAK,MAAM,gBAAgB,IAAI,kBAAkB,EAAE,CAAC;YAClD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;gBAChD,OAAO,CAAC,MAAM,CACZ,+CAA+C,gBAAgB,IAAI,CACpE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type { ValidatorMeta } from '../validator-types';\n\nconst RECOMMENDED_FIELDS = ['repository'] as const;\n\n/**\n * Check if package.json contains recommended fields.\n */\nexport const packageJsonRecommendedFields: ValidatorMeta = {\n severity: 'warning',\n semanticCheck(files, context) {\n for (const recommendedField of RECOMMENDED_FIELDS) {\n if (!files.packageJson.result[recommendedField]) {\n context.report(\n `Missing recommended package.json property: \"${recommendedField}\".`,\n );\n }\n }\n },\n};\n"]}
1
+ {"version":3,"file":"package-json-recommended-fields.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/package-json-recommended-fields.ts"],"names":[],"mappings":"AAEA,MAAM,kBAAkB,GAAG,CAAC,YAAY,CAAU,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAkB;IACzD,QAAQ,EAAE,SAAS;IACnB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,KAAK,MAAM,gBAAgB,IAAI,kBAAkB,EAAE,CAAC;YAClD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;gBAChD,OAAO,CAAC,MAAM,CACZ,mCAAmC,gBAAgB,EAAE,EACrD,+CAA+C,gBAAgB,IAAI,CACpE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type { ValidatorMeta } from '../validator-types';\n\nconst RECOMMENDED_FIELDS = ['repository'] as const;\n\n/**\n * Check if package.json contains recommended fields.\n */\nexport const packageJsonRecommendedFields: ValidatorMeta = {\n severity: 'warning',\n semanticCheck(files, context) {\n for (const recommendedField of RECOMMENDED_FIELDS) {\n if (!files.packageJson.result[recommendedField]) {\n context.report(\n `package-json-recommended-fields-${recommendedField}`,\n `Missing recommended package.json property: \"${recommendedField}\".`,\n );\n }\n }\n },\n};\n"]}
@@ -11,7 +11,7 @@ exports.packageNameMatch = {
11
11
  const packageJsonName = files.packageJson.result.name;
12
12
  const manifestPackageName = files.manifest.result.source.location.npm.packageName;
13
13
  if (packageJsonName !== manifestPackageName) {
14
- context.report(`"${types_1.NpmSnapFileNames.Manifest}" npm package name ("${manifestPackageName}") does not match the "${types_1.NpmSnapFileNames.PackageJson}" "name" field ("${packageJsonName}").`, ({ manifest }) => {
14
+ context.report('package-name-match', `"${types_1.NpmSnapFileNames.Manifest}" npm package name ("${manifestPackageName}") does not match the "${types_1.NpmSnapFileNames.PackageJson}" "name" field ("${packageJsonName}").`, ({ manifest }) => {
15
15
  manifest.source.location.npm.packageName = packageJsonName;
16
16
  return { manifest };
17
17
  });
@@ -1 +1 @@
1
- {"version":3,"file":"package-name-match.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/package-name-match.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAG/C;;GAEG;AACU,QAAA,gBAAgB,GAAkB;IAC7C,QAAQ,EAAE,OAAO;IACjB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;QACtD,MAAM,mBAAmB,GACvB,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC;QACxD,IAAI,eAAe,KAAK,mBAAmB,EAAE,CAAC;YAC5C,OAAO,CAAC,MAAM,CACZ,IAAI,wBAAgB,CAAC,QAAQ,wBAAwB,mBAAmB,0BAA0B,wBAAgB,CAAC,WAAW,oBAAoB,eAAe,KAAK,EACtK,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACf,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,GAAG,eAAe,CAAC;gBAC3D,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { NpmSnapFileNames } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if the package name in manifest matches package.json name.\n */\nexport const packageNameMatch: ValidatorMeta = {\n severity: 'error',\n semanticCheck(files, context) {\n const packageJsonName = files.packageJson.result.name;\n const manifestPackageName =\n files.manifest.result.source.location.npm.packageName;\n if (packageJsonName !== manifestPackageName) {\n context.report(\n `\"${NpmSnapFileNames.Manifest}\" npm package name (\"${manifestPackageName}\") does not match the \"${NpmSnapFileNames.PackageJson}\" \"name\" field (\"${packageJsonName}\").`,\n ({ manifest }) => {\n manifest.source.location.npm.packageName = packageJsonName;\n return { manifest };\n },\n );\n }\n },\n};\n"]}
1
+ {"version":3,"file":"package-name-match.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/package-name-match.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAG/C;;GAEG;AACU,QAAA,gBAAgB,GAAkB;IAC7C,QAAQ,EAAE,OAAO;IACjB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;QACtD,MAAM,mBAAmB,GACvB,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC;QACxD,IAAI,eAAe,KAAK,mBAAmB,EAAE,CAAC;YAC5C,OAAO,CAAC,MAAM,CACZ,oBAAoB,EACpB,IAAI,wBAAgB,CAAC,QAAQ,wBAAwB,mBAAmB,0BAA0B,wBAAgB,CAAC,WAAW,oBAAoB,eAAe,KAAK,EACtK,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACf,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,GAAG,eAAe,CAAC;gBAC3D,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { NpmSnapFileNames } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if the package name in manifest matches package.json name.\n */\nexport const packageNameMatch: ValidatorMeta = {\n severity: 'error',\n semanticCheck(files, context) {\n const packageJsonName = files.packageJson.result.name;\n const manifestPackageName =\n files.manifest.result.source.location.npm.packageName;\n if (packageJsonName !== manifestPackageName) {\n context.report(\n 'package-name-match',\n `\"${NpmSnapFileNames.Manifest}\" npm package name (\"${manifestPackageName}\") does not match the \"${NpmSnapFileNames.PackageJson}\" \"name\" field (\"${packageJsonName}\").`,\n ({ manifest }) => {\n manifest.source.location.npm.packageName = packageJsonName;\n return { manifest };\n },\n );\n }\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"package-name-match.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/package-name-match.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAgB9B,CAAC"}
1
+ {"version":3,"file":"package-name-match.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/package-name-match.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAiB9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"package-name-match.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/package-name-match.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAgB9B,CAAC"}
1
+ {"version":3,"file":"package-name-match.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/package-name-match.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAiB9B,CAAC"}
@@ -8,7 +8,7 @@ export const packageNameMatch = {
8
8
  const packageJsonName = files.packageJson.result.name;
9
9
  const manifestPackageName = files.manifest.result.source.location.npm.packageName;
10
10
  if (packageJsonName !== manifestPackageName) {
11
- context.report(`"${NpmSnapFileNames.Manifest}" npm package name ("${manifestPackageName}") does not match the "${NpmSnapFileNames.PackageJson}" "name" field ("${packageJsonName}").`, ({ manifest }) => {
11
+ context.report('package-name-match', `"${NpmSnapFileNames.Manifest}" npm package name ("${manifestPackageName}") does not match the "${NpmSnapFileNames.PackageJson}" "name" field ("${packageJsonName}").`, ({ manifest }) => {
12
12
  manifest.source.location.npm.packageName = packageJsonName;
13
13
  return { manifest };
14
14
  });
@@ -1 +1 @@
1
- {"version":3,"file":"package-name-match.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/package-name-match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,wBAAoB;AAG/C;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAkB;IAC7C,QAAQ,EAAE,OAAO;IACjB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;QACtD,MAAM,mBAAmB,GACvB,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC;QACxD,IAAI,eAAe,KAAK,mBAAmB,EAAE,CAAC;YAC5C,OAAO,CAAC,MAAM,CACZ,IAAI,gBAAgB,CAAC,QAAQ,wBAAwB,mBAAmB,0BAA0B,gBAAgB,CAAC,WAAW,oBAAoB,eAAe,KAAK,EACtK,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACf,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,GAAG,eAAe,CAAC;gBAC3D,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { NpmSnapFileNames } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if the package name in manifest matches package.json name.\n */\nexport const packageNameMatch: ValidatorMeta = {\n severity: 'error',\n semanticCheck(files, context) {\n const packageJsonName = files.packageJson.result.name;\n const manifestPackageName =\n files.manifest.result.source.location.npm.packageName;\n if (packageJsonName !== manifestPackageName) {\n context.report(\n `\"${NpmSnapFileNames.Manifest}\" npm package name (\"${manifestPackageName}\") does not match the \"${NpmSnapFileNames.PackageJson}\" \"name\" field (\"${packageJsonName}\").`,\n ({ manifest }) => {\n manifest.source.location.npm.packageName = packageJsonName;\n return { manifest };\n },\n );\n }\n },\n};\n"]}
1
+ {"version":3,"file":"package-name-match.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/package-name-match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,wBAAoB;AAG/C;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAkB;IAC7C,QAAQ,EAAE,OAAO;IACjB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;QACtD,MAAM,mBAAmB,GACvB,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC;QACxD,IAAI,eAAe,KAAK,mBAAmB,EAAE,CAAC;YAC5C,OAAO,CAAC,MAAM,CACZ,oBAAoB,EACpB,IAAI,gBAAgB,CAAC,QAAQ,wBAAwB,mBAAmB,0BAA0B,gBAAgB,CAAC,WAAW,oBAAoB,eAAe,KAAK,EACtK,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACf,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,GAAG,eAAe,CAAC;gBAC3D,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { NpmSnapFileNames } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if the package name in manifest matches package.json name.\n */\nexport const packageNameMatch: ValidatorMeta = {\n severity: 'error',\n semanticCheck(files, context) {\n const packageJsonName = files.packageJson.result.name;\n const manifestPackageName =\n files.manifest.result.source.location.npm.packageName;\n if (packageJsonName !== manifestPackageName) {\n context.report(\n 'package-name-match',\n `\"${NpmSnapFileNames.Manifest}\" npm package name (\"${manifestPackageName}\") does not match the \"${NpmSnapFileNames.PackageJson}\" \"name\" field (\"${packageJsonName}\").`,\n ({ manifest }) => {\n manifest.source.location.npm.packageName = packageJsonName;\n return { manifest };\n },\n );\n }\n },\n};\n"]}
@@ -17,14 +17,14 @@ exports.platformVersion = {
17
17
  // eslint-disable-next-line import-x/no-dynamic-require
18
18
  const actualVersion = require(packageJson).version;
19
19
  if (!manifestPlatformVersion) {
20
- context.report('The "platformVersion" field is missing from the manifest.', ({ manifest }) => {
20
+ context.report('platform-version-missing', 'The "platformVersion" field is missing from the manifest.', ({ manifest }) => {
21
21
  manifest.platformVersion = actualVersion;
22
22
  return { manifest };
23
23
  });
24
24
  return;
25
25
  }
26
26
  if (manifestPlatformVersion !== actualVersion) {
27
- context.report(`The "platformVersion" field in the manifest must match the version of the Snaps SDK. Got "${manifestPlatformVersion}", expected "${actualVersion}".`, async ({ manifest }) => {
27
+ context.report('platform-version-mismatch', `The "platformVersion" field in the manifest must match the version of the Snaps SDK. Got "${manifestPlatformVersion}", expected "${actualVersion}".`, async ({ manifest }) => {
28
28
  manifest.platformVersion = actualVersion;
29
29
  return { manifest };
30
30
  });
@@ -1 +1 @@
1
- {"version":3,"file":"platform-version.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/platform-version.ts"],"names":[],"mappings":";;;AAAA,mCAAuC;AAIvC;;;GAGG;AACU,QAAA,eAAe,GAAkB;IAC5C,QAAQ,EAAE,OAAO;IACjB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO;QAChC,MAAM,uBAAuB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC;QAEtE,2EAA2E;QAC3E,wEAAwE;QACxE,MAAM,OAAO,GAAG,IAAA,sBAAa,EAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEnD,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;QACxE,uDAAuD;QACvD,MAAM,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC;QAEnD,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC7B,OAAO,CAAC,MAAM,CACZ,2DAA2D,EAC3D,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACf,QAAQ,CAAC,eAAe,GAAG,aAAa,CAAC;gBACzC,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;YAEF,OAAO;QACT,CAAC;QAED,IAAI,uBAAuB,KAAK,aAAa,EAAE,CAAC;YAC9C,OAAO,CAAC,MAAM,CACZ,6FAA6F,uBAAuB,gBAAgB,aAAa,IAAI,EACrJ,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACrB,QAAQ,CAAC,eAAe,GAAG,aAAa,CAAC;gBACzC,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { createRequire } from 'module';\n\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if the platform version in manifest matches the version of the Snaps\n * SDK.\n */\nexport const platformVersion: ValidatorMeta = {\n severity: 'error',\n async semanticCheck(files, context) {\n const manifestPlatformVersion = files.manifest.result.platformVersion;\n\n // Create a require function in the context of the location of the manifest\n // file to avoid potentially loading the wrong version of the Snaps SDK.\n const require = createRequire(files.manifest.path);\n\n const packageJson = require.resolve('@metamask/snaps-sdk/package.json');\n // eslint-disable-next-line import-x/no-dynamic-require\n const actualVersion = require(packageJson).version;\n\n if (!manifestPlatformVersion) {\n context.report(\n 'The \"platformVersion\" field is missing from the manifest.',\n ({ manifest }) => {\n manifest.platformVersion = actualVersion;\n return { manifest };\n },\n );\n\n return;\n }\n\n if (manifestPlatformVersion !== actualVersion) {\n context.report(\n `The \"platformVersion\" field in the manifest must match the version of the Snaps SDK. Got \"${manifestPlatformVersion}\", expected \"${actualVersion}\".`,\n async ({ manifest }) => {\n manifest.platformVersion = actualVersion;\n return { manifest };\n },\n );\n }\n },\n};\n"]}
1
+ {"version":3,"file":"platform-version.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/platform-version.ts"],"names":[],"mappings":";;;AAAA,mCAAuC;AAIvC;;;GAGG;AACU,QAAA,eAAe,GAAkB;IAC5C,QAAQ,EAAE,OAAO;IACjB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO;QAChC,MAAM,uBAAuB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC;QAEtE,2EAA2E;QAC3E,wEAAwE;QACxE,MAAM,OAAO,GAAG,IAAA,sBAAa,EAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEnD,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;QACxE,uDAAuD;QACvD,MAAM,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC;QAEnD,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC7B,OAAO,CAAC,MAAM,CACZ,0BAA0B,EAC1B,2DAA2D,EAC3D,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACf,QAAQ,CAAC,eAAe,GAAG,aAAa,CAAC;gBACzC,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;YAEF,OAAO;QACT,CAAC;QAED,IAAI,uBAAuB,KAAK,aAAa,EAAE,CAAC;YAC9C,OAAO,CAAC,MAAM,CACZ,2BAA2B,EAC3B,6FAA6F,uBAAuB,gBAAgB,aAAa,IAAI,EACrJ,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACrB,QAAQ,CAAC,eAAe,GAAG,aAAa,CAAC;gBACzC,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { createRequire } from 'module';\n\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if the platform version in manifest matches the version of the Snaps\n * SDK.\n */\nexport const platformVersion: ValidatorMeta = {\n severity: 'error',\n async semanticCheck(files, context) {\n const manifestPlatformVersion = files.manifest.result.platformVersion;\n\n // Create a require function in the context of the location of the manifest\n // file to avoid potentially loading the wrong version of the Snaps SDK.\n const require = createRequire(files.manifest.path);\n\n const packageJson = require.resolve('@metamask/snaps-sdk/package.json');\n // eslint-disable-next-line import-x/no-dynamic-require\n const actualVersion = require(packageJson).version;\n\n if (!manifestPlatformVersion) {\n context.report(\n 'platform-version-missing',\n 'The \"platformVersion\" field is missing from the manifest.',\n ({ manifest }) => {\n manifest.platformVersion = actualVersion;\n return { manifest };\n },\n );\n\n return;\n }\n\n if (manifestPlatformVersion !== actualVersion) {\n context.report(\n 'platform-version-mismatch',\n `The \"platformVersion\" field in the manifest must match the version of the Snaps SDK. Got \"${manifestPlatformVersion}\", expected \"${actualVersion}\".`,\n async ({ manifest }) => {\n manifest.platformVersion = actualVersion;\n return { manifest };\n },\n );\n }\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"platform-version.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/platform-version.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,aAmC7B,CAAC"}
1
+ {"version":3,"file":"platform-version.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/platform-version.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,aAqC7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"platform-version.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/platform-version.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,aAmC7B,CAAC"}
1
+ {"version":3,"file":"platform-version.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/platform-version.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,aAqC7B,CAAC"}
@@ -14,14 +14,14 @@ export const platformVersion = {
14
14
  // eslint-disable-next-line import-x/no-dynamic-require
15
15
  const actualVersion = require(packageJson).version;
16
16
  if (!manifestPlatformVersion) {
17
- context.report('The "platformVersion" field is missing from the manifest.', ({ manifest }) => {
17
+ context.report('platform-version-missing', 'The "platformVersion" field is missing from the manifest.', ({ manifest }) => {
18
18
  manifest.platformVersion = actualVersion;
19
19
  return { manifest };
20
20
  });
21
21
  return;
22
22
  }
23
23
  if (manifestPlatformVersion !== actualVersion) {
24
- context.report(`The "platformVersion" field in the manifest must match the version of the Snaps SDK. Got "${manifestPlatformVersion}", expected "${actualVersion}".`, async ({ manifest }) => {
24
+ context.report('platform-version-mismatch', `The "platformVersion" field in the manifest must match the version of the Snaps SDK. Got "${manifestPlatformVersion}", expected "${actualVersion}".`, async ({ manifest }) => {
25
25
  manifest.platformVersion = actualVersion;
26
26
  return { manifest };
27
27
  });
@@ -1 +1 @@
1
- {"version":3,"file":"platform-version.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/platform-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe;AAIvC;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAkB;IAC5C,QAAQ,EAAE,OAAO;IACjB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO;QAChC,MAAM,uBAAuB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC;QAEtE,2EAA2E;QAC3E,wEAAwE;QACxE,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEnD,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;QACxE,uDAAuD;QACvD,MAAM,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC;QAEnD,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC7B,OAAO,CAAC,MAAM,CACZ,2DAA2D,EAC3D,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACf,QAAQ,CAAC,eAAe,GAAG,aAAa,CAAC;gBACzC,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;YAEF,OAAO;QACT,CAAC;QAED,IAAI,uBAAuB,KAAK,aAAa,EAAE,CAAC;YAC9C,OAAO,CAAC,MAAM,CACZ,6FAA6F,uBAAuB,gBAAgB,aAAa,IAAI,EACrJ,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACrB,QAAQ,CAAC,eAAe,GAAG,aAAa,CAAC;gBACzC,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { createRequire } from 'module';\n\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if the platform version in manifest matches the version of the Snaps\n * SDK.\n */\nexport const platformVersion: ValidatorMeta = {\n severity: 'error',\n async semanticCheck(files, context) {\n const manifestPlatformVersion = files.manifest.result.platformVersion;\n\n // Create a require function in the context of the location of the manifest\n // file to avoid potentially loading the wrong version of the Snaps SDK.\n const require = createRequire(files.manifest.path);\n\n const packageJson = require.resolve('@metamask/snaps-sdk/package.json');\n // eslint-disable-next-line import-x/no-dynamic-require\n const actualVersion = require(packageJson).version;\n\n if (!manifestPlatformVersion) {\n context.report(\n 'The \"platformVersion\" field is missing from the manifest.',\n ({ manifest }) => {\n manifest.platformVersion = actualVersion;\n return { manifest };\n },\n );\n\n return;\n }\n\n if (manifestPlatformVersion !== actualVersion) {\n context.report(\n `The \"platformVersion\" field in the manifest must match the version of the Snaps SDK. Got \"${manifestPlatformVersion}\", expected \"${actualVersion}\".`,\n async ({ manifest }) => {\n manifest.platformVersion = actualVersion;\n return { manifest };\n },\n );\n }\n },\n};\n"]}
1
+ {"version":3,"file":"platform-version.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/platform-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe;AAIvC;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAkB;IAC5C,QAAQ,EAAE,OAAO;IACjB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO;QAChC,MAAM,uBAAuB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC;QAEtE,2EAA2E;QAC3E,wEAAwE;QACxE,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEnD,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;QACxE,uDAAuD;QACvD,MAAM,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC;QAEnD,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC7B,OAAO,CAAC,MAAM,CACZ,0BAA0B,EAC1B,2DAA2D,EAC3D,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACf,QAAQ,CAAC,eAAe,GAAG,aAAa,CAAC;gBACzC,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;YAEF,OAAO;QACT,CAAC;QAED,IAAI,uBAAuB,KAAK,aAAa,EAAE,CAAC;YAC9C,OAAO,CAAC,MAAM,CACZ,2BAA2B,EAC3B,6FAA6F,uBAAuB,gBAAgB,aAAa,IAAI,EACrJ,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACrB,QAAQ,CAAC,eAAe,GAAG,aAAa,CAAC;gBACzC,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { createRequire } from 'module';\n\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if the platform version in manifest matches the version of the Snaps\n * SDK.\n */\nexport const platformVersion: ValidatorMeta = {\n severity: 'error',\n async semanticCheck(files, context) {\n const manifestPlatformVersion = files.manifest.result.platformVersion;\n\n // Create a require function in the context of the location of the manifest\n // file to avoid potentially loading the wrong version of the Snaps SDK.\n const require = createRequire(files.manifest.path);\n\n const packageJson = require.resolve('@metamask/snaps-sdk/package.json');\n // eslint-disable-next-line import-x/no-dynamic-require\n const actualVersion = require(packageJson).version;\n\n if (!manifestPlatformVersion) {\n context.report(\n 'platform-version-missing',\n 'The \"platformVersion\" field is missing from the manifest.',\n ({ manifest }) => {\n manifest.platformVersion = actualVersion;\n return { manifest };\n },\n );\n\n return;\n }\n\n if (manifestPlatformVersion !== actualVersion) {\n context.report(\n 'platform-version-mismatch',\n `The \"platformVersion\" field in the manifest must match the version of the Snaps SDK. Got \"${manifestPlatformVersion}\", expected \"${actualVersion}\".`,\n async ({ manifest }) => {\n manifest.platformVersion = actualVersion;\n return { manifest };\n },\n );\n }\n },\n};\n"]}
@@ -40,7 +40,7 @@ exports.productionPlatformVersion = {
40
40
  return;
41
41
  }
42
42
  if ((0, semver_1.gt)(manifestPlatformVersion, maximumVersion)) {
43
- context.report(`The specified platform version "${manifestPlatformVersion}" is not supported in the production version of MetaMask. The current maximum supported version is "${maximumVersion}". To resolve this, downgrade \`@metamask/snaps-sdk\` to a compatible version.`);
43
+ context.report('production-platform-version', `The specified platform version "${manifestPlatformVersion}" is not supported in the production version of MetaMask. The current maximum supported version is "${maximumVersion}". To resolve this, downgrade \`@metamask/snaps-sdk\` to a compatible version.`);
44
44
  }
45
45
  },
46
46
  };
@@ -1 +1 @@
1
- {"version":3,"file":"production-platform-version.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/production-platform-version.ts"],"names":[],"mappings":";;;AAAA,2CAA2D;AAC3D,mCAAwC;AAExC,qCAA8C;AAG9C;;;;;GAKG;AACH,MAAM,0BAA0B,GAAG,IAAA,uBAAkB,EACnD,0BAA0B,EAC1B,IAAA,sBAAc,EAAC,CAAC,EAAE,gBAAQ,CAAC,GAAG,CAAC,EAC/B,KAAK,IAAI,EAAE;IACT,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,MAAM,KAAK,CAC/B,0EAA0E,CAC3E,CAAC;QAEF,MAAM,iBAAiB,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE,CAAC;QAErD,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC;QAE/D,MAAM,mBAAmB,GAAG,MAAM,KAAK,CACrC,sFAAsF,mBAAmB,EAAE,EAC3G,EAAE,OAAO,EAAE,IAAI,OAAO,CAAC,EAAE,MAAM,EAAE,iCAAiC,EAAE,CAAC,EAAE,CACxE,CAAC;QAEF,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;QAErD,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;QAErE,OAAO,IAAA,mBAAU,EAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CACF,CAAC;AAEF;;;GAGG;AACU,QAAA,yBAAyB,GAAkB;IACtD,QAAQ,EAAE,SAAS;IACnB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO;QAChC,MAAM,uBAAuB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC;QAEtE,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC7B,OAAO;QACT,CAAC;QAED,MAAM,cAAc,GAAG,MAAM,0BAA0B,EAAE,CAAC;QAE1D,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QAED,IAAI,IAAA,WAAE,EAAC,uBAAuB,EAAE,cAAc,CAAC,EAAE,CAAC;YAChD,OAAO,CAAC,MAAM,CACZ,mCAAmC,uBAAuB,uGAAuG,cAAc,gFAAgF,CAChQ,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { Duration, inMilliseconds } from '@metamask/utils';\nimport { minVersion, gt } from 'semver';\n\nimport { useFileSystemCache } from '../../fs';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Determine the production version of the Snaps platform by inspecting\n * the latest GitHub release of the MetaMask extension.\n *\n * @returns The production version of the Snaps platform or null if any error occurred.\n */\nconst determineProductionVersion = useFileSystemCache(\n 'snaps-production-version',\n inMilliseconds(3, Duration.Day),\n async () => {\n try {\n const latestRelease = await fetch(\n 'https://api.github.com/repos/metamask/metamask-extension/releases/latest',\n );\n\n const latestReleaseJson = await latestRelease.json();\n\n const latestReleaseCommit = latestReleaseJson.target_commitish;\n\n const packageJsonResponse = await fetch(\n `https://api.github.com/repos/metamask/metamask-extension/contents/package.json?ref=${latestReleaseCommit}`,\n { headers: new Headers({ accept: 'application/vnd.github.raw+json' }) },\n );\n\n const packageJson = await packageJsonResponse.json();\n\n const versionRange = packageJson.dependencies['@metamask/snaps-sdk'];\n\n return minVersion(versionRange)?.format();\n } catch {\n return null;\n }\n },\n);\n\n/**\n * Check if the platform version in manifest exceeds the version\n * used in production.\n */\nexport const productionPlatformVersion: ValidatorMeta = {\n severity: 'warning',\n async semanticCheck(files, context) {\n const manifestPlatformVersion = files.manifest.result.platformVersion;\n\n if (!manifestPlatformVersion) {\n return;\n }\n\n const maximumVersion = await determineProductionVersion();\n\n if (!maximumVersion) {\n return;\n }\n\n if (gt(manifestPlatformVersion, maximumVersion)) {\n context.report(\n `The specified platform version \"${manifestPlatformVersion}\" is not supported in the production version of MetaMask. The current maximum supported version is \"${maximumVersion}\". To resolve this, downgrade \\`@metamask/snaps-sdk\\` to a compatible version.`,\n );\n }\n },\n};\n"]}
1
+ {"version":3,"file":"production-platform-version.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/production-platform-version.ts"],"names":[],"mappings":";;;AAAA,2CAA2D;AAC3D,mCAAwC;AAExC,qCAA8C;AAG9C;;;;;GAKG;AACH,MAAM,0BAA0B,GAAG,IAAA,uBAAkB,EACnD,0BAA0B,EAC1B,IAAA,sBAAc,EAAC,CAAC,EAAE,gBAAQ,CAAC,GAAG,CAAC,EAC/B,KAAK,IAAI,EAAE;IACT,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,MAAM,KAAK,CAC/B,0EAA0E,CAC3E,CAAC;QAEF,MAAM,iBAAiB,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE,CAAC;QAErD,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC;QAE/D,MAAM,mBAAmB,GAAG,MAAM,KAAK,CACrC,sFAAsF,mBAAmB,EAAE,EAC3G,EAAE,OAAO,EAAE,IAAI,OAAO,CAAC,EAAE,MAAM,EAAE,iCAAiC,EAAE,CAAC,EAAE,CACxE,CAAC;QAEF,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;QAErD,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;QAErE,OAAO,IAAA,mBAAU,EAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CACF,CAAC;AAEF;;;GAGG;AACU,QAAA,yBAAyB,GAAkB;IACtD,QAAQ,EAAE,SAAS;IACnB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO;QAChC,MAAM,uBAAuB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC;QAEtE,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC7B,OAAO;QACT,CAAC;QAED,MAAM,cAAc,GAAG,MAAM,0BAA0B,EAAE,CAAC;QAE1D,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QAED,IAAI,IAAA,WAAE,EAAC,uBAAuB,EAAE,cAAc,CAAC,EAAE,CAAC;YAChD,OAAO,CAAC,MAAM,CACZ,6BAA6B,EAC7B,mCAAmC,uBAAuB,uGAAuG,cAAc,gFAAgF,CAChQ,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { Duration, inMilliseconds } from '@metamask/utils';\nimport { minVersion, gt } from 'semver';\n\nimport { useFileSystemCache } from '../../fs';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Determine the production version of the Snaps platform by inspecting\n * the latest GitHub release of the MetaMask extension.\n *\n * @returns The production version of the Snaps platform or null if any error occurred.\n */\nconst determineProductionVersion = useFileSystemCache(\n 'snaps-production-version',\n inMilliseconds(3, Duration.Day),\n async () => {\n try {\n const latestRelease = await fetch(\n 'https://api.github.com/repos/metamask/metamask-extension/releases/latest',\n );\n\n const latestReleaseJson = await latestRelease.json();\n\n const latestReleaseCommit = latestReleaseJson.target_commitish;\n\n const packageJsonResponse = await fetch(\n `https://api.github.com/repos/metamask/metamask-extension/contents/package.json?ref=${latestReleaseCommit}`,\n { headers: new Headers({ accept: 'application/vnd.github.raw+json' }) },\n );\n\n const packageJson = await packageJsonResponse.json();\n\n const versionRange = packageJson.dependencies['@metamask/snaps-sdk'];\n\n return minVersion(versionRange)?.format();\n } catch {\n return null;\n }\n },\n);\n\n/**\n * Check if the platform version in manifest exceeds the version\n * used in production.\n */\nexport const productionPlatformVersion: ValidatorMeta = {\n severity: 'warning',\n async semanticCheck(files, context) {\n const manifestPlatformVersion = files.manifest.result.platformVersion;\n\n if (!manifestPlatformVersion) {\n return;\n }\n\n const maximumVersion = await determineProductionVersion();\n\n if (!maximumVersion) {\n return;\n }\n\n if (gt(manifestPlatformVersion, maximumVersion)) {\n context.report(\n 'production-platform-version',\n `The specified platform version \"${manifestPlatformVersion}\" is not supported in the production version of MetaMask. The current maximum supported version is \"${maximumVersion}\". To resolve this, downgrade \\`@metamask/snaps-sdk\\` to a compatible version.`,\n );\n }\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"production-platform-version.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/production-platform-version.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAqCxD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,aAqBvC,CAAC"}
1
+ {"version":3,"file":"production-platform-version.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/production-platform-version.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAqCxD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,aAsBvC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"production-platform-version.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/production-platform-version.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAqCxD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,aAqBvC,CAAC"}
1
+ {"version":3,"file":"production-platform-version.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/production-platform-version.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAqCxD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,aAsBvC,CAAC"}
@@ -37,7 +37,7 @@ export const productionPlatformVersion = {
37
37
  return;
38
38
  }
39
39
  if (gt(manifestPlatformVersion, maximumVersion)) {
40
- context.report(`The specified platform version "${manifestPlatformVersion}" is not supported in the production version of MetaMask. The current maximum supported version is "${maximumVersion}". To resolve this, downgrade \`@metamask/snaps-sdk\` to a compatible version.`);
40
+ context.report('production-platform-version', `The specified platform version "${manifestPlatformVersion}" is not supported in the production version of MetaMask. The current maximum supported version is "${maximumVersion}". To resolve this, downgrade \`@metamask/snaps-sdk\` to a compatible version.`);
41
41
  }
42
42
  },
43
43
  };
@@ -1 +1 @@
1
- {"version":3,"file":"production-platform-version.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/production-platform-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,wBAAwB;AAC3D,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,eAAe;AAExC,OAAO,EAAE,kBAAkB,EAAE,qBAAiB;AAG9C;;;;;GAKG;AACH,MAAM,0BAA0B,GAAG,kBAAkB,CACnD,0BAA0B,EAC1B,cAAc,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,EAC/B,KAAK,IAAI,EAAE;IACT,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,MAAM,KAAK,CAC/B,0EAA0E,CAC3E,CAAC;QAEF,MAAM,iBAAiB,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE,CAAC;QAErD,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC;QAE/D,MAAM,mBAAmB,GAAG,MAAM,KAAK,CACrC,sFAAsF,mBAAmB,EAAE,EAC3G,EAAE,OAAO,EAAE,IAAI,OAAO,CAAC,EAAE,MAAM,EAAE,iCAAiC,EAAE,CAAC,EAAE,CACxE,CAAC;QAEF,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;QAErD,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;QAErE,OAAO,UAAU,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAkB;IACtD,QAAQ,EAAE,SAAS;IACnB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO;QAChC,MAAM,uBAAuB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC;QAEtE,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC7B,OAAO;QACT,CAAC;QAED,MAAM,cAAc,GAAG,MAAM,0BAA0B,EAAE,CAAC;QAE1D,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QAED,IAAI,EAAE,CAAC,uBAAuB,EAAE,cAAc,CAAC,EAAE,CAAC;YAChD,OAAO,CAAC,MAAM,CACZ,mCAAmC,uBAAuB,uGAAuG,cAAc,gFAAgF,CAChQ,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { Duration, inMilliseconds } from '@metamask/utils';\nimport { minVersion, gt } from 'semver';\n\nimport { useFileSystemCache } from '../../fs';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Determine the production version of the Snaps platform by inspecting\n * the latest GitHub release of the MetaMask extension.\n *\n * @returns The production version of the Snaps platform or null if any error occurred.\n */\nconst determineProductionVersion = useFileSystemCache(\n 'snaps-production-version',\n inMilliseconds(3, Duration.Day),\n async () => {\n try {\n const latestRelease = await fetch(\n 'https://api.github.com/repos/metamask/metamask-extension/releases/latest',\n );\n\n const latestReleaseJson = await latestRelease.json();\n\n const latestReleaseCommit = latestReleaseJson.target_commitish;\n\n const packageJsonResponse = await fetch(\n `https://api.github.com/repos/metamask/metamask-extension/contents/package.json?ref=${latestReleaseCommit}`,\n { headers: new Headers({ accept: 'application/vnd.github.raw+json' }) },\n );\n\n const packageJson = await packageJsonResponse.json();\n\n const versionRange = packageJson.dependencies['@metamask/snaps-sdk'];\n\n return minVersion(versionRange)?.format();\n } catch {\n return null;\n }\n },\n);\n\n/**\n * Check if the platform version in manifest exceeds the version\n * used in production.\n */\nexport const productionPlatformVersion: ValidatorMeta = {\n severity: 'warning',\n async semanticCheck(files, context) {\n const manifestPlatformVersion = files.manifest.result.platformVersion;\n\n if (!manifestPlatformVersion) {\n return;\n }\n\n const maximumVersion = await determineProductionVersion();\n\n if (!maximumVersion) {\n return;\n }\n\n if (gt(manifestPlatformVersion, maximumVersion)) {\n context.report(\n `The specified platform version \"${manifestPlatformVersion}\" is not supported in the production version of MetaMask. The current maximum supported version is \"${maximumVersion}\". To resolve this, downgrade \\`@metamask/snaps-sdk\\` to a compatible version.`,\n );\n }\n },\n};\n"]}
1
+ {"version":3,"file":"production-platform-version.mjs","sourceRoot":"","sources":["../../../src/manifest/validators/production-platform-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,wBAAwB;AAC3D,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,eAAe;AAExC,OAAO,EAAE,kBAAkB,EAAE,qBAAiB;AAG9C;;;;;GAKG;AACH,MAAM,0BAA0B,GAAG,kBAAkB,CACnD,0BAA0B,EAC1B,cAAc,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,EAC/B,KAAK,IAAI,EAAE;IACT,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,MAAM,KAAK,CAC/B,0EAA0E,CAC3E,CAAC;QAEF,MAAM,iBAAiB,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE,CAAC;QAErD,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC;QAE/D,MAAM,mBAAmB,GAAG,MAAM,KAAK,CACrC,sFAAsF,mBAAmB,EAAE,EAC3G,EAAE,OAAO,EAAE,IAAI,OAAO,CAAC,EAAE,MAAM,EAAE,iCAAiC,EAAE,CAAC,EAAE,CACxE,CAAC;QAEF,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;QAErD,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;QAErE,OAAO,UAAU,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAkB;IACtD,QAAQ,EAAE,SAAS;IACnB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO;QAChC,MAAM,uBAAuB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC;QAEtE,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC7B,OAAO;QACT,CAAC;QAED,MAAM,cAAc,GAAG,MAAM,0BAA0B,EAAE,CAAC;QAE1D,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QAED,IAAI,EAAE,CAAC,uBAAuB,EAAE,cAAc,CAAC,EAAE,CAAC;YAChD,OAAO,CAAC,MAAM,CACZ,6BAA6B,EAC7B,mCAAmC,uBAAuB,uGAAuG,cAAc,gFAAgF,CAChQ,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { Duration, inMilliseconds } from '@metamask/utils';\nimport { minVersion, gt } from 'semver';\n\nimport { useFileSystemCache } from '../../fs';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Determine the production version of the Snaps platform by inspecting\n * the latest GitHub release of the MetaMask extension.\n *\n * @returns The production version of the Snaps platform or null if any error occurred.\n */\nconst determineProductionVersion = useFileSystemCache(\n 'snaps-production-version',\n inMilliseconds(3, Duration.Day),\n async () => {\n try {\n const latestRelease = await fetch(\n 'https://api.github.com/repos/metamask/metamask-extension/releases/latest',\n );\n\n const latestReleaseJson = await latestRelease.json();\n\n const latestReleaseCommit = latestReleaseJson.target_commitish;\n\n const packageJsonResponse = await fetch(\n `https://api.github.com/repos/metamask/metamask-extension/contents/package.json?ref=${latestReleaseCommit}`,\n { headers: new Headers({ accept: 'application/vnd.github.raw+json' }) },\n );\n\n const packageJson = await packageJsonResponse.json();\n\n const versionRange = packageJson.dependencies['@metamask/snaps-sdk'];\n\n return minVersion(versionRange)?.format();\n } catch {\n return null;\n }\n },\n);\n\n/**\n * Check if the platform version in manifest exceeds the version\n * used in production.\n */\nexport const productionPlatformVersion: ValidatorMeta = {\n severity: 'warning',\n async semanticCheck(files, context) {\n const manifestPlatformVersion = files.manifest.result.platformVersion;\n\n if (!manifestPlatformVersion) {\n return;\n }\n\n const maximumVersion = await determineProductionVersion();\n\n if (!maximumVersion) {\n return;\n }\n\n if (gt(manifestPlatformVersion, maximumVersion)) {\n context.report(\n 'production-platform-version',\n `The specified platform version \"${manifestPlatformVersion}\" is not supported in the production version of MetaMask. The current maximum supported version is \"${maximumVersion}\". To resolve this, downgrade \\`@metamask/snaps-sdk\\` to a compatible version.`,\n );\n }\n },\n};\n"]}
@@ -17,7 +17,7 @@ exports.repositoryMatch = {
17
17
  const manifestRepository = files.manifest.result.repository;
18
18
  if ((packageJsonRepository || manifestRepository) &&
19
19
  !(0, fast_deep_equal_1.default)(packageJsonRepository, manifestRepository)) {
20
- context.report(`"${types_1.NpmSnapFileNames.Manifest}" "repository" field does not match the "${types_1.NpmSnapFileNames.PackageJson}" "repository" field.`, ({ manifest }) => {
20
+ context.report('repository-match', `"${types_1.NpmSnapFileNames.Manifest}" "repository" field does not match the "${types_1.NpmSnapFileNames.PackageJson}" "repository" field.`, ({ manifest }) => {
21
21
  manifest.repository = packageJsonRepository
22
22
  ? (0, deep_clone_1.deepClone)(packageJsonRepository)
23
23
  : undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"repository-match.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/repository-match.ts"],"names":[],"mappings":";;;;;;AAAA,sEAAwC;AAExC,qDAA6C;AAC7C,2CAA+C;AAG/C;;GAEG;AACU,QAAA,eAAe,GAAkB;IAC5C,QAAQ,EAAE,OAAO;IACjB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,MAAM,qBAAqB,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC;QAClE,MAAM,kBAAkB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC;QAC5D,IACE,CAAC,qBAAqB,IAAI,kBAAkB,CAAC;YAC7C,CAAC,IAAA,yBAAS,EAAC,qBAAqB,EAAE,kBAAkB,CAAC,EACrD,CAAC;YACD,OAAO,CAAC,MAAM,CACZ,IAAI,wBAAgB,CAAC,QAAQ,4CAA4C,wBAAgB,CAAC,WAAW,uBAAuB,EAC5H,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACf,QAAQ,CAAC,UAAU,GAAG,qBAAqB;oBACzC,CAAC,CAAC,IAAA,sBAAS,EAAC,qBAAqB,CAAC;oBAClC,CAAC,CAAC,SAAS,CAAC;gBACd,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import deepEqual from 'fast-deep-equal';\n\nimport { deepClone } from '../../deep-clone';\nimport { NpmSnapFileNames } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if the repository object in manifest is the same as in package.json.\n */\nexport const repositoryMatch: ValidatorMeta = {\n severity: 'error',\n semanticCheck(files, context) {\n const packageJsonRepository = files.packageJson.result.repository;\n const manifestRepository = files.manifest.result.repository;\n if (\n (packageJsonRepository || manifestRepository) &&\n !deepEqual(packageJsonRepository, manifestRepository)\n ) {\n context.report(\n `\"${NpmSnapFileNames.Manifest}\" \"repository\" field does not match the \"${NpmSnapFileNames.PackageJson}\" \"repository\" field.`,\n ({ manifest }) => {\n manifest.repository = packageJsonRepository\n ? deepClone(packageJsonRepository)\n : undefined;\n return { manifest };\n },\n );\n }\n },\n};\n"]}
1
+ {"version":3,"file":"repository-match.cjs","sourceRoot":"","sources":["../../../src/manifest/validators/repository-match.ts"],"names":[],"mappings":";;;;;;AAAA,sEAAwC;AAExC,qDAA6C;AAC7C,2CAA+C;AAG/C;;GAEG;AACU,QAAA,eAAe,GAAkB;IAC5C,QAAQ,EAAE,OAAO;IACjB,aAAa,CAAC,KAAK,EAAE,OAAO;QAC1B,MAAM,qBAAqB,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC;QAClE,MAAM,kBAAkB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC;QAC5D,IACE,CAAC,qBAAqB,IAAI,kBAAkB,CAAC;YAC7C,CAAC,IAAA,yBAAS,EAAC,qBAAqB,EAAE,kBAAkB,CAAC,EACrD,CAAC;YACD,OAAO,CAAC,MAAM,CACZ,kBAAkB,EAClB,IAAI,wBAAgB,CAAC,QAAQ,4CAA4C,wBAAgB,CAAC,WAAW,uBAAuB,EAC5H,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACf,QAAQ,CAAC,UAAU,GAAG,qBAAqB;oBACzC,CAAC,CAAC,IAAA,sBAAS,EAAC,qBAAqB,CAAC;oBAClC,CAAC,CAAC,SAAS,CAAC;gBACd,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import deepEqual from 'fast-deep-equal';\n\nimport { deepClone } from '../../deep-clone';\nimport { NpmSnapFileNames } from '../../types';\nimport type { ValidatorMeta } from '../validator-types';\n\n/**\n * Check if the repository object in manifest is the same as in package.json.\n */\nexport const repositoryMatch: ValidatorMeta = {\n severity: 'error',\n semanticCheck(files, context) {\n const packageJsonRepository = files.packageJson.result.repository;\n const manifestRepository = files.manifest.result.repository;\n if (\n (packageJsonRepository || manifestRepository) &&\n !deepEqual(packageJsonRepository, manifestRepository)\n ) {\n context.report(\n 'repository-match',\n `\"${NpmSnapFileNames.Manifest}\" \"repository\" field does not match the \"${NpmSnapFileNames.PackageJson}\" \"repository\" field.`,\n ({ manifest }) => {\n manifest.repository = packageJsonRepository\n ? deepClone(packageJsonRepository)\n : undefined;\n return { manifest };\n },\n );\n }\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"repository-match.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/repository-match.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,aAoB7B,CAAC"}
1
+ {"version":3,"file":"repository-match.d.cts","sourceRoot":"","sources":["../../../src/manifest/validators/repository-match.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,aAqB7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"repository-match.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/repository-match.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,aAoB7B,CAAC"}
1
+ {"version":3,"file":"repository-match.d.mts","sourceRoot":"","sources":["../../../src/manifest/validators/repository-match.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA2B;AAExD;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,aAqB7B,CAAC"}
@@ -18,7 +18,7 @@ export const repositoryMatch = {
18
18
  const manifestRepository = files.manifest.result.repository;
19
19
  if ((packageJsonRepository || manifestRepository) &&
20
20
  !deepEqual(packageJsonRepository, manifestRepository)) {
21
- context.report(`"${NpmSnapFileNames.Manifest}" "repository" field does not match the "${NpmSnapFileNames.PackageJson}" "repository" field.`, ({ manifest }) => {
21
+ context.report('repository-match', `"${NpmSnapFileNames.Manifest}" "repository" field does not match the "${NpmSnapFileNames.PackageJson}" "repository" field.`, ({ manifest }) => {
22
22
  manifest.repository = packageJsonRepository
23
23
  ? deepClone(packageJsonRepository)
24
24
  : undefined;