Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: bundle specific ref-counting (#467)
* per-bundle ref counting for css dependencies Fixes #466
- Loading branch information
Showing
13 changed files
with
210 additions
and
86 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
153 changes: 102 additions & 51 deletions
153
packages/rollup/test/__snapshots__/splitting.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,115 +1,166 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP | // Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
|
||
exports[`/rollup.js code splitting should support dynamic imports 1`] = ` | exports[`/rollup.js code splitting should support dynamic imports 1`] = ` | ||
"/* packages/rollup/test/specimens/dynamic-imports/a.css */ | Array [ | ||
Object { | |||
"file": "a.css", | |||
"text": "/* packages/rollup/test/specimens/dynamic-imports/a.css */ | |||
.a { | .a { | ||
color: aqua; | color: aqua; | ||
} | } | ||
" | ", | ||
`; | }, | ||
|
Object { | ||
exports[`/rollup.js code splitting should support dynamic imports 2`] = ` | "file": "b.css", | ||
"/* packages/rollup/test/specimens/dynamic-imports/b.css */ | "text": "/* packages/rollup/test/specimens/dynamic-imports/b.css */ | ||
.b { | .b { | ||
color: blue; | color: blue; | ||
} | } | ||
" | ", | ||
`; | }, | ||
|
Object { | ||
exports[`/rollup.js code splitting should support dynamic imports 3`] = ` | "file": "c.css", | ||
"/* packages/rollup/test/specimens/dynamic-imports/c.css */ | "text": "/* packages/rollup/test/specimens/dynamic-imports/c.css */ | ||
.c { | .c { | ||
color: cyan; | color: cyan; | ||
} | } | ||
" | ", | ||
`; | }, | ||
|
Object { | ||
exports[`/rollup.js code splitting should support dynamic imports 4`] = ` | "file": "common.css", | ||
"/* packages/rollup/test/specimens/dynamic-imports/d.css */ | "text": "/* packages/rollup/test/specimens/dynamic-imports/d.css */ | ||
.d { | .d { | ||
color: darkred; | color: darkred; | ||
} | } | ||
" | ", | ||
}, | |||
] | |||
`; | `; | ||
|
|
||
exports[`/rollup.js code splitting should support manual chunks 1`] = ` | exports[`/rollup.js code splitting should support manual chunks 1`] = ` | ||
"/* packages/rollup/test/specimens/manual-chunks/a.css */ | Array [ | ||
Object { | |||
"file": "a.css", | |||
"text": "/* packages/rollup/test/specimens/manual-chunks/a.css */ | |||
.a { | .a { | ||
color: red; | color: red; | ||
} | } | ||
" | ", | ||
`; | }, | ||
|
Object { | ||
exports[`/rollup.js code splitting should support manual chunks 2`] = ` | "file": "b.css", | ||
"/* packages/rollup/test/specimens/manual-chunks/b.css */ | "text": "/* packages/rollup/test/specimens/manual-chunks/b.css */ | ||
.b { | .b { | ||
color: blue; | color: blue; | ||
} | } | ||
" | ", | ||
`; | }, | ||
|
Object { | ||
exports[`/rollup.js code splitting should support manual chunks 3`] = ` | "file": "common.css", | ||
"/* packages/rollup/test/specimens/manual-chunks/d.css */ | "text": "/* packages/rollup/test/specimens/manual-chunks/d.css */ | ||
/* packages/rollup/test/specimens/manual-chunks/c.css */ | /* packages/rollup/test/specimens/manual-chunks/c.css */ | ||
.c { | .c { | ||
color: green; | color: green; | ||
background: darkred; | background: darkred; | ||
} | } | ||
" | ", | ||
}, | |||
] | |||
`; | `; | ||
|
|
||
exports[`/rollup.js code splitting should support splitting up CSS files 1`] = ` | exports[`/rollup.js code splitting should support splitting up CSS files 1`] = ` | ||
"/* packages/rollup/test/specimens/simple.css */ | Array [ | ||
Object { | |||
"file": "common.css", | |||
"text": "/* packages/rollup/test/specimens/simple.css */ | |||
.fooga { | .fooga { | ||
color: red; | color: red; | ||
} | } | ||
" | ", | ||
`; | }, | ||
|
Object { | ||
exports[`/rollup.js code splitting should support splitting up CSS files 2`] = ` | "file": "dependencies.css", | ||
"/* packages/rollup/test/specimens/dependencies.css */ | "text": "/* packages/rollup/test/specimens/dependencies.css */ | ||
.wooga { | .wooga { | ||
background: blue; | background: blue; | ||
} | } | ||
" | ", | ||
}, | |||
] | |||
`; | `; | ||
|
|
||
exports[`/rollup.js code splitting should support splitting up CSS files w/ shared assets 1`] = ` | exports[`/rollup.js code splitting should support splitting up CSS files w/ shared assets 1`] = ` | ||
"/* packages/rollup/test/specimens/css-chunks/a.css */ | Array [ | ||
Object { | |||
"file": "a.css", | |||
"text": "/* packages/rollup/test/specimens/css-chunks/a.css */ | |||
.a { | .a { | ||
color: aqua; | color: aqua; | ||
} | } | ||
" | ", | ||
`; | }, | ||
|
Object { | ||
exports[`/rollup.js code splitting should support splitting up CSS files w/ shared assets 2`] = ` | "file": "b.css", | ||
"/* packages/rollup/test/specimens/css-chunks/b.css */ | "text": "/* packages/rollup/test/specimens/css-chunks/b.css */ | ||
.b { | .b { | ||
color: blue; | color: blue; | ||
} | } | ||
" | ", | ||
`; | }, | ||
|
Object { | ||
exports[`/rollup.js code splitting should support splitting up CSS files w/ shared assets 3`] = ` | "file": "chunk.css", | ||
"/* packages/rollup/test/specimens/css-chunks/c.css */ | "text": "/* packages/rollup/test/specimens/css-chunks/c.css */ | ||
.c { | .c { | ||
color: cyan; | color: cyan; | ||
} | } | ||
" | ", | ||
}, | |||
Object { | |||
"file": "common.css", | |||
"text": "/* packages/rollup/test/specimens/css-chunks/shared.css */ | |||
.shared { | |||
color: snow; | |||
} | |||
", | |||
}, | |||
] | |||
`; | `; | ||
|
|
||
exports[`/rollup.js code splitting should support splitting up CSS files w/ shared assets 4`] = ` | exports[`/rollup.js code splitting shouldn't put bundle-specific CSS in common.css 1`] = ` | ||
"/* packages/rollup/test/specimens/css-chunks/shared.css */ | Array [ | ||
Object { | |||
"file": "a.css", | |||
"text": "/* packages/rollup/test/specimens/common-splitting/shared.css */ | |||
.shared { | .shared { | ||
color: snow; | color: snow; | ||
} | } | ||
" | /* packages/rollup/test/specimens/common-splitting/a.css */ | ||
.a { | |||
color: aqua; | |||
} | |||
/* packages/rollup/test/specimens/common-splitting/b.css */ | |||
.b { | |||
color: blue; | |||
} | |||
", | |||
}, | |||
Object { | |||
"file": "c.css", | |||
"text": "/* packages/rollup/test/specimens/common-splitting/c.css */ | |||
.c { | |||
color: cyan; | |||
} | |||
", | |||
}, | |||
] | |||
`; | `; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,5 @@ | |||
.a { | |||
composes: shared from "./shared.css"; | |||
|
|||
color: aqua; | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
import css from "./a.css"; | |||
import js from "./b.js"; | |||
|
|||
console.log(css, js); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,5 @@ | |||
.b { | |||
composes: shared from "./shared.css"; | |||
|
|||
color: blue; | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,5 @@ | |||
import css from "./b.css"; | |||
|
|||
console.log(css); | |||
|
|||
export default "b.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
.c { | |||
color: cyan; | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
import css from "./c.css"; | |||
|
|||
export default css; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
.shared { | |||
color: snow; | |||
} |
Oops, something went wrong.