(opts = {})
| 1 | const { createFilter } = require("rollup-pluginutils"); |
| 2 | |
| 3 | function string(opts = {}) { |
| 4 | if (!opts.include) { |
| 5 | throw Error("include option should be specified"); |
| 6 | } |
| 7 | |
| 8 | const filter = createFilter(opts.include, opts.exclude); |
| 9 | |
| 10 | return { |
| 11 | name: "string", |
| 12 | |
| 13 | transform(code, id) { |
| 14 | if (filter(id)) { |
| 15 | return { |
| 16 | code: `export default ${JSON.stringify(code)};`, |
| 17 | map: { mappings: "" } |
| 18 | }; |
| 19 | } |
| 20 | } |
| 21 | }; |
| 22 | } |
| 23 | |
| 24 | exports.string = string; |
no outgoing calls
no test coverage detected
searching dependent graphs…