From 0976e8f196aba095cb3a1623b03cd7c2622e5365 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Thu, 28 Jan 2021 09:58:48 +0300 Subject: [PATCH] fix: filter out only related files --- __tests__/__snapshots__/index.test.ts.snap | 30 ++++---- package.json | 2 +- pnpm-lock.yaml | 81 +++++++++------------- src/index.ts | 18 ++--- 4 files changed, 54 insertions(+), 77 deletions(-) diff --git a/__tests__/__snapshots__/index.test.ts.snap b/__tests__/__snapshots__/index.test.ts.snap index 3d2b617e..a928d139 100644 --- a/__tests__/__snapshots__/index.test.ts.snap +++ b/__tests__/__snapshots__/index.test.ts.snap @@ -2688,7 +2688,7 @@ function injector_3b481dac (css, options) { } } -var css = \\".d {\\\\n color: red;\\\\n}\\\\n.a {\\\\n color: royalblue;\\\\n}\\\\n.b {\\\\n color: red;\\\\n}\\\\n.c {\\\\n color: red;\\\\n}\\\\n.foo {\\\\n color: royalblue;\\\\n}\\\\n/*! minireset.css v0.0.6 | MIT License | github.com/jgthms/minireset.css */\\\\nhtml,\\\\nbody,\\\\np,\\\\nol,\\\\nul,\\\\nli,\\\\ndl,\\\\ndt,\\\\ndd,\\\\nblockquote,\\\\nfigure,\\\\nfieldset,\\\\nlegend,\\\\ntextarea,\\\\npre,\\\\niframe,\\\\nhr,\\\\nh1,\\\\nh2,\\\\nh3,\\\\nh4,\\\\nh5,\\\\nh6 {\\\\n margin: 0;\\\\n padding: 0;\\\\n}\\\\nh1,\\\\nh2,\\\\nh3,\\\\nh4,\\\\nh5,\\\\nh6 {\\\\n font-size: 100%;\\\\n font-weight: normal;\\\\n}\\\\nul {\\\\n list-style: none;\\\\n}\\\\nbutton,\\\\ninput,\\\\nselect,\\\\ntextarea {\\\\n margin: 0;\\\\n}\\\\nhtml {\\\\n box-sizing: border-box;\\\\n}\\\\n*,\\\\n*::before,\\\\n*::after {\\\\n box-sizing: inherit;\\\\n}\\\\nimg,\\\\nvideo {\\\\n height: auto;\\\\n max-width: 100%;\\\\n}\\\\niframe {\\\\n border: 0;\\\\n}\\\\ntable {\\\\n border-collapse: collapse;\\\\n border-spacing: 0;\\\\n}\\\\ntd,\\\\nth {\\\\n padding: 0;\\\\n}\\\\ntd:not([align]),\\\\nth:not([align]) {\\\\n text-align: left;\\\\n}\\\\n\\"; +var css = \\".d {\\\\n color: red;\\\\n}\\\\n.a {\\\\n color: royalblue;\\\\n}\\\\n.b {\\\\n color: red;\\\\n}\\\\n.c {\\\\n color: red;\\\\n}\\\\n.foo {\\\\n color: royalblue;\\\\n}\\\\n/*! minireset.css v0.0.7 | MIT License | github.com/jgthms/minireset.css */\\\\nhtml,\\\\nbody,\\\\np,\\\\nol,\\\\nul,\\\\nli,\\\\ndl,\\\\ndt,\\\\ndd,\\\\nblockquote,\\\\nfigure,\\\\nfieldset,\\\\nlegend,\\\\ntextarea,\\\\npre,\\\\niframe,\\\\nhr,\\\\nh1,\\\\nh2,\\\\nh3,\\\\nh4,\\\\nh5,\\\\nh6 {\\\\n margin: 0;\\\\n padding: 0;\\\\n}\\\\nh1,\\\\nh2,\\\\nh3,\\\\nh4,\\\\nh5,\\\\nh6 {\\\\n font-size: 100%;\\\\n font-weight: normal;\\\\n}\\\\nul {\\\\n list-style: none;\\\\n}\\\\nbutton,\\\\ninput,\\\\nselect {\\\\n margin: 0;\\\\n}\\\\nhtml {\\\\n box-sizing: border-box;\\\\n}\\\\n*,\\\\n*::before,\\\\n*::after {\\\\n box-sizing: inherit;\\\\n}\\\\nimg,\\\\nvideo {\\\\n height: auto;\\\\n max-width: 100%;\\\\n}\\\\niframe {\\\\n border: 0;\\\\n}\\\\ntable {\\\\n border-collapse: collapse;\\\\n border-spacing: 0;\\\\n}\\\\ntd,\\\\nth {\\\\n padding: 0;\\\\n}\\\\n\\"; injector_3b481dac(css,{}); " `; @@ -2784,7 +2784,7 @@ exports[`less sourcemap: css 1`] = ` .foo { color: royalblue; } -/*! minireset.css v0.0.6 | MIT License | github.com/jgthms/minireset.css */ +/*! minireset.css v0.0.7 | MIT License | github.com/jgthms/minireset.css */ html, body, p, @@ -2825,8 +2825,7 @@ ul { } button, input, -select, -textarea { +select { margin: 0; } html { @@ -2853,12 +2852,8 @@ td, th { padding: 0; } -td:not([align]), -th:not([align]) { - text-align: left; -} -/*# sourceMappingURL=index-da8d7528.css.map */" +/*# sourceMappingURL=index-6cea763b.css.map */" `; exports[`less sourcemap: js 1`] = ` @@ -2866,7 +2861,7 @@ exports[`less sourcemap: js 1`] = ` " `; -exports[`less sourcemap: map 1`] = `"{\\"version\\":3,\\"sources\\":[\\"../../../../less-import/node_modules/foo/bar/d.css\\",\\"../../../../less-import/node_modules/foo/bar/a.less\\",\\"../../../../less-import/style.less\\",\\"../../../../less-import/node_modules/foo/bar/b.less\\",\\"../../../../less-import/node_modules/foo/bar/c.css\\",\\"../../../../less-import/foo.less\\",\\"../../../../../../node_modules/minireset.css/minireset.min.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,UAAU;AACZ;ACFA;EACE,gBAAA;ACEF;ACHA;EACE,UAAA;ADKF;AENA;EACE,UAAA;AFQF;AGPA;EACE,gBAAA;AHSF;AACA,0EAA0E;AIbC;;;;;;;;;;;;;;;;;;;;;;;EAAyG,SAAA;EAAS,UAAA;AJuC7L;AIvCuM;;;;;;EAAkB,eAAA;EAAe,mBAAA;AJgDxO;AIhD2P;EAAG,gBAAA;AJmD9P;AInD8Q;;;;EAA6B,SAAA;AJyD3S;AIzDoT;EAAK,sBAAA;AJ4DzT;AI5D+U;;;EAAqB,mBAAA;AJiEpW;AIjEuX;;EAAU,YAAA;EAAY,eAAA;AJsE7Y;AItE4Z;EAAO,SAAA;AJyEna;AIzE4a;EAAM,yBAAA;EAAyB,iBAAA;AJ6E3c;AI7E4d;;EAAM,UAAA;AJiFle;AIjF4e;;EAAgC,gBAAA;AJqF5gB\\",\\"file\\":\\"index-da8d7528.css\\",\\"sourcesContent\\":[\\".d {\\\\n color: red;\\\\n}\\\\n\\",\\".a {\\\\n color: @color;\\\\n}\\\\n\\\\n@import \\\\\\"partial\\\\\\";\\\\n\\",\\"@import \\\\\\"~foo/bar/a\\\\\\";\\\\n@import \\\\\\"~foo/bar/b\\\\\\";\\\\n@import \\\\\\"~foo/bar/c\\\\\\";\\\\n@import \\\\\\"foo/bar/d.css\\\\\\";\\\\n@import \\\\\\"~foo/bar/partial\\\\\\";\\\\n@import \\\\\\"foo.less\\\\\\";\\\\n@import \\\\\\"~minireset.css/minireset.min\\\\\\";\\\\n\\",\\".b {\\\\n color: red;\\\\n}\\\\n\\",\\".c {\\\\n color: red;\\\\n}\\\\n\\",\\"@import \\\\\\"partial\\\\\\";\\\\n\\\\n.foo {\\\\n color: @color;\\\\n}\\\\n\\",\\"/*! minireset.css v0.0.6 | MIT License | github.com/jgthms/minireset.css */html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}ul{list-style:none}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*::before,*::after{box-sizing:inherit}img,video{height:auto;max-width:100%}iframe{border:0}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}td:not([align]),th:not([align]){text-align:left}\\\\n\\"]}"`; +exports[`less sourcemap: map 1`] = `"{\\"version\\":3,\\"sources\\":[\\"../../../../less-import/node_modules/foo/bar/d.css\\",\\"../../../../less-import/node_modules/foo/bar/a.less\\",\\"../../../../less-import/style.less\\",\\"../../../../less-import/node_modules/foo/bar/b.less\\",\\"../../../../less-import/node_modules/foo/bar/c.css\\",\\"../../../../less-import/foo.less\\",\\"../../../../../../node_modules/minireset.css/minireset.min.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,UAAU;AACZ;ACFA;EACE,gBAAA;ACEF;ACHA;EACE,UAAA;ADKF;AENA;EACE,UAAA;AFQF;AGPA;EACE,gBAAA;AHSF;AACA,0EAA0E;AIbC;;;;;;;;;;;;;;;;;;;;;;;EAAyG,SAAA;EAAS,UAAA;AJuC7L;AIvCuM;;;;;;EAAkB,eAAA;EAAe,mBAAA;AJgDxO;AIhD2P;EAAG,gBAAA;AJmD9P;AInD8Q;;;EAAoB,SAAA;AJwDlS;AIxD2S;EAAK,sBAAA;AJ2DhT;AI3DsU;;;EAAqB,mBAAA;AJgE3V;AIhE8W;;EAAU,YAAA;EAAY,eAAA;AJqEpY;AIrEmZ;EAAO,SAAA;AJwE1Z;AIxEma;EAAM,yBAAA;EAAyB,iBAAA;AJ4Elc;AI5Emd;;EAAM,UAAA;AJgFzd\\",\\"file\\":\\"index-6cea763b.css\\",\\"sourcesContent\\":[\\".d {\\\\n color: red;\\\\n}\\\\n\\",\\".a {\\\\n color: @color;\\\\n}\\\\n\\\\n@import \\\\\\"partial\\\\\\";\\\\n\\",\\"@import \\\\\\"~foo/bar/a\\\\\\";\\\\n@import \\\\\\"~foo/bar/b\\\\\\";\\\\n@import \\\\\\"~foo/bar/c\\\\\\";\\\\n@import \\\\\\"foo/bar/d.css\\\\\\";\\\\n@import \\\\\\"~foo/bar/partial\\\\\\";\\\\n@import \\\\\\"foo.less\\\\\\";\\\\n@import \\\\\\"~minireset.css/minireset.min\\\\\\";\\\\n\\",\\".b {\\\\n color: red;\\\\n}\\\\n\\",\\".c {\\\\n color: red;\\\\n}\\\\n\\",\\"@import \\\\\\"partial\\\\\\";\\\\n\\\\n.foo {\\\\n color: @color;\\\\n}\\\\n\\",\\"/*! minireset.css v0.0.7 | MIT License | github.com/jgthms/minireset.css */html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}ul{list-style:none}button,input,select{margin:0}html{box-sizing:border-box}*,*::before,*::after{box-sizing:inherit}img,video{height:auto;max-width:100%}iframe{border:0}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}\\\\n\\"]}"`; exports[`minimize extract: css 1`] = `".bar,.foo,.stylus{color:red}.stylus{background:red}.pcss,.sass{color:red}.sass{width:30%}.less{color:#6c94be}"`; @@ -4510,7 +4505,7 @@ function injector_f31f2858 (css, options) { } } -var css = \\".a {\\\\n color: magenta; }\\\\n\\\\n.b {\\\\n color: red; }\\\\n\\\\n.c {\\\\n color: red; }\\\\n\\\\n.foo {\\\\n color: royalblue; }\\\\n\\\\n/*! minireset.css v0.0.6 | MIT License | github.com/jgthms/minireset.css */\\\\nhtml, body, p, ol, ul, li, dl, dt, dd, blockquote, figure, fieldset, legend, textarea, pre, iframe, hr, h1, h2, h3, h4, h5, h6 {\\\\n margin: 0;\\\\n padding: 0; }\\\\n\\\\nh1, h2, h3, h4, h5, h6 {\\\\n font-size: 100%;\\\\n font-weight: normal; }\\\\n\\\\nul {\\\\n list-style: none; }\\\\n\\\\nbutton, input, select, textarea {\\\\n margin: 0; }\\\\n\\\\nhtml {\\\\n box-sizing: border-box; }\\\\n\\\\n*, *::before, *::after {\\\\n box-sizing: inherit; }\\\\n\\\\nimg, video {\\\\n height: auto;\\\\n max-width: 100%; }\\\\n\\\\niframe {\\\\n border: 0; }\\\\n\\\\ntable {\\\\n border-collapse: collapse;\\\\n border-spacing: 0; }\\\\n\\\\ntd, th {\\\\n padding: 0; }\\\\n\\\\ntd:not([align]), th:not([align]) {\\\\n text-align: left; }\\\\n\\"; +var css = \\".a {\\\\n color: magenta; }\\\\n\\\\n.b {\\\\n color: red; }\\\\n\\\\n.c {\\\\n color: red; }\\\\n\\\\n.foo {\\\\n color: royalblue; }\\\\n\\\\n/*! minireset.css v0.0.7 | MIT License | github.com/jgthms/minireset.css */\\\\nhtml, body, p, ol, ul, li, dl, dt, dd, blockquote, figure, fieldset, legend, textarea, pre, iframe, hr, h1, h2, h3, h4, h5, h6 {\\\\n margin: 0;\\\\n padding: 0; }\\\\n\\\\nh1, h2, h3, h4, h5, h6 {\\\\n font-size: 100%;\\\\n font-weight: normal; }\\\\n\\\\nul {\\\\n list-style: none; }\\\\n\\\\nbutton, input, select {\\\\n margin: 0; }\\\\n\\\\nhtml {\\\\n box-sizing: border-box; }\\\\n\\\\n*, *::before, *::after {\\\\n box-sizing: inherit; }\\\\n\\\\nimg, video {\\\\n height: auto;\\\\n max-width: 100%; }\\\\n\\\\niframe {\\\\n border: 0; }\\\\n\\\\ntable {\\\\n border-collapse: collapse;\\\\n border-spacing: 0; }\\\\n\\\\ntd, th {\\\\n padding: 0; }\\\\n\\"; injector_f31f2858(css,{}); " `; @@ -5038,7 +5033,7 @@ function injector_f31f2858 (css, options) { } } -var css = \\"/*! minireset.css v0.0.6 | MIT License | github.com/jgthms/minireset.css */\\\\nhtml, body, p, ol, ul, li, dl, dt, dd, blockquote, figure, fieldset, legend, textarea, pre, iframe, hr, h1, h2, h3, h4, h5, h6 {\\\\n margin: 0;\\\\n padding: 0;\\\\n}\\\\n\\\\nh1, h2, h3, h4, h5, h6 {\\\\n font-size: 100%;\\\\n font-weight: normal;\\\\n}\\\\n\\\\nul {\\\\n list-style: none;\\\\n}\\\\n\\\\nbutton, input, select, textarea {\\\\n margin: 0;\\\\n}\\\\n\\\\nhtml {\\\\n box-sizing: border-box;\\\\n}\\\\n\\\\n*, *::before, *::after {\\\\n box-sizing: inherit;\\\\n}\\\\n\\\\nimg, video {\\\\n height: auto;\\\\n max-width: 100%;\\\\n}\\\\n\\\\niframe {\\\\n border: 0;\\\\n}\\\\n\\\\ntable {\\\\n border-collapse: collapse;\\\\n border-spacing: 0;\\\\n}\\\\n\\\\ntd, th {\\\\n padding: 0;\\\\n}\\\\n\\\\ntd:not([align]), th:not([align]) {\\\\n text-align: left;\\\\n}\\\\n\\\\n.button {\\\\n border-radius: 3px;\\\\n padding: 8px;\\\\n}\\"; +var css = \\"/*! minireset.css v0.0.7 | MIT License | github.com/jgthms/minireset.css */\\\\nhtml, body, p, ol, ul, li, dl, dt, dd, blockquote, figure, fieldset, legend, textarea, pre, iframe, hr, h1, h2, h3, h4, h5, h6 {\\\\n margin: 0;\\\\n padding: 0;\\\\n}\\\\n\\\\nh1, h2, h3, h4, h5, h6 {\\\\n font-size: 100%;\\\\n font-weight: normal;\\\\n}\\\\n\\\\nul {\\\\n list-style: none;\\\\n}\\\\n\\\\nbutton, input, select {\\\\n margin: 0;\\\\n}\\\\n\\\\nhtml {\\\\n box-sizing: border-box;\\\\n}\\\\n\\\\n*, *::before, *::after {\\\\n box-sizing: inherit;\\\\n}\\\\n\\\\nimg, video {\\\\n height: auto;\\\\n max-width: 100%;\\\\n}\\\\n\\\\niframe {\\\\n border: 0;\\\\n}\\\\n\\\\ntable {\\\\n border-collapse: collapse;\\\\n border-spacing: 0;\\\\n}\\\\n\\\\ntd, th {\\\\n padding: 0;\\\\n}\\\\n\\\\n.button {\\\\n border-radius: 3px;\\\\n padding: 8px;\\\\n}\\"; injector_f31f2858(css,{}); " `; @@ -5665,7 +5660,7 @@ function injector_045adddd (css, options) { } } -var css = \\".a {\\\\n color: #f0f;\\\\n}\\\\n.b {\\\\n color: red;\\\\n}\\\\n.style .foo {\\\\n color: #4169e1;\\\\n}\\\\n.style .foo .inner {\\\\n color: #4169e1;\\\\n}\\\\n/*! minireset.css v0.0.6 | MIT License | github.com/jgthms/minireset.css */\\\\nhtml,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}\\\\nh1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}\\\\nul{list-style:none}\\\\nbutton,input,select,textarea{margin:0}\\\\nhtml{box-sizing:border-box}\\\\n*,*::before,*::after{box-sizing:inherit}\\\\nimg,video{height:auto;max-width:100%}\\\\niframe{border:0}\\\\ntable{border-collapse:collapse;border-spacing:0}\\\\ntd,th{padding:0}\\\\ntd:not([align]),th:not([align]){text-align:left}\\\\n\\"; +var css = \\".a {\\\\n color: #f0f;\\\\n}\\\\n.b {\\\\n color: red;\\\\n}\\\\n.style .foo {\\\\n color: #4169e1;\\\\n}\\\\n.style .foo .inner {\\\\n color: #4169e1;\\\\n}\\\\n/*! minireset.css v0.0.7 | MIT License | github.com/jgthms/minireset.css */\\\\nhtml,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}\\\\nh1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}\\\\nul{list-style:none}\\\\nbutton,input,select{margin:0}\\\\nhtml{box-sizing:border-box}\\\\n*,*::before,*::after{box-sizing:inherit}\\\\nimg,video{height:auto;max-width:100%}\\\\niframe{border:0}\\\\ntable{border-collapse:collapse;border-spacing:0}\\\\ntd,th{padding:0}\\\\n\\"; injector_045adddd(css,{}); " `; @@ -5683,20 +5678,19 @@ exports[`stylus sourcemap: css 1`] = ` .style .foo .inner { color: #4169e1; } -/*! minireset.css v0.0.6 | MIT License | github.com/jgthms/minireset.css */ +/*! minireset.css v0.0.7 | MIT License | github.com/jgthms/minireset.css */ html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0} h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal} ul{list-style:none} -button,input,select,textarea{margin:0} +button,input,select{margin:0} html{box-sizing:border-box} *,*::before,*::after{box-sizing:inherit} img,video{height:auto;max-width:100%} iframe{border:0} table{border-collapse:collapse;border-spacing:0} td,th{padding:0} -td:not([align]),th:not([align]){text-align:left} -/*# sourceMappingURL=index-192a63dc.css.map */" +/*# sourceMappingURL=index-df2f4dc0.css.map */" `; exports[`stylus sourcemap: js 1`] = ` @@ -5704,4 +5698,4 @@ exports[`stylus sourcemap: js 1`] = ` " `; -exports[`stylus sourcemap: map 1`] = `"{\\"version\\":3,\\"sources\\":[\\"../../../../stylus-import/node_modules/foo/bar/a.styl\\",\\"../../../../stylus-import/style.styl\\",\\"../../../../stylus-import/node_modules/foo/bar/b.css\\",\\"../../../../stylus-import/foo.styl\\",\\"../../../../../../node_modules/minireset.css/minireset.min.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,WAAO;ACDT;ACFA;EACE,UAAU;AACZ;ACDA;EACE,cAAO;AFIT;AEHE;EACE,cAAO;AFKX;AGTA,0EAA0E;AAAC,yGAAyG,QAAQ,CAAC,SAAS;AAAC,kBAAkB,cAAc,CAAC,kBAAkB;AAAC,GAAG,eAAe;AAAC,6BAA6B,QAAQ;AAAC,KAAK,qBAAqB;AAAC,qBAAqB,kBAAkB;AAAC,UAAU,WAAW,CAAC,cAAc;AAAC,OAAO,QAAQ;AAAC,MAAM,wBAAwB,CAAC,gBAAgB;AAAC,MAAM,SAAS;AAAC,gCAAgC,eAAe\\",\\"file\\":\\"index-192a63dc.css\\",\\"sourcesContent\\":[\\"color = magenta\\\\n\\\\n.a\\\\n color: color\\\\n\\",\\"@import \\\\\\"foo/bar/a\\\\\\"\\\\n@import \\\\\\"foo/bar/b.css\\\\\\"\\\\n\\\\n.style\\\\n @import \\\\\\"foo.styl\\\\\\"\\\\n\\\\n@import \\\\\\"minireset.css/minireset.min.css\\\\\\"\\\\n\\",\\".b {\\\\n color: red;\\\\n}\\\\n\\",\\"\\\\n.foo\\\\n color: royalblue\\\\n .inner\\\\n color: @color\\\\n\\",\\"/*! minireset.css v0.0.6 | MIT License | github.com/jgthms/minireset.css */html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}ul{list-style:none}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*::before,*::after{box-sizing:inherit}img,video{height:auto;max-width:100%}iframe{border:0}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}td:not([align]),th:not([align]){text-align:left}\\\\n\\"]}"`; +exports[`stylus sourcemap: map 1`] = `"{\\"version\\":3,\\"sources\\":[\\"../../../../stylus-import/node_modules/foo/bar/a.styl\\",\\"../../../../stylus-import/style.styl\\",\\"../../../../stylus-import/node_modules/foo/bar/b.css\\",\\"../../../../stylus-import/foo.styl\\",\\"../../../../../../node_modules/minireset.css/minireset.min.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,WAAO;ACDT;ACFA;EACE,UAAU;AACZ;ACDA;EACE,cAAO;AFIT;AEHE;EACE,cAAO;AFKX;AGTA,0EAA0E;AAAC,yGAAyG,QAAQ,CAAC,SAAS;AAAC,kBAAkB,cAAc,CAAC,kBAAkB;AAAC,GAAG,eAAe;AAAC,oBAAoB,QAAQ;AAAC,KAAK,qBAAqB;AAAC,qBAAqB,kBAAkB;AAAC,UAAU,WAAW,CAAC,cAAc;AAAC,OAAO,QAAQ;AAAC,MAAM,wBAAwB,CAAC,gBAAgB;AAAC,MAAM,SAAS\\",\\"file\\":\\"index-df2f4dc0.css\\",\\"sourcesContent\\":[\\"color = magenta\\\\n\\\\n.a\\\\n color: color\\\\n\\",\\"@import \\\\\\"foo/bar/a\\\\\\"\\\\n@import \\\\\\"foo/bar/b.css\\\\\\"\\\\n\\\\n.style\\\\n @import \\\\\\"foo.styl\\\\\\"\\\\n\\\\n@import \\\\\\"minireset.css/minireset.min.css\\\\\\"\\\\n\\",\\".b {\\\\n color: red;\\\\n}\\\\n\\",\\"\\\\n.foo\\\\n color: royalblue\\\\n .inner\\\\n color: @color\\\\n\\",\\"/*! minireset.css v0.0.7 | MIT License | github.com/jgthms/minireset.css */html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}ul{list-style:none}button,input,select{margin:0}html{box-sizing:border-box}*,*::before,*::after{box-sizing:inherit}img,video{height:auto;max-width:100%}iframe{border:0}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}\\\\n\\"]}"`; diff --git a/package.json b/package.json index 6da3e7d7..d48a4873 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "jest-circus": "^26.6.3", "less": "^4.1.0", "lint-staged": "^10.5.3", - "minireset.css": "^0.0.6", + "minireset.css": "^0.0.7", "node-sass": "^5.0.0", "postcss-custom-properties": "^11.0.0", "prettier": "^2.2.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e23c3a13..73190447 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -55,7 +55,7 @@ devDependencies: jest-circus: 26.6.3 less: 4.1.0 lint-staged: 10.5.3 - minireset.css: 0.0.6 + minireset.css: 0.0.7 node-sass: 5.0.0 postcss-custom-properties: 11.0.0_postcss@8.2.4 prettier: 2.2.1 @@ -1149,7 +1149,7 @@ packages: dependencies: '@commitlint/top-level': 11.0.0 fs-extra: 9.1.0 - git-raw-commits: 2.0.9 + git-raw-commits: 2.0.10 dev: true engines: node: '>=v10.22.0' @@ -1440,7 +1440,7 @@ packages: integrity: sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow== /@octokit/auth-token/2.4.5: dependencies: - '@octokit/types': 6.5.3 + '@octokit/types': 6.6.0 dev: true resolution: integrity: sha512-BpGYsPgJt05M7/L/5FoE1PiAbdxXFZkX/3kDYcsvd1v6UhlnE5e96dTDr0ezX/EFwciQxf3cNV0loipsURU+WA== @@ -1449,7 +1449,7 @@ packages: '@octokit/auth-token': 2.4.5 '@octokit/graphql': 4.5.9 '@octokit/request': 5.4.13 - '@octokit/types': 6.5.3 + '@octokit/types': 6.6.0 before-after-hook: 2.1.0 universal-user-agent: 6.0.0 dev: true @@ -1457,7 +1457,7 @@ packages: integrity: sha512-+DCtPykGnvXKWWQI0E1XD+CCeWSBhB6kwItXqfFmNBlIlhczuDPbg+P6BtLnVBaRJDAjv+1mrUJuRsFSjktopg== /@octokit/endpoint/6.0.11: dependencies: - '@octokit/types': 6.5.3 + '@octokit/types': 6.6.0 is-plain-object: 5.0.0 universal-user-agent: 6.0.0 dev: true @@ -1466,24 +1466,24 @@ packages: /@octokit/graphql/4.5.9: dependencies: '@octokit/request': 5.4.13 - '@octokit/types': 6.5.3 + '@octokit/types': 6.6.0 universal-user-agent: 6.0.0 dev: true resolution: integrity: sha512-c+0yofIugUNqo+ktrLaBlWSbjSq/UF8ChAyxQzbD3X74k1vAuyLKdDJmPwVExUFSp6+U1FzWe+3OkeRsIqV0vg== - /@octokit/openapi-types/3.2.1: + /@octokit/openapi-types/3.3.0: dev: true resolution: - integrity: sha512-OOXW6e+vSIpA63Zp5Q+hio3tnQsWFnn9xx1xco0arjTOBcKW/NwFsmhpmj4Yt5IddUS1V7PVGSfRRDO5qZhEqQ== - /@octokit/plugin-paginate-rest/2.8.4_@octokit+core@3.2.5: + integrity: sha512-s3dd32gagPmKaSLNJ9aPNok7U+tl69YLESf6DgQz5Ml/iipPZtif3GLvWpNXoA6qspFm1LFUZX+C3SqWX/Y/TQ== + /@octokit/plugin-paginate-rest/2.9.0_@octokit+core@3.2.5: dependencies: '@octokit/core': 3.2.5 - '@octokit/types': 6.5.3 + '@octokit/types': 6.6.0 dev: true peerDependencies: '@octokit/core': '>=2' resolution: - integrity: sha512-4JD7Chzs4k7Z9asxLoagwwP1md5cS5AiPbnHCRuiN/W8Jwe8a/ZNxZi5Ipb4D/lkr3qQNRcCEsjXldNH8Y8J/w== + integrity: sha512-XxbOg45r2n/2QpU6hnGDxQNDRrJ7gjYpMXeDbUCigWTHECmjoyFLizkFO2jMEtidMkfiELn7AF8GBAJ/cbPTnA== /@octokit/plugin-request-log/1.0.3_@octokit+core@3.2.5: dependencies: '@octokit/core': 3.2.5 @@ -1495,7 +1495,7 @@ packages: /@octokit/plugin-rest-endpoint-methods/4.8.0_@octokit+core@3.2.5: dependencies: '@octokit/core': 3.2.5 - '@octokit/types': 6.5.3 + '@octokit/types': 6.6.0 deprecation: 2.3.1 dev: true peerDependencies: @@ -1504,7 +1504,7 @@ packages: integrity: sha512-2zRpXDveJH8HsXkeeMtRW21do8wuSxVn1xXFdvhILyxlLWqGQrdJUA1/dk5DM7iAAYvwT/P3bDOLs90yL4S2AA== /@octokit/request-error/2.0.5: dependencies: - '@octokit/types': 6.5.3 + '@octokit/types': 6.6.0 deprecation: 2.3.1 once: 1.4.0 dev: true @@ -1514,7 +1514,7 @@ packages: dependencies: '@octokit/endpoint': 6.0.11 '@octokit/request-error': 2.0.5 - '@octokit/types': 6.5.3 + '@octokit/types': 6.6.0 deprecation: 2.3.1 is-plain-object: 5.0.0 node-fetch: 2.6.1 @@ -1526,19 +1526,19 @@ packages: /@octokit/rest/18.0.15: dependencies: '@octokit/core': 3.2.5 - '@octokit/plugin-paginate-rest': 2.8.4_@octokit+core@3.2.5 + '@octokit/plugin-paginate-rest': 2.9.0_@octokit+core@3.2.5 '@octokit/plugin-request-log': 1.0.3_@octokit+core@3.2.5 '@octokit/plugin-rest-endpoint-methods': 4.8.0_@octokit+core@3.2.5 dev: true resolution: integrity: sha512-MBlZl0KeuvFMJ3210hG5xhh/jtYmMDLd5WmO49Wg4Rfg0odeivntWAyq3KofJDP2G8jskCaaOaZBKo0TeO9tFA== - /@octokit/types/6.5.3: + /@octokit/types/6.6.0: dependencies: - '@octokit/openapi-types': 3.2.1 + '@octokit/openapi-types': 3.3.0 '@types/node': 14.14.22 dev: true resolution: - integrity: sha512-kKefDpNiYXQoZvvbDxgdTDKn1pzopxyn9W/7nkIxNaiRC20jKDEC8vVT8GN6R8eTz8pImz2198jCXTgEMck+sA== + integrity: sha512-nmFoU3HCbw1AmnZU/eto2VvzV06+N7oAqXwMmAHGlNDF+KFykksh/VlAl85xc1P5T7Mw8fKYvXNaImNHCCH/rg== /@rollup/plugin-babel/5.2.2_ef0fb8bb075dad5ddd10a028b31f2344: dependencies: '@babel/core': 7.12.10 @@ -2366,7 +2366,7 @@ packages: /autoprefixer/10.2.3_postcss@8.2.4: dependencies: browserslist: 4.16.1 - caniuse-lite: 1.0.30001179 + caniuse-lite: 1.0.30001180 colorette: 1.2.1 fraction.js: 4.0.13 normalize-range: 0.1.2 @@ -2578,9 +2578,9 @@ packages: integrity: sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== /browserslist/4.16.1: dependencies: - caniuse-lite: 1.0.30001179 + caniuse-lite: 1.0.30001180 colorette: 1.2.1 - electron-to-chromium: 1.3.645 + electron-to-chromium: 1.3.647 escalade: 3.1.1 node-releases: 1.1.70 engines: @@ -2701,15 +2701,15 @@ packages: /caniuse-api/3.0.0: dependencies: browserslist: 4.16.1 - caniuse-lite: 1.0.30001179 + caniuse-lite: 1.0.30001180 lodash.memoize: 4.1.2 lodash.uniq: 4.5.0 dev: false resolution: integrity: sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw== - /caniuse-lite/1.0.30001179: + /caniuse-lite/1.0.30001180: resolution: - integrity: sha512-blMmO0QQujuUWZKyVrD1msR4WNDAqb/UPO1Sw2WWsQ7deoM5bJiicKnWJ1Y0NS/aGINSnKPIWBMw5luX+NDUCA== + integrity: sha512-n8JVqXuZMVSPKiPiypjFtDTXc4jWIdjxull0f92WLo7e1MSi3uJ3NvveakSh/aCl1QKFAvIz3vIj0v+0K+FrXw== /capture-exit/2.0.0: dependencies: rsvp: 4.8.5 @@ -3583,9 +3583,9 @@ packages: dev: true resolution: integrity: sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= - /electron-to-chromium/1.3.645: + /electron-to-chromium/1.3.647: resolution: - integrity: sha512-T7mYop3aDpRHIQaUYcmzmh6j9MAe560n6ukqjJMbVC6bVTau7dSpvB18bcsBPPtOSe10cKxhJFtlbEzLa0LL1g== + integrity: sha512-Or2Nu8TjkmSywY9hk85K/Y6il28hchlonITz30fkC87qvSNupQl29O12BzDDDTnUFlo6kEIFL2QGSpkZDMxH8g== /email-addresses/3.1.0: dev: true resolution: @@ -4526,10 +4526,10 @@ packages: dev: true resolution: integrity: sha1-LmpMGxP8AAKCB7p5WnrDFme5/Uo= - /git-raw-commits/2.0.9: + /git-raw-commits/2.0.10: dependencies: dargs: 7.0.0 - lodash.template: 4.5.0 + lodash: 4.17.20 meow: 8.1.2 split2: 3.2.2 through2: 4.0.2 @@ -4538,7 +4538,7 @@ packages: node: '>=10' hasBin: true resolution: - integrity: sha512-hSpNpxprVno7IOd4PZ93RQ+gNdzPAIrW0x8av6JQDJGV4k1mR9fE01dl8sEqi2P7aKmmwiGUn1BCPuf16Ae0Qw== + integrity: sha512-sHhX5lsbG9SOO6yXdlwgEMQ/ljIn7qMpAbJZCGfXX2fq5T8M5SrDnpYk9/4HswTildcIqatsWa91vty6VhWSaQ== /glob-parent/5.1.1: dependencies: is-glob: 4.0.1 @@ -6219,10 +6219,6 @@ packages: node: '>=10' resolution: integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== - /lodash._reinterpolate/3.0.0: - dev: true - resolution: - integrity: sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= /lodash.capitalize/4.2.1: dev: true resolution: @@ -6250,19 +6246,6 @@ packages: dev: true resolution: integrity: sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= - /lodash.template/4.5.0: - dependencies: - lodash._reinterpolate: 3.0.0 - lodash.templatesettings: 4.2.0 - dev: true - resolution: - integrity: sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A== - /lodash.templatesettings/4.2.0: - dependencies: - lodash._reinterpolate: 3.0.0 - dev: true - resolution: - integrity: sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ== /lodash.toarray/4.4.0: dev: true resolution: @@ -6567,10 +6550,10 @@ packages: node: '>=8' resolution: integrity: sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg== - /minireset.css/0.0.6: + /minireset.css/0.0.7: dev: true resolution: - integrity: sha512-aluj16Tc1KhEYGDa/tedYzIbZ2Ax/JR25MUQzGkqOrcw/P5OPSlwNNrlLpdULu0xFNnxu2SRHx4rKiIMq3iSTQ== + integrity: sha512-raWKK2aHP/MI4Yu72dU6hade1YFuoyDQtSUi/FiIZfeRHjgL81uN/nFvG2aoAr+mseRc3jpg47jQqx1/+6w+kQ== /minizlib/2.1.2: dependencies: minipass: 3.1.3 @@ -10206,7 +10189,7 @@ specifiers: less: ^4.1.0 lint-staged: ^10.5.3 mime-types: ^2.1.28 - minireset.css: ^0.0.6 + minireset.css: ^0.0.7 node-sass: ^5.0.0 p-queue: ^6.6.2 postcss: ^8.2.4 diff --git a/src/index.ts b/src/index.ts index 410390b3..04c47fbb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -202,29 +202,29 @@ export default (options: Options = {}): Plugin => { }; const getImports = (chunk: OutputChunk): string[] => { - const ordered: string[] = []; + const ids: string[] = []; for (const module of Object.keys(chunk.modules)) { const traversed: string[] = []; - let ids = [module]; + let current = [module]; do { const imports: string[] = []; - for (const id of ids) { - if (traversed.includes(id) || !isIncluded(id)) continue; + for (const id of current) { + if (traversed.includes(id)) continue; if (loaders.isSupported(id)) { - imports.push(id); + if (isIncluded(id)) imports.push(id); continue; } traversed.push(id); const i = this.getModuleInfo(id); i && imports.push(...i.importedIds); } - ids = imports; - } while (ids.some(id => !loaders.isSupported(id))); - ordered.push(...ids); + current = imports; + } while (current.some(id => !loaders.isSupported(id))); + ids.push(...current); } - return ordered; + return ids; }; const moved: string[] = [];