@maizzle/framework 4.2.3 → 4.2.5
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/package.json +7 -3
- package/src/generators/output/to-string.js +1 -4
- package/src/transformers/index.js +3 -1
- package/.editorconfig +0 -9
- package/.github/CONTRIBUTING.md +0 -33
- package/.github/ISSUE_TEMPLATE.md +0 -2
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -9
- package/.github/dependabot.yml +0 -11
- package/.github/media/logo-dark.svg +0 -1
- package/.github/media/logo-light.svg +0 -1
- package/.github/workflows/nodejs.yml +0 -28
- package/test/expected/posthtml/component.html +0 -13
- package/test/expected/transformers/base-url.html +0 -99
- package/test/expected/transformers/filters.html +0 -81
- package/test/fixtures/basic.html +0 -9
- package/test/fixtures/posthtml/component.html +0 -19
- package/test/fixtures/transformers/base-url.html +0 -101
- package/test/fixtures/transformers/filters.html +0 -87
- package/test/stubs/assets/foo.bar +0 -1
- package/test/stubs/breaking/bad.html +0 -5
- package/test/stubs/components/component.html +0 -5
- package/test/stubs/config/config.js +0 -10
- package/test/stubs/config/config.maizzle-ci.js +0 -10
- package/test/stubs/data.json +0 -14
- package/test/stubs/empty/empty.html +0 -0
- package/test/stubs/events/before-create.html +0 -1
- package/test/stubs/layouts/basic.html +0 -1
- package/test/stubs/layouts/full.html +0 -12
- package/test/stubs/layouts/template.html +0 -5
- package/test/stubs/main.css +0 -5
- package/test/stubs/plaintext/front-matter.html +0 -9
- package/test/stubs/plaintext/plaintext.html +0 -5
- package/test/stubs/post.css +0 -6
- package/test/stubs/tailwind/content-source.html +0 -1
- package/test/stubs/tailwind/tailwind.css +0 -3
- package/test/stubs/template.html +0 -10
- package/test/stubs/templates/1.html +0 -1
- package/test/stubs/templates/2.html +0 -1
- package/test/stubs/templates/2.test +0 -1
- package/test/test-config.js +0 -19
- package/test/test-misc.js +0 -8
- package/test/test-postcss.js +0 -8
- package/test/test-posthtml.js +0 -112
- package/test/test-tailwindcss.js +0 -115
- package/test/test-todisk.js +0 -493
- package/test/test-tostring.js +0 -164
- package/test/test-transformers.js +0 -626
- package/xo.config.js +0 -22
package/test/stubs/data.json
DELETED
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<div class="inline">Foo is {{ page.foo }}</div>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<block name="template"></block>
|
package/test/stubs/main.css
DELETED
package/test/stubs/post.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<div class="hidden"></div>
|
package/test/stubs/template.html
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<div class="inline">html</div>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<div class="inline">html modified</div>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
test
|
package/test/test-config.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const test = require('ava')
|
|
2
|
-
const Config = require('../src/generators/config')
|
|
3
|
-
|
|
4
|
-
test('returns the merged config', async t => {
|
|
5
|
-
const config = await Config.getMerged('maizzle-ci')
|
|
6
|
-
t.is(config.env, 'maizzle-ci')
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
test('throws if env name is not a string', async t => {
|
|
10
|
-
await t.throwsAsync(async () => {
|
|
11
|
-
await Config.getMerged(false)
|
|
12
|
-
}, {instanceOf: TypeError, message: `env name must be a string, received boolean(false)`})
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
test('throws if a config could not be loaded for the specified environment', async t => {
|
|
16
|
-
await t.throwsAsync(async () => {
|
|
17
|
-
await Config.getMerged('fake')
|
|
18
|
-
}, {instanceOf: Error, message: `could not load config.fake.js`})
|
|
19
|
-
})
|
package/test/test-misc.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
const test = require('ava')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
const {requireUncached} = require('../src/utils/helpers')
|
|
4
|
-
|
|
5
|
-
test('requires an uncached module', t => {
|
|
6
|
-
const helpers = requireUncached(path.resolve(process.cwd(), 'src/utils/helpers'))
|
|
7
|
-
t.is(typeof helpers.requireUncached, 'function')
|
|
8
|
-
})
|
package/test/test-postcss.js
DELETED
package/test/test-posthtml.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
const test = require('ava')
|
|
2
|
-
const {render} = require('../src')
|
|
3
|
-
|
|
4
|
-
const renderString = (string, options = {}) => render(string, options).then(({html}) => html)
|
|
5
|
-
|
|
6
|
-
test('layouts', async t => {
|
|
7
|
-
const source = `---
|
|
8
|
-
greeting: Hello
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
<extends src="test/stubs/layouts/basic.html">
|
|
12
|
-
<block name="template">
|
|
13
|
-
Front matter variable: {{ page.greeting }}
|
|
14
|
-
</block>
|
|
15
|
-
</extends>`
|
|
16
|
-
|
|
17
|
-
const html = await renderString(source, {
|
|
18
|
-
maizzle: {
|
|
19
|
-
greeting: 'Hello'
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
t.is(html.trim(), `Front matter variable: Hello`)
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
test('inheritance when extending a template', async t => {
|
|
27
|
-
const source = `---
|
|
28
|
-
template: second
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
<extends src="test/stubs/template.html">
|
|
32
|
-
<block name="button">Child in second.html</block>
|
|
33
|
-
</extends>`
|
|
34
|
-
|
|
35
|
-
let html = await renderString(source)
|
|
36
|
-
|
|
37
|
-
html = html.replace(/[^\S\r\n]+$/gm, '').trim()
|
|
38
|
-
|
|
39
|
-
t.is(html, `Parent
|
|
40
|
-
Child in second.html`)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
test('components', async t => {
|
|
44
|
-
const source = `<component
|
|
45
|
-
src="test/stubs/components/component.html"
|
|
46
|
-
text="Example"
|
|
47
|
-
locals='{
|
|
48
|
-
"foo": "bar"
|
|
49
|
-
}'
|
|
50
|
-
>
|
|
51
|
-
<p class="hidden">Variable from page: [[ page.env ]]</p>
|
|
52
|
-
|
|
53
|
-
<component
|
|
54
|
-
src="test/stubs/components/component.html"
|
|
55
|
-
text="Nested component"
|
|
56
|
-
locals='{
|
|
57
|
-
"foo": "bar (nested)"
|
|
58
|
-
}'
|
|
59
|
-
>
|
|
60
|
-
<p>Variable from page (nested): [[ page.env ]]</p>
|
|
61
|
-
</component>
|
|
62
|
-
</component>`
|
|
63
|
-
|
|
64
|
-
const options = {
|
|
65
|
-
maizzle: {
|
|
66
|
-
env: 'prod',
|
|
67
|
-
build: {
|
|
68
|
-
components: {
|
|
69
|
-
expressions: {
|
|
70
|
-
delimiters: ['[[', ']]']
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const html = await renderString(source, options)
|
|
78
|
-
|
|
79
|
-
t.is(html.trim(), `<p>Variable from attribute: Example</p>
|
|
80
|
-
<p>Variable from locals attribute: bar</p><p class="hidden">Variable from page: prod</p>
|
|
81
|
-
<p>Variable from attribute: Nested component</p>
|
|
82
|
-
<p>Variable from locals attribute: bar (nested)</p><p>Variable from page (nested): prod</p>`)
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
test('fetch component', async t => {
|
|
86
|
-
const source = `<extends src="test/stubs/layouts/basic.html">
|
|
87
|
-
<block name="template">
|
|
88
|
-
<fetch url="test/stubs/data.json">
|
|
89
|
-
<each loop="user in response">
|
|
90
|
-
[[ user.name + (loop.last ? '' : ', ') ]]
|
|
91
|
-
</each>
|
|
92
|
-
</fetch>
|
|
93
|
-
</block>
|
|
94
|
-
</extends>`
|
|
95
|
-
|
|
96
|
-
const options = {
|
|
97
|
-
maizzle: {
|
|
98
|
-
env: 'maizzle-ci',
|
|
99
|
-
build: {
|
|
100
|
-
posthtml: {
|
|
101
|
-
expressions: {
|
|
102
|
-
delimiters: ['[[', ']]']
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const html = await renderString(source, options)
|
|
110
|
-
|
|
111
|
-
t.is(html.trim(), 'Leanne Graham, Ervin Howell, Clementine Bauch')
|
|
112
|
-
})
|
package/test/test-tailwindcss.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
const test = require('ava')
|
|
2
|
-
const Tailwind = require('../src/generators/tailwindcss')
|
|
3
|
-
|
|
4
|
-
test('throws on compile error', async t => {
|
|
5
|
-
await t.throwsAsync(async () => {
|
|
6
|
-
await Tailwind.compile('div {@apply inexistent;}', '<div class="inline">Test</a>', {}, {})
|
|
7
|
-
}, {instanceOf: SyntaxError})
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
test('uses defaults if no config specified', async t => {
|
|
11
|
-
const css = await Tailwind.compile(
|
|
12
|
-
'@tailwind utilities;',
|
|
13
|
-
'<p class="xl:z-0"></p>',
|
|
14
|
-
{},
|
|
15
|
-
{env: 'production'}
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
t.not(css, undefined)
|
|
19
|
-
t.true(css.includes('.xl\\:z-0'))
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
test('uses css file provided in environment config', async t => {
|
|
23
|
-
const config = {
|
|
24
|
-
env: 'production',
|
|
25
|
-
build: {
|
|
26
|
-
tailwind: {
|
|
27
|
-
css: './test/stubs/main.css'
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const css = await Tailwind.compile('', '<div class="text-center foo">test</div>', {}, config)
|
|
33
|
-
|
|
34
|
-
t.not(css, undefined)
|
|
35
|
-
t.true(css.includes('.text-center'))
|
|
36
|
-
t.true(css.includes('.foo'))
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
test('works with custom `content` sources', async t => {
|
|
40
|
-
const css = await Tailwind.compile(
|
|
41
|
-
'@tailwind utilities;',
|
|
42
|
-
'<div class="hidden"></div>',
|
|
43
|
-
{
|
|
44
|
-
content: ['./test/stubs/tailwind/*.*']
|
|
45
|
-
}
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
t.true(css.includes('.hidden'))
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
test('works with custom `files` sources', async t => {
|
|
52
|
-
const css = await Tailwind.compile(
|
|
53
|
-
'@tailwind utilities;',
|
|
54
|
-
'<div class="inline"></div>',
|
|
55
|
-
{
|
|
56
|
-
content: {
|
|
57
|
-
files: ['./test/stubs/tailwind/*.*']
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
t.true(css.includes('.hidden'))
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
test('uses maizzle template path as content source', async t => {
|
|
66
|
-
const css = await Tailwind.compile(
|
|
67
|
-
'@tailwind utilities;',
|
|
68
|
-
'<div class="inline"></div>',
|
|
69
|
-
{},
|
|
70
|
-
{
|
|
71
|
-
build: {
|
|
72
|
-
templates: {
|
|
73
|
-
source: './test/stubs/tailwind'
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
t.true(css.includes('.hidden'))
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
test('uses maizzle template path as content source (single file)', async t => {
|
|
83
|
-
const css = await Tailwind.compile(
|
|
84
|
-
'@tailwind utilities;',
|
|
85
|
-
'<div class="inline"></div>',
|
|
86
|
-
{},
|
|
87
|
-
{
|
|
88
|
-
build: {
|
|
89
|
-
templates: {
|
|
90
|
-
source: './test/stubs/tailwind/content-source.html'
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
t.true(css.includes('.hidden'))
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
test('uses custom postcss plugins from the maizzle config', async t => {
|
|
100
|
-
const maizzleConfig = {
|
|
101
|
-
env: 'production',
|
|
102
|
-
build: {
|
|
103
|
-
postcss: {
|
|
104
|
-
plugins: [
|
|
105
|
-
require('autoprefixer')({overrideBrowserslist: ['> 0.1%']})
|
|
106
|
-
]
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const css = await Tailwind.compile('.test {transform: scale(0.5)}', '<div class="test inline">Test</a>', {}, maizzleConfig)
|
|
112
|
-
|
|
113
|
-
t.not(css, undefined)
|
|
114
|
-
t.is(css.trim(), '.inline {display: inline !important} .test {-webkit-transform: scale(0.5);transform: scale(0.5)}')
|
|
115
|
-
})
|