Skip to content
Permalink
Browse files

fix: remove newlines after composes (#561)

  • Loading branch information...
tivac committed Feb 5, 2019
1 parent bede9a3 commit 23569dc2bf732d8aa112e2bc3abaa1b59cb10715
@@ -15,7 +15,6 @@ exports[`/glob.js should find files on disk & output css 1`] = `
}
/* dir/2.css */
.two {

background: blue;
}
"
@@ -32,7 +31,6 @@ exports[`/glob.js should support exclusion patterns 1`] = `
}
/* dir/2.css */
.two {

background: blue;
}
"
@@ -53,7 +51,6 @@ exports[`/glob.js should use a default search 1`] = `
}
/* dir/2.css */
.two {

background: blue;
}
"
@@ -94,8 +94,12 @@ module.exports = (css, result) => {
}
});

const next = decl.next();

// Remove just the composes declaration if there are other declarations
if(decl.parent.nodes.length > 1) {
if(next) {
next.raws.before = decl.raw("before");

return decl.remove();
}

@@ -233,7 +233,6 @@ exports[`/processor.js API .output() should order output by dependencies, then a
/* packages/processor/test/specimens/composes.css */
/* packages/processor/test/specimens/deep.css */
.deep {

color: black;
}
/* packages/processor/test/specimens/local.css */
@@ -10,7 +10,6 @@ Array [
}
/* packages/rollup/test/specimens/casing/foo.css */
.mc3dd08d27_foo {

color: #F00;
}",
},
@@ -436,7 +435,6 @@ exports[`/rollup.js should respect the CSS dependency tree 2`] = `
}
/* packages/rollup/test/specimens/dependencies.css */
.wooga {

background: blue;
}
"
@@ -3,46 +3,30 @@
exports[`/rollup.js code splitting should dedupe chunk names using rollup's incrementing counter logic (hashed) 1`] = `
Array [
Object {
"file": "a-14363c2f.css",
"file": "a-8dc3c49a.css",
"text": "/* packages/rollup/test/specimens/multiple-chunks/a.css */
.a {

color: aqua;
}

/*# sourceMappingURL=a-14363c2f.css.map */",
/*# sourceMappingURL=a-8dc3c49a.css.map */",
},
Object {
"file": "a-14363c2f.css.map",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/a.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;;IAGI,WAAW;AACf\\",\\"file\\":\\"a-[hash].css\\",\\"sourcesContent\\":[\\".a {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: aqua;\\\\n}\\\\n\\"]}",
"file": "a-8dc3c49a.css.map",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/a.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;IAGI,WAAW;AACf\\",\\"file\\":\\"a-[hash].css\\",\\"sourcesContent\\":[\\".a {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: aqua;\\\\n}\\\\n\\"]}",
},
Object {
"file": "b-b31885ac.css",
"file": "b-fc0ef588.css",
"text": "/* packages/rollup/test/specimens/multiple-chunks/b.css */
.b {

color: blue;
}

/*# sourceMappingURL=b-b31885ac.css.map */",
},
Object {
"file": "b-b31885ac.css.map",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/b.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;;IAGI,WAAW;AACf\\",\\"file\\":\\"b-[hash].css\\",\\"sourcesContent\\":[\\".b {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: blue;\\\\n}\\\\n\\"]}",
},
Object {
"file": "chunk-23649ca7.css",
"text": "/* packages/rollup/test/specimens/multiple-chunks/d.css */
.d {

color: deepskyblue;
}

/*# sourceMappingURL=chunk-23649ca7.css.map */",
/*# sourceMappingURL=b-fc0ef588.css.map */",
},
Object {
"file": "chunk-23649ca7.css.map",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/packages/rollup/test/specimens/multiple-chunks/b.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;;IAGI,kBAAW;AACf\\",\\"file\\":\\"chunk-[hash].css\\",\\"sourcesContent\\":[\\".b {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: blue;\\\\n}\\\\n\\"]}",
"file": "b-fc0ef588.css.map",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/b.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;IAGI,WAAW;AACf\\",\\"file\\":\\"b-[hash].css\\",\\"sourcesContent\\":[\\".b {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: blue;\\\\n}\\\\n\\"]}",
},
Object {
"file": "chunk-2f7464a0.css",
@@ -58,18 +42,30 @@ Array [
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/constants.css\\",\\"../../../specimens/multiple-chunks/shared.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,iEAAA,ECAA,8DAAA;AAEA,UAAU,aAAa,EAAE;;AAEzB,SDJA,WAAiB,ECIK\\",\\"file\\":\\"chunk-[hash].css\\",\\"sourcesContent\\":[\\"@value main: blue;\\\\n\\",\\"@value main from \\\\\\"./constants.css\\\\\\";\\\\n\\\\n.shared { color: salmon; }\\\\n\\\\n.other { color: main; }\\\\n\\"]}",
},
Object {
"file": "chunk-57d5c038.css",
"file": "chunk-48a593d7.css",
"text": "/* packages/rollup/test/specimens/multiple-chunks/c.css */
.c {

color: coral;
}

/*# sourceMappingURL=chunk-57d5c038.css.map */",
/*# sourceMappingURL=chunk-48a593d7.css.map */",
},
Object {
"file": "chunk-57d5c038.css.map",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/packages/rollup/test/specimens/multiple-chunks/b.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;;IAGI,YAAW;AACf\\",\\"file\\":\\"chunk-[hash].css\\",\\"sourcesContent\\":[\\".b {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: blue;\\\\n}\\\\n\\"]}",
"file": "chunk-48a593d7.css.map",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/packages/rollup/test/specimens/multiple-chunks/b.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;IAGI,YAAW;AACf\\",\\"file\\":\\"chunk-[hash].css\\",\\"sourcesContent\\":[\\".b {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: blue;\\\\n}\\\\n\\"]}",
},
Object {
"file": "chunk-ee76f9f0.css",
"text": "/* packages/rollup/test/specimens/multiple-chunks/d.css */
.d {
color: deepskyblue;
}

/*# sourceMappingURL=chunk-ee76f9f0.css.map */",
},
Object {
"file": "chunk-ee76f9f0.css.map",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/packages/rollup/test/specimens/multiple-chunks/b.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;IAGI,kBAAW;AACf\\",\\"file\\":\\"chunk-[hash].css\\",\\"sourcesContent\\":[\\".b {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: blue;\\\\n}\\\\n\\"]}",
},
]
`;
@@ -80,29 +76,27 @@ Array [
"file": "a.css",
"text": "/* packages/rollup/test/specimens/multiple-chunks/a.css */
.a {

color: aqua;
}

/*# sourceMappingURL=a.css.map */",
},
Object {
"file": "a.css.map",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/a.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;;IAGI,WAAW;AACf\\",\\"file\\":\\"a.css\\",\\"sourcesContent\\":[\\".a {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: aqua;\\\\n}\\\\n\\"]}",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/a.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;IAGI,WAAW;AACf\\",\\"file\\":\\"a.css\\",\\"sourcesContent\\":[\\".a {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: aqua;\\\\n}\\\\n\\"]}",
},
Object {
"file": "b.css",
"text": "/* packages/rollup/test/specimens/multiple-chunks/b.css */
.b {

color: blue;
}

/*# sourceMappingURL=b.css.map */",
},
Object {
"file": "b.css.map",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/b.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;;IAGI,WAAW;AACf\\",\\"file\\":\\"b.css\\",\\"sourcesContent\\":[\\".b {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: blue;\\\\n}\\\\n\\"]}",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/b.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;IAGI,WAAW;AACf\\",\\"file\\":\\"b.css\\",\\"sourcesContent\\":[\\".b {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: blue;\\\\n}\\\\n\\"]}",
},
Object {
"file": "chunk.css",
@@ -121,27 +115,25 @@ Array [
"file": "chunk2.css",
"text": "/* packages/rollup/test/specimens/multiple-chunks/d.css */
.d {

color: deepskyblue;
}
",
},
Object {
"file": "chunk2.css.map",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/packages/rollup/test/specimens/multiple-chunks/b.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;;IAGI,kBAAW;AACf\\",\\"file\\":\\"chunk.css\\",\\"sourcesContent\\":[\\".b {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: blue;\\\\n}\\\\n\\"]}",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/packages/rollup/test/specimens/multiple-chunks/b.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;IAGI,kBAAW;AACf\\",\\"file\\":\\"chunk.css\\",\\"sourcesContent\\":[\\".b {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: blue;\\\\n}\\\\n\\"]}",
},
Object {
"file": "chunk3.css",
"text": "/* packages/rollup/test/specimens/multiple-chunks/c.css */
.c {

color: coral;
}
",
},
Object {
"file": "chunk3.css.map",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/packages/rollup/test/specimens/multiple-chunks/b.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;;IAGI,YAAW;AACf\\",\\"file\\":\\"chunk.css\\",\\"sourcesContent\\":[\\".b {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: blue;\\\\n}\\\\n\\"]}",
"text": "{\\"version\\":3,\\"sources\\":[\\"../../../specimens/multiple-chunks/packages/rollup/test/specimens/multiple-chunks/b.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA,yDAAA;AAAA;IAGI,YAAW;AACf\\",\\"file\\":\\"chunk.css\\",\\"sourcesContent\\":[\\".b {\\\\n composes: shared from \\\\\\"./shared.css\\\\\\";\\\\n\\\\n color: blue;\\\\n}\\\\n\\"]}",
},
]
`;
@@ -160,7 +152,6 @@ Array [
"file": "dependencies.css",
"text": "/* packages/rollup/test/specimens/dependencies.css */
.wooga {

background: blue;
}
",
@@ -284,12 +275,10 @@ Array [
}
/* packages/rollup/test/specimens/dynamic-imports/d.css */
.d {

color: darkred;
}
/* packages/rollup/test/specimens/dynamic-imports/a.css */
.a {

color: aqua;
}
",
@@ -302,7 +291,6 @@ Array [
}
/* packages/rollup/test/specimens/dynamic-imports/b.css */
.b {

color: blue;
}
",
@@ -311,7 +299,6 @@ Array [
"file": "chunk.css",
"text": "/* packages/rollup/test/specimens/dynamic-imports/c.css */
.c {

color: cyan;
}
",
@@ -325,7 +312,6 @@ Array [
"file": "a.css",
"text": "/* packages/rollup/test/specimens/manual-chunks/a.css */
.a {

color: red;
}
",
@@ -334,7 +320,6 @@ Array [
"file": "b.css",
"text": "/* packages/rollup/test/specimens/manual-chunks/b.css */
.b {

color: blue;
}
",
@@ -458,7 +443,6 @@ Array [
"file": "dependencies.css",
"text": "/* packages/rollup/test/specimens/dependencies.css */
.wooga {

background: blue;
}
",
@@ -472,7 +456,6 @@ Array [
"file": "a.css",
"text": "/* packages/rollup/test/specimens/css-chunks/a.css */
.a {

color: aqua;
}
",
@@ -481,7 +464,6 @@ Array [
"file": "b.css",
"text": "/* packages/rollup/test/specimens/css-chunks/b.css */
.b {

color: blue;
}
",
@@ -494,7 +476,6 @@ Array [
}
/* packages/rollup/test/specimens/css-chunks/c.css */
.c {

color: cyan;
}
",
@@ -514,12 +495,10 @@ Array [
}
/* packages/rollup/test/specimens/common-splitting/a.css */
.a {

color: aqua;
}
/* packages/rollup/test/specimens/common-splitting/b.css */
.b {

color: blue;
}
",
@@ -37,7 +37,6 @@ exports[`/svelte.js should extract CSS from a <link> tag ("existing script") 2`]
}
/* packages/svelte/test/specimens/dependencies.css */
.wooga {

background: blue;
}
/* packages/svelte/test/specimens/external.css */
@@ -73,7 +72,6 @@ exports[`/svelte.js should extract CSS from a <link> tag ("no script") 2`] = `
}
/* packages/svelte/test/specimens/dependencies.css */
.wooga {

background: blue;
}
/* packages/svelte/test/specimens/external.css */
@@ -109,7 +107,6 @@ exports[`/svelte.js should extract CSS from a <link> tag ("single quotes") 2`] =
}
/* packages/svelte/test/specimens/dependencies.css */
.wooga {

background: blue;
}
/* packages/svelte/test/specimens/external.css */
@@ -145,7 +142,6 @@ exports[`/svelte.js should extract CSS from a <link> tag ("unquoted") 2`] = `
}
/* packages/svelte/test/specimens/dependencies.css */
.wooga {

background: blue;
}
/* packages/svelte/test/specimens/external.css */
@@ -191,7 +187,6 @@ exports[`/svelte.js should extract CSS from a <link> tag ("values") 2`] = `
}
/* packages/svelte/test/specimens/dependencies.css */
.wooga {

background: blue;
}
/* packages/svelte/test/specimens/external.css */
@@ -234,7 +229,6 @@ exports[`/svelte.js should extract CSS from a <style> tag 2`] = `
}
/* packages/svelte/test/specimens/dependencies.css */
.wooga {

background: blue;
}
/* packages/svelte/test/specimens/style.html */

0 comments on commit 23569dc

Please sign in to comment.
You can’t perform that action at this time.