@metamask/snaps-utils 0.30.0 → 0.31.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 (48) hide show
  1. package/dist/cronjob.d.ts +3 -3
  2. package/dist/cronjob.js +4 -7
  3. package/dist/cronjob.js.map +1 -1
  4. package/dist/eval-worker.js +24 -7
  5. package/dist/eval-worker.js.map +1 -1
  6. package/dist/eval.js +1 -2
  7. package/dist/eval.js.map +1 -1
  8. package/dist/fs.d.ts +9 -0
  9. package/dist/fs.js +24 -1
  10. package/dist/fs.js.map +1 -1
  11. package/dist/handlers.d.ts +2 -5
  12. package/dist/handlers.js.map +1 -1
  13. package/dist/iframe.js +1 -0
  14. package/dist/iframe.js.map +1 -1
  15. package/dist/iframe.test.browser.d.ts +1 -0
  16. package/dist/iframe.test.browser.js +15 -0
  17. package/dist/iframe.test.browser.js.map +1 -0
  18. package/dist/index.browser.d.ts +0 -2
  19. package/dist/index.browser.js +0 -2
  20. package/dist/index.browser.js.map +1 -1
  21. package/dist/index.d.ts +0 -2
  22. package/dist/index.js +0 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/manifest/manifest.js +13 -20
  25. package/dist/manifest/manifest.js.map +1 -1
  26. package/dist/manifest/validation.d.ts +12 -12
  27. package/dist/mock.js +3 -3
  28. package/dist/mock.js.map +1 -1
  29. package/dist/namespace.js +2 -2
  30. package/dist/namespace.js.map +1 -1
  31. package/dist/npm.js +4 -4
  32. package/dist/npm.js.map +1 -1
  33. package/dist/post-process.js +5 -7
  34. package/dist/post-process.js.map +1 -1
  35. package/dist/snaps.d.ts +10 -6
  36. package/dist/snaps.js +16 -22
  37. package/dist/snaps.js.map +1 -1
  38. package/dist/types.js +1 -1
  39. package/dist/types.js.map +1 -1
  40. package/dist/virtual-file/VirtualFile.js +4 -5
  41. package/dist/virtual-file/VirtualFile.js.map +1 -1
  42. package/package.json +30 -9
  43. package/dist/flatMap.d.ts +0 -22
  44. package/dist/flatMap.js +0 -38
  45. package/dist/flatMap.js.map +0 -1
  46. package/dist/object.d.ts +0 -8
  47. package/dist/object.js +0 -15
  48. package/dist/object.js.map +0 -1
package/dist/flatMap.js DELETED
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.flatMap = exports.flatten = void 0;
4
- /**
5
- * Flattens an array of arrays of up to 1 level deep into a single array.
6
- *
7
- * This is a non-recursive implementation of `Array.prototype.flat`, which is
8
- * only available in ES2019 and above.
9
- *
10
- * @param array - The array to flatten.
11
- * @returns The flattened array.
12
- */
13
- const flatten = (array) => {
14
- return array.reduce((acc, cur) => {
15
- if (Array.isArray(cur)) {
16
- return [...acc, ...cur];
17
- }
18
- acc.push(cur);
19
- return acc;
20
- }, []);
21
- };
22
- exports.flatten = flatten;
23
- /**
24
- * Maps an array of values using the provided callback, then flattens the result
25
- * into a single array, up to 1 level deep.
26
- *
27
- * This is a non-recursive implementation of `Array.prototype.flatMap`, which is
28
- * only available in ES2019 and above.
29
- *
30
- * @param array - The array to map.
31
- * @param callback - The callback to map each value with.
32
- * @returns The mapped and flattened array.
33
- */
34
- const flatMap = (array, callback) => {
35
- return (0, exports.flatten)(array.map(callback));
36
- };
37
- exports.flatMap = flatMap;
38
- //# sourceMappingURL=flatMap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"flatMap.js","sourceRoot":"","sources":["../src/flatMap.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACI,MAAM,OAAO,GAAG,CAAO,KAAwB,EAAU,EAAE;IAChE,OAAO,KAAK,CAAC,MAAM,CAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACvC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACtB,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC;SACzB;QACD,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACd,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AARW,QAAA,OAAO,WAQlB;AAEF;;;;;;;;;;GAUG;AACI,MAAM,OAAO,GAAG,CACrB,KAAa,EACb,QAA4C,EAClC,EAAE;IACZ,OAAO,IAAA,eAAO,EAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtC,CAAC,CAAC;AALW,QAAA,OAAO,WAKlB","sourcesContent":["/**\n * Flattens an array of arrays of up to 1 level deep into a single array.\n *\n * This is a non-recursive implementation of `Array.prototype.flat`, which is\n * only available in ES2019 and above.\n *\n * @param array - The array to flatten.\n * @returns The flattened array.\n */\nexport const flatten = <Type>(array: (Type | Type[])[]): Type[] => {\n return array.reduce<Type[]>((acc, cur) => {\n if (Array.isArray(cur)) {\n return [...acc, ...cur];\n }\n acc.push(cur);\n return acc;\n }, []);\n};\n\n/**\n * Maps an array of values using the provided callback, then flattens the result\n * into a single array, up to 1 level deep.\n *\n * This is a non-recursive implementation of `Array.prototype.flatMap`, which is\n * only available in ES2019 and above.\n *\n * @param array - The array to map.\n * @param callback - The callback to map each value with.\n * @returns The mapped and flattened array.\n */\nexport const flatMap = <Type, Return>(\n array: Type[],\n callback: (value: Type) => Return | Return[],\n): Return[] => {\n return flatten(array.map(callback));\n};\n"]}
package/dist/object.d.ts DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * An alternative implementation of `Object.fromEntries`, which works in older
3
- * browsers.
4
- *
5
- * @param entries - The entries to convert to an object.
6
- * @returns The object.
7
- */
8
- export declare const fromEntries: <Key extends string, Value>(entries: readonly (readonly [Key, Value])[]) => Record<Key, Value>;
package/dist/object.js DELETED
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fromEntries = void 0;
4
- /**
5
- * An alternative implementation of `Object.fromEntries`, which works in older
6
- * browsers.
7
- *
8
- * @param entries - The entries to convert to an object.
9
- * @returns The object.
10
- */
11
- const fromEntries = (entries) => {
12
- return entries.reduce((acc, [key, value]) => (Object.assign(Object.assign({}, acc), { [key]: value })), {});
13
- };
14
- exports.fromEntries = fromEntries;
15
- //# sourceMappingURL=object.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"object.js","sourceRoot":"","sources":["../src/object.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACI,MAAM,WAAW,GAAG,CACzB,OAA2C,EACvB,EAAE;IACtB,OAAO,OAAO,CAAC,MAAM,CACnB,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,iCAAM,GAAG,KAAE,CAAC,GAAG,CAAC,EAAE,KAAK,IAAG,EACjD,EAAE,CACH,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,WAAW,eAOtB","sourcesContent":["/**\n * An alternative implementation of `Object.fromEntries`, which works in older\n * browsers.\n *\n * @param entries - The entries to convert to an object.\n * @returns The object.\n */\nexport const fromEntries = <Key extends string, Value>(\n entries: readonly (readonly [Key, Value])[],\n): Record<Key, Value> => {\n return entries.reduce<Record<string, Value>>(\n (acc, [key, value]) => ({ ...acc, [key]: value }),\n {},\n );\n};\n"]}