diff --git a/README.md b/README.md index 82e483a5..4a993e71 100644 --- a/README.md +++ b/README.md @@ -1355,6 +1355,7 @@ config.merge({ enforce, issuer, parser, + generator, resource, resourceQuery, test, diff --git a/src/Rule.js b/src/Rule.js index f3006999..f4905c68 100644 --- a/src/Rule.js +++ b/src/Rule.js @@ -34,6 +34,7 @@ const Rule = Orderable( 'enforce', 'issuer', 'parser', + 'generator', 'resource', 'resourceQuery', 'sideEffects', diff --git a/test/Rule.js b/test/Rule.js index a2f99ae7..7bbb0f0f 100644 --- a/test/Rule.js +++ b/test/Rule.js @@ -505,3 +505,32 @@ test('ordered oneOfs', () => { /\.third$/, ]); }); + +test('asset modules with generator and parser', () => { + const rule = new Rule(); + rule + .rule('fonts') + .test(/\.tff$/) + .type('asset') + .generator({ + filename: 'fonts/[hash][ext][query]', + }) + .parser({ + dataUrlCondition: { + maxSize: 4 * 1024, + }, + }); + + expect(rule.toConfig().rules[0]).toStrictEqual({ + test: /\.tff$/, + type: 'asset', + generator: { + filename: 'fonts/[hash][ext][query]', + }, + parser: { + dataUrlCondition: { + maxSize: 4 * 1024, + }, + }, + }); +});