@maizzle/framework 4.7.5 → 4.7.6

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.
@@ -0,0 +1,39 @@
1
+ export default interface LayoutsConfig {
2
+ /**
3
+ Encoding to be used when reading a layout file from disk.
4
+
5
+ @default 'utf8'
6
+ */
7
+ encoding?: string;
8
+
9
+ /**
10
+ Name of the slot tag, where the content will be injected.
11
+ This is typically used in a Layout file, to define the place where to inject a Template.
12
+
13
+ @default 'block'
14
+ */
15
+ slotTagName?: string;
16
+
17
+ /**
18
+ Name of the fill tag, inside of which content that will be injected is defined.
19
+ This is typically used in a Template file, to extend a Layout.
20
+
21
+ @default 'block'
22
+ */
23
+ fillTagName?: string;
24
+
25
+ /**
26
+ Path to the layouts folder, relative to the project root.
27
+
28
+ @default 'src/layouts'
29
+ */
30
+ root?: string;
31
+
32
+ /**
33
+ Tag name to be used in HTML when extending a layout.
34
+
35
+ @default 'extends'
36
+ */
37
+ tagName?: string;
38
+
39
+ }
@@ -0,0 +1,31 @@
1
+ import type {Options as MarkdownItOptions} from 'markdown-it';
2
+
3
+ export default interface MarkdownConfig {
4
+ /**
5
+ Path relative to which markdown files are imported.
6
+
7
+ @default './'
8
+ */
9
+ root?: string;
10
+
11
+ /**
12
+ Encoding for imported Markdown files.
13
+
14
+ @default 'utf8'
15
+ */
16
+ encoding?: string;
17
+
18
+ /**
19
+ Options to pass to the `markdown-it` library.
20
+
21
+ @default {}
22
+ */
23
+ markdownit?: MarkdownItOptions;
24
+
25
+ /**
26
+ Plugins for the `markdown-it` library.
27
+
28
+ @default []
29
+ */
30
+ plugins?: any[];
31
+ }
@@ -0,0 +1,136 @@
1
+ export default interface MinifyConfig {
2
+ /**
3
+ Maximum line length. Works only when `removeLineBreaks` is `true`.
4
+
5
+ @default 500
6
+ */
7
+ lineLengthLimit?: number;
8
+
9
+ /**
10
+ Remove all line breaks from HTML when minifying.
11
+
12
+ @default true
13
+ */
14
+ removeLineBreaks?: boolean;
15
+
16
+ /**
17
+ Remove code indentation when minifying HTML.
18
+
19
+ @default true
20
+ */
21
+ removeIndentations?: boolean;
22
+
23
+ /**
24
+ Remove `<!-- HTML comments -->` when minifying HTML.
25
+
26
+ `0` - don't remove any HTML comments
27
+
28
+ `1` - remove all comments except Outlook conditional comments
29
+
30
+ `2` - remove all comments, including Outlook conditional comments
31
+
32
+ @default false
33
+ */
34
+ removeHTMLComments?: boolean | number;
35
+
36
+ /**
37
+ Remove CSS comments when minifying HTML.
38
+
39
+ @default true
40
+ */
41
+ removeCSSComments?: boolean;
42
+
43
+ /**
44
+ When any of given strings are encountered and `removeLineBreaks` is true, current line will be terminated.
45
+
46
+ @default
47
+ [
48
+ '</td',
49
+ '<html',
50
+ '</html',
51
+ '<head',
52
+ '</head',
53
+ '<meta',
54
+ '<link',
55
+ '<table',
56
+ '<script',
57
+ '</script',
58
+ '<!DOCTYPE',
59
+ '<style',
60
+ '</style',
61
+ '<title',
62
+ '<body',
63
+ '@media',
64
+ '</body',
65
+ '<!--[if',
66
+ '<!--<![endif',
67
+ '<![endif]'
68
+ ]
69
+ */
70
+ breakToTheLeftOf?: string[] | boolean | null;
71
+
72
+ /**
73
+ Some inline tags can accidentally introduce extra text.
74
+ The minifier will take extra precaution when minifying around these tags.
75
+
76
+ @default
77
+ [
78
+ 'a',
79
+ 'abbr',
80
+ 'acronym',
81
+ 'audio',
82
+ 'b',
83
+ 'bdi',
84
+ 'bdo',
85
+ 'big',
86
+ 'br',
87
+ 'button',
88
+ 'canvas',
89
+ 'cite',
90
+ 'code',
91
+ 'data',
92
+ 'datalist',
93
+ 'del',
94
+ 'dfn',
95
+ 'em',
96
+ 'embed',
97
+ 'i',
98
+ 'iframe',
99
+ 'img',
100
+ 'input',
101
+ 'ins',
102
+ 'kbd',
103
+ 'label',
104
+ 'map',
105
+ 'mark',
106
+ 'meter',
107
+ 'noscript',
108
+ 'object',
109
+ 'output',
110
+ 'picture',
111
+ 'progress',
112
+ 'q',
113
+ 'ruby',
114
+ 's',
115
+ 'samp',
116
+ 'script',
117
+ 'select',
118
+ 'slot',
119
+ 'small',
120
+ 'span',
121
+ 'strong',
122
+ 'sub',
123
+ 'sup',
124
+ 'svg',
125
+ 'template',
126
+ 'textarea',
127
+ 'time',
128
+ 'u',
129
+ 'tt',
130
+ 'var',
131
+ 'video',
132
+ 'wbr'
133
+ ]
134
+ */
135
+ mindTheInlineTags?: string[] | boolean | null;
136
+ }
@@ -0,0 +1,62 @@
1
+ import type {Opts as PlaintextOptions} from 'string-strip-html';
2
+
3
+ export default interface PlaintextConfig extends PlaintextOptions {
4
+ /**
5
+ Configure where plaintext files should be output.
6
+
7
+ @example
8
+ ```
9
+ module.exports = {
10
+ build: {
11
+ plaintext: {
12
+ destination: {
13
+ path: 'dist/brand/plaintext',
14
+ extension: 'rtxt'
15
+ }
16
+ }
17
+ }
18
+ }
19
+ ```
20
+ */
21
+ destination?: {
22
+ /**
23
+ Directory where Maizzle should output compiled Plaintext files.
24
+
25
+ @default 'build_{env}'
26
+
27
+ @example
28
+ ```
29
+ module.exports = {
30
+ build: {
31
+ plaintext: {
32
+ destination: {
33
+ path: 'dist/brand/plaintext'
34
+ }
35
+ }
36
+ }
37
+ }
38
+ ```
39
+ */
40
+ path?: string;
41
+
42
+ /**
43
+ File extension to be used for compiled Plaintext files.
44
+
45
+ @default 'txt'
46
+
47
+ @example
48
+ ```
49
+ module.exports = {
50
+ build: {
51
+ plaintext: {
52
+ destination: {
53
+ extension: 'rtxt'
54
+ }
55
+ }
56
+ }
57
+ }
58
+ ```
59
+ */
60
+ extension: string;
61
+ };
62
+ }
@@ -0,0 +1,195 @@
1
+ import type PostHTMLFetchConfig from './fetch';
2
+ import type ExpressionsConfig from './expressions';
3
+
4
+ export interface PostHTMLOptions {
5
+ /**
6
+ Configure the PostHTML parser to process custom directives.
7
+
8
+ @default []
9
+ */
10
+ directives?: any[];
11
+
12
+ /**
13
+ Enable `xmlMode` if you're using Maizzle to output XML content, and not actual HTML.
14
+
15
+ @default false
16
+ */
17
+ xmlMode?: boolean;
18
+
19
+ /**
20
+ Decode entities in the HTML.
21
+
22
+ @default false
23
+ */
24
+ decodeEntities?: boolean;
25
+
26
+ /**
27
+ Output all tags in lowercase. Works only when `xmlMode` is disabled.
28
+
29
+ @default false
30
+ */
31
+ lowerCaseTags?: boolean;
32
+
33
+ /**
34
+ Output all attribute names in lowercase.
35
+
36
+ @default false
37
+ */
38
+ lowerCaseAttributeNames?: boolean;
39
+
40
+ /**
41
+ Recognize CDATA sections as text even if the `xmlMode` option is disabled.
42
+
43
+ @default false
44
+ */
45
+ recognizeCDATA?: boolean;
46
+
47
+ /**
48
+ Recognize self-closing tags.
49
+ Disabling this will cause rendering to stop at the first self-closing custom (non-HTML) tag.
50
+
51
+ @default true
52
+ */
53
+ recognizeSelfClosing?: boolean;
54
+
55
+ /**
56
+ If enabled, AST nodes will have a location property containing the `start` and `end` line and column position of the node.
57
+
58
+ @default false
59
+ */
60
+ sourceLocations?: boolean;
61
+
62
+ /**
63
+ Whether attributes with no values should render exactly as they were written, without `=""` appended.
64
+
65
+ @default true
66
+ */
67
+ recognizeNoValueAttribute?: boolean;
68
+
69
+ /**
70
+ Tell PostHTML to treat custom tags as self-closing.
71
+
72
+ @default []
73
+ */
74
+ singleTags?: string[] | RegExp[];
75
+
76
+ /**
77
+ Define the closing format for single tags.
78
+
79
+ @default 'default'
80
+ */
81
+ closingSingleTag?: 'tag' | 'slash';
82
+
83
+ /**
84
+ Whether to quote all attribute values.
85
+
86
+ @default true
87
+ */
88
+ quoteAllAttributes?: boolean;
89
+
90
+ /**
91
+ Replaces quotes in attribute values with `&quote;`.
92
+
93
+ @default true
94
+ */
95
+ replaceQuote?: boolean;
96
+
97
+ /**
98
+ Specify the style of quote around the attribute values.
99
+
100
+ @default 2
101
+
102
+ @example
103
+
104
+ `0` - Quote style is based on attribute values (an alternative for `replaceQuote` option)
105
+
106
+ ```
107
+ <img src="example.jpg" onload='testFunc("test")'>
108
+ ```
109
+
110
+ @example
111
+
112
+ `1` - Attribute values are wrapped in single quotes
113
+
114
+ ```
115
+ <img src='example.jpg' onload='testFunc("test")'>
116
+ ```
117
+
118
+ @example
119
+
120
+ `2` - Attribute values are wrapped in double quotes
121
+
122
+ ```
123
+ <img src="example.jpg" onload="testFunc("test")">
124
+ ```
125
+ */
126
+ quoteStyle?: 0 | 1 | 2;
127
+ }
128
+
129
+ export default interface PostHTMLConfig {
130
+ /**
131
+ Configure expressions.
132
+ */
133
+ expressions?: ExpressionsConfig;
134
+
135
+ /**
136
+ Configure PostHTML options.
137
+ */
138
+ options?: PostHTMLOptions;
139
+
140
+ /**
141
+ Additional PostHTML plugins that you would like to use.
142
+
143
+ These will run last, after components.
144
+
145
+ @default []
146
+
147
+ @example
148
+ ```
149
+ const spaceless = require('posthtml-spaceless')
150
+ module.exports = {
151
+ build: {
152
+ posthtml: {
153
+ plugins: [
154
+ spaceless()
155
+ ]
156
+ }
157
+ }
158
+ }
159
+ ```
160
+ */
161
+ plugins?: any[];
162
+
163
+ /**
164
+ Configure the `posthtml-mso` plugin.
165
+ */
166
+ outlook?: {
167
+ /**
168
+ The tag name to use for Outlook conditional comments.
169
+
170
+ @default 'outlook'
171
+
172
+ @example
173
+ ```
174
+ module.exports = {
175
+ build: {
176
+ posthtml: {
177
+ outlook: {
178
+ tag: 'mso'
179
+ }
180
+ }
181
+ }
182
+ }
183
+ // You now write <mso>...</mso> instead of <outlook>...</outlook>
184
+ ```
185
+ */
186
+ tag?: string;
187
+ };
188
+
189
+ /**
190
+ Configure the `<fetch>` tag behavior.
191
+
192
+ @default {}
193
+ */
194
+ fetch?: PostHTMLFetchConfig;
195
+ }
@@ -0,0 +1,115 @@
1
+ export default interface RemoveUnusedCSSConfig {
2
+ /**
3
+ Classes or IDs that you don't want removed.
4
+
5
+ @default []
6
+
7
+ @example
8
+ ```
9
+ module.exports = {
10
+ removeUnusedCSS: {
11
+ whitelist: ['.some-class', '.Mso*', '#*'],
12
+ }
13
+ }
14
+ ```
15
+ */
16
+ whitelist?: string[];
17
+
18
+ /**
19
+ Start and end delimiters for computed classes that you don't want removed.
20
+
21
+ @default [{heads: '{{', tails: '}}'}, {heads: '{%', tails: '%}'}]
22
+
23
+ @example
24
+ ```
25
+ module.exports = {
26
+ removeUnusedCSS: {
27
+ backend: [
28
+ { heads: '[[', tails: ']]' },
29
+ ]
30
+ }
31
+ }
32
+ ```
33
+ */
34
+ backend?: Array<Record<string, string>>;
35
+
36
+ /**
37
+ Whether to remove `<!-- HTML comments -->`.
38
+
39
+ @default true
40
+
41
+ @example
42
+ ```
43
+ module.exports = {
44
+ removeUnusedCSS: {
45
+ removeHTMLComments: false
46
+ }
47
+ }
48
+ ```
49
+ */
50
+ removeHTMLComments?: boolean;
51
+
52
+ /**
53
+ Whether to remove `/* CSS comments *\/`.
54
+
55
+ @default true
56
+
57
+ @example
58
+ ```
59
+ module.exports = {
60
+ removeUnusedCSS: {
61
+ removeCSSComments: false
62
+ }
63
+ }
64
+ ```
65
+ */
66
+ removeCSSComments?: boolean;
67
+
68
+ /**
69
+ Whether to remove classes that have been inlined.
70
+
71
+ @default undefined
72
+
73
+ @example
74
+ ```
75
+ module.exports = {
76
+ removeUnusedCSS: {
77
+ removeInlinedSelectors: false,
78
+ }
79
+ }
80
+ ```
81
+ */
82
+ removeInlinedSelectors?: boolean;
83
+
84
+ /**
85
+ List of strings representing start of a conditional comment that should not be removed.
86
+
87
+ @default ['[if', '[endif']
88
+
89
+ @example
90
+ ```
91
+ module.exports = {
92
+ removeUnusedCSS: {
93
+ doNotRemoveHTMLCommentsWhoseOpeningTagContains: ['[if', '[endif']
94
+ }
95
+ }
96
+ ```
97
+ */
98
+ doNotRemoveHTMLCommentsWhoseOpeningTagContains: string[];
99
+
100
+ /**
101
+ Rename all classes and IDs in both your `<style>` tags and your body HTML elements, to be as few characters as possible.
102
+
103
+ @default false
104
+
105
+ @example
106
+ ```
107
+ module.exports = {
108
+ removeUnusedCSS: {
109
+ uglify: true
110
+ }
111
+ }
112
+ ```
113
+ */
114
+ uglify?: boolean;
115
+ }
@@ -0,0 +1,130 @@
1
+ import {
2
+ beforeRenderType,
3
+ afterRenderType,
4
+ afterTransformersType
5
+ } from './events';
6
+ import type Config from './config';
7
+ import type TailwindConfig from './tailwind';
8
+
9
+ export type RenderOutput = {
10
+ /**
11
+ The rendered HTML.
12
+ */
13
+ html: string;
14
+
15
+ /**
16
+ The Maizzle configuration object.
17
+ */
18
+ config: Config;
19
+ };
20
+
21
+ export default interface RenderOptions {
22
+ /**
23
+ A Maizzle configuration object.
24
+
25
+ @default {}
26
+
27
+ @example
28
+ ```
29
+ const Maizzle = require('@maizzle/framework');
30
+
31
+ Maizzle
32
+ .render(`html string`, {
33
+ maizzle: {
34
+ inlineCSS: true,
35
+ }
36
+ })
37
+ .then(({html, config}) => console.log(html, config))
38
+ ```
39
+ */
40
+ maizzle: Config;
41
+
42
+ /**
43
+ Tailwind CSS configuration object.
44
+
45
+ @default {}
46
+
47
+ @example
48
+ ```
49
+ const Maizzle = require('@maizzle/framework');
50
+
51
+ Maizzle
52
+ .render(`html string`, {
53
+ tailwind: {
54
+ config: './tailwind-custom.config.js',
55
+ },
56
+ })
57
+ .then(({html, config}) => console.log(html, config))
58
+ ```
59
+ */
60
+ tailwind?: TailwindConfig;
61
+
62
+ /**
63
+ A function that runs after the Template's config has been computed, but just before it is compiled.
64
+
65
+ It exposes the Template's config, as well as the HTML.
66
+
67
+ @default undefined
68
+
69
+ @example
70
+ ```
71
+ const Maizzle = require('@maizzle/framework');
72
+
73
+ Maizzle
74
+ .render(`html string`, {
75
+ beforeRender: (html, config) => {
76
+ // do something with html and config
77
+ return html;
78
+ },
79
+ })
80
+ .then(({html, config}) => console.log(html, config))
81
+ ```
82
+ */
83
+ beforeRender?: beforeRenderType;
84
+
85
+ /**
86
+ A function that runs after the Template has been compiled, but before any Transformers have been applied.
87
+
88
+ Exposes the rendered html string and the Templates' config.
89
+
90
+ @default undefined
91
+
92
+ @example
93
+ ```
94
+ const Maizzle = require('@maizzle/framework');
95
+
96
+ Maizzle
97
+ .render(`html string`, {
98
+ afterRender: (html, config) => {
99
+ // do something with html and config
100
+ return html;
101
+ },
102
+ })
103
+ .then(({html, config}) => console.log(html, config))
104
+ ```
105
+ */
106
+ afterRender?: afterRenderType;
107
+
108
+ /**
109
+ A function that runs after all Transformers have been applied, just before the final HTML is returned.
110
+
111
+ It exposes the Template's config, as well as the HTML.
112
+
113
+ @default undefined
114
+
115
+ @example
116
+ ```
117
+ const Maizzle = require('@maizzle/framework');
118
+
119
+ Maizzle
120
+ .render(`html string`, {
121
+ afterTransformers: (html, config) => {
122
+ // do something with html and config
123
+ return html;
124
+ },
125
+ })
126
+ .then(({html, config}) => console.log(html, config))
127
+ ```
128
+ */
129
+ afterTransformers?: afterTransformersType;
130
+ }