@metamask/snaps-rollup-plugin 4.1.2 → 5.0.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.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Changelog
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
4
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@@ -6,55 +7,95 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
7
 
7
8
  ## [Unreleased]
8
9
 
10
+ ## [5.0.0]
11
+
12
+ ### Added
13
+
14
+ - Support scheduling cronjobs with an ISO 8601 duration ([#3421](https://github.com/MetaMask/snaps/pull/3421))
15
+
16
+ ### Changed
17
+
18
+ - **BREAKING:** Drop support for Node.js 18 and 21 ([#3447](https://github.com/MetaMask/snaps/pull/3447))
19
+
20
+ ## [4.2.0]
21
+
22
+ ### Added
23
+
24
+ - Automatically add `platformVersion` to manifest ([#2938](https://github.com/MetaMask/snaps/pull/2938))
25
+
9
26
  ## [4.1.2]
27
+
10
28
  ### Fixed
29
+
11
30
  - Fix invalid types in type declaration in some cases ([#2714](https://github.com/MetaMask/snaps/pull/2714))
12
31
 
13
32
  ## [4.1.1]
33
+
14
34
  ### Fixed
35
+
15
36
  - Fix ESM version of the package ([#2682](https://github.com/MetaMask/snaps/pull/2682))
16
37
  - This fixes the ESM version of the package to be fully compliant with the ESM
17
38
  standard.
18
39
 
19
40
  ## [4.1.0]
41
+
20
42
  ### Changed
43
+
21
44
  - Improve manifest validation output ([#2572](https://github.com/MetaMask/snaps/pull/2572))
22
45
 
23
46
  ## [4.0.1]
47
+
24
48
  ### Fixed
49
+
25
50
  - Fix minor build configuration problems ([#2220](https://github.com/MetaMask/snaps/pull/2220))
26
51
 
27
52
  ## [4.0.0]
53
+
28
54
  ### Changed
55
+
29
56
  - **BREAKING:** Update ESM build to be fully compliant with the ESM standard ([#2210](https://github.com/MetaMask/snaps/pull/2210))
30
57
 
31
58
  ## [3.0.2]
59
+
32
60
  ### Changed
61
+
33
62
  - Bump several MetaMask dependencies ([#2054](https://github.com/MetaMask/snaps/pull/2054), [#2100](https://github.com/MetaMask/snaps/pull/2100), [#2105](https://github.com/MetaMask/snaps/pull/2105), [#2173](https://github.com/MetaMask/snaps/pull/2173))
34
63
 
35
64
  ## [3.0.1]
65
+
36
66
  ### Changed
67
+
37
68
  - Update multiple MetaMask dependencies ([#1841](https://github.com/MetaMask/snaps/pull/1841))
38
69
 
39
70
  ## [3.0.0]
71
+
40
72
  ### Changed
73
+
41
74
  - **BREAKING:** Bump minimum Node.js version to `^18.16.0` ([#1741](https://github.com/MetaMask/snaps/pull/1741))
42
75
 
43
76
  ## [2.0.0]
77
+
44
78
  ### Changed
79
+
45
80
  - Initial stable release from main branch ([#1757](https://github.com/MetaMask/snaps/pull/1757))
46
81
 
47
82
  ## [0.37.3-flask.1]
83
+
48
84
  ### Fixed
85
+
49
86
  - Remove unused dependencies ([#1680](https://github.com/MetaMask/snaps/pull/1680))
50
87
 
51
88
  ## [0.37.2-flask.1]
89
+
52
90
  ### Changed
91
+
53
92
  - Release package independently ([#1600](https://github.com/MetaMask/snaps/pull/1600))
54
93
  - The version of the package no longer needs to match the version of all other
55
94
  MetaMask Snaps packages.
56
95
 
57
- [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rollup-plugin@4.1.2...HEAD
96
+ [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rollup-plugin@5.0.0...HEAD
97
+ [5.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rollup-plugin@4.2.0...@metamask/snaps-rollup-plugin@5.0.0
98
+ [4.2.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rollup-plugin@4.1.2...@metamask/snaps-rollup-plugin@4.2.0
58
99
  [4.1.2]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rollup-plugin@4.1.1...@metamask/snaps-rollup-plugin@4.1.2
59
100
  [4.1.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rollup-plugin@4.1.0...@metamask/snaps-rollup-plugin@4.1.1
60
101
  [4.1.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rollup-plugin@4.0.1...@metamask/snaps-rollup-plugin@4.1.0
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  // This file is only used for testing source map generation.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- // eslint-disable-next-line import/unambiguous
5
4
  const foo = 'bar';
6
5
  // eslint-disable-next-line no-console
7
6
  console.log(foo);
@@ -1 +1 @@
1
- {"version":3,"file":"source-map.cjs","sourceRoot":"","sources":["../../src/__fixtures__/source-map.ts"],"names":[],"mappings":";AAAA,4DAA4D;;AAE5D,8CAA8C;AAC9C,MAAM,GAAG,GAAG,KAAK,CAAC;AAClB,sCAAsC;AACtC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","sourcesContent":["// This file is only used for testing source map generation.\n\n// eslint-disable-next-line import/unambiguous\nconst foo = 'bar';\n// eslint-disable-next-line no-console\nconsole.log(foo);\n"]}
1
+ {"version":3,"file":"source-map.cjs","sourceRoot":"","sources":["../../src/__fixtures__/source-map.ts"],"names":[],"mappings":";AAAA,4DAA4D;;AAE5D,MAAM,GAAG,GAAG,KAAK,CAAC;AAClB,sCAAsC;AACtC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","sourcesContent":["// This file is only used for testing source map generation.\n\nconst foo = 'bar';\n// eslint-disable-next-line no-console\nconsole.log(foo);\n"]}
@@ -1,5 +1,4 @@
1
1
  // This file is only used for testing source map generation.
2
- // eslint-disable-next-line import/unambiguous
3
2
  const foo = 'bar';
4
3
  // eslint-disable-next-line no-console
5
4
  console.log(foo);
@@ -1 +1 @@
1
- {"version":3,"file":"source-map.mjs","sourceRoot":"","sources":["../../src/__fixtures__/source-map.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,8CAA8C;AAC9C,MAAM,GAAG,GAAG,KAAK,CAAC;AAClB,sCAAsC;AACtC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","sourcesContent":["// This file is only used for testing source map generation.\n\n// eslint-disable-next-line import/unambiguous\nconst foo = 'bar';\n// eslint-disable-next-line no-console\nconsole.log(foo);\n"]}
1
+ {"version":3,"file":"source-map.mjs","sourceRoot":"","sources":["../../src/__fixtures__/source-map.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,MAAM,GAAG,GAAG,KAAK,CAAC;AAClB,sCAAsC;AACtC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","sourcesContent":["// This file is only used for testing source map generation.\n\nconst foo = 'bar';\n// eslint-disable-next-line no-console\nconsole.log(foo);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;AACA,qDAIoC;AACpC,2BAAoC;AACpC,gDAA6B;AAa7B;;;;;;;;;;;;;GAaG;AACH,SAAwB,KAAK,CAAC,OAA0B;IACtD,MAAM,cAAc,GAAG;QACrB,IAAI,EAAE,IAAI;QACV,YAAY,EAAE,cAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC;QACjE,aAAa,EAAE,IAAI;QACnB,GAAG,OAAO;KACX,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,+BAA+B;QAErC,WAAW,CAAC,IAAY;YACtB,yEAAyE;YACzE,6DAA6D;YAC7D,MAAM,MAAM,GAAG,IAAA,wBAAiB,EAAC,IAAI,EAAE;gBACrC,GAAG,cAAc;gBACjB,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;YAEH,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,IAAI,CAAC,IAAI,CACP,2EAA2E,MAAM,CAAC,QAAQ,CAAC,IAAI,CAC7F,IAAI,CACL,EAAE,CACJ,CAAC;Y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C,MAAM,CAAC,OAAO,CAAC,CAAC;gBACnC,MAAM,KAAK,GAAG,OAAO;qBAClB,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;qBACnC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAEnC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC7B,IAAI,CAAC,KAAK,CACR,6CAA6C,aAAa,CAAC,IAAI,CAC7D,IAAI,CACL,EAAE,CACJ,CAAC;gBACJ,CAAC;gBAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACxB,IAAI,CAAC,IAAI,CACP,gFAAgF,QAAQ,CAAC,IAAI,CAC3F,IAAI,CACL,EAAE,CACJ,CAAC;gBACJ,CAAC;gBAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACrB,IAAI,CAAC,IAAI,CACP,iFAAiF,KAAK,CAAC,IAAI,CACzF,IAAI,CACL,EAAE,CACJ,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAvFD,wBAuFC","sourcesContent":["import type { PostProcessOptions } from '@metamask/snaps-utils/node';\nimport {\n checkManifest,\n evalBundle,\n postProcessBundle,\n} from '@metamask/snaps-utils/node';\nimport { promises as fs } from 'fs';\nimport pathUtils from 'path';\n// eslint-disable-next-line @typescript-eslint/no-shadow\nimport type { Plugin, SourceMapInput } from 'rollup';\n\ntype PluginOptions = {\n eval?: boolean;\n manifestPath?: string;\n writeManifest?: boolean;\n};\n\nexport type Options = PluginOptions &\n Omit<PostProcessOptions, 'sourceMap' | 'inputSourceMap'>;\n\n/**\n * Creates a Snaps Rollup plugin instance.\n *\n * @param options - The plugin options.\n * @param options.stripComments - Whether to strip comments. Defaults to `true`.\n * @param options.eval - Whether to evaluate the bundle to test SES\n * compatibility. Defaults to `true`.\n * @param options.manifestPath - The path to the manifest file. If provided,\n * the manifest will be validated. Defaults to\n * `process.cwd() + '/snap.manifest.json'`.\n * @param options.writeManifest - Whether to fix the manifest. Defaults to\n * `true`.\n * @returns The Rollup plugin object.\n */\nexport default function snaps(options?: Partial<Options>): Plugin {\n const defaultOptions = {\n eval: true,\n manifestPath: pathUtils.join(process.cwd(), 'snap.manifest.json'),\n writeManifest: true,\n ...options,\n };\n\n return {\n name: '@metamask/snaps-rollup-plugin',\n\n renderChunk(code: string): { code: string; map?: SourceMapInput } | null {\n // Rollup internally merges the new source map with the old one, so there\n // is no need to pass the current source map to the function.\n const result = postProcessBundle(code, {\n ...defaultOptions,\n sourceMap: true,\n });\n\n if (result.warnings.length > 0) {\n this.warn(\n `Bundle Warning: Processing of the Snap bundle completed with warnings.\\n${result.warnings.join(\n '\\n',\n )}`,\n );\n }\n\n return { code: result.code, map: result.sourceMap };\n },\n\n async writeBundle(output): Promise<void> {\n if (!output.file) {\n this.warn('No output file specified, skipping bundle validation.');\n return;\n }\n\n if (defaultOptions.eval) {\n await evalBundle(output.file).catch((error) => {\n this.error(error);\n });\n }\n\n if (defaultOptions.manifestPath) {\n const { reports } = await checkManifest(\n pathUtils.dirname(defaultOptions.manifestPath),\n {\n updateAndWriteManifest: defaultOptions.writeManifest,\n sourceCode: await fs.readFile(output.file, 'utf8'),\n },\n );\n\n const errorsUnfixed = reports\n .filter((report) => report.severity === 'error' && !report.wasFixed)\n .map((report) => report.message);\n const warnings = reports\n .filter((report) => report.severity === 'warning' && !report.wasFixed)\n .map((report) => report.message);\n const fixed = reports\n .filter((report) => report.wasFixed)\n .map((report) => report.message);\n\n if (errorsUnfixed.length > 0) {\n this.error(\n `Manifest Error: The manifest is invalid.\\n${errorsUnfixed.join(\n '\\n',\n )}`,\n );\n }\n\n if (warnings.length > 0) {\n this.warn(\n `Manifest Warning: Validation of snap.manifest.json completed with warnings.\\n${warnings.join(\n '\\n',\n )}`,\n );\n }\n\n if (fixed.length > 0) {\n this.warn(\n `Manifest Warning: Validation of snap.manifest.json fixed following problems.\\n${fixed.join(\n '\\n',\n )}`,\n );\n }\n }\n },\n };\n}\n"]}
1
+ {"version":3,"file":"plugin.cjs","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;AACA,qDAIoC;AACpC,2BAAoC;AACpC,gDAA6B;AAY7B;;;;;;;;;;;;;GAaG;AACH,SAAwB,KAAK,CAAC,OAA0B;IACtD,MAAM,cAAc,GAAG;QACrB,IAAI,EAAE,IAAI;QACV,YAAY,EAAE,cAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC;QACjE,aAAa,EAAE,IAAI;QACnB,GAAG,OAAO;KACX,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,+BAA+B;QAErC,WAAW,CAAC,IAAY;YACtB,yEAAyE;YACzE,6DAA6D;YAC7D,MAAM,MAAM,GAAG,IAAA,wBAAiB,EAAC,IAAI,EAAE;gBACrC,GAAG,cAAc;gBACjB,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;YAEH,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,IAAI,CAAC,IAAI,CACP,2EAA2E,MAAM,CAAC,QAAQ,CAAC,IAAI,CAC7F,IAAI,CACL,EAAE,CACJ,CAAC;YACJ,CAAC;YAED,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;QACtD,CAAC;QAED,KAAK,CAAC,WAAW,CAAC,MAAM;YACtB,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBACjB,IAAI,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;gBACnE,OAAO;YACT,CAAC;YAED,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC;gBACxB,MAAM,IAAA,iBAAU,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KA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BAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACxB,IAAI,CAAC,IAAI,CACP,gFAAgF,QAAQ,CAAC,IAAI,CAC3F,IAAI,CACL,EAAE,CACJ,CAAC;gBACJ,CAAC;gBAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACrB,IAAI,CAAC,IAAI,CACP,iFAAiF,KAAK,CAAC,IAAI,CACzF,IAAI,CACL,EAAE,CACJ,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAvFD,wBAuFC","sourcesContent":["import type { PostProcessOptions } from '@metamask/snaps-utils/node';\nimport {\n checkManifest,\n evalBundle,\n postProcessBundle,\n} from '@metamask/snaps-utils/node';\nimport { promises as fs } from 'fs';\nimport pathUtils from 'path';\nimport type { Plugin, SourceMapInput } from 'rollup';\n\ntype PluginOptions = {\n eval?: boolean;\n manifestPath?: string;\n writeManifest?: boolean;\n};\n\nexport type Options = PluginOptions &\n Omit<PostProcessOptions, 'sourceMap' | 'inputSourceMap'>;\n\n/**\n * Creates a Snaps Rollup plugin instance.\n *\n * @param options - The plugin options.\n * @param options.stripComments - Whether to strip comments. Defaults to `true`.\n * @param options.eval - Whether to evaluate the bundle to test SES\n * compatibility. Defaults to `true`.\n * @param options.manifestPath - The path to the manifest file. If provided,\n * the manifest will be validated. Defaults to\n * `process.cwd() + '/snap.manifest.json'`.\n * @param options.writeManifest - Whether to fix the manifest. Defaults to\n * `true`.\n * @returns The Rollup plugin object.\n */\nexport default function snaps(options?: Partial<Options>): Plugin {\n const defaultOptions = {\n eval: true,\n manifestPath: pathUtils.join(process.cwd(), 'snap.manifest.json'),\n writeManifest: true,\n ...options,\n };\n\n return {\n name: '@metamask/snaps-rollup-plugin',\n\n renderChunk(code: string): { code: string; map?: SourceMapInput } | null {\n // Rollup internally merges the new source map with the old one, so there\n // is no need to pass the current source map to the function.\n const result = postProcessBundle(code, {\n ...defaultOptions,\n sourceMap: true,\n });\n\n if (result.warnings.length > 0) {\n this.warn(\n `Bundle Warning: Processing of the Snap bundle completed with warnings.\\n${result.warnings.join(\n '\\n',\n )}`,\n );\n }\n\n return { code: result.code, map: result.sourceMap };\n },\n\n async writeBundle(output): Promise<void> {\n if (!output.file) {\n this.warn('No output file specified, skipping bundle validation.');\n return;\n }\n\n if (defaultOptions.eval) {\n await evalBundle(output.file).catch((error) => {\n this.error(error);\n });\n }\n\n if (defaultOptions.manifestPath) {\n const { reports } = await checkManifest(\n pathUtils.dirname(defaultOptions.manifestPath),\n {\n updateAndWriteManifest: defaultOptions.writeManifest,\n sourceCode: await fs.readFile(output.file, 'utf8'),\n },\n );\n\n const errorsUnfixed = reports\n .filter((report) => report.severity === 'error' && !report.wasFixed)\n .map((report) => report.message);\n const warnings = reports\n .filter((report) => report.severity === 'warning' && !report.wasFixed)\n .map((report) => report.message);\n const fixed = reports\n .filter((report) => report.wasFixed)\n .map((report) => report.message);\n\n if (errorsUnfixed.length > 0) {\n this.error(\n `Manifest Error: The manifest is invalid.\\n${errorsUnfixed.join(\n '\\n',\n )}`,\n );\n }\n\n if (warnings.length > 0) {\n this.warn(\n `Manifest Warning: Validation of snap.manifest.json completed with warnings.\\n${warnings.join(\n '\\n',\n )}`,\n );\n }\n\n if (fixed.length > 0) {\n this.warn(\n `Manifest Warning: Validation of snap.manifest.json fixed following problems.\\n${fixed.join(\n '\\n',\n )}`,\n );\n }\n }\n },\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mCAAmC;AASrE,OAAO,KAAK,EAAE,MAAM,EAAkB,eAAe;AAErD,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,aAAa,GACjC,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,gBAAgB,CAAC,CAAC;AAE3D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,MAAM,CAuFhE"}
1
+ {"version":3,"file":"plugin.d.cts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mCAAmC;AAQrE,OAAO,KAAK,EAAE,MAAM,EAAkB,eAAe;AAErD,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,aAAa,GACjC,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,gBAAgB,CAAC,CAAC;AAE3D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,MAAM,CAuFhE"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mCAAmC;AASrE,OAAO,KAAK,EAAE,MAAM,EAAkB,eAAe;AAErD,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,aAAa,GACjC,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,gBAAgB,CAAC,CAAC;AAE3D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,MAAM,CAuFhE"}
1
+ {"version":3,"file":"plugin.d.mts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mCAAmC;AAQrE,OAAO,KAAK,EAAE,MAAM,EAAkB,eAAe;AAErD,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,aAAa,GACjC,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,gBAAgB,CAAC,CAAC;AAE3D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,MAAM,CAuFhE"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.mjs","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,UAAU,EACV,iBAAiB,EAClB,mCAAmC;AACpC,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,WAAW;AACpC,OAAO,SAAS,aAAa;AAa7B;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,OAA0B;IACtD,MAAM,cAAc,GAAG;QACrB,IAAI,EAAE,IAAI;QACV,YAAY,EAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC;QACjE,aAAa,EAAE,IAAI;QACnB,GAAG,OAAO;KACX,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,+BAA+B;QAErC,WAAW,CAAC,IAAY;YACtB,yEAAyE;YACzE,6DAA6D;YAC7D,MAAM,MAAM,GAAG,iBA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,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACnC,MAAM,QAAQ,GAAG,OAAO;qBACrB,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;qBACrE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACnC,MAAM,KAAK,GAAG,OAAO;qBAClB,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;qBACnC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAEnC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC7B,IAAI,CAAC,KAAK,CACR,6CAA6C,aAAa,CAAC,IAAI,CAC7D,IAAI,CACL,EAAE,CACJ,CAAC;gBACJ,CAAC;gBAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACxB,IAAI,CAAC,IAAI,CACP,gFAAgF,QAAQ,CAAC,IAAI,CAC3F,IAAI,CACL,EAAE,CACJ,CAAC;gBACJ,CAAC;gBAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACrB,IAAI,CAAC,IAAI,CACP,iFAAiF,KAAK,CAAC,IAAI,CACzF,IAAI,CACL,EAAE,CACJ,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { PostProcessOptions } from '@metamask/snaps-utils/node';\nimport {\n checkManifest,\n evalBundle,\n postProcessBundle,\n} from '@metamask/snaps-utils/node';\nimport { promises as fs } from 'fs';\nimport pathUtils from 'path';\n// eslint-disable-next-line @typescript-eslint/no-shadow\nimport type { Plugin, SourceMapInput } from 'rollup';\n\ntype PluginOptions = {\n eval?: boolean;\n manifestPath?: string;\n writeManifest?: boolean;\n};\n\nexport type Options = PluginOptions &\n Omit<PostProcessOptions, 'sourceMap' | 'inputSourceMap'>;\n\n/**\n * Creates a Snaps Rollup plugin instance.\n *\n * @param options - The plugin options.\n * @param options.stripComments - Whether to strip comments. Defaults to `true`.\n * @param options.eval - Whether to evaluate the bundle to test SES\n * compatibility. Defaults to `true`.\n * @param options.manifestPath - The path to the manifest file. If provided,\n * the manifest will be validated. Defaults to\n * `process.cwd() + '/snap.manifest.json'`.\n * @param options.writeManifest - Whether to fix the manifest. Defaults to\n * `true`.\n * @returns The Rollup plugin object.\n */\nexport default function snaps(options?: Partial<Options>): Plugin {\n const defaultOptions = {\n eval: true,\n manifestPath: pathUtils.join(process.cwd(), 'snap.manifest.json'),\n writeManifest: true,\n ...options,\n };\n\n return {\n name: '@metamask/snaps-rollup-plugin',\n\n renderChunk(code: string): { code: string; map?: SourceMapInput } | null {\n // Rollup internally merges the new source map with the old one, so there\n // is no need to pass the current source map to the function.\n const result = postProcessBundle(code, {\n ...defaultOptions,\n sourceMap: true,\n });\n\n if (result.warnings.length > 0) {\n this.warn(\n `Bundle Warning: Processing of the Snap bundle completed with warnings.\\n${result.warnings.join(\n '\\n',\n )}`,\n );\n }\n\n return { code: result.code, map: result.sourceMap };\n },\n\n async writeBundle(output): Promise<void> {\n if (!output.file) {\n this.warn('No output file specified, skipping bundle validation.');\n return;\n }\n\n if (defaultOptions.eval) {\n await evalBundle(output.file).catch((error) => {\n this.error(error);\n });\n }\n\n if (defaultOptions.manifestPath) {\n const { reports } = await checkManifest(\n pathUtils.dirname(defaultOptions.manifestPath),\n {\n updateAndWriteManifest: defaultOptions.writeManifest,\n sourceCode: await fs.readFile(output.file, 'utf8'),\n },\n );\n\n const errorsUnfixed = reports\n .filter((report) => report.severity === 'error' && !report.wasFixed)\n .map((report) => report.message);\n const warnings = reports\n .filter((report) => report.severity === 'warning' && !report.wasFixed)\n .map((report) => report.message);\n const fixed = reports\n .filter((report) => report.wasFixed)\n .map((report) => report.message);\n\n if (errorsUnfixed.length > 0) {\n this.error(\n `Manifest Error: The manifest is invalid.\\n${errorsUnfixed.join(\n '\\n',\n )}`,\n );\n }\n\n if (warnings.length > 0) {\n this.warn(\n `Manifest Warning: Validation of snap.manifest.json completed with warnings.\\n${warnings.join(\n '\\n',\n )}`,\n );\n }\n\n if (fixed.length > 0) {\n this.warn(\n `Manifest Warning: Validation of snap.manifest.json fixed following problems.\\n${fixed.join(\n '\\n',\n )}`,\n );\n }\n }\n },\n };\n}\n"]}
1
+ {"version":3,"file":"plugin.mjs","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,UAAU,EACV,iBAAiB,EAClB,mCAAmC;AACpC,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,WAAW;AACpC,OAAO,SAAS,aAAa;AAY7B;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,OAA0B;IACtD,MAAM,cAAc,GAAG;QACrB,IAAI,EAAE,IAAI;QACV,YAAY,EAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC;QACjE,aAAa,EAAE,IAAI;QACnB,GAAG,OAAO;KACX,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,+BAA+B;QAErC,WAAW,CAAC,IAAY;YACtB,yEAAyE;YACzE,6DAA6D;YAC7D,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,EAAE;gBACrC,GAAG,cAAc;gBACjB,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;YAEH,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,IAAI,CAAC,IAAI,CACP,2EAA2E,MAAM,CAAC,QAAQ,CAAC,IAAI,CAC7F,IAAI,CACL,EAAE,CACJ,CAAC;YACJ,CAAC;YAED,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IA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B,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;qBACnC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAEnC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC7B,IAAI,CAAC,KAAK,CACR,6CAA6C,aAAa,CAAC,IAAI,CAC7D,IAAI,CACL,EAAE,CACJ,CAAC;gBACJ,CAAC;gBAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACxB,IAAI,CAAC,IAAI,CACP,gFAAgF,QAAQ,CAAC,IAAI,CAC3F,IAAI,CACL,EAAE,CACJ,CAAC;gBACJ,CAAC;gBAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACrB,IAAI,CAAC,IAAI,CACP,iFAAiF,KAAK,CAAC,IAAI,CACzF,IAAI,CACL,EAAE,CACJ,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { PostProcessOptions } from '@metamask/snaps-utils/node';\nimport {\n checkManifest,\n evalBundle,\n postProcessBundle,\n} from '@metamask/snaps-utils/node';\nimport { promises as fs } from 'fs';\nimport pathUtils from 'path';\nimport type { Plugin, SourceMapInput } from 'rollup';\n\ntype PluginOptions = {\n eval?: boolean;\n manifestPath?: string;\n writeManifest?: boolean;\n};\n\nexport type Options = PluginOptions &\n Omit<PostProcessOptions, 'sourceMap' | 'inputSourceMap'>;\n\n/**\n * Creates a Snaps Rollup plugin instance.\n *\n * @param options - The plugin options.\n * @param options.stripComments - Whether to strip comments. Defaults to `true`.\n * @param options.eval - Whether to evaluate the bundle to test SES\n * compatibility. Defaults to `true`.\n * @param options.manifestPath - The path to the manifest file. If provided,\n * the manifest will be validated. Defaults to\n * `process.cwd() + '/snap.manifest.json'`.\n * @param options.writeManifest - Whether to fix the manifest. Defaults to\n * `true`.\n * @returns The Rollup plugin object.\n */\nexport default function snaps(options?: Partial<Options>): Plugin {\n const defaultOptions = {\n eval: true,\n manifestPath: pathUtils.join(process.cwd(), 'snap.manifest.json'),\n writeManifest: true,\n ...options,\n };\n\n return {\n name: '@metamask/snaps-rollup-plugin',\n\n renderChunk(code: string): { code: string; map?: SourceMapInput } | null {\n // Rollup internally merges the new source map with the old one, so there\n // is no need to pass the current source map to the function.\n const result = postProcessBundle(code, {\n ...defaultOptions,\n sourceMap: true,\n });\n\n if (result.warnings.length > 0) {\n this.warn(\n `Bundle Warning: Processing of the Snap bundle completed with warnings.\\n${result.warnings.join(\n '\\n',\n )}`,\n );\n }\n\n return { code: result.code, map: result.sourceMap };\n },\n\n async writeBundle(output): Promise<void> {\n if (!output.file) {\n this.warn('No output file specified, skipping bundle validation.');\n return;\n }\n\n if (defaultOptions.eval) {\n await evalBundle(output.file).catch((error) => {\n this.error(error);\n });\n }\n\n if (defaultOptions.manifestPath) {\n const { reports } = await checkManifest(\n pathUtils.dirname(defaultOptions.manifestPath),\n {\n updateAndWriteManifest: defaultOptions.writeManifest,\n sourceCode: await fs.readFile(output.file, 'utf8'),\n },\n );\n\n const errorsUnfixed = reports\n .filter((report) => report.severity === 'error' && !report.wasFixed)\n .map((report) => report.message);\n const warnings = reports\n .filter((report) => report.severity === 'warning' && !report.wasFixed)\n .map((report) => report.message);\n const fixed = reports\n .filter((report) => report.wasFixed)\n .map((report) => report.message);\n\n if (errorsUnfixed.length > 0) {\n this.error(\n `Manifest Error: The manifest is invalid.\\n${errorsUnfixed.join(\n '\\n',\n )}`,\n );\n }\n\n if (warnings.length > 0) {\n this.warn(\n `Manifest Warning: Validation of snap.manifest.json completed with warnings.\\n${warnings.join(\n '\\n',\n )}`,\n );\n }\n\n if (fixed.length > 0) {\n this.warn(\n `Manifest Warning: Validation of snap.manifest.json fixed following problems.\\n${fixed.join(\n '\\n',\n )}`,\n );\n }\n }\n },\n };\n}\n"]}
package/package.json CHANGED
@@ -1,14 +1,23 @@
1
1
  {
2
2
  "name": "@metamask/snaps-rollup-plugin",
3
- "version": "4.1.2",
3
+ "version": "5.0.0",
4
+ "description": "A Rollup plugin to build MetaMask Snaps with Rollup",
4
5
  "keywords": [
5
- "rollup",
6
- "rollup-plugin"
6
+ "MetaMask",
7
+ "Snaps",
8
+ "Ethereum",
9
+ "Rollup",
10
+ "Plugin"
7
11
  ],
12
+ "homepage": "https://github.com/MetaMask/snaps/tree/main/packages/snaps-rollup-plugin#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/MetaMask/snaps/issues"
15
+ },
8
16
  "repository": {
9
17
  "type": "git",
10
18
  "url": "https://github.com/MetaMask/snaps.git"
11
19
  },
20
+ "license": "ISC",
12
21
  "sideEffects": false,
13
22
  "exports": {
14
23
  ".": {
@@ -30,56 +39,47 @@
30
39
  "dist"
31
40
  ],
32
41
  "scripts": {
33
- "test": "jest && yarn posttest",
34
- "posttest": "jest-it-up",
35
- "test:ci": "yarn test",
36
- "lint:eslint": "eslint . --cache --ext js,ts,jsx,tsx",
37
- "lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn \"**/*.json\" \"**/*.md\" \"**/*.html\" \"!CHANGELOG.md\" --ignore-path ../../.gitignore",
38
- "lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog && yarn lint:dependencies",
42
+ "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
43
+ "changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-rollup-plugin",
44
+ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-rollup-plugin",
45
+ "lint": "yarn lint:eslint && yarn lint:misc --check && yarn changelog:validate && yarn lint:dependencies",
46
+ "lint:ci": "yarn lint",
47
+ "lint:dependencies": "depcheck",
48
+ "lint:eslint": "eslint . --cache",
39
49
  "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
40
- "lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-rollup-plugin",
41
- "build": "ts-bridge --project tsconfig.build.json --verbose --no-references",
50
+ "lint:misc": "prettier --no-error-on-unmatched-pattern --log-level warn \"**/*.json\" \"**/*.md\" \"**/*.html\" \"!CHANGELOG.md\" --ignore-path ../../.gitignore",
42
51
  "publish:preview": "yarn npm publish --tag preview",
43
- "lint:ci": "yarn lint",
44
- "lint:dependencies": "depcheck"
52
+ "since-latest-release": "../../scripts/since-latest-release.sh",
53
+ "test": "jest --reporters=jest-silent-reporter",
54
+ "test:clean": "jest --clearCache",
55
+ "test:post": "jest-it-up",
56
+ "test:verbose": "jest --verbose",
57
+ "test:watch": "jest --watch"
45
58
  },
46
59
  "dependencies": {
47
- "@metamask/snaps-utils": "^8.1.1"
60
+ "@metamask/snaps-utils": "^11.0.0"
48
61
  },
49
62
  "devDependencies": {
50
- "@lavamoat/allow-scripts": "^3.0.4",
51
- "@metamask/auto-changelog": "^3.4.4",
52
- "@metamask/eslint-config": "^12.1.0",
53
- "@metamask/eslint-config-jest": "^12.1.0",
54
- "@metamask/eslint-config-nodejs": "^12.1.0",
55
- "@metamask/eslint-config-typescript": "^12.1.0",
63
+ "@lavamoat/allow-scripts": "^3.3.4",
64
+ "@metamask/auto-changelog": "^5.0.2",
56
65
  "@rollup/plugin-virtual": "^2.1.0",
57
- "@swc/core": "1.3.78",
58
- "@swc/jest": "^0.2.26",
59
- "@ts-bridge/cli": "^0.5.1",
66
+ "@swc/core": "1.11.31",
67
+ "@swc/jest": "^0.2.38",
68
+ "@ts-bridge/cli": "^0.6.1",
60
69
  "@types/jest": "^27.5.1",
61
- "@typescript-eslint/eslint-plugin": "^5.42.1",
62
- "@typescript-eslint/parser": "^6.21.0",
63
70
  "deepmerge": "^4.2.2",
64
71
  "depcheck": "^1.4.7",
65
- "eslint": "^8.27.0",
66
- "eslint-config-prettier": "^8.5.0",
67
- "eslint-plugin-import": "^2.26.0",
68
- "eslint-plugin-jest": "^27.1.5",
69
- "eslint-plugin-jsdoc": "^41.1.2",
70
- "eslint-plugin-n": "^15.7.0",
71
- "eslint-plugin-prettier": "^4.2.1",
72
- "eslint-plugin-promise": "^6.1.1",
72
+ "eslint": "^9.11.0",
73
73
  "jest": "^29.0.2",
74
74
  "jest-it-up": "^2.0.0",
75
+ "jest-silent-reporter": "^0.6.0",
75
76
  "memfs": "^3.4.13",
76
- "prettier": "^2.7.1",
77
- "prettier-plugin-packagejson": "^2.2.11",
77
+ "prettier": "^3.3.3",
78
78
  "rollup": "^2.73.0",
79
79
  "typescript": "~5.3.3"
80
80
  },
81
81
  "engines": {
82
- "node": "^18.16 || >=20"
82
+ "node": "^20 || >=22"
83
83
  },
84
84
  "publishConfig": {
85
85
  "access": "public",