From 8486a4fd7230725b6af4c01be2781a21058516ce Mon Sep 17 00:00:00 2001 From: cap-Bernardito Date: Wed, 8 Apr 2020 12:22:18 +0300 Subject: [PATCH 01/11] test: contenthash is not changed on different operating systems --- src/index.js | 3 +- test/__snapshots__/loader.test.js.snap | 24 ++ test/fixtures/contenthash/basic-css.js | 5 + test/fixtures/contenthash/basic-postcss.js | 5 + test/fixtures/contenthash/basic-sass.js | 5 + test/fixtures/contenthash/basic.css | 3 + test/fixtures/contenthash/basic.postcss.css | 7 + test/fixtures/contenthash/basic.scss | 9 + test/loader.test.js | 296 ++++++++++++++++++++ 9 files changed, 355 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/contenthash/basic-css.js create mode 100644 test/fixtures/contenthash/basic-postcss.js create mode 100644 test/fixtures/contenthash/basic-sass.js create mode 100644 test/fixtures/contenthash/basic.css create mode 100644 test/fixtures/contenthash/basic.postcss.css create mode 100644 test/fixtures/contenthash/basic.scss diff --git a/src/index.js b/src/index.js index 2ee1b781..28cee5f1 100644 --- a/src/index.js +++ b/src/index.js @@ -19,7 +19,6 @@ import { getImportCode, getModuleCode, getModulesPlugins, - normalizeSourceMap, shouldUseModulesPlugins, } from './utils'; @@ -87,7 +86,7 @@ export default function loader(content, map, meta) { map: options.sourceMap ? { // Some loaders (example `"postcss-loader": "1.x.x"`) always generates source map, we should remove it - prev: sourceMap && map ? normalizeSourceMap(map) : null, + prev: sourceMap && map ? map : null, inline: false, annotation: false, } diff --git a/test/__snapshots__/loader.test.js.snap b/test/__snapshots__/loader.test.js.snap index d5d503eb..7ff60d13 100644 --- a/test/__snapshots__/loader.test.js.snap +++ b/test/__snapshots__/loader.test.js.snap @@ -37,6 +37,30 @@ exports[`loader issue #1033: result 1`] = `Object {}`; exports[`loader issue #1033: warnings 1`] = `Array []`; +exports[`loader should have same "contenthash" with "css-loader" and with source maps: errors 1`] = `Array []`; + +exports[`loader should have same "contenthash" with "css-loader" and with source maps: warnings 1`] = `Array []`; + +exports[`loader should have same "contenthash" with "css-loader" and without source maps: errors 1`] = `Array []`; + +exports[`loader should have same "contenthash" with "css-loader" and without source maps: warnings 1`] = `Array []`; + +exports[`loader should have same "contenthash" with "postcss-loader" and with source maps: errors 1`] = `Array []`; + +exports[`loader should have same "contenthash" with "postcss-loader" and with source maps: warnings 1`] = `Array []`; + +exports[`loader should have same "contenthash" with "postcss-loader" and without source maps: errors 1`] = `Array []`; + +exports[`loader should have same "contenthash" with "postcss-loader" and without source maps: warnings 1`] = `Array []`; + +exports[`loader should have same "contenthash" with "sass-loader" and with source maps: errors 1`] = `Array []`; + +exports[`loader should have same "contenthash" with "sass-loader" and with source maps: warnings 1`] = `Array []`; + +exports[`loader should have same "contenthash" with "sass-loader" and without source maps: errors 1`] = `Array []`; + +exports[`loader should have same "contenthash" with "sass-loader" and without source maps: warnings 1`] = `Array []`; + exports[`loader should reuse \`ast\` from "postcss-loader": errors 1`] = `Array []`; exports[`loader should reuse \`ast\` from "postcss-loader": module 1`] = ` diff --git a/test/fixtures/contenthash/basic-css.js b/test/fixtures/contenthash/basic-css.js new file mode 100644 index 00000000..72afb950 --- /dev/null +++ b/test/fixtures/contenthash/basic-css.js @@ -0,0 +1,5 @@ +import css from './basic.css'; + +__export__ = css; + +export default css; diff --git a/test/fixtures/contenthash/basic-postcss.js b/test/fixtures/contenthash/basic-postcss.js new file mode 100644 index 00000000..ff2b03ea --- /dev/null +++ b/test/fixtures/contenthash/basic-postcss.js @@ -0,0 +1,5 @@ +import css from './basic.postcss.css'; + +__export__ = css; + +export default css; diff --git a/test/fixtures/contenthash/basic-sass.js b/test/fixtures/contenthash/basic-sass.js new file mode 100644 index 00000000..68ce09f0 --- /dev/null +++ b/test/fixtures/contenthash/basic-sass.js @@ -0,0 +1,5 @@ +import css from './basic.scss'; + +__export__ = css; + +export default css; diff --git a/test/fixtures/contenthash/basic.css b/test/fixtures/contenthash/basic.css new file mode 100644 index 00000000..fdece7b4 --- /dev/null +++ b/test/fixtures/contenthash/basic.css @@ -0,0 +1,3 @@ +a { + color: red; +} diff --git a/test/fixtures/contenthash/basic.postcss.css b/test/fixtures/contenthash/basic.postcss.css new file mode 100644 index 00000000..ba8f6ef7 --- /dev/null +++ b/test/fixtures/contenthash/basic.postcss.css @@ -0,0 +1,7 @@ +a { + color: rgb(0 0 100% / 90%); + +&:hover { + color: rebeccapurple; + } +} diff --git a/test/fixtures/contenthash/basic.scss b/test/fixtures/contenthash/basic.scss new file mode 100644 index 00000000..ae47c032 --- /dev/null +++ b/test/fixtures/contenthash/basic.scss @@ -0,0 +1,9 @@ +$var: red; + +a { + color: $var; + + &:hover { + color: $var; + } +} diff --git a/test/loader.test.js b/test/loader.test.js index ccaee08c..a8cc8849 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -406,4 +406,300 @@ describe('loader', () => { expect(getWarnings(stats)).toMatchSnapshot('warnings'); expect(getErrors(stats)).toMatchSnapshot('errors'); }); + + it('should have same "contenthash" with "css-loader" and without source maps', async () => { + const compiler = getCompiler( + './contenthash/basic-css.js', + {}, + { + output: { + path: path.resolve(__dirname, '../outputs'), + filename: '[name].[contenthash].bundle.js', + chunkFilename: '[name].[contenthash].chunk.js', + publicPath: '/webpack/public/path/', + }, + module: { + rules: [ + { + test: /\.css$/i, + rules: [ + { + loader: path.resolve(__dirname, '../src'), + options: { sourceMap: false }, + }, + ], + }, + ], + }, + } + ); + const stats = await compile(compiler); + const isWebpack5 = version[0] === '5'; + + expect( + stats.compilation.assets[ + isWebpack5 + ? 'main.fd612b1d69f7c1e6ba5f.bundle.js' + : 'main.7d23eae418a6571797ac.bundle.js' + ] + ).toBeDefined(); + expect(getWarnings(stats)).toMatchSnapshot('warnings'); + expect(getErrors(stats)).toMatchSnapshot('errors'); + }); + + it('should have same "contenthash" with "css-loader" and with source maps', async () => { + const compiler = getCompiler( + './contenthash/basic-css.js', + {}, + { + output: { + path: path.resolve(__dirname, '../outputs'), + filename: '[name].[contenthash].bundle.js', + chunkFilename: '[name].[contenthash].chunk.js', + publicPath: '/webpack/public/path/', + }, + module: { + rules: [ + { + test: /\.css$/i, + rules: [ + { + loader: path.resolve(__dirname, '../src'), + options: { sourceMap: true }, + }, + ], + }, + ], + }, + } + ); + const stats = await compile(compiler); + const isWebpack5 = version[0] === '5'; + + expect( + stats.compilation.assets[ + isWebpack5 + ? 'main.4e80ca040390d63ea450.bundle.js' + : 'main.5cb87cbcc122bf7fffd7.bundle.js' + ] + ).toBeDefined(); + expect(getWarnings(stats)).toMatchSnapshot('warnings'); + expect(getErrors(stats)).toMatchSnapshot('errors'); + }); + + it('should have same "contenthash" with "postcss-loader" and without source maps', async () => { + const compiler = getCompiler( + './contenthash/basic-postcss.js', + {}, + { + output: { + path: path.resolve(__dirname, '../outputs'), + filename: '[name].[contenthash].bundle.js', + chunkFilename: '[name].[contenthash].chunk.js', + publicPath: '/webpack/public/path/', + }, + module: { + rules: [ + { + test: /\.css$/i, + rules: [ + { + loader: path.resolve(__dirname, '../src'), + options: { + sourceMap: false, + importLoaders: 1, + }, + }, + { + loader: 'postcss-loader', + options: { + plugins: () => [postcssPresetEnv({ stage: 0 })], + sourceMap: false, + }, + }, + ], + }, + ], + }, + } + ); + const stats = await compile(compiler); + const isWebpack5 = version[0] === '5'; + + expect( + stats.compilation.assets[ + isWebpack5 + ? 'main.47a6533d9b651ffbecad.bundle.js' + : 'main.f5cb4d0dd19d4911e054.bundle.js' + ] + ).toBeDefined(); + expect(getWarnings(stats)).toMatchSnapshot('warnings'); + expect(getErrors(stats)).toMatchSnapshot('errors'); + }); + + it('should have same "contenthash" with "postcss-loader" and with source maps', async () => { + const compiler = getCompiler( + './contenthash/basic-postcss.js', + {}, + { + output: { + path: path.resolve(__dirname, '../outputs'), + filename: '[name].[contenthash].bundle.js', + chunkFilename: '[name].[contenthash].chunk.js', + publicPath: '/webpack/public/path/', + }, + module: { + rules: [ + { + test: /\.css$/i, + rules: [ + { + loader: path.resolve(__dirname, '../src'), + options: { + sourceMap: true, + importLoaders: 1, + }, + }, + { + loader: 'postcss-loader', + options: { + plugins: () => [postcssPresetEnv({ stage: 0 })], + sourceMap: true, + }, + }, + ], + }, + ], + }, + } + ); + const stats = await compile(compiler); + const isWebpack5 = version[0] === '5'; + + expect( + stats.compilation.assets[ + isWebpack5 + ? 'main.0a16c4c25cba08ab696a.bundle.js' + : 'main.6668dc2ef887b6b04748.bundle.js' + ] + ).toBeDefined(); + expect(getWarnings(stats)).toMatchSnapshot('warnings'); + expect(getErrors(stats)).toMatchSnapshot('errors'); + }); + + it('should have same "contenthash" with "sass-loader" and without source maps', async () => { + const compiler = getCompiler( + './contenthash/basic-sass.js', + {}, + { + output: { + path: path.resolve(__dirname, '../outputs'), + filename: '[name].[contenthash].bundle.js', + chunkFilename: '[name].[contenthash].chunk.js', + publicPath: '/webpack/public/path/', + }, + module: { + rules: [ + { + test: /\.s[ca]ss$/i, + rules: [ + { + loader: path.resolve(__dirname, '../src'), + options: { + sourceMap: false, + importLoaders: 1, + }, + }, + { + loader: 'postcss-loader', + options: { + plugins: () => [postcssPresetEnv({ stage: 0 })], + sourceMap: false, + }, + }, + { + loader: 'sass-loader', + options: { + // eslint-disable-next-line global-require + implementation: require('sass'), + sourceMap: false, + }, + }, + ], + }, + ], + }, + } + ); + const stats = await compile(compiler); + const isWebpack5 = version[0] === '5'; + + expect( + stats.compilation.assets[ + isWebpack5 + ? 'main.f3d743a96cdd6e368436.bundle.js' + : 'main.8a3656011c59a5950f16.bundle.js' + ] + ).toBeDefined(); + expect(getWarnings(stats)).toMatchSnapshot('warnings'); + expect(getErrors(stats)).toMatchSnapshot('errors'); + }); + + it('should have same "contenthash" with "sass-loader" and with source maps', async () => { + const compiler = getCompiler( + './contenthash/basic-sass.js', + {}, + { + output: { + path: path.resolve(__dirname, '../outputs'), + filename: '[name].[contenthash].bundle.js', + chunkFilename: '[name].[contenthash].chunk.js', + publicPath: '/webpack/public/path/', + }, + module: { + rules: [ + { + test: /\.s[ca]ss$/i, + rules: [ + { + loader: path.resolve(__dirname, '../src'), + options: { + sourceMap: true, + importLoaders: 1, + }, + }, + { + loader: 'postcss-loader', + options: { + plugins: () => [postcssPresetEnv({ stage: 0 })], + sourceMap: true, + }, + }, + { + loader: 'sass-loader', + options: { + // eslint-disable-next-line global-require + implementation: require('sass'), + sourceMap: true, + }, + }, + ], + }, + ], + }, + } + ); + const stats = await compile(compiler); + const isWebpack5 = version[0] === '5'; + + expect( + stats.compilation.assets[ + isWebpack5 + ? 'main.021e49d811fb525fefec.bundle.js' + : 'main.4d3725d232198f3e836e.bundle.js' + ] + ).toBeDefined(); + expect(getWarnings(stats)).toMatchSnapshot('warnings'); + expect(getErrors(stats)).toMatchSnapshot('errors'); + }); }); From 2ebf2ec513eacf445487faa3dae18efb4cf60ce4 Mon Sep 17 00:00:00 2001 From: cap-Bernardito Date: Wed, 8 Apr 2020 13:35:23 +0300 Subject: [PATCH 02/11] test: contenthash should not changed on different operating systems --- test/__snapshots__/loader.test.js.snap | 111 +++++++++++++++++++++++++ test/loader.test.js | 81 ++++++------------ 2 files changed, 138 insertions(+), 54 deletions(-) diff --git a/test/__snapshots__/loader.test.js.snap b/test/__snapshots__/loader.test.js.snap index 7ff60d13..9b45e7c0 100644 --- a/test/__snapshots__/loader.test.js.snap +++ b/test/__snapshots__/loader.test.js.snap @@ -39,26 +39,137 @@ exports[`loader issue #1033: warnings 1`] = `Array []`; exports[`loader should have same "contenthash" with "css-loader" and with source maps: errors 1`] = `Array []`; +exports[`loader should have same "contenthash" with "css-loader" and with source maps: module 1`] = ` +"// Imports +var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); +var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ident]!./nested/nested.css\\"); +exports = ___CSS_LOADER_API_IMPORT___(true); +exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); +// Module +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +// Exports +module.exports = exports; +" +`; + exports[`loader should have same "contenthash" with "css-loader" and with source maps: warnings 1`] = `Array []`; exports[`loader should have same "contenthash" with "css-loader" and without source maps: errors 1`] = `Array []`; +exports[`loader should have same "contenthash" with "css-loader" and without source maps: module 1`] = ` +"// Imports +var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); +var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ident]!./nested/nested.css\\"); +exports = ___CSS_LOADER_API_IMPORT___(false); +exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); +// Module +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\"]); +// Exports +module.exports = exports; +" +`; + exports[`loader should have same "contenthash" with "css-loader" and without source maps: warnings 1`] = `Array []`; exports[`loader should have same "contenthash" with "postcss-loader" and with source maps: errors 1`] = `Array []`; +exports[`loader should have same "contenthash" with "postcss-loader" and with source maps: module 1`] = ` +"// Imports +var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); +var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ident]!./nested/nested.postcss.css\\"); +exports = ___CSS_LOADER_API_IMPORT___(true); +exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); +// Module +exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"file\\":\\"basic.postcss.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"]}]); +// Exports +module.exports = exports; +" +`; + exports[`loader should have same "contenthash" with "postcss-loader" and with source maps: warnings 1`] = `Array []`; exports[`loader should have same "contenthash" with "postcss-loader" and without source maps: errors 1`] = `Array []`; +exports[`loader should have same "contenthash" with "postcss-loader" and without source maps: module 1`] = ` +"// Imports +var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); +var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ident]!./nested/nested.postcss.css\\"); +exports = ___CSS_LOADER_API_IMPORT___(false); +exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); +// Module +exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\"]); +// Exports +module.exports = exports; +" +`; + exports[`loader should have same "contenthash" with "postcss-loader" and without source maps: warnings 1`] = `Array []`; exports[`loader should have same "contenthash" with "sass-loader" and with source maps: errors 1`] = `Array []`; +exports[`loader should have same "contenthash" with "sass-loader" and with source maps: module 1`] = ` +"// Imports +var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); +exports = ___CSS_LOADER_API_IMPORT___(true); +// Module +exports.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"/media/veracrypt1/IdeaProjects/css-loader/test/fixtures/source-map/basic.scss\\",\\"basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAGA;EACE,gCAAA;EACA,WAJc;ACEhB\\",\\"file\\":\\"basic.scss\\",\\"sourcesContent\\":[\\"$font-stack: Helvetica, sans-serif;\\\\n$primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% $font-stack;\\\\n color: $primary-color;\\\\n}\\\\n\\",\\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\"]}]); +// Exports +module.exports = exports; +" +`; + +exports[`loader should have same "contenthash" with "sass-loader" and with source maps: result 1`] = ` +Array [ + Array [ + "./source-map/basic.scss", + "body { + font: 100% Helvetica, sans-serif; + color: #333; +}", + "", + Object { + "file": "basic.scss", + "mappings": "AAGA;EACE,gCAAA;EACA,WAJc;ACEhB", + "names": Array [], + "sources": Array [ + "/media/veracrypt1/IdeaProjects/css-loader/test/fixtures/source-map/basic.scss", + "basic.scss", + ], + "sourcesContent": Array [ + "$font-stack: Helvetica, sans-serif; +$primary-color: #333; + +body { + font: 100% $font-stack; + color: $primary-color; +} +", + "body { + font: 100% Helvetica, sans-serif; + color: #333; +}", + ], + "version": 3, + }, + ], +] +`; + exports[`loader should have same "contenthash" with "sass-loader" and with source maps: warnings 1`] = `Array []`; exports[`loader should have same "contenthash" with "sass-loader" and without source maps: errors 1`] = `Array []`; +exports[`loader should have same "contenthash" with "sass-loader" and without source maps: module 1`] = ` +"// Imports +var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); +exports = ___CSS_LOADER_API_IMPORT___(false); +// Module +exports.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\"]); +// Exports +module.exports = exports; +" +`; + exports[`loader should have same "contenthash" with "sass-loader" and without source maps: warnings 1`] = `Array []`; exports[`loader should reuse \`ast\` from "postcss-loader": errors 1`] = `Array []`; diff --git a/test/loader.test.js b/test/loader.test.js index a8cc8849..5dcaa8a8 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -409,7 +409,7 @@ describe('loader', () => { it('should have same "contenthash" with "css-loader" and without source maps', async () => { const compiler = getCompiler( - './contenthash/basic-css.js', + './source-map/basic.js', {}, { output: { @@ -434,22 +434,17 @@ describe('loader', () => { } ); const stats = await compile(compiler); - const isWebpack5 = version[0] === '5'; - expect( - stats.compilation.assets[ - isWebpack5 - ? 'main.fd612b1d69f7c1e6ba5f.bundle.js' - : 'main.7d23eae418a6571797ac.bundle.js' - ] - ).toBeDefined(); + expect(getModuleSource('./source-map/basic.css', stats)).toMatchSnapshot( + 'module' + ); expect(getWarnings(stats)).toMatchSnapshot('warnings'); expect(getErrors(stats)).toMatchSnapshot('errors'); }); it('should have same "contenthash" with "css-loader" and with source maps', async () => { const compiler = getCompiler( - './contenthash/basic-css.js', + './source-map/basic.js', {}, { output: { @@ -474,22 +469,17 @@ describe('loader', () => { } ); const stats = await compile(compiler); - const isWebpack5 = version[0] === '5'; - expect( - stats.compilation.assets[ - isWebpack5 - ? 'main.4e80ca040390d63ea450.bundle.js' - : 'main.5cb87cbcc122bf7fffd7.bundle.js' - ] - ).toBeDefined(); + expect(getModuleSource('./source-map/basic.css', stats)).toMatchSnapshot( + 'module' + ); expect(getWarnings(stats)).toMatchSnapshot('warnings'); expect(getErrors(stats)).toMatchSnapshot('errors'); }); it('should have same "contenthash" with "postcss-loader" and without source maps', async () => { const compiler = getCompiler( - './contenthash/basic-postcss.js', + './source-map/basic-postcss.js', {}, { output: { @@ -524,22 +514,17 @@ describe('loader', () => { } ); const stats = await compile(compiler); - const isWebpack5 = version[0] === '5'; expect( - stats.compilation.assets[ - isWebpack5 - ? 'main.47a6533d9b651ffbecad.bundle.js' - : 'main.f5cb4d0dd19d4911e054.bundle.js' - ] - ).toBeDefined(); + getModuleSource('./source-map/basic.postcss.css', stats) + ).toMatchSnapshot('module'); expect(getWarnings(stats)).toMatchSnapshot('warnings'); expect(getErrors(stats)).toMatchSnapshot('errors'); }); it('should have same "contenthash" with "postcss-loader" and with source maps', async () => { const compiler = getCompiler( - './contenthash/basic-postcss.js', + './source-map/basic-postcss.js', {}, { output: { @@ -574,22 +559,17 @@ describe('loader', () => { } ); const stats = await compile(compiler); - const isWebpack5 = version[0] === '5'; expect( - stats.compilation.assets[ - isWebpack5 - ? 'main.0a16c4c25cba08ab696a.bundle.js' - : 'main.6668dc2ef887b6b04748.bundle.js' - ] - ).toBeDefined(); + getModuleSource('./source-map/basic.postcss.css', stats) + ).toMatchSnapshot('module'); expect(getWarnings(stats)).toMatchSnapshot('warnings'); expect(getErrors(stats)).toMatchSnapshot('errors'); }); it('should have same "contenthash" with "sass-loader" and without source maps', async () => { const compiler = getCompiler( - './contenthash/basic-sass.js', + './source-map/basic-scss.js', {}, { output: { @@ -632,28 +612,23 @@ describe('loader', () => { } ); const stats = await compile(compiler); - const isWebpack5 = version[0] === '5'; - expect( - stats.compilation.assets[ - isWebpack5 - ? 'main.f3d743a96cdd6e368436.bundle.js' - : 'main.8a3656011c59a5950f16.bundle.js' - ] - ).toBeDefined(); + expect(getModuleSource('./source-map/basic.scss', stats)).toMatchSnapshot( + 'module' + ); expect(getWarnings(stats)).toMatchSnapshot('warnings'); expect(getErrors(stats)).toMatchSnapshot('errors'); }); it('should have same "contenthash" with "sass-loader" and with source maps', async () => { const compiler = getCompiler( - './contenthash/basic-sass.js', + './source-map/basic-scss.js', {}, { output: { path: path.resolve(__dirname, '../outputs'), - filename: '[name].[contenthash].bundle.js', - chunkFilename: '[name].[contenthash].chunk.js', + filename: '[name].bundle.js', + chunkFilename: '[name].chunk.js', publicPath: '/webpack/public/path/', }, module: { @@ -690,15 +665,13 @@ describe('loader', () => { } ); const stats = await compile(compiler); - const isWebpack5 = version[0] === '5'; - expect( - stats.compilation.assets[ - isWebpack5 - ? 'main.021e49d811fb525fefec.bundle.js' - : 'main.4d3725d232198f3e836e.bundle.js' - ] - ).toBeDefined(); + expect(getModuleSource('./source-map/basic.scss', stats)).toMatchSnapshot( + 'module' + ); + expect(getExecutedCode('main.bundle.js', compiler, stats)).toMatchSnapshot( + 'result' + ); expect(getWarnings(stats)).toMatchSnapshot('warnings'); expect(getErrors(stats)).toMatchSnapshot('errors'); }); From cbbe2f6cbafb6f1006233f9f79a0cb58f70e434f Mon Sep 17 00:00:00 2001 From: cap-Bernardito Date: Wed, 8 Apr 2020 16:05:25 +0300 Subject: [PATCH 03/11] test: contenthash should not changed on different operating systems --- src/index.js | 3 ++- test/loader.test.js | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 28cee5f1..2ee1b781 100644 --- a/src/index.js +++ b/src/index.js @@ -19,6 +19,7 @@ import { getImportCode, getModuleCode, getModulesPlugins, + normalizeSourceMap, shouldUseModulesPlugins, } from './utils'; @@ -86,7 +87,7 @@ export default function loader(content, map, meta) { map: options.sourceMap ? { // Some loaders (example `"postcss-loader": "1.x.x"`) always generates source map, we should remove it - prev: sourceMap && map ? map : null, + prev: sourceMap && map ? normalizeSourceMap(map) : null, inline: false, annotation: false, } diff --git a/test/loader.test.js b/test/loader.test.js index 5dcaa8a8..21bca292 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -542,7 +542,6 @@ describe('loader', () => { loader: path.resolve(__dirname, '../src'), options: { sourceMap: true, - importLoaders: 1, }, }, { @@ -587,7 +586,6 @@ describe('loader', () => { loader: path.resolve(__dirname, '../src'), options: { sourceMap: false, - importLoaders: 1, }, }, { From 3a7e7d6e4e2518f3923447e8204705e8022c0064 Mon Sep 17 00:00:00 2001 From: cap-Bernardito Date: Thu, 9 Apr 2020 18:01:18 +0300 Subject: [PATCH 04/11] test: normalize sourceMaps on different operating systems --- src/index.js | 3 +-- src/utils.js | 13 ++++--------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/index.js b/src/index.js index 2ee1b781..28cee5f1 100644 --- a/src/index.js +++ b/src/index.js @@ -19,7 +19,6 @@ import { getImportCode, getModuleCode, getModulesPlugins, - normalizeSourceMap, shouldUseModulesPlugins, } from './utils'; @@ -87,7 +86,7 @@ export default function loader(content, map, meta) { map: options.sourceMap ? { // Some loaders (example `"postcss-loader": "1.x.x"`) always generates source map, we should remove it - prev: sourceMap && map ? normalizeSourceMap(map) : null, + prev: sourceMap && map ? map : null, inline: false, annotation: false, } diff --git a/src/utils.js b/src/utils.js index 45e8f7a9..e4afa0d3 100644 --- a/src/utils.js +++ b/src/utils.js @@ -190,13 +190,7 @@ function getModulesPlugins(options, loaderContext) { } function normalizeSourceMap(map) { - let newMap = map; - - // Some loader emit source map as string - // Strip any JSON XSSI avoidance prefix from the string (as documented in the source maps specification), and then parse the string as JSON. - if (typeof newMap === 'string') { - newMap = JSON.parse(newMap); - } + const newMap = map.toJSON(); // Source maps should use forward slash because it is URLs (https://github.com/mozilla/source-map/issues/91) // We should normalize path because previous loaders like `sass-loader` using backslash when generate source map @@ -213,7 +207,7 @@ function normalizeSourceMap(map) { newMap.sources = newMap.sources.map((source) => normalizePath(source)); } - return newMap; + return JSON.stringify(newMap); } function getPreRequester({ loaders, loaderIndex }) { @@ -281,7 +275,8 @@ function getModuleCode( } const { css, map } = result; - const sourceMapValue = sourceMap && map ? `,${map}` : ''; + + const sourceMapValue = sourceMap && map ? `,${normalizeSourceMap(map)}` : ''; let code = JSON.stringify(css); let beforeCode = ''; From 6ab147d2dc2939a1cd46d0931f48b2f13805f545 Mon Sep 17 00:00:00 2001 From: cap-Bernardito Date: Fri, 10 Apr 2020 17:10:17 +0300 Subject: [PATCH 05/11] test: normalize sourceMaps on different operating systems --- package-lock.json | 68 ++ package.json | 1 + src/index.js | 3 +- src/utils.js | 74 +- test/__snapshots__/loader.test.js.snap | 135 ---- .../sourceMap-option.test.js.snap | 704 +++++++++++++++++- test/fixtures/contenthash/basic-css.js | 5 - test/fixtures/contenthash/basic-postcss.js | 5 - test/fixtures/contenthash/basic-sass.js | 5 - test/fixtures/contenthash/basic.css | 3 - test/fixtures/contenthash/basic.postcss.css | 7 - test/fixtures/contenthash/basic.scss | 9 - test/fixtures/source-map/basic.scss | 2 + test/fixtures/source-map/nested/nested.scss | 3 + test/loader.test.js | 267 ------- test/sourceMap-option.test.js | 432 +++++++++++ 16 files changed, 1279 insertions(+), 444 deletions(-) delete mode 100644 test/fixtures/contenthash/basic-css.js delete mode 100644 test/fixtures/contenthash/basic-postcss.js delete mode 100644 test/fixtures/contenthash/basic-sass.js delete mode 100644 test/fixtures/contenthash/basic.css delete mode 100644 test/fixtures/contenthash/basic.postcss.css delete mode 100644 test/fixtures/contenthash/basic.scss create mode 100644 test/fixtures/source-map/nested/nested.scss diff --git a/package-lock.json b/package-lock.json index d228cf6e..8d7bc6c3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10706,6 +10706,31 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, + "mini-css-extract-plugin": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.9.0.tgz", + "integrity": "sha512-lp3GeY7ygcgAmVIcRPBVhIkf8Us7FZjA+ILpal44qLdSu11wmjKQ3d9k15lfD7pO4esu9eUIAW7qiYIBppv40A==", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "normalize-url": "1.9.1", + "schema-utils": "^1.0.0", + "webpack-sources": "^1.1.0" + }, + "dependencies": { + "schema-utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", + "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + } + } + }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -11069,6 +11094,18 @@ "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", "dev": true }, + "normalize-url": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-1.9.1.tgz", + "integrity": "sha1-LMDWazHqIwNkWENuNiDYWVTGbDw=", + "dev": true, + "requires": { + "object-assign": "^4.0.1", + "prepend-http": "^1.0.0", + "query-string": "^4.1.0", + "sort-keys": "^1.0.0" + } + }, "npm-run-all": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz", @@ -12082,6 +12119,12 @@ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", "dev": true }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, "prettier": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.3.tgz", @@ -12282,6 +12325,16 @@ "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", "dev": true }, + "query-string": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", + "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", + "dev": true, + "requires": { + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, "querystring": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", @@ -13086,6 +13139,15 @@ } } }, + "sort-keys": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", + "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=", + "dev": true, + "requires": { + "is-plain-obj": "^1.0.0" + } + }, "source-list-map": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", @@ -13469,6 +13531,12 @@ "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==", "dev": true }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", + "dev": true + }, "string-argv": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", diff --git a/package.json b/package.json index a94fac04..c588fe3a 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "jest-junit": "^10.0.0", "lint-staged": "^10.1.2", "memfs": "^3.1.2", + "mini-css-extract-plugin": "^0.9.0", "npm-run-all": "^4.1.5", "postcss-loader": "^3.0.0", "postcss-preset-env": "^6.7.0", diff --git a/src/index.js b/src/index.js index 28cee5f1..24a2978c 100644 --- a/src/index.js +++ b/src/index.js @@ -136,7 +136,8 @@ export default function loader(content, map, meta) { apiImports, urlReplacements, icssReplacements, - esModule + esModule, + this ); const exportCode = getExportCode( exports, diff --git a/src/utils.js b/src/utils.js index e4afa0d3..b34c6db3 100644 --- a/src/utils.js +++ b/src/utils.js @@ -13,6 +13,9 @@ import extractImports from 'postcss-modules-extract-imports'; import modulesScope from 'postcss-modules-scope'; import camelCase from 'camelcase'; +const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/; +const SEGMENTS_SPLIT_REGEXP = /([|!])/; +const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g; const whitespace = '[\\x20\\t\\r\\n\\f]'; const unescapeRegExp = new RegExp( `\\\\([\\da-f]{1,6}${whitespace}?|(${whitespace})|.)`, @@ -189,7 +192,7 @@ function getModulesPlugins(options, loaderContext) { return plugins; } -function normalizeSourceMap(map) { +function normalizeSourceMap(map, loaderContext) { const newMap = map.toJSON(); // Source maps should use forward slash because it is URLs (https://github.com/mozilla/source-map/issues/91) @@ -204,10 +207,12 @@ function normalizeSourceMap(map) { } if (newMap.sources) { - newMap.sources = newMap.sources.map((source) => normalizePath(source)); + newMap.sources = newMap.sources.map((source) => + makeRelativePath(loaderContext.context, normalizePath(source)) + ); } - return JSON.stringify(newMap); + return newMap; } function getPreRequester({ loaders, loaderIndex }) { @@ -268,15 +273,18 @@ function getModuleCode( apiImports, urlReplacements, icssReplacements, - esModule + esModule, + loaderContext ) { if (exportType !== 'full') { return ''; } const { css, map } = result; - - const sourceMapValue = sourceMap && map ? `,${normalizeSourceMap(map)}` : ''; + const sourceMapValue = + sourceMap && map + ? `,${JSON.stringify(normalizeSourceMap(map, loaderContext))}` + : ''; let code = JSON.stringify(css); let beforeCode = ''; @@ -333,6 +341,60 @@ function dashesCamelCase(str) { ); } +function absoluteToRequest(context, maybeAbsolutePath) { + if (maybeAbsolutePath[0] === '/') { + if ( + maybeAbsolutePath.length > 1 && + maybeAbsolutePath[maybeAbsolutePath.length - 1] === '/' + ) { + // this 'path' is actually a regexp generated by dynamic requires. + // Don't treat it as an absolute path. + return maybeAbsolutePath; + } + + const querySplitPos = maybeAbsolutePath.indexOf('?'); + let resource = + querySplitPos === -1 + ? maybeAbsolutePath + : maybeAbsolutePath.slice(0, querySplitPos); + resource = path.posix.relative(context, resource); + if (!resource.startsWith('../')) { + resource = `./${resource}`; + } + return querySplitPos === -1 + ? resource + : resource + maybeAbsolutePath.slice(querySplitPos); + } + + if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) { + const querySplitPos = maybeAbsolutePath.indexOf('?'); + let resource = + querySplitPos === -1 + ? maybeAbsolutePath + : maybeAbsolutePath.slice(0, querySplitPos); + resource = path.win32.relative(context, resource); + if (!WINDOWS_ABS_PATH_REGEXP.test(resource)) { + resource = resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, '/'); + if (!resource.startsWith('../')) { + resource = `./${resource}`; + } + } + return querySplitPos === -1 + ? resource + : resource + maybeAbsolutePath.slice(querySplitPos); + } + + // not an absolute path + return maybeAbsolutePath; +} + +function makeRelativePath(context, identifier) { + return identifier + .split(SEGMENTS_SPLIT_REGEXP) + .map((str) => absoluteToRequest(context, str)) + .join(''); +} + function getExportCode( exports, exportType, diff --git a/test/__snapshots__/loader.test.js.snap b/test/__snapshots__/loader.test.js.snap index 9b45e7c0..d5d503eb 100644 --- a/test/__snapshots__/loader.test.js.snap +++ b/test/__snapshots__/loader.test.js.snap @@ -37,141 +37,6 @@ exports[`loader issue #1033: result 1`] = `Object {}`; exports[`loader issue #1033: warnings 1`] = `Array []`; -exports[`loader should have same "contenthash" with "css-loader" and with source maps: errors 1`] = `Array []`; - -exports[`loader should have same "contenthash" with "css-loader" and with source maps: module 1`] = ` -"// Imports -var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); -var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ident]!./nested/nested.css\\"); -exports = ___CSS_LOADER_API_IMPORT___(true); -exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); -// Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); -// Exports -module.exports = exports; -" -`; - -exports[`loader should have same "contenthash" with "css-loader" and with source maps: warnings 1`] = `Array []`; - -exports[`loader should have same "contenthash" with "css-loader" and without source maps: errors 1`] = `Array []`; - -exports[`loader should have same "contenthash" with "css-loader" and without source maps: module 1`] = ` -"// Imports -var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); -var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ident]!./nested/nested.css\\"); -exports = ___CSS_LOADER_API_IMPORT___(false); -exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); -// Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\"]); -// Exports -module.exports = exports; -" -`; - -exports[`loader should have same "contenthash" with "css-loader" and without source maps: warnings 1`] = `Array []`; - -exports[`loader should have same "contenthash" with "postcss-loader" and with source maps: errors 1`] = `Array []`; - -exports[`loader should have same "contenthash" with "postcss-loader" and with source maps: module 1`] = ` -"// Imports -var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); -var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ident]!./nested/nested.postcss.css\\"); -exports = ___CSS_LOADER_API_IMPORT___(true); -exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); -// Module -exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"file\\":\\"basic.postcss.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"]}]); -// Exports -module.exports = exports; -" -`; - -exports[`loader should have same "contenthash" with "postcss-loader" and with source maps: warnings 1`] = `Array []`; - -exports[`loader should have same "contenthash" with "postcss-loader" and without source maps: errors 1`] = `Array []`; - -exports[`loader should have same "contenthash" with "postcss-loader" and without source maps: module 1`] = ` -"// Imports -var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); -var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ident]!./nested/nested.postcss.css\\"); -exports = ___CSS_LOADER_API_IMPORT___(false); -exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); -// Module -exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\"]); -// Exports -module.exports = exports; -" -`; - -exports[`loader should have same "contenthash" with "postcss-loader" and without source maps: warnings 1`] = `Array []`; - -exports[`loader should have same "contenthash" with "sass-loader" and with source maps: errors 1`] = `Array []`; - -exports[`loader should have same "contenthash" with "sass-loader" and with source maps: module 1`] = ` -"// Imports -var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); -exports = ___CSS_LOADER_API_IMPORT___(true); -// Module -exports.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"/media/veracrypt1/IdeaProjects/css-loader/test/fixtures/source-map/basic.scss\\",\\"basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAGA;EACE,gCAAA;EACA,WAJc;ACEhB\\",\\"file\\":\\"basic.scss\\",\\"sourcesContent\\":[\\"$font-stack: Helvetica, sans-serif;\\\\n$primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% $font-stack;\\\\n color: $primary-color;\\\\n}\\\\n\\",\\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\"]}]); -// Exports -module.exports = exports; -" -`; - -exports[`loader should have same "contenthash" with "sass-loader" and with source maps: result 1`] = ` -Array [ - Array [ - "./source-map/basic.scss", - "body { - font: 100% Helvetica, sans-serif; - color: #333; -}", - "", - Object { - "file": "basic.scss", - "mappings": "AAGA;EACE,gCAAA;EACA,WAJc;ACEhB", - "names": Array [], - "sources": Array [ - "/media/veracrypt1/IdeaProjects/css-loader/test/fixtures/source-map/basic.scss", - "basic.scss", - ], - "sourcesContent": Array [ - "$font-stack: Helvetica, sans-serif; -$primary-color: #333; - -body { - font: 100% $font-stack; - color: $primary-color; -} -", - "body { - font: 100% Helvetica, sans-serif; - color: #333; -}", - ], - "version": 3, - }, - ], -] -`; - -exports[`loader should have same "contenthash" with "sass-loader" and with source maps: warnings 1`] = `Array []`; - -exports[`loader should have same "contenthash" with "sass-loader" and without source maps: errors 1`] = `Array []`; - -exports[`loader should have same "contenthash" with "sass-loader" and without source maps: module 1`] = ` -"// Imports -var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); -exports = ___CSS_LOADER_API_IMPORT___(false); -// Module -exports.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\"]); -// Exports -module.exports = exports; -" -`; - -exports[`loader should have same "contenthash" with "sass-loader" and without source maps: warnings 1`] = `Array []`; - exports[`loader should reuse \`ast\` from "postcss-loader": errors 1`] = `Array []`; exports[`loader should reuse \`ast\` from "postcss-loader": module 1`] = ` diff --git a/test/__snapshots__/sourceMap-option.test.js.snap b/test/__snapshots__/sourceMap-option.test.js.snap index 02092fd5..3b69a7b4 100644 --- a/test/__snapshots__/sourceMap-option.test.js.snap +++ b/test/__snapshots__/sourceMap-option.test.js.snap @@ -197,7 +197,7 @@ exports[`"sourceMap" option false should not generate source maps when source ma var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); exports = ___CSS_LOADER_API_IMPORT___(false); // Module -exports.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\"]); +exports.push([module.id, \\"body {\\\\n background: coral;\\\\n}\\\\n\\\\nbody {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\"]); // Exports module.exports = exports; " @@ -208,6 +208,10 @@ Array [ Array [ "./source-map/basic.scss", "body { + background: coral; +} + +body { font: 100% Helvetica, sans-serif; color: #333; }", @@ -294,6 +298,704 @@ Array [ exports[`"sourceMap" option not specified should not generate source maps: warnings 1`] = `Array []`; +exports[`"sourceMap" option should use forward slash in url with "css-loader" and with source maps: errors 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "css-loader" and with source maps: module 1`] = ` +"// Imports +var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); +var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ident]!./nested/nested.css\\"); +exports = ___CSS_LOADER_API_IMPORT___(true); +exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); +// Module +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +// Exports +module.exports = exports; +" +`; + +exports[`"sourceMap" option should use forward slash in url with "css-loader" and with source maps: warnings 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "css-loader" and without source maps: errors 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "css-loader" and without source maps: module 1`] = ` +"// Imports +var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); +var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ident]!./nested/nested.css\\"); +exports = ___CSS_LOADER_API_IMPORT___(false); +exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); +// Module +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\"]); +// Exports +module.exports = exports; +" +`; + +exports[`"sourceMap" option should use forward slash in url with "css-loader" and without source maps: warnings 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin: errors 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin: module 1`] = ` +Object { + "main.44feaad4705782814aa3.bundle.js": ConcatSource { + "children": Array [ + RawSource { + "_value": "/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = \\"/webpack/public/path/\\"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = \\"./source-map/basic.js\\"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ \\"./source-map/basic.css\\": +/*!******************************!*\\\\ + !*** ./source-map/basic.css ***! + \\\\******************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// extracted by mini-css-extract-plugin + +/***/ }), + +/***/ \\"./source-map/basic.js\\": +/*!*****************************!*\\\\ + !*** ./source-map/basic.js ***! + \\\\*****************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _basic_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./basic.css */ \\"./source-map/basic.css\\"); +/* harmony import */ var _basic_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_basic_css__WEBPACK_IMPORTED_MODULE_0__); + + +__export__ = _basic_css__WEBPACK_IMPORTED_MODULE_0___default.a; + +/* harmony default export */ __webpack_exports__[\\"default\\"] = (_basic_css__WEBPACK_IMPORTED_MODULE_0___default.a); + + +/***/ }) + +/******/ });", + }, + " +//# sourceMappingURL=main.44feaad4705782814aa3.bundle.js.map", + ], + "emitted": true, + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.44feaad4705782814aa3.bundle.js", + }, + "main.44feaad4705782814aa3.bundle.js.map": RawSource { + "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///webpack/bootstrap\\",\\"webpack:///./source-map/basic.css\\",\\"webpack:///./source-map/basic.js\\"],\\"names\\":[],\\"mappings\\":\\";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;AClFA,uC;;;;;;;;;;;;ACAA;AAAA;AAAA;AAA8B;;AAE9B,aAAa,iDAAG;;AAED,gHAAG,EAAC\\",\\"file\\":\\"main.44feaad4705782814aa3.bundle.js\\",\\"sourcesContent\\":[\\" \\\\t// The module cache\\\\n \\\\tvar installedModules = {};\\\\n\\\\n \\\\t// The require function\\\\n \\\\tfunction __webpack_require__(moduleId) {\\\\n\\\\n \\\\t\\\\t// Check if module is in cache\\\\n \\\\t\\\\tif(installedModules[moduleId]) {\\\\n \\\\t\\\\t\\\\treturn installedModules[moduleId].exports;\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\t// Create a new module (and put it into the cache)\\\\n \\\\t\\\\tvar module = installedModules[moduleId] = {\\\\n \\\\t\\\\t\\\\ti: moduleId,\\\\n \\\\t\\\\t\\\\tl: false,\\\\n \\\\t\\\\t\\\\texports: {}\\\\n \\\\t\\\\t};\\\\n\\\\n \\\\t\\\\t// Execute the module function\\\\n \\\\t\\\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\\\n\\\\n \\\\t\\\\t// Flag the module as loaded\\\\n \\\\t\\\\tmodule.l = true;\\\\n\\\\n \\\\t\\\\t// Return the exports of the module\\\\n \\\\t\\\\treturn module.exports;\\\\n \\\\t}\\\\n\\\\n\\\\n \\\\t// expose the modules object (__webpack_modules__)\\\\n \\\\t__webpack_require__.m = modules;\\\\n\\\\n \\\\t// expose the module cache\\\\n \\\\t__webpack_require__.c = installedModules;\\\\n\\\\n \\\\t// define getter function for harmony exports\\\\n \\\\t__webpack_require__.d = function(exports, name, getter) {\\\\n \\\\t\\\\tif(!__webpack_require__.o(exports, name)) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\\\\n \\\\t\\\\t}\\\\n \\\\t};\\\\n\\\\n \\\\t// define __esModule on exports\\\\n \\\\t__webpack_require__.r = function(exports) {\\\\n \\\\t\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n \\\\t};\\\\n\\\\n \\\\t// create a fake namespace object\\\\n \\\\t// mode & 1: value is a module id, require it\\\\n \\\\t// mode & 2: merge all properties of value into the ns\\\\n \\\\t// mode & 4: return value when already ns object\\\\n \\\\t// mode & 8|1: behave like require\\\\n \\\\t__webpack_require__.t = function(value, mode) {\\\\n \\\\t\\\\tif(mode & 1) value = __webpack_require__(value);\\\\n \\\\t\\\\tif(mode & 8) return value;\\\\n \\\\t\\\\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\\\\n \\\\t\\\\tvar ns = Object.create(null);\\\\n \\\\t\\\\t__webpack_require__.r(ns);\\\\n \\\\t\\\\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\\\\n \\\\t\\\\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\\\\n \\\\t\\\\treturn ns;\\\\n \\\\t};\\\\n\\\\n \\\\t// getDefaultExport function for compatibility with non-harmony modules\\\\n \\\\t__webpack_require__.n = function(module) {\\\\n \\\\t\\\\tvar getter = module && module.__esModule ?\\\\n \\\\t\\\\t\\\\tfunction getDefault() { return module['default']; } :\\\\n \\\\t\\\\t\\\\tfunction getModuleExports() { return module; };\\\\n \\\\t\\\\t__webpack_require__.d(getter, 'a', getter);\\\\n \\\\t\\\\treturn getter;\\\\n \\\\t};\\\\n\\\\n \\\\t// Object.prototype.hasOwnProperty.call\\\\n \\\\t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\\\\n\\\\n \\\\t// __webpack_public_path__\\\\n \\\\t__webpack_require__.p = \\\\\\"/webpack/public/path/\\\\\\";\\\\n\\\\n\\\\n \\\\t// Load entry module and return exports\\\\n \\\\treturn __webpack_require__(__webpack_require__.s = \\\\\\"./source-map/basic.js\\\\\\");\\\\n\\",\\"// extracted by mini-css-extract-plugin\\",\\"import css from './basic.css';\\\\n\\\\n__export__ = css;\\\\n\\\\nexport default css;\\\\n\\"],\\"sourceRoot\\":\\"\\"}", + "emitted": true, + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.44feaad4705782814aa3.bundle.js.map", + }, + "main.css": ConcatSource { + "children": Array [ + RawSource { + "_value": ".nested { + color: blue; +} + +.class { + color: red; +} + +", + }, + " +/*# sourceMappingURL=main.css.map*/", + ], + "emitted": true, + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.css", + }, + "main.css.map": RawSource { + "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///nested.css\\",\\"webpack:///basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,WAAW;AACb;;ACAA;EACE,UAAU;AACZ\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\".nested {\\\\n color: blue;\\\\n}\\\\n\\",\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}", + "emitted": true, + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.css.map", + }, +} +`; + +exports[`"sourceMap" option should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin: module 2`] = `"// extracted by mini-css-extract-plugin"`; + +exports[`"sourceMap" option should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin: warnings 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "postcss-loader" and with source maps: errors 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "postcss-loader" and with source maps: module 1`] = ` +"// Imports +var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); +var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ident]!./nested/nested.postcss.css\\"); +exports = ___CSS_LOADER_API_IMPORT___(true); +exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); +// Module +exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"file\\":\\"basic.postcss.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"]}]); +// Exports +module.exports = exports; +" +`; + +exports[`"sourceMap" option should use forward slash in url with "postcss-loader" and with source maps: warnings 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "postcss-loader" and without source maps: errors 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "postcss-loader" and without source maps: module 1`] = ` +"// Imports +var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); +var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ident]!./nested/nested.postcss.css\\"); +exports = ___CSS_LOADER_API_IMPORT___(false); +exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); +// Module +exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\"]); +// Exports +module.exports = exports; +" +`; + +exports[`"sourceMap" option should use forward slash in url with "postcss-loader" and without source maps: warnings 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: errors 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: module 1`] = ` +Object { + "main.7a589a7f7e1183114dc2.bundle.js": ConcatSource { + "children": Array [ + RawSource { + "_value": "/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = \\"/webpack/public/path/\\"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = \\"./source-map/basic-postcss.js\\"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ \\"./source-map/basic-postcss.js\\": +/*!*************************************!*\\\\ + !*** ./source-map/basic-postcss.js ***! + \\\\*************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _basic_postcss_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./basic.postcss.css */ \\"./source-map/basic.postcss.css\\"); +/* harmony import */ var _basic_postcss_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_basic_postcss_css__WEBPACK_IMPORTED_MODULE_0__); + + +__export__ = _basic_postcss_css__WEBPACK_IMPORTED_MODULE_0___default.a; + +/* harmony default export */ __webpack_exports__[\\"default\\"] = (_basic_postcss_css__WEBPACK_IMPORTED_MODULE_0___default.a); + + +/***/ }), + +/***/ \\"./source-map/basic.postcss.css\\": +/*!**************************************!*\\\\ + !*** ./source-map/basic.postcss.css ***! + \\\\**************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// extracted by mini-css-extract-plugin + +/***/ }) + +/******/ });", + }, + " +//# sourceMappingURL=main.7a589a7f7e1183114dc2.bundle.js.map", + ], + "emitted": true, + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.7a589a7f7e1183114dc2.bundle.js", + }, + "main.7a589a7f7e1183114dc2.bundle.js.map": RawSource { + "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///webpack/bootstrap\\",\\"webpack:///./source-map/basic-postcss.js\\",\\"webpack:///./source-map/basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAsC;;AAEtC,aAAa,yDAAG;;AAED,wHAAG,EAAC;;;;;;;;;;;;ACJnB,uC\\",\\"file\\":\\"main.7a589a7f7e1183114dc2.bundle.js\\",\\"sourcesContent\\":[\\" \\\\t// The module cache\\\\n \\\\tvar installedModules = {};\\\\n\\\\n \\\\t// The require function\\\\n \\\\tfunction __webpack_require__(moduleId) {\\\\n\\\\n \\\\t\\\\t// Check if module is in cache\\\\n \\\\t\\\\tif(installedModules[moduleId]) {\\\\n \\\\t\\\\t\\\\treturn installedModules[moduleId].exports;\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\t// Create a new module (and put it into the cache)\\\\n \\\\t\\\\tvar module = installedModules[moduleId] = {\\\\n \\\\t\\\\t\\\\ti: moduleId,\\\\n \\\\t\\\\t\\\\tl: false,\\\\n \\\\t\\\\t\\\\texports: {}\\\\n \\\\t\\\\t};\\\\n\\\\n \\\\t\\\\t// Execute the module function\\\\n \\\\t\\\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\\\n\\\\n \\\\t\\\\t// Flag the module as loaded\\\\n \\\\t\\\\tmodule.l = true;\\\\n\\\\n \\\\t\\\\t// Return the exports of the module\\\\n \\\\t\\\\treturn module.exports;\\\\n \\\\t}\\\\n\\\\n\\\\n \\\\t// expose the modules object (__webpack_modules__)\\\\n \\\\t__webpack_require__.m = modules;\\\\n\\\\n \\\\t// expose the module cache\\\\n \\\\t__webpack_require__.c = installedModules;\\\\n\\\\n \\\\t// define getter function for harmony exports\\\\n \\\\t__webpack_require__.d = function(exports, name, getter) {\\\\n \\\\t\\\\tif(!__webpack_require__.o(exports, name)) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\\\\n \\\\t\\\\t}\\\\n \\\\t};\\\\n\\\\n \\\\t// define __esModule on exports\\\\n \\\\t__webpack_require__.r = function(exports) {\\\\n \\\\t\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n \\\\t};\\\\n\\\\n \\\\t// create a fake namespace object\\\\n \\\\t// mode & 1: value is a module id, require it\\\\n \\\\t// mode & 2: merge all properties of value into the ns\\\\n \\\\t// mode & 4: return value when already ns object\\\\n \\\\t// mode & 8|1: behave like require\\\\n \\\\t__webpack_require__.t = function(value, mode) {\\\\n \\\\t\\\\tif(mode & 1) value = __webpack_require__(value);\\\\n \\\\t\\\\tif(mode & 8) return value;\\\\n \\\\t\\\\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\\\\n \\\\t\\\\tvar ns = Object.create(null);\\\\n \\\\t\\\\t__webpack_require__.r(ns);\\\\n \\\\t\\\\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\\\\n \\\\t\\\\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\\\\n \\\\t\\\\treturn ns;\\\\n \\\\t};\\\\n\\\\n \\\\t// getDefaultExport function for compatibility with non-harmony modules\\\\n \\\\t__webpack_require__.n = function(module) {\\\\n \\\\t\\\\tvar getter = module && module.__esModule ?\\\\n \\\\t\\\\t\\\\tfunction getDefault() { return module['default']; } :\\\\n \\\\t\\\\t\\\\tfunction getModuleExports() { return module; };\\\\n \\\\t\\\\t__webpack_require__.d(getter, 'a', getter);\\\\n \\\\t\\\\treturn getter;\\\\n \\\\t};\\\\n\\\\n \\\\t// Object.prototype.hasOwnProperty.call\\\\n \\\\t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\\\\n\\\\n \\\\t// __webpack_public_path__\\\\n \\\\t__webpack_require__.p = \\\\\\"/webpack/public/path/\\\\\\";\\\\n\\\\n\\\\n \\\\t// Load entry module and return exports\\\\n \\\\treturn __webpack_require__(__webpack_require__.s = \\\\\\"./source-map/basic-postcss.js\\\\\\");\\\\n\\",\\"import css from './basic.postcss.css';\\\\n\\\\n__export__ = css;\\\\n\\\\nexport default css;\\\\n\\",\\"// extracted by mini-css-extract-plugin\\"],\\"sourceRoot\\":\\"\\"}", + "emitted": true, + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.7a589a7f7e1183114dc2.bundle.js.map", + }, + "main.css": ConcatSource { + "children": Array [ + RawSource { + "_value": ".nested { + color: blue; +} + +:root { + --fontSize: 1rem; + --mainColor: rgba(18,52,86,0.47059); + --secondaryColor: rgba(102, 51, 153, 0.9); +} + +html { + overflow-x: hidden; + overflow-y: auto; + overflow: hidden auto; +} + +@media (max-width: 50rem) { + body { + color: rgba(18,52,86,0.47059); + color: var(--mainColor); + font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif; + font-size: 1rem; + font-size: var(--fontSize); + line-height: calc(1rem * 1.5); + line-height: calc(var(--fontSize) * 1.5); + word-wrap: break-word; + padding-left: calc(1rem / 2 + 1px); + padding-right: calc(1rem / 2 + 1px); + padding-left: calc(var(--fontSize) / 2 + 1px); + padding-right: calc(var(--fontSize) / 2 + 1px); + } +} + +h1,h2,h3,h4,h5,h6 { + margin-top: 0; + margin-bottom: 0; +} + +a { + color: rgba(0, 0, 255, 0.9) +} + +a:hover { + color: #639; + } + +", + }, + " +/*# sourceMappingURL=main.css.map*/", + ], + "emitted": true, + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.css", + }, + "main.css.map": RawSource { + "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///nested.postcss.css\\",\\"webpack:///basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,WAAW;AACb;;ACGA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\".nested {\\\\n color: blue;\\\\n}\\\\n\\",\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}", + "emitted": true, + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.css.map", + }, +} +`; + +exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: module 2`] = `"// extracted by mini-css-extract-plugin"`; + +exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: warnings 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "sass-loader" and with source maps: errors 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "sass-loader" and with source maps: module 1`] = ` +"// Imports +var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); +exports = ___CSS_LOADER_API_IMPORT___(true); +// Module +exports.push([module.id, \\"body {\\\\n background: coral;\\\\n}\\\\n\\\\nbody {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./nested/nested.scss\\",\\"basic.scss\\",\\"./basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,iBAAA;ACCF;;ACGA;EACE,gCAAA;EACA,WAJc;ADIhB\\",\\"file\\":\\"basic.scss\\",\\"sourcesContent\\":[\\"body {\\\\n background: coral;\\\\n}\\\\n\\",\\"body {\\\\n background: coral;\\\\n}\\\\n\\\\nbody {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\",\\"@import \\\\\\"./nested/nested\\\\\\";\\\\n\\\\n$font-stack: Helvetica, sans-serif;\\\\n$primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% $font-stack;\\\\n color: $primary-color;\\\\n}\\\\n\\"]}]); +// Exports +module.exports = exports; +" +`; + +exports[`"sourceMap" option should use forward slash in url with "sass-loader" and with source maps: result 1`] = ` +Array [ + Array [ + "./source-map/basic.scss", + "body { + background: coral; +} + +body { + font: 100% Helvetica, sans-serif; + color: #333; +}", + "", + Object { + "file": "basic.scss", + "mappings": "AAAA;EACE,iBAAA;ACCF;;ACGA;EACE,gCAAA;EACA,WAJc;ADIhB", + "names": Array [], + "sources": Array [ + "./nested/nested.scss", + "basic.scss", + "./basic.scss", + ], + "sourcesContent": Array [ + "body { + background: coral; +} +", + "body { + background: coral; +} + +body { + font: 100% Helvetica, sans-serif; + color: #333; +}", + "@import \\"./nested/nested\\"; + +$font-stack: Helvetica, sans-serif; +$primary-color: #333; + +body { + font: 100% $font-stack; + color: $primary-color; +} +", + ], + "version": 3, + }, + ], +] +`; + +exports[`"sourceMap" option should use forward slash in url with "sass-loader" and with source maps: warnings 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "sass-loader" and without source maps: errors 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "sass-loader" and without source maps: module 1`] = ` +"// Imports +var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); +exports = ___CSS_LOADER_API_IMPORT___(false); +// Module +exports.push([module.id, \\"body {\\\\n background: coral;\\\\n}\\\\n\\\\nbody {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\"]); +// Exports +module.exports = exports; +" +`; + +exports[`"sourceMap" option should use forward slash in url with "sass-loader" and without source maps: warnings 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: errors 1`] = `Array []`; + +exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 1`] = ` +Object { + "main.17b8db17c2cac5999ebf.bundle.js": ConcatSource { + "children": Array [ + RawSource { + "_value": "/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = \\"/webpack/public/path/\\"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = \\"./source-map/basic-scss.js\\"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ \\"./source-map/basic-scss.js\\": +/*!**********************************!*\\\\ + !*** ./source-map/basic-scss.js ***! + \\\\**********************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _basic_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./basic.scss */ \\"./source-map/basic.scss\\"); +/* harmony import */ var _basic_scss__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_basic_scss__WEBPACK_IMPORTED_MODULE_0__); + + +__export__ = _basic_scss__WEBPACK_IMPORTED_MODULE_0___default.a; + +/* harmony default export */ __webpack_exports__[\\"default\\"] = (_basic_scss__WEBPACK_IMPORTED_MODULE_0___default.a); + + +/***/ }), + +/***/ \\"./source-map/basic.scss\\": +/*!*******************************!*\\\\ + !*** ./source-map/basic.scss ***! + \\\\*******************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// extracted by mini-css-extract-plugin + +/***/ }) + +/******/ });", + }, + " +//# sourceMappingURL=main.17b8db17c2cac5999ebf.bundle.js.map", + ], + "emitted": true, + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.17b8db17c2cac5999ebf.bundle.js", + }, + "main.17b8db17c2cac5999ebf.bundle.js.map": RawSource { + "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///webpack/bootstrap\\",\\"webpack:///./source-map/basic-scss.js\\",\\"webpack:///./source-map/basic.scss\\"],\\"names\\":[],\\"mappings\\":\\";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAA+B;;AAE/B,aAAa,kDAAG;;AAED,iHAAG,EAAC;;;;;;;;;;;;ACJnB,uC\\",\\"file\\":\\"main.17b8db17c2cac5999ebf.bundle.js\\",\\"sourcesContent\\":[\\" \\\\t// The module cache\\\\n \\\\tvar installedModules = {};\\\\n\\\\n \\\\t// The require function\\\\n \\\\tfunction __webpack_require__(moduleId) {\\\\n\\\\n \\\\t\\\\t// Check if module is in cache\\\\n \\\\t\\\\tif(installedModules[moduleId]) {\\\\n \\\\t\\\\t\\\\treturn installedModules[moduleId].exports;\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\t// Create a new module (and put it into the cache)\\\\n \\\\t\\\\tvar module = installedModules[moduleId] = {\\\\n \\\\t\\\\t\\\\ti: moduleId,\\\\n \\\\t\\\\t\\\\tl: false,\\\\n \\\\t\\\\t\\\\texports: {}\\\\n \\\\t\\\\t};\\\\n\\\\n \\\\t\\\\t// Execute the module function\\\\n \\\\t\\\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\\\n\\\\n \\\\t\\\\t// Flag the module as loaded\\\\n \\\\t\\\\tmodule.l = true;\\\\n\\\\n \\\\t\\\\t// Return the exports of the module\\\\n \\\\t\\\\treturn module.exports;\\\\n \\\\t}\\\\n\\\\n\\\\n \\\\t// expose the modules object (__webpack_modules__)\\\\n \\\\t__webpack_require__.m = modules;\\\\n\\\\n \\\\t// expose the module cache\\\\n \\\\t__webpack_require__.c = installedModules;\\\\n\\\\n \\\\t// define getter function for harmony exports\\\\n \\\\t__webpack_require__.d = function(exports, name, getter) {\\\\n \\\\t\\\\tif(!__webpack_require__.o(exports, name)) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\\\\n \\\\t\\\\t}\\\\n \\\\t};\\\\n\\\\n \\\\t// define __esModule on exports\\\\n \\\\t__webpack_require__.r = function(exports) {\\\\n \\\\t\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n \\\\t};\\\\n\\\\n \\\\t// create a fake namespace object\\\\n \\\\t// mode & 1: value is a module id, require it\\\\n \\\\t// mode & 2: merge all properties of value into the ns\\\\n \\\\t// mode & 4: return value when already ns object\\\\n \\\\t// mode & 8|1: behave like require\\\\n \\\\t__webpack_require__.t = function(value, mode) {\\\\n \\\\t\\\\tif(mode & 1) value = __webpack_require__(value);\\\\n \\\\t\\\\tif(mode & 8) return value;\\\\n \\\\t\\\\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\\\\n \\\\t\\\\tvar ns = Object.create(null);\\\\n \\\\t\\\\t__webpack_require__.r(ns);\\\\n \\\\t\\\\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\\\\n \\\\t\\\\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\\\\n \\\\t\\\\treturn ns;\\\\n \\\\t};\\\\n\\\\n \\\\t// getDefaultExport function for compatibility with non-harmony modules\\\\n \\\\t__webpack_require__.n = function(module) {\\\\n \\\\t\\\\tvar getter = module && module.__esModule ?\\\\n \\\\t\\\\t\\\\tfunction getDefault() { return module['default']; } :\\\\n \\\\t\\\\t\\\\tfunction getModuleExports() { return module; };\\\\n \\\\t\\\\t__webpack_require__.d(getter, 'a', getter);\\\\n \\\\t\\\\treturn getter;\\\\n \\\\t};\\\\n\\\\n \\\\t// Object.prototype.hasOwnProperty.call\\\\n \\\\t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\\\\n\\\\n \\\\t// __webpack_public_path__\\\\n \\\\t__webpack_require__.p = \\\\\\"/webpack/public/path/\\\\\\";\\\\n\\\\n\\\\n \\\\t// Load entry module and return exports\\\\n \\\\treturn __webpack_require__(__webpack_require__.s = \\\\\\"./source-map/basic-scss.js\\\\\\");\\\\n\\",\\"import css from './basic.scss';\\\\n\\\\n__export__ = css;\\\\n\\\\nexport default css;\\\\n\\",\\"// extracted by mini-css-extract-plugin\\"],\\"sourceRoot\\":\\"\\"}", + "emitted": true, + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.17b8db17c2cac5999ebf.bundle.js.map", + }, + "main.css": ConcatSource { + "children": Array [ + RawSource { + "_value": "body { + background: coral; +} + +body { + font: 100% Helvetica, sans-serif; + color: #333; +} +", + }, + " +/*# sourceMappingURL=main.css.map*/", + ], + "emitted": true, + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.css", + }, + "main.css.map": RawSource { + "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///nested/nested.scss\\",\\"webpack:///basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE;ACCF;;AAGA;EACE;EACA,WAJc;AAIhB,C\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\"body {\\\\n background: coral;\\\\n}\\\\n\\",\\"body {\\\\n background: coral;\\\\n}\\\\n\\\\nbody {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}", + "emitted": true, + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.css.map", + }, +} +`; + +exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 2`] = `"// extracted by mini-css-extract-plugin"`; + +exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: warnings 1`] = `Array []`; + exports[`"sourceMap" option true should generate source maps when source maps equal to "null" from an other loader: errors 1`] = `Array []`; exports[`"sourceMap" option true should generate source maps when source maps equal to "null" from an other loader: module 1`] = ` diff --git a/test/fixtures/contenthash/basic-css.js b/test/fixtures/contenthash/basic-css.js deleted file mode 100644 index 72afb950..00000000 --- a/test/fixtures/contenthash/basic-css.js +++ /dev/null @@ -1,5 +0,0 @@ -import css from './basic.css'; - -__export__ = css; - -export default css; diff --git a/test/fixtures/contenthash/basic-postcss.js b/test/fixtures/contenthash/basic-postcss.js deleted file mode 100644 index ff2b03ea..00000000 --- a/test/fixtures/contenthash/basic-postcss.js +++ /dev/null @@ -1,5 +0,0 @@ -import css from './basic.postcss.css'; - -__export__ = css; - -export default css; diff --git a/test/fixtures/contenthash/basic-sass.js b/test/fixtures/contenthash/basic-sass.js deleted file mode 100644 index 68ce09f0..00000000 --- a/test/fixtures/contenthash/basic-sass.js +++ /dev/null @@ -1,5 +0,0 @@ -import css from './basic.scss'; - -__export__ = css; - -export default css; diff --git a/test/fixtures/contenthash/basic.css b/test/fixtures/contenthash/basic.css deleted file mode 100644 index fdece7b4..00000000 --- a/test/fixtures/contenthash/basic.css +++ /dev/null @@ -1,3 +0,0 @@ -a { - color: red; -} diff --git a/test/fixtures/contenthash/basic.postcss.css b/test/fixtures/contenthash/basic.postcss.css deleted file mode 100644 index ba8f6ef7..00000000 --- a/test/fixtures/contenthash/basic.postcss.css +++ /dev/null @@ -1,7 +0,0 @@ -a { - color: rgb(0 0 100% / 90%); - -&:hover { - color: rebeccapurple; - } -} diff --git a/test/fixtures/contenthash/basic.scss b/test/fixtures/contenthash/basic.scss deleted file mode 100644 index ae47c032..00000000 --- a/test/fixtures/contenthash/basic.scss +++ /dev/null @@ -1,9 +0,0 @@ -$var: red; - -a { - color: $var; - - &:hover { - color: $var; - } -} diff --git a/test/fixtures/source-map/basic.scss b/test/fixtures/source-map/basic.scss index 1a72d52f..e646594f 100644 --- a/test/fixtures/source-map/basic.scss +++ b/test/fixtures/source-map/basic.scss @@ -1,3 +1,5 @@ +@import "./nested/nested"; + $font-stack: Helvetica, sans-serif; $primary-color: #333; diff --git a/test/fixtures/source-map/nested/nested.scss b/test/fixtures/source-map/nested/nested.scss new file mode 100644 index 00000000..2040cf4c --- /dev/null +++ b/test/fixtures/source-map/nested/nested.scss @@ -0,0 +1,3 @@ +body { + background: coral; +} diff --git a/test/loader.test.js b/test/loader.test.js index 21bca292..ccaee08c 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -406,271 +406,4 @@ describe('loader', () => { expect(getWarnings(stats)).toMatchSnapshot('warnings'); expect(getErrors(stats)).toMatchSnapshot('errors'); }); - - it('should have same "contenthash" with "css-loader" and without source maps', async () => { - const compiler = getCompiler( - './source-map/basic.js', - {}, - { - output: { - path: path.resolve(__dirname, '../outputs'), - filename: '[name].[contenthash].bundle.js', - chunkFilename: '[name].[contenthash].chunk.js', - publicPath: '/webpack/public/path/', - }, - module: { - rules: [ - { - test: /\.css$/i, - rules: [ - { - loader: path.resolve(__dirname, '../src'), - options: { sourceMap: false }, - }, - ], - }, - ], - }, - } - ); - const stats = await compile(compiler); - - expect(getModuleSource('./source-map/basic.css', stats)).toMatchSnapshot( - 'module' - ); - expect(getWarnings(stats)).toMatchSnapshot('warnings'); - expect(getErrors(stats)).toMatchSnapshot('errors'); - }); - - it('should have same "contenthash" with "css-loader" and with source maps', async () => { - const compiler = getCompiler( - './source-map/basic.js', - {}, - { - output: { - path: path.resolve(__dirname, '../outputs'), - filename: '[name].[contenthash].bundle.js', - chunkFilename: '[name].[contenthash].chunk.js', - publicPath: '/webpack/public/path/', - }, - module: { - rules: [ - { - test: /\.css$/i, - rules: [ - { - loader: path.resolve(__dirname, '../src'), - options: { sourceMap: true }, - }, - ], - }, - ], - }, - } - ); - const stats = await compile(compiler); - - expect(getModuleSource('./source-map/basic.css', stats)).toMatchSnapshot( - 'module' - ); - expect(getWarnings(stats)).toMatchSnapshot('warnings'); - expect(getErrors(stats)).toMatchSnapshot('errors'); - }); - - it('should have same "contenthash" with "postcss-loader" and without source maps', async () => { - const compiler = getCompiler( - './source-map/basic-postcss.js', - {}, - { - output: { - path: path.resolve(__dirname, '../outputs'), - filename: '[name].[contenthash].bundle.js', - chunkFilename: '[name].[contenthash].chunk.js', - publicPath: '/webpack/public/path/', - }, - module: { - rules: [ - { - test: /\.css$/i, - rules: [ - { - loader: path.resolve(__dirname, '../src'), - options: { - sourceMap: false, - importLoaders: 1, - }, - }, - { - loader: 'postcss-loader', - options: { - plugins: () => [postcssPresetEnv({ stage: 0 })], - sourceMap: false, - }, - }, - ], - }, - ], - }, - } - ); - const stats = await compile(compiler); - - expect( - getModuleSource('./source-map/basic.postcss.css', stats) - ).toMatchSnapshot('module'); - expect(getWarnings(stats)).toMatchSnapshot('warnings'); - expect(getErrors(stats)).toMatchSnapshot('errors'); - }); - - it('should have same "contenthash" with "postcss-loader" and with source maps', async () => { - const compiler = getCompiler( - './source-map/basic-postcss.js', - {}, - { - output: { - path: path.resolve(__dirname, '../outputs'), - filename: '[name].[contenthash].bundle.js', - chunkFilename: '[name].[contenthash].chunk.js', - publicPath: '/webpack/public/path/', - }, - module: { - rules: [ - { - test: /\.css$/i, - rules: [ - { - loader: path.resolve(__dirname, '../src'), - options: { - sourceMap: true, - }, - }, - { - loader: 'postcss-loader', - options: { - plugins: () => [postcssPresetEnv({ stage: 0 })], - sourceMap: true, - }, - }, - ], - }, - ], - }, - } - ); - const stats = await compile(compiler); - - expect( - getModuleSource('./source-map/basic.postcss.css', stats) - ).toMatchSnapshot('module'); - expect(getWarnings(stats)).toMatchSnapshot('warnings'); - expect(getErrors(stats)).toMatchSnapshot('errors'); - }); - - it('should have same "contenthash" with "sass-loader" and without source maps', async () => { - const compiler = getCompiler( - './source-map/basic-scss.js', - {}, - { - output: { - path: path.resolve(__dirname, '../outputs'), - filename: '[name].[contenthash].bundle.js', - chunkFilename: '[name].[contenthash].chunk.js', - publicPath: '/webpack/public/path/', - }, - module: { - rules: [ - { - test: /\.s[ca]ss$/i, - rules: [ - { - loader: path.resolve(__dirname, '../src'), - options: { - sourceMap: false, - }, - }, - { - loader: 'postcss-loader', - options: { - plugins: () => [postcssPresetEnv({ stage: 0 })], - sourceMap: false, - }, - }, - { - loader: 'sass-loader', - options: { - // eslint-disable-next-line global-require - implementation: require('sass'), - sourceMap: false, - }, - }, - ], - }, - ], - }, - } - ); - const stats = await compile(compiler); - - expect(getModuleSource('./source-map/basic.scss', stats)).toMatchSnapshot( - 'module' - ); - expect(getWarnings(stats)).toMatchSnapshot('warnings'); - expect(getErrors(stats)).toMatchSnapshot('errors'); - }); - - it('should have same "contenthash" with "sass-loader" and with source maps', async () => { - const compiler = getCompiler( - './source-map/basic-scss.js', - {}, - { - output: { - path: path.resolve(__dirname, '../outputs'), - filename: '[name].bundle.js', - chunkFilename: '[name].chunk.js', - publicPath: '/webpack/public/path/', - }, - module: { - rules: [ - { - test: /\.s[ca]ss$/i, - rules: [ - { - loader: path.resolve(__dirname, '../src'), - options: { - sourceMap: true, - importLoaders: 1, - }, - }, - { - loader: 'postcss-loader', - options: { - plugins: () => [postcssPresetEnv({ stage: 0 })], - sourceMap: true, - }, - }, - { - loader: 'sass-loader', - options: { - // eslint-disable-next-line global-require - implementation: require('sass'), - sourceMap: true, - }, - }, - ], - }, - ], - }, - } - ); - const stats = await compile(compiler); - - expect(getModuleSource('./source-map/basic.scss', stats)).toMatchSnapshot( - 'module' - ); - expect(getExecutedCode('main.bundle.js', compiler, stats)).toMatchSnapshot( - 'result' - ); - expect(getWarnings(stats)).toMatchSnapshot('warnings'); - expect(getErrors(stats)).toMatchSnapshot('errors'); - }); }); diff --git a/test/sourceMap-option.test.js b/test/sourceMap-option.test.js index 8aacdce8..06a1654b 100644 --- a/test/sourceMap-option.test.js +++ b/test/sourceMap-option.test.js @@ -11,6 +11,8 @@ import { getWarnings, } from './helpers/index'; +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); + describe('"sourceMap" option', () => { describe('not specified', () => { it('should not generate source maps', async () => { @@ -491,4 +493,434 @@ describe('"sourceMap" option', () => { expect(getErrors(stats)).toMatchSnapshot('errors'); }); }); + + it('should use forward slash in url with "css-loader" and without source maps', async () => { + const compiler = getCompiler( + './source-map/basic.js', + {}, + { + output: { + path: path.resolve(__dirname, '../outputs'), + filename: '[name].[contenthash].bundle.js', + chunkFilename: '[name].[contenthash].chunk.js', + publicPath: '/webpack/public/path/', + }, + module: { + rules: [ + { + test: /\.css$/i, + rules: [ + { + loader: path.resolve(__dirname, '../src'), + options: { sourceMap: false }, + }, + ], + }, + ], + }, + } + ); + const stats = await compile(compiler); + + expect(getModuleSource('./source-map/basic.css', stats)).toMatchSnapshot( + 'module' + ); + expect(getWarnings(stats)).toMatchSnapshot('warnings'); + expect(getErrors(stats)).toMatchSnapshot('errors'); + }); + + it('should use forward slash in url with "css-loader" and with source maps', async () => { + const compiler = getCompiler( + './source-map/basic.js', + {}, + { + output: { + path: path.resolve(__dirname, '../outputs'), + filename: '[name].[contenthash].bundle.js', + chunkFilename: '[name].[contenthash].chunk.js', + publicPath: '/webpack/public/path/', + }, + module: { + rules: [ + { + test: /\.css$/i, + rules: [ + { + loader: path.resolve(__dirname, '../src'), + options: { sourceMap: true }, + }, + ], + }, + ], + }, + } + ); + const stats = await compile(compiler); + + expect(getModuleSource('./source-map/basic.css', stats)).toMatchSnapshot( + 'module' + ); + expect(getWarnings(stats)).toMatchSnapshot('warnings'); + expect(getErrors(stats)).toMatchSnapshot('errors'); + }); + + it('should use forward slash in url with "postcss-loader" and without source maps', async () => { + const compiler = getCompiler( + './source-map/basic-postcss.js', + {}, + { + output: { + path: path.resolve(__dirname, '../outputs'), + filename: '[name].[contenthash].bundle.js', + chunkFilename: '[name].[contenthash].chunk.js', + publicPath: '/webpack/public/path/', + }, + module: { + rules: [ + { + test: /\.css$/i, + rules: [ + { + loader: path.resolve(__dirname, '../src'), + options: { + sourceMap: false, + importLoaders: 1, + }, + }, + { + loader: 'postcss-loader', + options: { + plugins: () => [postcssPresetEnv({ stage: 0 })], + sourceMap: false, + }, + }, + ], + }, + ], + }, + } + ); + const stats = await compile(compiler); + + expect( + getModuleSource('./source-map/basic.postcss.css', stats) + ).toMatchSnapshot('module'); + expect(getWarnings(stats)).toMatchSnapshot('warnings'); + expect(getErrors(stats)).toMatchSnapshot('errors'); + }); + + it('should use forward slash in url with "postcss-loader" and with source maps', async () => { + const compiler = getCompiler( + './source-map/basic-postcss.js', + {}, + { + output: { + path: path.resolve(__dirname, '../outputs'), + filename: '[name].[contenthash].bundle.js', + chunkFilename: '[name].[contenthash].chunk.js', + publicPath: '/webpack/public/path/', + }, + module: { + rules: [ + { + test: /\.css$/i, + rules: [ + { + loader: path.resolve(__dirname, '../src'), + options: { + sourceMap: true, + }, + }, + { + loader: 'postcss-loader', + options: { + plugins: () => [postcssPresetEnv({ stage: 0 })], + sourceMap: true, + }, + }, + ], + }, + ], + }, + } + ); + const stats = await compile(compiler); + + expect( + getModuleSource('./source-map/basic.postcss.css', stats) + ).toMatchSnapshot('module'); + expect(getWarnings(stats)).toMatchSnapshot('warnings'); + expect(getErrors(stats)).toMatchSnapshot('errors'); + }); + + it('should use forward slash in url with "sass-loader" and without source maps', async () => { + const compiler = getCompiler( + './source-map/basic-scss.js', + {}, + { + output: { + path: path.resolve(__dirname, '../outputs'), + filename: '[name].[contenthash].bundle.js', + chunkFilename: '[name].[contenthash].chunk.js', + publicPath: '/webpack/public/path/', + }, + module: { + rules: [ + { + test: /\.s[ca]ss$/i, + rules: [ + { + loader: path.resolve(__dirname, '../src'), + options: { + sourceMap: false, + }, + }, + { + loader: 'postcss-loader', + options: { + plugins: () => [postcssPresetEnv({ stage: 0 })], + sourceMap: false, + }, + }, + { + loader: 'sass-loader', + options: { + // eslint-disable-next-line global-require + implementation: require('sass'), + sourceMap: false, + }, + }, + ], + }, + ], + }, + } + ); + const stats = await compile(compiler); + + expect(getModuleSource('./source-map/basic.scss', stats)).toMatchSnapshot( + 'module' + ); + expect(getWarnings(stats)).toMatchSnapshot('warnings'); + expect(getErrors(stats)).toMatchSnapshot('errors'); + }); + + it('should use forward slash in url with "sass-loader" and with source maps', async () => { + const compiler = getCompiler( + './source-map/basic-scss.js', + {}, + { + output: { + path: path.resolve(__dirname, '../outputs'), + filename: '[name].bundle.js', + chunkFilename: '[name].chunk.js', + publicPath: '/webpack/public/path/', + }, + module: { + rules: [ + { + test: /\.s[ca]ss$/i, + rules: [ + { + loader: path.resolve(__dirname, '../src'), + options: { + sourceMap: true, + importLoaders: 1, + }, + }, + { + loader: 'postcss-loader', + options: { + plugins: () => [postcssPresetEnv({ stage: 0 })], + sourceMap: true, + }, + }, + { + loader: 'sass-loader', + options: { + // eslint-disable-next-line global-require + implementation: require('sass'), + sourceMap: true, + }, + }, + ], + }, + ], + }, + } + ); + const stats = await compile(compiler); + + expect(getModuleSource('./source-map/basic.scss', stats)).toMatchSnapshot( + 'module' + ); + expect(getExecutedCode('main.bundle.js', compiler, stats)).toMatchSnapshot( + 'result' + ); + expect(getWarnings(stats)).toMatchSnapshot('warnings'); + expect(getErrors(stats)).toMatchSnapshot('errors'); + }); + + it('should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin', async () => { + const compiler = getCompiler( + './source-map/basic.js', + {}, + { + devtool: 'source-map', + output: { + path: path.resolve(__dirname, '../outputs'), + filename: '[name].[contenthash].bundle.js', + chunkFilename: '[name].[contenthash].chunk.js', + publicPath: '/webpack/public/path/', + }, + plugins: [ + new MiniCssExtractPlugin({ + filename: '[name].css', + }), + ], + module: { + rules: [ + { + test: /\.css$/i, + rules: [ + { + loader: MiniCssExtractPlugin.loader, + }, + { + loader: path.resolve(__dirname, '../src'), + options: { sourceMap: true }, + }, + ], + }, + ], + }, + } + ); + const stats = await compile(compiler); + + expect(stats.compilation.assets).toMatchSnapshot('module'); + expect(getModuleSource('./source-map/basic.css', stats)).toMatchSnapshot( + 'module' + ); + expect(getWarnings(stats)).toMatchSnapshot('warnings'); + expect(getErrors(stats)).toMatchSnapshot('errors'); + }); + + it('should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin', async () => { + const compiler = getCompiler( + './source-map/basic-scss.js', + {}, + { + devtool: 'source-map', + output: { + path: path.resolve(__dirname, '../outputs'), + filename: '[name].[contenthash].bundle.js', + chunkFilename: '[name].[contenthash].chunk.js', + publicPath: '/webpack/public/path/', + }, + plugins: [ + new MiniCssExtractPlugin({ + filename: '[name].css', + }), + ], + module: { + rules: [ + { + test: /\.s[ca]ss$/i, + rules: [ + { + loader: MiniCssExtractPlugin.loader, + }, + { + loader: path.resolve(__dirname, '../src'), + options: { + sourceMap: true, + importLoaders: 1, + }, + }, + { + loader: 'postcss-loader', + options: { + plugins: () => [postcssPresetEnv({ stage: 0 })], + sourceMap: true, + }, + }, + { + loader: 'sass-loader', + options: { + // eslint-disable-next-line global-require + implementation: require('sass'), + sourceMap: true, + }, + }, + ], + }, + ], + }, + } + ); + const stats = await compile(compiler); + + expect(stats.compilation.assets).toMatchSnapshot('module'); + expect(getModuleSource('./source-map/basic.scss', stats)).toMatchSnapshot( + 'module' + ); + expect(getWarnings(stats)).toMatchSnapshot('warnings'); + expect(getErrors(stats)).toMatchSnapshot('errors'); + }); + + it('should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin', async () => { + const compiler = getCompiler( + './source-map/basic-postcss.js', + {}, + { + devtool: 'source-map', + output: { + path: path.resolve(__dirname, '../outputs'), + filename: '[name].[contenthash].bundle.js', + chunkFilename: '[name].[contenthash].chunk.js', + publicPath: '/webpack/public/path/', + }, + plugins: [ + new MiniCssExtractPlugin({ + filename: '[name].css', + }), + ], + module: { + rules: [ + { + test: /\.css$/i, + rules: [ + { + loader: MiniCssExtractPlugin.loader, + }, + { + loader: path.resolve(__dirname, '../src'), + options: { + sourceMap: true, + importLoaders: 1, + }, + }, + { + loader: 'postcss-loader', + options: { + plugins: () => [postcssPresetEnv({ stage: 0 })], + sourceMap: true, + }, + }, + ], + }, + ], + }, + } + ); + const stats = await compile(compiler); + + expect(stats.compilation.assets).toMatchSnapshot('module'); + expect( + getModuleSource('./source-map/basic.postcss.css', stats) + ).toMatchSnapshot('module'); + expect(getWarnings(stats)).toMatchSnapshot('warnings'); + expect(getErrors(stats)).toMatchSnapshot('errors'); + }); }); From 74d6cec5e79947ac4a7894f4cf94063c32d07b1a Mon Sep 17 00:00:00 2001 From: cap-Bernardito Date: Fri, 10 Apr 2020 17:19:43 +0300 Subject: [PATCH 06/11] test: normalize sourceMaps on different operating systems --- .../sourceMap-option.test.js.snap | 36 +++++++++---------- test/sourceMap-option.test.js | 32 ++++++++--------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/test/__snapshots__/sourceMap-option.test.js.snap b/test/__snapshots__/sourceMap-option.test.js.snap index 3b69a7b4..dea1a6cd 100644 --- a/test/__snapshots__/sourceMap-option.test.js.snap +++ b/test/__snapshots__/sourceMap-option.test.js.snap @@ -336,7 +336,7 @@ exports[`"sourceMap" option should use forward slash in url with "css-loader", s exports[`"sourceMap" option should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin: module 1`] = ` Object { - "main.44feaad4705782814aa3.bundle.js": ConcatSource { + "main.bundle.js": ConcatSource { "children": Array [ RawSource { "_value": "/******/ (function(modules) { // webpackBootstrap @@ -461,15 +461,15 @@ __export__ = _basic_css__WEBPACK_IMPORTED_MODULE_0___default.a; /******/ });", }, " -//# sourceMappingURL=main.44feaad4705782814aa3.bundle.js.map", +//# sourceMappingURL=main.bundle.js.map", ], "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.44feaad4705782814aa3.bundle.js", + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.bundle.js", }, - "main.44feaad4705782814aa3.bundle.js.map": RawSource { - "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///webpack/bootstrap\\",\\"webpack:///./source-map/basic.css\\",\\"webpack:///./source-map/basic.js\\"],\\"names\\":[],\\"mappings\\":\\";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;AClFA,uC;;;;;;;;;;;;ACAA;AAAA;AAAA;AAA8B;;AAE9B,aAAa,iDAAG;;AAED,gHAAG,EAAC\\",\\"file\\":\\"main.44feaad4705782814aa3.bundle.js\\",\\"sourcesContent\\":[\\" \\\\t// The module cache\\\\n \\\\tvar installedModules = {};\\\\n\\\\n \\\\t// The require function\\\\n \\\\tfunction __webpack_require__(moduleId) {\\\\n\\\\n \\\\t\\\\t// Check if module is in cache\\\\n \\\\t\\\\tif(installedModules[moduleId]) {\\\\n \\\\t\\\\t\\\\treturn installedModules[moduleId].exports;\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\t// Create a new module (and put it into the cache)\\\\n \\\\t\\\\tvar module = installedModules[moduleId] = {\\\\n \\\\t\\\\t\\\\ti: moduleId,\\\\n \\\\t\\\\t\\\\tl: false,\\\\n \\\\t\\\\t\\\\texports: {}\\\\n \\\\t\\\\t};\\\\n\\\\n \\\\t\\\\t// Execute the module function\\\\n \\\\t\\\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\\\n\\\\n \\\\t\\\\t// Flag the module as loaded\\\\n \\\\t\\\\tmodule.l = true;\\\\n\\\\n \\\\t\\\\t// Return the exports of the module\\\\n \\\\t\\\\treturn module.exports;\\\\n \\\\t}\\\\n\\\\n\\\\n \\\\t// expose the modules object (__webpack_modules__)\\\\n \\\\t__webpack_require__.m = modules;\\\\n\\\\n \\\\t// expose the module cache\\\\n \\\\t__webpack_require__.c = installedModules;\\\\n\\\\n \\\\t// define getter function for harmony exports\\\\n \\\\t__webpack_require__.d = function(exports, name, getter) {\\\\n \\\\t\\\\tif(!__webpack_require__.o(exports, name)) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\\\\n \\\\t\\\\t}\\\\n \\\\t};\\\\n\\\\n \\\\t// define __esModule on exports\\\\n \\\\t__webpack_require__.r = function(exports) {\\\\n \\\\t\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n \\\\t};\\\\n\\\\n \\\\t// create a fake namespace object\\\\n \\\\t// mode & 1: value is a module id, require it\\\\n \\\\t// mode & 2: merge all properties of value into the ns\\\\n \\\\t// mode & 4: return value when already ns object\\\\n \\\\t// mode & 8|1: behave like require\\\\n \\\\t__webpack_require__.t = function(value, mode) {\\\\n \\\\t\\\\tif(mode & 1) value = __webpack_require__(value);\\\\n \\\\t\\\\tif(mode & 8) return value;\\\\n \\\\t\\\\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\\\\n \\\\t\\\\tvar ns = Object.create(null);\\\\n \\\\t\\\\t__webpack_require__.r(ns);\\\\n \\\\t\\\\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\\\\n \\\\t\\\\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\\\\n \\\\t\\\\treturn ns;\\\\n \\\\t};\\\\n\\\\n \\\\t// getDefaultExport function for compatibility with non-harmony modules\\\\n \\\\t__webpack_require__.n = function(module) {\\\\n \\\\t\\\\tvar getter = module && module.__esModule ?\\\\n \\\\t\\\\t\\\\tfunction getDefault() { return module['default']; } :\\\\n \\\\t\\\\t\\\\tfunction getModuleExports() { return module; };\\\\n \\\\t\\\\t__webpack_require__.d(getter, 'a', getter);\\\\n \\\\t\\\\treturn getter;\\\\n \\\\t};\\\\n\\\\n \\\\t// Object.prototype.hasOwnProperty.call\\\\n \\\\t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\\\\n\\\\n \\\\t// __webpack_public_path__\\\\n \\\\t__webpack_require__.p = \\\\\\"/webpack/public/path/\\\\\\";\\\\n\\\\n\\\\n \\\\t// Load entry module and return exports\\\\n \\\\treturn __webpack_require__(__webpack_require__.s = \\\\\\"./source-map/basic.js\\\\\\");\\\\n\\",\\"// extracted by mini-css-extract-plugin\\",\\"import css from './basic.css';\\\\n\\\\n__export__ = css;\\\\n\\\\nexport default css;\\\\n\\"],\\"sourceRoot\\":\\"\\"}", + "main.bundle.js.map": RawSource { + "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///webpack/bootstrap\\",\\"webpack:///./source-map/basic.css\\",\\"webpack:///./source-map/basic.js\\"],\\"names\\":[],\\"mappings\\":\\";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;AClFA,uC;;;;;;;;;;;;ACAA;AAAA;AAAA;AAA8B;;AAE9B,aAAa,iDAAG;;AAED,gHAAG,EAAC\\",\\"file\\":\\"main.bundle.js\\",\\"sourcesContent\\":[\\" \\\\t// The module cache\\\\n \\\\tvar installedModules = {};\\\\n\\\\n \\\\t// The require function\\\\n \\\\tfunction __webpack_require__(moduleId) {\\\\n\\\\n \\\\t\\\\t// Check if module is in cache\\\\n \\\\t\\\\tif(installedModules[moduleId]) {\\\\n \\\\t\\\\t\\\\treturn installedModules[moduleId].exports;\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\t// Create a new module (and put it into the cache)\\\\n \\\\t\\\\tvar module = installedModules[moduleId] = {\\\\n \\\\t\\\\t\\\\ti: moduleId,\\\\n \\\\t\\\\t\\\\tl: false,\\\\n \\\\t\\\\t\\\\texports: {}\\\\n \\\\t\\\\t};\\\\n\\\\n \\\\t\\\\t// Execute the module function\\\\n \\\\t\\\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\\\n\\\\n \\\\t\\\\t// Flag the module as loaded\\\\n \\\\t\\\\tmodule.l = true;\\\\n\\\\n \\\\t\\\\t// Return the exports of the module\\\\n \\\\t\\\\treturn module.exports;\\\\n \\\\t}\\\\n\\\\n\\\\n \\\\t// expose the modules object (__webpack_modules__)\\\\n \\\\t__webpack_require__.m = modules;\\\\n\\\\n \\\\t// expose the module cache\\\\n \\\\t__webpack_require__.c = installedModules;\\\\n\\\\n \\\\t// define getter function for harmony exports\\\\n \\\\t__webpack_require__.d = function(exports, name, getter) {\\\\n \\\\t\\\\tif(!__webpack_require__.o(exports, name)) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\\\\n \\\\t\\\\t}\\\\n \\\\t};\\\\n\\\\n \\\\t// define __esModule on exports\\\\n \\\\t__webpack_require__.r = function(exports) {\\\\n \\\\t\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n \\\\t};\\\\n\\\\n \\\\t// create a fake namespace object\\\\n \\\\t// mode & 1: value is a module id, require it\\\\n \\\\t// mode & 2: merge all properties of value into the ns\\\\n \\\\t// mode & 4: return value when already ns object\\\\n \\\\t// mode & 8|1: behave like require\\\\n \\\\t__webpack_require__.t = function(value, mode) {\\\\n \\\\t\\\\tif(mode & 1) value = __webpack_require__(value);\\\\n \\\\t\\\\tif(mode & 8) return value;\\\\n \\\\t\\\\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\\\\n \\\\t\\\\tvar ns = Object.create(null);\\\\n \\\\t\\\\t__webpack_require__.r(ns);\\\\n \\\\t\\\\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\\\\n \\\\t\\\\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\\\\n \\\\t\\\\treturn ns;\\\\n \\\\t};\\\\n\\\\n \\\\t// getDefaultExport function for compatibility with non-harmony modules\\\\n \\\\t__webpack_require__.n = function(module) {\\\\n \\\\t\\\\tvar getter = module && module.__esModule ?\\\\n \\\\t\\\\t\\\\tfunction getDefault() { return module['default']; } :\\\\n \\\\t\\\\t\\\\tfunction getModuleExports() { return module; };\\\\n \\\\t\\\\t__webpack_require__.d(getter, 'a', getter);\\\\n \\\\t\\\\treturn getter;\\\\n \\\\t};\\\\n\\\\n \\\\t// Object.prototype.hasOwnProperty.call\\\\n \\\\t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\\\\n\\\\n \\\\t// __webpack_public_path__\\\\n \\\\t__webpack_require__.p = \\\\\\"/webpack/public/path/\\\\\\";\\\\n\\\\n\\\\n \\\\t// Load entry module and return exports\\\\n \\\\treturn __webpack_require__(__webpack_require__.s = \\\\\\"./source-map/basic.js\\\\\\");\\\\n\\",\\"// extracted by mini-css-extract-plugin\\",\\"import css from './basic.css';\\\\n\\\\n__export__ = css;\\\\n\\\\nexport default css;\\\\n\\"],\\"sourceRoot\\":\\"\\"}", "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.44feaad4705782814aa3.bundle.js.map", + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.bundle.js.map", }, "main.css": ConcatSource { "children": Array [ @@ -540,7 +540,7 @@ exports[`"sourceMap" option should use forward slash in url with "postcss-loader exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: module 1`] = ` Object { - "main.7a589a7f7e1183114dc2.bundle.js": ConcatSource { + "main.bundle.js": ConcatSource { "children": Array [ RawSource { "_value": "/******/ (function(modules) { // webpackBootstrap @@ -665,15 +665,15 @@ __export__ = _basic_postcss_css__WEBPACK_IMPORTED_MODULE_0___default.a; /******/ });", }, " -//# sourceMappingURL=main.7a589a7f7e1183114dc2.bundle.js.map", +//# sourceMappingURL=main.bundle.js.map", ], "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.7a589a7f7e1183114dc2.bundle.js", + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.bundle.js", }, - "main.7a589a7f7e1183114dc2.bundle.js.map": RawSource { - "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///webpack/bootstrap\\",\\"webpack:///./source-map/basic-postcss.js\\",\\"webpack:///./source-map/basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAsC;;AAEtC,aAAa,yDAAG;;AAED,wHAAG,EAAC;;;;;;;;;;;;ACJnB,uC\\",\\"file\\":\\"main.7a589a7f7e1183114dc2.bundle.js\\",\\"sourcesContent\\":[\\" \\\\t// The module cache\\\\n \\\\tvar installedModules = {};\\\\n\\\\n \\\\t// The require function\\\\n \\\\tfunction __webpack_require__(moduleId) {\\\\n\\\\n \\\\t\\\\t// Check if module is in cache\\\\n \\\\t\\\\tif(installedModules[moduleId]) {\\\\n \\\\t\\\\t\\\\treturn installedModules[moduleId].exports;\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\t// Create a new module (and put it into the cache)\\\\n \\\\t\\\\tvar module = installedModules[moduleId] = {\\\\n \\\\t\\\\t\\\\ti: moduleId,\\\\n \\\\t\\\\t\\\\tl: false,\\\\n \\\\t\\\\t\\\\texports: {}\\\\n \\\\t\\\\t};\\\\n\\\\n \\\\t\\\\t// Execute the module function\\\\n \\\\t\\\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\\\n\\\\n \\\\t\\\\t// Flag the module as loaded\\\\n \\\\t\\\\tmodule.l = true;\\\\n\\\\n \\\\t\\\\t// Return the exports of the module\\\\n \\\\t\\\\treturn module.exports;\\\\n \\\\t}\\\\n\\\\n\\\\n \\\\t// expose the modules object (__webpack_modules__)\\\\n \\\\t__webpack_require__.m = modules;\\\\n\\\\n \\\\t// expose the module cache\\\\n \\\\t__webpack_require__.c = installedModules;\\\\n\\\\n \\\\t// define getter function for harmony exports\\\\n \\\\t__webpack_require__.d = function(exports, name, getter) {\\\\n \\\\t\\\\tif(!__webpack_require__.o(exports, name)) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\\\\n \\\\t\\\\t}\\\\n \\\\t};\\\\n\\\\n \\\\t// define __esModule on exports\\\\n \\\\t__webpack_require__.r = function(exports) {\\\\n \\\\t\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n \\\\t};\\\\n\\\\n \\\\t// create a fake namespace object\\\\n \\\\t// mode & 1: value is a module id, require it\\\\n \\\\t// mode & 2: merge all properties of value into the ns\\\\n \\\\t// mode & 4: return value when already ns object\\\\n \\\\t// mode & 8|1: behave like require\\\\n \\\\t__webpack_require__.t = function(value, mode) {\\\\n \\\\t\\\\tif(mode & 1) value = __webpack_require__(value);\\\\n \\\\t\\\\tif(mode & 8) return value;\\\\n \\\\t\\\\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\\\\n \\\\t\\\\tvar ns = Object.create(null);\\\\n \\\\t\\\\t__webpack_require__.r(ns);\\\\n \\\\t\\\\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\\\\n \\\\t\\\\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\\\\n \\\\t\\\\treturn ns;\\\\n \\\\t};\\\\n\\\\n \\\\t// getDefaultExport function for compatibility with non-harmony modules\\\\n \\\\t__webpack_require__.n = function(module) {\\\\n \\\\t\\\\tvar getter = module && module.__esModule ?\\\\n \\\\t\\\\t\\\\tfunction getDefault() { return module['default']; } :\\\\n \\\\t\\\\t\\\\tfunction getModuleExports() { return module; };\\\\n \\\\t\\\\t__webpack_require__.d(getter, 'a', getter);\\\\n \\\\t\\\\treturn getter;\\\\n \\\\t};\\\\n\\\\n \\\\t// Object.prototype.hasOwnProperty.call\\\\n \\\\t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\\\\n\\\\n \\\\t// __webpack_public_path__\\\\n \\\\t__webpack_require__.p = \\\\\\"/webpack/public/path/\\\\\\";\\\\n\\\\n\\\\n \\\\t// Load entry module and return exports\\\\n \\\\treturn __webpack_require__(__webpack_require__.s = \\\\\\"./source-map/basic-postcss.js\\\\\\");\\\\n\\",\\"import css from './basic.postcss.css';\\\\n\\\\n__export__ = css;\\\\n\\\\nexport default css;\\\\n\\",\\"// extracted by mini-css-extract-plugin\\"],\\"sourceRoot\\":\\"\\"}", + "main.bundle.js.map": RawSource { + "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///webpack/bootstrap\\",\\"webpack:///./source-map/basic-postcss.js\\",\\"webpack:///./source-map/basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAsC;;AAEtC,aAAa,yDAAG;;AAED,wHAAG,EAAC;;;;;;;;;;;;ACJnB,uC\\",\\"file\\":\\"main.bundle.js\\",\\"sourcesContent\\":[\\" \\\\t// The module cache\\\\n \\\\tvar installedModules = {};\\\\n\\\\n \\\\t// The require function\\\\n \\\\tfunction __webpack_require__(moduleId) {\\\\n\\\\n \\\\t\\\\t// Check if module is in cache\\\\n \\\\t\\\\tif(installedModules[moduleId]) {\\\\n \\\\t\\\\t\\\\treturn installedModules[moduleId].exports;\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\t// Create a new module (and put it into the cache)\\\\n \\\\t\\\\tvar module = installedModules[moduleId] = {\\\\n \\\\t\\\\t\\\\ti: moduleId,\\\\n \\\\t\\\\t\\\\tl: false,\\\\n \\\\t\\\\t\\\\texports: {}\\\\n \\\\t\\\\t};\\\\n\\\\n \\\\t\\\\t// Execute the module function\\\\n \\\\t\\\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\\\n\\\\n \\\\t\\\\t// Flag the module as loaded\\\\n \\\\t\\\\tmodule.l = true;\\\\n\\\\n \\\\t\\\\t// Return the exports of the module\\\\n \\\\t\\\\treturn module.exports;\\\\n \\\\t}\\\\n\\\\n\\\\n \\\\t// expose the modules object (__webpack_modules__)\\\\n \\\\t__webpack_require__.m = modules;\\\\n\\\\n \\\\t// expose the module cache\\\\n \\\\t__webpack_require__.c = installedModules;\\\\n\\\\n \\\\t// define getter function for harmony exports\\\\n \\\\t__webpack_require__.d = function(exports, name, getter) {\\\\n \\\\t\\\\tif(!__webpack_require__.o(exports, name)) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\\\\n \\\\t\\\\t}\\\\n \\\\t};\\\\n\\\\n \\\\t// define __esModule on exports\\\\n \\\\t__webpack_require__.r = function(exports) {\\\\n \\\\t\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n \\\\t};\\\\n\\\\n \\\\t// create a fake namespace object\\\\n \\\\t// mode & 1: value is a module id, require it\\\\n \\\\t// mode & 2: merge all properties of value into the ns\\\\n \\\\t// mode & 4: return value when already ns object\\\\n \\\\t// mode & 8|1: behave like require\\\\n \\\\t__webpack_require__.t = function(value, mode) {\\\\n \\\\t\\\\tif(mode & 1) value = __webpack_require__(value);\\\\n \\\\t\\\\tif(mode & 8) return value;\\\\n \\\\t\\\\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\\\\n \\\\t\\\\tvar ns = Object.create(null);\\\\n \\\\t\\\\t__webpack_require__.r(ns);\\\\n \\\\t\\\\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\\\\n \\\\t\\\\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\\\\n \\\\t\\\\treturn ns;\\\\n \\\\t};\\\\n\\\\n \\\\t// getDefaultExport function for compatibility with non-harmony modules\\\\n \\\\t__webpack_require__.n = function(module) {\\\\n \\\\t\\\\tvar getter = module && module.__esModule ?\\\\n \\\\t\\\\t\\\\tfunction getDefault() { return module['default']; } :\\\\n \\\\t\\\\t\\\\tfunction getModuleExports() { return module; };\\\\n \\\\t\\\\t__webpack_require__.d(getter, 'a', getter);\\\\n \\\\t\\\\treturn getter;\\\\n \\\\t};\\\\n\\\\n \\\\t// Object.prototype.hasOwnProperty.call\\\\n \\\\t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\\\\n\\\\n \\\\t// __webpack_public_path__\\\\n \\\\t__webpack_require__.p = \\\\\\"/webpack/public/path/\\\\\\";\\\\n\\\\n\\\\n \\\\t// Load entry module and return exports\\\\n \\\\treturn __webpack_require__(__webpack_require__.s = \\\\\\"./source-map/basic-postcss.js\\\\\\");\\\\n\\",\\"import css from './basic.postcss.css';\\\\n\\\\n__export__ = css;\\\\n\\\\nexport default css;\\\\n\\",\\"// extracted by mini-css-extract-plugin\\"],\\"sourceRoot\\":\\"\\"}", "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.7a589a7f7e1183114dc2.bundle.js.map", + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.bundle.js.map", }, "main.css": ConcatSource { "children": Array [ @@ -830,7 +830,7 @@ exports[`"sourceMap" option should use forward slash in url with "sass-loader", exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 1`] = ` Object { - "main.17b8db17c2cac5999ebf.bundle.js": ConcatSource { + "main.bundle.js": ConcatSource { "children": Array [ RawSource { "_value": "/******/ (function(modules) { // webpackBootstrap @@ -955,15 +955,15 @@ __export__ = _basic_scss__WEBPACK_IMPORTED_MODULE_0___default.a; /******/ });", }, " -//# sourceMappingURL=main.17b8db17c2cac5999ebf.bundle.js.map", +//# sourceMappingURL=main.bundle.js.map", ], "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.17b8db17c2cac5999ebf.bundle.js", + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.bundle.js", }, - "main.17b8db17c2cac5999ebf.bundle.js.map": RawSource { - "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///webpack/bootstrap\\",\\"webpack:///./source-map/basic-scss.js\\",\\"webpack:///./source-map/basic.scss\\"],\\"names\\":[],\\"mappings\\":\\";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAA+B;;AAE/B,aAAa,kDAAG;;AAED,iHAAG,EAAC;;;;;;;;;;;;ACJnB,uC\\",\\"file\\":\\"main.17b8db17c2cac5999ebf.bundle.js\\",\\"sourcesContent\\":[\\" \\\\t// The module cache\\\\n \\\\tvar installedModules = {};\\\\n\\\\n \\\\t// The require function\\\\n \\\\tfunction __webpack_require__(moduleId) {\\\\n\\\\n \\\\t\\\\t// Check if module is in cache\\\\n \\\\t\\\\tif(installedModules[moduleId]) {\\\\n \\\\t\\\\t\\\\treturn installedModules[moduleId].exports;\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\t// Create a new module (and put it into the cache)\\\\n \\\\t\\\\tvar module = installedModules[moduleId] = {\\\\n \\\\t\\\\t\\\\ti: moduleId,\\\\n \\\\t\\\\t\\\\tl: false,\\\\n \\\\t\\\\t\\\\texports: {}\\\\n \\\\t\\\\t};\\\\n\\\\n \\\\t\\\\t// Execute the module function\\\\n \\\\t\\\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\\\n\\\\n \\\\t\\\\t// Flag the module as loaded\\\\n \\\\t\\\\tmodule.l = true;\\\\n\\\\n \\\\t\\\\t// Return the exports of the module\\\\n \\\\t\\\\treturn module.exports;\\\\n \\\\t}\\\\n\\\\n\\\\n \\\\t// expose the modules object (__webpack_modules__)\\\\n \\\\t__webpack_require__.m = modules;\\\\n\\\\n \\\\t// expose the module cache\\\\n \\\\t__webpack_require__.c = installedModules;\\\\n\\\\n \\\\t// define getter function for harmony exports\\\\n \\\\t__webpack_require__.d = function(exports, name, getter) {\\\\n \\\\t\\\\tif(!__webpack_require__.o(exports, name)) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\\\\n \\\\t\\\\t}\\\\n \\\\t};\\\\n\\\\n \\\\t// define __esModule on exports\\\\n \\\\t__webpack_require__.r = function(exports) {\\\\n \\\\t\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n \\\\t};\\\\n\\\\n \\\\t// create a fake namespace object\\\\n \\\\t// mode & 1: value is a module id, require it\\\\n \\\\t// mode & 2: merge all properties of value into the ns\\\\n \\\\t// mode & 4: return value when already ns object\\\\n \\\\t// mode & 8|1: behave like require\\\\n \\\\t__webpack_require__.t = function(value, mode) {\\\\n \\\\t\\\\tif(mode & 1) value = __webpack_require__(value);\\\\n \\\\t\\\\tif(mode & 8) return value;\\\\n \\\\t\\\\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\\\\n \\\\t\\\\tvar ns = Object.create(null);\\\\n \\\\t\\\\t__webpack_require__.r(ns);\\\\n \\\\t\\\\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\\\\n \\\\t\\\\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\\\\n \\\\t\\\\treturn ns;\\\\n \\\\t};\\\\n\\\\n \\\\t// getDefaultExport function for compatibility with non-harmony modules\\\\n \\\\t__webpack_require__.n = function(module) {\\\\n \\\\t\\\\tvar getter = module && module.__esModule ?\\\\n \\\\t\\\\t\\\\tfunction getDefault() { return module['default']; } :\\\\n \\\\t\\\\t\\\\tfunction getModuleExports() { return module; };\\\\n \\\\t\\\\t__webpack_require__.d(getter, 'a', getter);\\\\n \\\\t\\\\treturn getter;\\\\n \\\\t};\\\\n\\\\n \\\\t// Object.prototype.hasOwnProperty.call\\\\n \\\\t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\\\\n\\\\n \\\\t// __webpack_public_path__\\\\n \\\\t__webpack_require__.p = \\\\\\"/webpack/public/path/\\\\\\";\\\\n\\\\n\\\\n \\\\t// Load entry module and return exports\\\\n \\\\treturn __webpack_require__(__webpack_require__.s = \\\\\\"./source-map/basic-scss.js\\\\\\");\\\\n\\",\\"import css from './basic.scss';\\\\n\\\\n__export__ = css;\\\\n\\\\nexport default css;\\\\n\\",\\"// extracted by mini-css-extract-plugin\\"],\\"sourceRoot\\":\\"\\"}", + "main.bundle.js.map": RawSource { + "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///webpack/bootstrap\\",\\"webpack:///./source-map/basic-scss.js\\",\\"webpack:///./source-map/basic.scss\\"],\\"names\\":[],\\"mappings\\":\\";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAA+B;;AAE/B,aAAa,kDAAG;;AAED,iHAAG,EAAC;;;;;;;;;;;;ACJnB,uC\\",\\"file\\":\\"main.bundle.js\\",\\"sourcesContent\\":[\\" \\\\t// The module cache\\\\n \\\\tvar installedModules = {};\\\\n\\\\n \\\\t// The require function\\\\n \\\\tfunction __webpack_require__(moduleId) {\\\\n\\\\n \\\\t\\\\t// Check if module is in cache\\\\n \\\\t\\\\tif(installedModules[moduleId]) {\\\\n \\\\t\\\\t\\\\treturn installedModules[moduleId].exports;\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\t// Create a new module (and put it into the cache)\\\\n \\\\t\\\\tvar module = installedModules[moduleId] = {\\\\n \\\\t\\\\t\\\\ti: moduleId,\\\\n \\\\t\\\\t\\\\tl: false,\\\\n \\\\t\\\\t\\\\texports: {}\\\\n \\\\t\\\\t};\\\\n\\\\n \\\\t\\\\t// Execute the module function\\\\n \\\\t\\\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\\\n\\\\n \\\\t\\\\t// Flag the module as loaded\\\\n \\\\t\\\\tmodule.l = true;\\\\n\\\\n \\\\t\\\\t// Return the exports of the module\\\\n \\\\t\\\\treturn module.exports;\\\\n \\\\t}\\\\n\\\\n\\\\n \\\\t// expose the modules object (__webpack_modules__)\\\\n \\\\t__webpack_require__.m = modules;\\\\n\\\\n \\\\t// expose the module cache\\\\n \\\\t__webpack_require__.c = installedModules;\\\\n\\\\n \\\\t// define getter function for harmony exports\\\\n \\\\t__webpack_require__.d = function(exports, name, getter) {\\\\n \\\\t\\\\tif(!__webpack_require__.o(exports, name)) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\\\\n \\\\t\\\\t}\\\\n \\\\t};\\\\n\\\\n \\\\t// define __esModule on exports\\\\n \\\\t__webpack_require__.r = function(exports) {\\\\n \\\\t\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n \\\\t};\\\\n\\\\n \\\\t// create a fake namespace object\\\\n \\\\t// mode & 1: value is a module id, require it\\\\n \\\\t// mode & 2: merge all properties of value into the ns\\\\n \\\\t// mode & 4: return value when already ns object\\\\n \\\\t// mode & 8|1: behave like require\\\\n \\\\t__webpack_require__.t = function(value, mode) {\\\\n \\\\t\\\\tif(mode & 1) value = __webpack_require__(value);\\\\n \\\\t\\\\tif(mode & 8) return value;\\\\n \\\\t\\\\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\\\\n \\\\t\\\\tvar ns = Object.create(null);\\\\n \\\\t\\\\t__webpack_require__.r(ns);\\\\n \\\\t\\\\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\\\\n \\\\t\\\\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\\\\n \\\\t\\\\treturn ns;\\\\n \\\\t};\\\\n\\\\n \\\\t// getDefaultExport function for compatibility with non-harmony modules\\\\n \\\\t__webpack_require__.n = function(module) {\\\\n \\\\t\\\\tvar getter = module && module.__esModule ?\\\\n \\\\t\\\\t\\\\tfunction getDefault() { return module['default']; } :\\\\n \\\\t\\\\t\\\\tfunction getModuleExports() { return module; };\\\\n \\\\t\\\\t__webpack_require__.d(getter, 'a', getter);\\\\n \\\\t\\\\treturn getter;\\\\n \\\\t};\\\\n\\\\n \\\\t// Object.prototype.hasOwnProperty.call\\\\n \\\\t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\\\\n\\\\n \\\\t// __webpack_public_path__\\\\n \\\\t__webpack_require__.p = \\\\\\"/webpack/public/path/\\\\\\";\\\\n\\\\n\\\\n \\\\t// Load entry module and return exports\\\\n \\\\treturn __webpack_require__(__webpack_require__.s = \\\\\\"./source-map/basic-scss.js\\\\\\");\\\\n\\",\\"import css from './basic.scss';\\\\n\\\\n__export__ = css;\\\\n\\\\nexport default css;\\\\n\\",\\"// extracted by mini-css-extract-plugin\\"],\\"sourceRoot\\":\\"\\"}", "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.17b8db17c2cac5999ebf.bundle.js.map", + "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.bundle.js.map", }, "main.css": ConcatSource { "children": Array [ diff --git a/test/sourceMap-option.test.js b/test/sourceMap-option.test.js index 06a1654b..32acb120 100644 --- a/test/sourceMap-option.test.js +++ b/test/sourceMap-option.test.js @@ -501,8 +501,8 @@ describe('"sourceMap" option', () => { { output: { path: path.resolve(__dirname, '../outputs'), - filename: '[name].[contenthash].bundle.js', - chunkFilename: '[name].[contenthash].chunk.js', + filename: '[name].bundle.js', + chunkFilename: '[name].chunk.js', publicPath: '/webpack/public/path/', }, module: { @@ -536,8 +536,8 @@ describe('"sourceMap" option', () => { { output: { path: path.resolve(__dirname, '../outputs'), - filename: '[name].[contenthash].bundle.js', - chunkFilename: '[name].[contenthash].chunk.js', + filename: '[name].bundle.js', + chunkFilename: '[name].chunk.js', publicPath: '/webpack/public/path/', }, module: { @@ -571,8 +571,8 @@ describe('"sourceMap" option', () => { { output: { path: path.resolve(__dirname, '../outputs'), - filename: '[name].[contenthash].bundle.js', - chunkFilename: '[name].[contenthash].chunk.js', + filename: '[name].bundle.js', + chunkFilename: '[name].chunk.js', publicPath: '/webpack/public/path/', }, module: { @@ -616,8 +616,8 @@ describe('"sourceMap" option', () => { { output: { path: path.resolve(__dirname, '../outputs'), - filename: '[name].[contenthash].bundle.js', - chunkFilename: '[name].[contenthash].chunk.js', + filename: '[name].bundle.js', + chunkFilename: '[name].chunk.js', publicPath: '/webpack/public/path/', }, module: { @@ -660,8 +660,8 @@ describe('"sourceMap" option', () => { { output: { path: path.resolve(__dirname, '../outputs'), - filename: '[name].[contenthash].bundle.js', - chunkFilename: '[name].[contenthash].chunk.js', + filename: '[name].bundle.js', + chunkFilename: '[name].chunk.js', publicPath: '/webpack/public/path/', }, module: { @@ -769,8 +769,8 @@ describe('"sourceMap" option', () => { devtool: 'source-map', output: { path: path.resolve(__dirname, '../outputs'), - filename: '[name].[contenthash].bundle.js', - chunkFilename: '[name].[contenthash].chunk.js', + filename: '[name].bundle.js', + chunkFilename: '[name].chunk.js', publicPath: '/webpack/public/path/', }, plugins: [ @@ -814,8 +814,8 @@ describe('"sourceMap" option', () => { devtool: 'source-map', output: { path: path.resolve(__dirname, '../outputs'), - filename: '[name].[contenthash].bundle.js', - chunkFilename: '[name].[contenthash].chunk.js', + filename: '[name].bundle.js', + chunkFilename: '[name].chunk.js', publicPath: '/webpack/public/path/', }, plugins: [ @@ -877,8 +877,8 @@ describe('"sourceMap" option', () => { devtool: 'source-map', output: { path: path.resolve(__dirname, '../outputs'), - filename: '[name].[contenthash].bundle.js', - chunkFilename: '[name].[contenthash].chunk.js', + filename: '[name].bundle.js', + chunkFilename: '[name].chunk.js', publicPath: '/webpack/public/path/', }, plugins: [ From 980b4d44e5f229aa70a1d0a1325a7b2e9b94a8cd Mon Sep 17 00:00:00 2001 From: cap-Bernardito Date: Fri, 10 Apr 2020 18:05:29 +0300 Subject: [PATCH 07/11] test: normalize sourceMaps on different operating systems --- .../sourceMap-option.test.js.snap | 483 +----------------- test/sourceMap-option.test.js | 22 +- 2 files changed, 34 insertions(+), 471 deletions(-) diff --git a/test/__snapshots__/sourceMap-option.test.js.snap b/test/__snapshots__/sourceMap-option.test.js.snap index dea1a6cd..362b1b87 100644 --- a/test/__snapshots__/sourceMap-option.test.js.snap +++ b/test/__snapshots__/sourceMap-option.test.js.snap @@ -335,146 +335,7 @@ exports[`"sourceMap" option should use forward slash in url with "css-loader" an exports[`"sourceMap" option should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin: errors 1`] = `Array []`; exports[`"sourceMap" option should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin: module 1`] = ` -Object { - "main.bundle.js": ConcatSource { - "children": Array [ - RawSource { - "_value": "/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = \\"/webpack/public/path/\\"; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = \\"./source-map/basic.js\\"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ \\"./source-map/basic.css\\": -/*!******************************!*\\\\ - !*** ./source-map/basic.css ***! - \\\\******************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -// extracted by mini-css-extract-plugin - -/***/ }), - -/***/ \\"./source-map/basic.js\\": -/*!*****************************!*\\\\ - !*** ./source-map/basic.js ***! - \\\\*****************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -\\"use strict\\"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _basic_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./basic.css */ \\"./source-map/basic.css\\"); -/* harmony import */ var _basic_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_basic_css__WEBPACK_IMPORTED_MODULE_0__); - - -__export__ = _basic_css__WEBPACK_IMPORTED_MODULE_0___default.a; - -/* harmony default export */ __webpack_exports__[\\"default\\"] = (_basic_css__WEBPACK_IMPORTED_MODULE_0___default.a); - - -/***/ }) - -/******/ });", - }, - " -//# sourceMappingURL=main.bundle.js.map", - ], - "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.bundle.js", - }, - "main.bundle.js.map": RawSource { - "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///webpack/bootstrap\\",\\"webpack:///./source-map/basic.css\\",\\"webpack:///./source-map/basic.js\\"],\\"names\\":[],\\"mappings\\":\\";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;AClFA,uC;;;;;;;;;;;;ACAA;AAAA;AAAA;AAA8B;;AAE9B,aAAa,iDAAG;;AAED,gHAAG,EAAC\\",\\"file\\":\\"main.bundle.js\\",\\"sourcesContent\\":[\\" \\\\t// The module cache\\\\n \\\\tvar installedModules = {};\\\\n\\\\n \\\\t// The require function\\\\n \\\\tfunction __webpack_require__(moduleId) {\\\\n\\\\n \\\\t\\\\t// Check if module is in cache\\\\n \\\\t\\\\tif(installedModules[moduleId]) {\\\\n \\\\t\\\\t\\\\treturn installedModules[moduleId].exports;\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\t// Create a new module (and put it into the cache)\\\\n \\\\t\\\\tvar module = installedModules[moduleId] = {\\\\n \\\\t\\\\t\\\\ti: moduleId,\\\\n \\\\t\\\\t\\\\tl: false,\\\\n \\\\t\\\\t\\\\texports: {}\\\\n \\\\t\\\\t};\\\\n\\\\n \\\\t\\\\t// Execute the module function\\\\n \\\\t\\\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\\\n\\\\n \\\\t\\\\t// Flag the module as loaded\\\\n \\\\t\\\\tmodule.l = true;\\\\n\\\\n \\\\t\\\\t// Return the exports of the module\\\\n \\\\t\\\\treturn module.exports;\\\\n \\\\t}\\\\n\\\\n\\\\n \\\\t// expose the modules object (__webpack_modules__)\\\\n \\\\t__webpack_require__.m = modules;\\\\n\\\\n \\\\t// expose the module cache\\\\n \\\\t__webpack_require__.c = installedModules;\\\\n\\\\n \\\\t// define getter function for harmony exports\\\\n \\\\t__webpack_require__.d = function(exports, name, getter) {\\\\n \\\\t\\\\tif(!__webpack_require__.o(exports, name)) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\\\\n \\\\t\\\\t}\\\\n \\\\t};\\\\n\\\\n \\\\t// define __esModule on exports\\\\n \\\\t__webpack_require__.r = function(exports) {\\\\n \\\\t\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n \\\\t};\\\\n\\\\n \\\\t// create a fake namespace object\\\\n \\\\t// mode & 1: value is a module id, require it\\\\n \\\\t// mode & 2: merge all properties of value into the ns\\\\n \\\\t// mode & 4: return value when already ns object\\\\n \\\\t// mode & 8|1: behave like require\\\\n \\\\t__webpack_require__.t = function(value, mode) {\\\\n \\\\t\\\\tif(mode & 1) value = __webpack_require__(value);\\\\n \\\\t\\\\tif(mode & 8) return value;\\\\n \\\\t\\\\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\\\\n \\\\t\\\\tvar ns = Object.create(null);\\\\n \\\\t\\\\t__webpack_require__.r(ns);\\\\n \\\\t\\\\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\\\\n \\\\t\\\\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\\\\n \\\\t\\\\treturn ns;\\\\n \\\\t};\\\\n\\\\n \\\\t// getDefaultExport function for compatibility with non-harmony modules\\\\n \\\\t__webpack_require__.n = function(module) {\\\\n \\\\t\\\\tvar getter = module && module.__esModule ?\\\\n \\\\t\\\\t\\\\tfunction getDefault() { return module['default']; } :\\\\n \\\\t\\\\t\\\\tfunction getModuleExports() { return module; };\\\\n \\\\t\\\\t__webpack_require__.d(getter, 'a', getter);\\\\n \\\\t\\\\treturn getter;\\\\n \\\\t};\\\\n\\\\n \\\\t// Object.prototype.hasOwnProperty.call\\\\n \\\\t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\\\\n\\\\n \\\\t// __webpack_public_path__\\\\n \\\\t__webpack_require__.p = \\\\\\"/webpack/public/path/\\\\\\";\\\\n\\\\n\\\\n \\\\t// Load entry module and return exports\\\\n \\\\treturn __webpack_require__(__webpack_require__.s = \\\\\\"./source-map/basic.js\\\\\\");\\\\n\\",\\"// extracted by mini-css-extract-plugin\\",\\"import css from './basic.css';\\\\n\\\\n__export__ = css;\\\\n\\\\nexport default css;\\\\n\\"],\\"sourceRoot\\":\\"\\"}", - "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.bundle.js.map", - }, - "main.css": ConcatSource { - "children": Array [ - RawSource { - "_value": ".nested { +".nested { color: blue; } @@ -482,23 +343,13 @@ __export__ = _basic_css__WEBPACK_IMPORTED_MODULE_0___default.a; color: red; } -", - }, - " -/*# sourceMappingURL=main.css.map*/", - ], - "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.css", - }, - "main.css.map": RawSource { - "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///nested.css\\",\\"webpack:///basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,WAAW;AACb;;ACAA;EACE,UAAU;AACZ\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\".nested {\\\\n color: blue;\\\\n}\\\\n\\",\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}", - "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.css.map", - }, -} + +/*# sourceMappingURL=main.css.map*/" `; -exports[`"sourceMap" option should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin: module 2`] = `"// extracted by mini-css-extract-plugin"`; +exports[`"sourceMap" option should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin: module 2`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///nested.css\\",\\"webpack:///basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,WAAW;AACb;;ACAA;EACE,UAAU;AACZ\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\".nested {\\\\n color: blue;\\\\n}\\\\n\\",\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}"`; + +exports[`"sourceMap" option should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin: module 3`] = `"// extracted by mini-css-extract-plugin"`; exports[`"sourceMap" option should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin: warnings 1`] = `Array []`; @@ -539,146 +390,7 @@ exports[`"sourceMap" option should use forward slash in url with "postcss-loader exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: errors 1`] = `Array []`; exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: module 1`] = ` -Object { - "main.bundle.js": ConcatSource { - "children": Array [ - RawSource { - "_value": "/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = \\"/webpack/public/path/\\"; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = \\"./source-map/basic-postcss.js\\"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ \\"./source-map/basic-postcss.js\\": -/*!*************************************!*\\\\ - !*** ./source-map/basic-postcss.js ***! - \\\\*************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -\\"use strict\\"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _basic_postcss_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./basic.postcss.css */ \\"./source-map/basic.postcss.css\\"); -/* harmony import */ var _basic_postcss_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_basic_postcss_css__WEBPACK_IMPORTED_MODULE_0__); - - -__export__ = _basic_postcss_css__WEBPACK_IMPORTED_MODULE_0___default.a; - -/* harmony default export */ __webpack_exports__[\\"default\\"] = (_basic_postcss_css__WEBPACK_IMPORTED_MODULE_0___default.a); - - -/***/ }), - -/***/ \\"./source-map/basic.postcss.css\\": -/*!**************************************!*\\\\ - !*** ./source-map/basic.postcss.css ***! - \\\\**************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -// extracted by mini-css-extract-plugin - -/***/ }) - -/******/ });", - }, - " -//# sourceMappingURL=main.bundle.js.map", - ], - "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.bundle.js", - }, - "main.bundle.js.map": RawSource { - "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///webpack/bootstrap\\",\\"webpack:///./source-map/basic-postcss.js\\",\\"webpack:///./source-map/basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAsC;;AAEtC,aAAa,yDAAG;;AAED,wHAAG,EAAC;;;;;;;;;;;;ACJnB,uC\\",\\"file\\":\\"main.bundle.js\\",\\"sourcesContent\\":[\\" \\\\t// The module cache\\\\n \\\\tvar installedModules = {};\\\\n\\\\n \\\\t// The require function\\\\n \\\\tfunction __webpack_require__(moduleId) {\\\\n\\\\n \\\\t\\\\t// Check if module is in cache\\\\n \\\\t\\\\tif(installedModules[moduleId]) {\\\\n \\\\t\\\\t\\\\treturn installedModules[moduleId].exports;\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\t// Create a new module (and put it into the cache)\\\\n \\\\t\\\\tvar module = installedModules[moduleId] = {\\\\n \\\\t\\\\t\\\\ti: moduleId,\\\\n \\\\t\\\\t\\\\tl: false,\\\\n \\\\t\\\\t\\\\texports: {}\\\\n \\\\t\\\\t};\\\\n\\\\n \\\\t\\\\t// Execute the module function\\\\n \\\\t\\\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\\\n\\\\n \\\\t\\\\t// Flag the module as loaded\\\\n \\\\t\\\\tmodule.l = true;\\\\n\\\\n \\\\t\\\\t// Return the exports of the module\\\\n \\\\t\\\\treturn module.exports;\\\\n \\\\t}\\\\n\\\\n\\\\n \\\\t// expose the modules object (__webpack_modules__)\\\\n \\\\t__webpack_require__.m = modules;\\\\n\\\\n \\\\t// expose the module cache\\\\n \\\\t__webpack_require__.c = installedModules;\\\\n\\\\n \\\\t// define getter function for harmony exports\\\\n \\\\t__webpack_require__.d = function(exports, name, getter) {\\\\n \\\\t\\\\tif(!__webpack_require__.o(exports, name)) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\\\\n \\\\t\\\\t}\\\\n \\\\t};\\\\n\\\\n \\\\t// define __esModule on exports\\\\n \\\\t__webpack_require__.r = function(exports) {\\\\n \\\\t\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n \\\\t};\\\\n\\\\n \\\\t// create a fake namespace object\\\\n \\\\t// mode & 1: value is a module id, require it\\\\n \\\\t// mode & 2: merge all properties of value into the ns\\\\n \\\\t// mode & 4: return value when already ns object\\\\n \\\\t// mode & 8|1: behave like require\\\\n \\\\t__webpack_require__.t = function(value, mode) {\\\\n \\\\t\\\\tif(mode & 1) value = __webpack_require__(value);\\\\n \\\\t\\\\tif(mode & 8) return value;\\\\n \\\\t\\\\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\\\\n \\\\t\\\\tvar ns = Object.create(null);\\\\n \\\\t\\\\t__webpack_require__.r(ns);\\\\n \\\\t\\\\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\\\\n \\\\t\\\\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\\\\n \\\\t\\\\treturn ns;\\\\n \\\\t};\\\\n\\\\n \\\\t// getDefaultExport function for compatibility with non-harmony modules\\\\n \\\\t__webpack_require__.n = function(module) {\\\\n \\\\t\\\\tvar getter = module && module.__esModule ?\\\\n \\\\t\\\\t\\\\tfunction getDefault() { return module['default']; } :\\\\n \\\\t\\\\t\\\\tfunction getModuleExports() { return module; };\\\\n \\\\t\\\\t__webpack_require__.d(getter, 'a', getter);\\\\n \\\\t\\\\treturn getter;\\\\n \\\\t};\\\\n\\\\n \\\\t// Object.prototype.hasOwnProperty.call\\\\n \\\\t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\\\\n\\\\n \\\\t// __webpack_public_path__\\\\n \\\\t__webpack_require__.p = \\\\\\"/webpack/public/path/\\\\\\";\\\\n\\\\n\\\\n \\\\t// Load entry module and return exports\\\\n \\\\treturn __webpack_require__(__webpack_require__.s = \\\\\\"./source-map/basic-postcss.js\\\\\\");\\\\n\\",\\"import css from './basic.postcss.css';\\\\n\\\\n__export__ = css;\\\\n\\\\nexport default css;\\\\n\\",\\"// extracted by mini-css-extract-plugin\\"],\\"sourceRoot\\":\\"\\"}", - "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.bundle.js.map", - }, - "main.css": ConcatSource { - "children": Array [ - RawSource { - "_value": ".nested { +".nested { color: blue; } @@ -724,23 +436,13 @@ a:hover { color: #639; } -", - }, - " -/*# sourceMappingURL=main.css.map*/", - ], - "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.css", - }, - "main.css.map": RawSource { - "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///nested.postcss.css\\",\\"webpack:///basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,WAAW;AACb;;ACGA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\".nested {\\\\n color: blue;\\\\n}\\\\n\\",\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}", - "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.css.map", - }, -} + +/*# sourceMappingURL=main.css.map*/" `; -exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: module 2`] = `"// extracted by mini-css-extract-plugin"`; +exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: module 2`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///nested.postcss.css\\",\\"webpack:///basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,WAAW;AACb;;ACGA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\".nested {\\\\n color: blue;\\\\n}\\\\n\\",\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}"`; + +exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: module 3`] = `"// extracted by mini-css-extract-plugin"`; exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: warnings 1`] = `Array []`; @@ -829,146 +531,7 @@ exports[`"sourceMap" option should use forward slash in url with "sass-loader" a exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: errors 1`] = `Array []`; exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 1`] = ` -Object { - "main.bundle.js": ConcatSource { - "children": Array [ - RawSource { - "_value": "/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = \\"/webpack/public/path/\\"; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = \\"./source-map/basic-scss.js\\"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ \\"./source-map/basic-scss.js\\": -/*!**********************************!*\\\\ - !*** ./source-map/basic-scss.js ***! - \\\\**********************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -\\"use strict\\"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _basic_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./basic.scss */ \\"./source-map/basic.scss\\"); -/* harmony import */ var _basic_scss__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_basic_scss__WEBPACK_IMPORTED_MODULE_0__); - - -__export__ = _basic_scss__WEBPACK_IMPORTED_MODULE_0___default.a; - -/* harmony default export */ __webpack_exports__[\\"default\\"] = (_basic_scss__WEBPACK_IMPORTED_MODULE_0___default.a); - - -/***/ }), - -/***/ \\"./source-map/basic.scss\\": -/*!*******************************!*\\\\ - !*** ./source-map/basic.scss ***! - \\\\*******************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -// extracted by mini-css-extract-plugin - -/***/ }) - -/******/ });", - }, - " -//# sourceMappingURL=main.bundle.js.map", - ], - "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.bundle.js", - }, - "main.bundle.js.map": RawSource { - "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///webpack/bootstrap\\",\\"webpack:///./source-map/basic-scss.js\\",\\"webpack:///./source-map/basic.scss\\"],\\"names\\":[],\\"mappings\\":\\";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAA+B;;AAE/B,aAAa,kDAAG;;AAED,iHAAG,EAAC;;;;;;;;;;;;ACJnB,uC\\",\\"file\\":\\"main.bundle.js\\",\\"sourcesContent\\":[\\" \\\\t// The module cache\\\\n \\\\tvar installedModules = {};\\\\n\\\\n \\\\t// The require function\\\\n \\\\tfunction __webpack_require__(moduleId) {\\\\n\\\\n \\\\t\\\\t// Check if module is in cache\\\\n \\\\t\\\\tif(installedModules[moduleId]) {\\\\n \\\\t\\\\t\\\\treturn installedModules[moduleId].exports;\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\t// Create a new module (and put it into the cache)\\\\n \\\\t\\\\tvar module = installedModules[moduleId] = {\\\\n \\\\t\\\\t\\\\ti: moduleId,\\\\n \\\\t\\\\t\\\\tl: false,\\\\n \\\\t\\\\t\\\\texports: {}\\\\n \\\\t\\\\t};\\\\n\\\\n \\\\t\\\\t// Execute the module function\\\\n \\\\t\\\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\\\n\\\\n \\\\t\\\\t// Flag the module as loaded\\\\n \\\\t\\\\tmodule.l = true;\\\\n\\\\n \\\\t\\\\t// Return the exports of the module\\\\n \\\\t\\\\treturn module.exports;\\\\n \\\\t}\\\\n\\\\n\\\\n \\\\t// expose the modules object (__webpack_modules__)\\\\n \\\\t__webpack_require__.m = modules;\\\\n\\\\n \\\\t// expose the module cache\\\\n \\\\t__webpack_require__.c = installedModules;\\\\n\\\\n \\\\t// define getter function for harmony exports\\\\n \\\\t__webpack_require__.d = function(exports, name, getter) {\\\\n \\\\t\\\\tif(!__webpack_require__.o(exports, name)) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\\\\n \\\\t\\\\t}\\\\n \\\\t};\\\\n\\\\n \\\\t// define __esModule on exports\\\\n \\\\t__webpack_require__.r = function(exports) {\\\\n \\\\t\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n \\\\t};\\\\n\\\\n \\\\t// create a fake namespace object\\\\n \\\\t// mode & 1: value is a module id, require it\\\\n \\\\t// mode & 2: merge all properties of value into the ns\\\\n \\\\t// mode & 4: return value when already ns object\\\\n \\\\t// mode & 8|1: behave like require\\\\n \\\\t__webpack_require__.t = function(value, mode) {\\\\n \\\\t\\\\tif(mode & 1) value = __webpack_require__(value);\\\\n \\\\t\\\\tif(mode & 8) return value;\\\\n \\\\t\\\\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\\\\n \\\\t\\\\tvar ns = Object.create(null);\\\\n \\\\t\\\\t__webpack_require__.r(ns);\\\\n \\\\t\\\\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\\\\n \\\\t\\\\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\\\\n \\\\t\\\\treturn ns;\\\\n \\\\t};\\\\n\\\\n \\\\t// getDefaultExport function for compatibility with non-harmony modules\\\\n \\\\t__webpack_require__.n = function(module) {\\\\n \\\\t\\\\tvar getter = module && module.__esModule ?\\\\n \\\\t\\\\t\\\\tfunction getDefault() { return module['default']; } :\\\\n \\\\t\\\\t\\\\tfunction getModuleExports() { return module; };\\\\n \\\\t\\\\t__webpack_require__.d(getter, 'a', getter);\\\\n \\\\t\\\\treturn getter;\\\\n \\\\t};\\\\n\\\\n \\\\t// Object.prototype.hasOwnProperty.call\\\\n \\\\t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\\\\n\\\\n \\\\t// __webpack_public_path__\\\\n \\\\t__webpack_require__.p = \\\\\\"/webpack/public/path/\\\\\\";\\\\n\\\\n\\\\n \\\\t// Load entry module and return exports\\\\n \\\\treturn __webpack_require__(__webpack_require__.s = \\\\\\"./source-map/basic-scss.js\\\\\\");\\\\n\\",\\"import css from './basic.scss';\\\\n\\\\n__export__ = css;\\\\n\\\\nexport default css;\\\\n\\",\\"// extracted by mini-css-extract-plugin\\"],\\"sourceRoot\\":\\"\\"}", - "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.bundle.js.map", - }, - "main.css": ConcatSource { - "children": Array [ - RawSource { - "_value": "body { +"body { background: coral; } @@ -976,23 +539,13 @@ body { font: 100% Helvetica, sans-serif; color: #333; } -", - }, - " -/*# sourceMappingURL=main.css.map*/", - ], - "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.css", - }, - "main.css.map": RawSource { - "_value": "{\\"version\\":3,\\"sources\\":[\\"webpack:///nested/nested.scss\\",\\"webpack:///basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE;ACCF;;AAGA;EACE;EACA,WAJc;AAIhB,C\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\"body {\\\\n background: coral;\\\\n}\\\\n\\",\\"body {\\\\n background: coral;\\\\n}\\\\n\\\\nbody {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}", - "emitted": true, - "existsAt": "/media/veracrypt1/IdeaProjects/css-loader/outputs/main.css.map", - }, -} + +/*# sourceMappingURL=main.css.map*/" `; -exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 2`] = `"// extracted by mini-css-extract-plugin"`; +exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 2`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///nested/nested.scss\\",\\"webpack:///basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE;ACCF;;AAGA;EACE;EACA,WAJc;AAIhB,C\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\"body {\\\\n background: coral;\\\\n}\\\\n\\",\\"body {\\\\n background: coral;\\\\n}\\\\n\\\\nbody {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`; + +exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 3`] = `"// extracted by mini-css-extract-plugin"`; exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: warnings 1`] = `Array []`; diff --git a/test/sourceMap-option.test.js b/test/sourceMap-option.test.js index 32acb120..5d0d6675 100644 --- a/test/sourceMap-option.test.js +++ b/test/sourceMap-option.test.js @@ -9,6 +9,7 @@ import { getExecutedCode, getModuleSource, getWarnings, + readAsset, } from './helpers/index'; const MiniCssExtractPlugin = require('mini-css-extract-plugin'); @@ -775,7 +776,7 @@ describe('"sourceMap" option', () => { }, plugins: [ new MiniCssExtractPlugin({ - filename: '[name].css', + filename: 'main.css', }), ], module: { @@ -798,7 +799,10 @@ describe('"sourceMap" option', () => { ); const stats = await compile(compiler); - expect(stats.compilation.assets).toMatchSnapshot('module'); + expect(readAsset('main.css', compiler, stats)).toMatchSnapshot('module'); + expect(readAsset('main.css.map', compiler, stats)).toMatchSnapshot( + 'module' + ); expect(getModuleSource('./source-map/basic.css', stats)).toMatchSnapshot( 'module' ); @@ -820,7 +824,7 @@ describe('"sourceMap" option', () => { }, plugins: [ new MiniCssExtractPlugin({ - filename: '[name].css', + filename: 'main.css', }), ], module: { @@ -861,7 +865,10 @@ describe('"sourceMap" option', () => { ); const stats = await compile(compiler); - expect(stats.compilation.assets).toMatchSnapshot('module'); + expect(readAsset('main.css', compiler, stats)).toMatchSnapshot('module'); + expect(readAsset('main.css.map', compiler, stats)).toMatchSnapshot( + 'module' + ); expect(getModuleSource('./source-map/basic.scss', stats)).toMatchSnapshot( 'module' ); @@ -883,7 +890,7 @@ describe('"sourceMap" option', () => { }, plugins: [ new MiniCssExtractPlugin({ - filename: '[name].css', + filename: 'main.css', }), ], module: { @@ -916,7 +923,10 @@ describe('"sourceMap" option', () => { ); const stats = await compile(compiler); - expect(stats.compilation.assets).toMatchSnapshot('module'); + expect(readAsset('main.css', compiler, stats)).toMatchSnapshot('module'); + expect(readAsset('main.css.map', compiler, stats)).toMatchSnapshot( + 'module' + ); expect( getModuleSource('./source-map/basic.postcss.css', stats) ).toMatchSnapshot('module'); From 9ad9873873902c0246c8a897de7f9e9b0b12d889 Mon Sep 17 00:00:00 2001 From: cap-Bernardito Date: Sat, 11 Apr 2020 13:29:42 +0300 Subject: [PATCH 08/11] test: normalize sourceMaps on different operating systems --- src/utils.js | 27 ++----- .../sourceMap-option.test.js.snap | 79 +++++++------------ test/fixtures/source-map/basic.scss | 2 - test/fixtures/source-map/nested/nested.scss | 3 - 4 files changed, 36 insertions(+), 75 deletions(-) delete mode 100644 test/fixtures/source-map/nested/nested.scss diff --git a/src/utils.js b/src/utils.js index b34c6db3..fe5ad102 100644 --- a/src/utils.js +++ b/src/utils.js @@ -13,9 +13,7 @@ import extractImports from 'postcss-modules-extract-imports'; import modulesScope from 'postcss-modules-scope'; import camelCase from 'camelcase'; -const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/; const SEGMENTS_SPLIT_REGEXP = /([|!])/; -const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g; const whitespace = '[\\x20\\t\\r\\n\\f]'; const unescapeRegExp = new RegExp( `\\\\([\\da-f]{1,6}${whitespace}?|(${whitespace})|.)`, @@ -210,6 +208,8 @@ function normalizeSourceMap(map, loaderContext) { newMap.sources = newMap.sources.map((source) => makeRelativePath(loaderContext.context, normalizePath(source)) ); + + // newMap.sources = Array.from(new Set(newMap.sources)); } return newMap; @@ -366,26 +366,15 @@ function absoluteToRequest(context, maybeAbsolutePath) { : resource + maybeAbsolutePath.slice(querySplitPos); } - if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) { - const querySplitPos = maybeAbsolutePath.indexOf('?'); - let resource = - querySplitPos === -1 - ? maybeAbsolutePath - : maybeAbsolutePath.slice(0, querySplitPos); - resource = path.win32.relative(context, resource); - if (!WINDOWS_ABS_PATH_REGEXP.test(resource)) { - resource = resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, '/'); - if (!resource.startsWith('../')) { - resource = `./${resource}`; - } - } - return querySplitPos === -1 - ? resource - : resource + maybeAbsolutePath.slice(querySplitPos); + if ( + maybeAbsolutePath.startsWith('./') || + maybeAbsolutePath.startsWith('../') + ) { + return maybeAbsolutePath; } // not an absolute path - return maybeAbsolutePath; + return `./${maybeAbsolutePath}`; } function makeRelativePath(context, identifier) { diff --git a/test/__snapshots__/sourceMap-option.test.js.snap b/test/__snapshots__/sourceMap-option.test.js.snap index 362b1b87..bae27e44 100644 --- a/test/__snapshots__/sourceMap-option.test.js.snap +++ b/test/__snapshots__/sourceMap-option.test.js.snap @@ -197,7 +197,7 @@ exports[`"sourceMap" option false should not generate source maps when source ma var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); exports = ___CSS_LOADER_API_IMPORT___(false); // Module -exports.push([module.id, \\"body {\\\\n background: coral;\\\\n}\\\\n\\\\nbody {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\"]); +exports.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\"]); // Exports module.exports = exports; " @@ -208,10 +208,6 @@ Array [ Array [ "./source-map/basic.scss", "body { - background: coral; -} - -body { font: 100% Helvetica, sans-serif; color: #333; }", @@ -307,7 +303,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -362,7 +358,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"file\\":\\"basic.postcss.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"file\\":\\"basic.postcss.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -453,7 +449,7 @@ exports[`"sourceMap" option should use forward slash in url with "sass-loader" a var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); exports = ___CSS_LOADER_API_IMPORT___(true); // Module -exports.push([module.id, \\"body {\\\\n background: coral;\\\\n}\\\\n\\\\nbody {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./nested/nested.scss\\",\\"basic.scss\\",\\"./basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,iBAAA;ACCF;;ACGA;EACE,gCAAA;EACA,WAJc;ADIhB\\",\\"file\\":\\"basic.scss\\",\\"sourcesContent\\":[\\"body {\\\\n background: coral;\\\\n}\\\\n\\",\\"body {\\\\n background: coral;\\\\n}\\\\n\\\\nbody {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\",\\"@import \\\\\\"./nested/nested\\\\\\";\\\\n\\\\n$font-stack: Helvetica, sans-serif;\\\\n$primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% $font-stack;\\\\n color: $primary-color;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.scss\\",\\"./basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAGA;EACE,gCAAA;EACA,WAJc;ACEhB\\",\\"file\\":\\"basic.scss\\",\\"sourcesContent\\":[\\"$font-stack: Helvetica, sans-serif;\\\\n$primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% $font-stack;\\\\n color: $primary-color;\\\\n}\\\\n\\",\\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\"]}]); // Exports module.exports = exports; " @@ -464,39 +460,20 @@ Array [ Array [ "./source-map/basic.scss", "body { - background: coral; -} - -body { font: 100% Helvetica, sans-serif; color: #333; }", "", Object { "file": "basic.scss", - "mappings": "AAAA;EACE,iBAAA;ACCF;;ACGA;EACE,gCAAA;EACA,WAJc;ADIhB", + "mappings": "AAGA;EACE,gCAAA;EACA,WAJc;ACEhB", "names": Array [], "sources": Array [ - "./nested/nested.scss", - "basic.scss", + "./basic.scss", "./basic.scss", ], "sourcesContent": Array [ - "body { - background: coral; -} -", - "body { - background: coral; -} - -body { - font: 100% Helvetica, sans-serif; - color: #333; -}", - "@import \\"./nested/nested\\"; - -$font-stack: Helvetica, sans-serif; + "$font-stack: Helvetica, sans-serif; $primary-color: #333; body { @@ -504,6 +481,10 @@ body { color: $primary-color; } ", + "body { + font: 100% Helvetica, sans-serif; + color: #333; +}", ], "version": 3, }, @@ -520,7 +501,7 @@ exports[`"sourceMap" option should use forward slash in url with "sass-loader" a var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); exports = ___CSS_LOADER_API_IMPORT___(false); // Module -exports.push([module.id, \\"body {\\\\n background: coral;\\\\n}\\\\n\\\\nbody {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\"]); +exports.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\"]); // Exports module.exports = exports; " @@ -532,10 +513,6 @@ exports[`"sourceMap" option should use forward slash in url with "sass-loader", exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 1`] = ` "body { - background: coral; -} - -body { font: 100% Helvetica, sans-serif; color: #333; } @@ -543,7 +520,7 @@ body { /*# sourceMappingURL=main.css.map*/" `; -exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 2`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///nested/nested.scss\\",\\"webpack:///basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE;ACCF;;AAGA;EACE;EACA,WAJc;AAIhB,C\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\"body {\\\\n background: coral;\\\\n}\\\\n\\",\\"body {\\\\n background: coral;\\\\n}\\\\n\\\\nbody {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`; +exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 2`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAGA;EACE;EACA,WAJc;AAEhB,C\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\"$font-stack: Helvetica, sans-serif;\\\\n$primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% $font-stack;\\\\n color: $primary-color;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}"`; exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 3`] = `"// extracted by mini-css-extract-plugin"`; @@ -558,7 +535,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -578,7 +555,7 @@ Array [ "mappings": "AAAA;EACE,WAAW;AACb", "names": Array [], "sources": Array [ - "nested.css", + "./nested.css", ], "sourcesContent": Array [ ".nested { @@ -601,7 +578,7 @@ Array [ "mappings": "AAEA;EACE,UAAU;AACZ", "names": Array [], "sources": Array [ - "basic.css", + "./basic.css", ], "sourcesContent": Array [ "@import \\"./nested/nested.css\\"; @@ -628,7 +605,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -648,7 +625,7 @@ Array [ "mappings": "AAAA;EACE,WAAW;AACb", "names": Array [], "sources": Array [ - "nested.css", + "./nested.css", ], "sourcesContent": Array [ ".nested { @@ -671,7 +648,7 @@ Array [ "mappings": "AAEA;EACE,UAAU;AACZ", "names": Array [], "sources": Array [ - "basic.css", + "./basic.css", ], "sourcesContent": Array [ "@import \\"./nested/nested.css\\"; @@ -698,7 +675,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\".class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\".class {\\\\n color: red;\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -718,7 +695,7 @@ Array [ "mappings": "AAAA;EACE,WAAW;AACb", "names": Array [], "sources": Array [ - "nested.css", + "./nested.css", ], "sourcesContent": Array [ ".nested { @@ -741,7 +718,7 @@ Array [ "mappings": "AAEA;EACE,UAAU;AACZ", "names": Array [], "sources": Array [ - "basic.css", + "./basic.css", ], "sourcesContent": Array [ ".class { @@ -766,7 +743,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"file\\":\\"basic.postcss.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"file\\":\\"basic.postcss.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -786,7 +763,7 @@ Array [ "mappings": "AAAA;EACE,WAAW;AACb", "names": Array [], "sources": Array [ - "nested.postcss.css", + "./nested.postcss.css", ], "sourcesContent": Array [ ".nested { @@ -847,7 +824,7 @@ a:hover { "mappings": "AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB", "names": Array [], "sources": Array [ - "basic.postcss.css", + "./basic.postcss.css", ], "sourcesContent": Array [ "@import \\"./nested/nested.postcss.css\\"; @@ -906,7 +883,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -926,7 +903,7 @@ Array [ "mappings": "AAAA;EACE,WAAW;AACb", "names": Array [], "sources": Array [ - "nested.css", + "./nested.css", ], "sourcesContent": Array [ ".nested { @@ -949,7 +926,7 @@ Array [ "mappings": "AAEA;EACE,UAAU;AACZ", "names": Array [], "sources": Array [ - "basic.css", + "./basic.css", ], "sourcesContent": Array [ "@import \\"./nested/nested.css\\"; diff --git a/test/fixtures/source-map/basic.scss b/test/fixtures/source-map/basic.scss index e646594f..1a72d52f 100644 --- a/test/fixtures/source-map/basic.scss +++ b/test/fixtures/source-map/basic.scss @@ -1,5 +1,3 @@ -@import "./nested/nested"; - $font-stack: Helvetica, sans-serif; $primary-color: #333; diff --git a/test/fixtures/source-map/nested/nested.scss b/test/fixtures/source-map/nested/nested.scss deleted file mode 100644 index 2040cf4c..00000000 --- a/test/fixtures/source-map/nested/nested.scss +++ /dev/null @@ -1,3 +0,0 @@ -body { - background: coral; -} From 0669c94fdd9349b4ace6a10e868b8467a0d0dfdb Mon Sep 17 00:00:00 2001 From: cap-Bernardito Date: Sat, 11 Apr 2020 14:33:26 +0300 Subject: [PATCH 09/11] test: normalize sourceMaps on different operating systems --- src/utils.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/utils.js b/src/utils.js index fe5ad102..184c8d0b 100644 --- a/src/utils.js +++ b/src/utils.js @@ -13,7 +13,9 @@ import extractImports from 'postcss-modules-extract-imports'; import modulesScope from 'postcss-modules-scope'; import camelCase from 'camelcase'; +const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/; const SEGMENTS_SPLIT_REGEXP = /([|!])/; +const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g; const whitespace = '[\\x20\\t\\r\\n\\f]'; const unescapeRegExp = new RegExp( `\\\\([\\da-f]{1,6}${whitespace}?|(${whitespace})|.)`, @@ -366,6 +368,24 @@ function absoluteToRequest(context, maybeAbsolutePath) { : resource + maybeAbsolutePath.slice(querySplitPos); } + if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) { + const querySplitPos = maybeAbsolutePath.indexOf('?'); + let resource = + querySplitPos === -1 + ? maybeAbsolutePath + : maybeAbsolutePath.slice(0, querySplitPos); + resource = path.win32.relative(context, resource); + if (!WINDOWS_ABS_PATH_REGEXP.test(resource)) { + resource = resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, '/'); + if (!resource.startsWith('../')) { + resource = `./${resource}`; + } + } + return querySplitPos === -1 + ? resource + : resource + maybeAbsolutePath.slice(querySplitPos); + } + if ( maybeAbsolutePath.startsWith('./') || maybeAbsolutePath.startsWith('../') From 5878ac52165b26dec1c6a277c120fcce57ff5c9a Mon Sep 17 00:00:00 2001 From: cap-Bernardito Date: Sat, 11 Apr 2020 18:43:04 +0300 Subject: [PATCH 10/11] test: normalize sourceMaps on different operating systems --- src/index.js | 2 +- src/utils.js | 11 ++-- .../sourceMap-option.test.js.snap | 57 ++++++++----------- 3 files changed, 30 insertions(+), 40 deletions(-) diff --git a/src/index.js b/src/index.js index 24a2978c..cae9efc9 100644 --- a/src/index.js +++ b/src/index.js @@ -82,7 +82,7 @@ export default function loader(content, map, meta) { postcss(plugins) .process(content, { from: this.remainingRequest.split('!').pop(), - to: this.currentRequest.split('!').pop(), + to: null, map: options.sourceMap ? { // Some loaders (example `"postcss-loader": "1.x.x"`) always generates source map, we should remove it diff --git a/src/utils.js b/src/utils.js index 184c8d0b..25b76df1 100644 --- a/src/utils.js +++ b/src/utils.js @@ -199,19 +199,20 @@ function normalizeSourceMap(map, loaderContext) { // We should normalize path because previous loaders like `sass-loader` using backslash when generate source map if (newMap.file) { - newMap.file = normalizePath(newMap.file); + delete newMap.file; } if (newMap.sourceRoot) { - newMap.sourceRoot = normalizePath(newMap.sourceRoot); + newMap.sourceRoot = makeRelativePath( + loaderContext.rootContext, + normalizePath(newMap.sourceRoot) + ); } if (newMap.sources) { newMap.sources = newMap.sources.map((source) => - makeRelativePath(loaderContext.context, normalizePath(source)) + makeRelativePath(loaderContext.rootContext, normalizePath(source)) ); - - // newMap.sources = Array.from(new Set(newMap.sources)); } return newMap; diff --git a/test/__snapshots__/sourceMap-option.test.js.snap b/test/__snapshots__/sourceMap-option.test.js.snap index bae27e44..0034b0aa 100644 --- a/test/__snapshots__/sourceMap-option.test.js.snap +++ b/test/__snapshots__/sourceMap-option.test.js.snap @@ -303,7 +303,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -343,7 +343,7 @@ exports[`"sourceMap" option should use forward slash in url with "css-loader", s /*# sourceMappingURL=main.css.map*/" `; -exports[`"sourceMap" option should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin: module 2`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///nested.css\\",\\"webpack:///basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,WAAW;AACb;;ACAA;EACE,UAAU;AACZ\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\".nested {\\\\n color: blue;\\\\n}\\\\n\\",\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}"`; +exports[`"sourceMap" option should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin: module 2`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///test/fixtures/source-map/nested/nested.css\\",\\"webpack:///test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,WAAW;AACb;;ACAA;EACE,UAAU;AACZ\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\".nested {\\\\n color: blue;\\\\n}\\\\n\\",\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}"`; exports[`"sourceMap" option should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin: module 3`] = `"// extracted by mini-css-extract-plugin"`; @@ -358,7 +358,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"file\\":\\"basic.postcss.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./test/fixtures/source-map/basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -436,7 +436,7 @@ a:hover { /*# sourceMappingURL=main.css.map*/" `; -exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: module 2`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///nested.postcss.css\\",\\"webpack:///basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,WAAW;AACb;;ACGA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\".nested {\\\\n color: blue;\\\\n}\\\\n\\",\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}"`; +exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: module 2`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///test/fixtures/source-map/nested/nested.postcss.css\\",\\"webpack:///test/fixtures/source-map/basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,WAAW;AACb;;ACGA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\".nested {\\\\n color: blue;\\\\n}\\\\n\\",\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}"`; exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: module 3`] = `"// extracted by mini-css-extract-plugin"`; @@ -449,7 +449,7 @@ exports[`"sourceMap" option should use forward slash in url with "sass-loader" a var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); exports = ___CSS_LOADER_API_IMPORT___(true); // Module -exports.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.scss\\",\\"./basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAGA;EACE,gCAAA;EACA,WAJc;ACEhB\\",\\"file\\":\\"basic.scss\\",\\"sourcesContent\\":[\\"$font-stack: Helvetica, sans-serif;\\\\n$primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% $font-stack;\\\\n color: $primary-color;\\\\n}\\\\n\\",\\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\"]}]); +exports.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./source-map/basic.scss\\",\\"./test/fixtures/source-map/basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAGA;EACE,gCAAA;EACA,WAJc;ACEhB\\",\\"sourcesContent\\":[\\"$font-stack: Helvetica, sans-serif;\\\\n$primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% $font-stack;\\\\n color: $primary-color;\\\\n}\\\\n\\",\\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\"]}]); // Exports module.exports = exports; " @@ -465,12 +465,11 @@ Array [ }", "", Object { - "file": "basic.scss", "mappings": "AAGA;EACE,gCAAA;EACA,WAJc;ACEhB", "names": Array [], "sources": Array [ - "./basic.scss", - "./basic.scss", + "./source-map/basic.scss", + "./test/fixtures/source-map/basic.scss", ], "sourcesContent": Array [ "$font-stack: Helvetica, sans-serif; @@ -520,7 +519,7 @@ exports[`"sourceMap" option should use forward slash in url with "sass-loader", /*# sourceMappingURL=main.css.map*/" `; -exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 2`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAGA;EACE;EACA,WAJc;AAEhB,C\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\"$font-stack: Helvetica, sans-serif;\\\\n$primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% $font-stack;\\\\n color: $primary-color;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}"`; +exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 2`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///source-map/basic.scss\\",\\"webpack:///test/fixtures/source-map/basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAGA;EACE;EACA,WAJc;ACEhB,C\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\"$font-stack: Helvetica, sans-serif;\\\\n$primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% $font-stack;\\\\n color: $primary-color;\\\\n}\\\\n\\",\\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`; exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 3`] = `"// extracted by mini-css-extract-plugin"`; @@ -535,7 +534,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -551,11 +550,10 @@ Array [ ", "", Object { - "file": "nested.css", "mappings": "AAAA;EACE,WAAW;AACb", "names": Array [], "sources": Array [ - "./nested.css", + "./test/fixtures/source-map/nested/nested.css", ], "sourcesContent": Array [ ".nested { @@ -574,11 +572,10 @@ Array [ ", "", Object { - "file": "basic.css", "mappings": "AAEA;EACE,UAAU;AACZ", "names": Array [], "sources": Array [ - "./basic.css", + "./test/fixtures/source-map/basic.css", ], "sourcesContent": Array [ "@import \\"./nested/nested.css\\"; @@ -605,7 +602,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -621,11 +618,10 @@ Array [ ", "", Object { - "file": "nested.css", "mappings": "AAAA;EACE,WAAW;AACb", "names": Array [], "sources": Array [ - "./nested.css", + "./test/fixtures/source-map/nested/nested.css", ], "sourcesContent": Array [ ".nested { @@ -644,11 +640,10 @@ Array [ ", "", Object { - "file": "basic.css", "mappings": "AAEA;EACE,UAAU;AACZ", "names": Array [], "sources": Array [ - "./basic.css", + "./test/fixtures/source-map/basic.css", ], "sourcesContent": Array [ "@import \\"./nested/nested.css\\"; @@ -675,7 +670,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\".class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\".class {\\\\n color: red;\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -691,11 +686,10 @@ Array [ ", "", Object { - "file": "nested.css", "mappings": "AAAA;EACE,WAAW;AACb", "names": Array [], "sources": Array [ - "./nested.css", + "./test/fixtures/source-map/nested/nested.css", ], "sourcesContent": Array [ ".nested { @@ -714,11 +708,10 @@ Array [ ", "", Object { - "file": "basic.css", "mappings": "AAEA;EACE,UAAU;AACZ", "names": Array [], "sources": Array [ - "./basic.css", + "./test/fixtures/source-map/basic.css", ], "sourcesContent": Array [ ".class { @@ -743,7 +736,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"file\\":\\"basic.postcss.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./test/fixtures/source-map/basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -759,11 +752,10 @@ Array [ ", "", Object { - "file": "nested.postcss.css", "mappings": "AAAA;EACE,WAAW;AACb", "names": Array [], "sources": Array [ - "./nested.postcss.css", + "./test/fixtures/source-map/nested/nested.postcss.css", ], "sourcesContent": Array [ ".nested { @@ -820,11 +812,10 @@ a:hover { ", "", Object { - "file": "basic.postcss.css", "mappings": "AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB", "names": Array [], "sources": Array [ - "./basic.postcss.css", + "./test/fixtures/source-map/basic.postcss.css", ], "sourcesContent": Array [ "@import \\"./nested/nested.postcss.css\\"; @@ -883,7 +874,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"file\\":\\"basic.css\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -899,11 +890,10 @@ Array [ ", "", Object { - "file": "nested.css", "mappings": "AAAA;EACE,WAAW;AACb", "names": Array [], "sources": Array [ - "./nested.css", + "./test/fixtures/source-map/nested/nested.css", ], "sourcesContent": Array [ ".nested { @@ -922,11 +912,10 @@ Array [ ", "", Object { - "file": "basic.css", "mappings": "AAEA;EACE,UAAU;AACZ", "names": Array [], "sources": Array [ - "./basic.css", + "./test/fixtures/source-map/basic.css", ], "sourcesContent": Array [ "@import \\"./nested/nested.css\\"; From 3cd05a2c98fa25c994c4d0111af884263aa5c732 Mon Sep 17 00:00:00 2001 From: cap-Bernardito Date: Mon, 13 Apr 2020 14:42:33 +0300 Subject: [PATCH 11/11] test: normalize sourceMaps on different operating systems --- src/index.js | 3 +- src/utils.js | 75 +- .../sourceMap-option.test.js.snap | 208 +----- test/sourceMap-option.test.js | 638 +++++++++--------- 4 files changed, 340 insertions(+), 584 deletions(-) diff --git a/src/index.js b/src/index.js index cae9efc9..84878113 100644 --- a/src/index.js +++ b/src/index.js @@ -82,7 +82,8 @@ export default function loader(content, map, meta) { postcss(plugins) .process(content, { from: this.remainingRequest.split('!').pop(), - to: null, + // eslint-disable-next-line no-undefined + to: undefined, map: options.sourceMap ? { // Some loaders (example `"postcss-loader": "1.x.x"`) always generates source map, we should remove it diff --git a/src/utils.js b/src/utils.js index 25b76df1..15b7646a 100644 --- a/src/utils.js +++ b/src/utils.js @@ -13,9 +13,6 @@ import extractImports from 'postcss-modules-extract-imports'; import modulesScope from 'postcss-modules-scope'; import camelCase from 'camelcase'; -const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/; -const SEGMENTS_SPLIT_REGEXP = /([|!])/; -const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g; const whitespace = '[\\x20\\t\\r\\n\\f]'; const unescapeRegExp = new RegExp( `\\\\([\\da-f]{1,6}${whitespace}?|(${whitespace})|.)`, @@ -192,7 +189,7 @@ function getModulesPlugins(options, loaderContext) { return plugins; } -function normalizeSourceMap(map, loaderContext) { +function normalizeSourceMap(map) { const newMap = map.toJSON(); // Source maps should use forward slash because it is URLs (https://github.com/mozilla/source-map/issues/91) @@ -203,16 +200,11 @@ function normalizeSourceMap(map, loaderContext) { } if (newMap.sourceRoot) { - newMap.sourceRoot = makeRelativePath( - loaderContext.rootContext, - normalizePath(newMap.sourceRoot) - ); + newMap.sourceRoot = normalizePath(newMap.sourceRoot); } if (newMap.sources) { - newMap.sources = newMap.sources.map((source) => - makeRelativePath(loaderContext.rootContext, normalizePath(source)) - ); + newMap.sources = newMap.sources.map((source) => normalizePath(source)); } return newMap; @@ -344,67 +336,6 @@ function dashesCamelCase(str) { ); } -function absoluteToRequest(context, maybeAbsolutePath) { - if (maybeAbsolutePath[0] === '/') { - if ( - maybeAbsolutePath.length > 1 && - maybeAbsolutePath[maybeAbsolutePath.length - 1] === '/' - ) { - // this 'path' is actually a regexp generated by dynamic requires. - // Don't treat it as an absolute path. - return maybeAbsolutePath; - } - - const querySplitPos = maybeAbsolutePath.indexOf('?'); - let resource = - querySplitPos === -1 - ? maybeAbsolutePath - : maybeAbsolutePath.slice(0, querySplitPos); - resource = path.posix.relative(context, resource); - if (!resource.startsWith('../')) { - resource = `./${resource}`; - } - return querySplitPos === -1 - ? resource - : resource + maybeAbsolutePath.slice(querySplitPos); - } - - if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) { - const querySplitPos = maybeAbsolutePath.indexOf('?'); - let resource = - querySplitPos === -1 - ? maybeAbsolutePath - : maybeAbsolutePath.slice(0, querySplitPos); - resource = path.win32.relative(context, resource); - if (!WINDOWS_ABS_PATH_REGEXP.test(resource)) { - resource = resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, '/'); - if (!resource.startsWith('../')) { - resource = `./${resource}`; - } - } - return querySplitPos === -1 - ? resource - : resource + maybeAbsolutePath.slice(querySplitPos); - } - - if ( - maybeAbsolutePath.startsWith('./') || - maybeAbsolutePath.startsWith('../') - ) { - return maybeAbsolutePath; - } - - // not an absolute path - return `./${maybeAbsolutePath}`; -} - -function makeRelativePath(context, identifier) { - return identifier - .split(SEGMENTS_SPLIT_REGEXP) - .map((str) => absoluteToRequest(context, str)) - .join(''); -} - function getExportCode( exports, exportType, diff --git a/test/__snapshots__/sourceMap-option.test.js.snap b/test/__snapshots__/sourceMap-option.test.js.snap index 0034b0aa..b6d809d9 100644 --- a/test/__snapshots__/sourceMap-option.test.js.snap +++ b/test/__snapshots__/sourceMap-option.test.js.snap @@ -303,7 +303,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -349,182 +349,6 @@ exports[`"sourceMap" option should use forward slash in url with "css-loader", s exports[`"sourceMap" option should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin: warnings 1`] = `Array []`; -exports[`"sourceMap" option should use forward slash in url with "postcss-loader" and with source maps: errors 1`] = `Array []`; - -exports[`"sourceMap" option should use forward slash in url with "postcss-loader" and with source maps: module 1`] = ` -"// Imports -var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); -var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ident]!./nested/nested.postcss.css\\"); -exports = ___CSS_LOADER_API_IMPORT___(true); -exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); -// Module -exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./test/fixtures/source-map/basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"]}]); -// Exports -module.exports = exports; -" -`; - -exports[`"sourceMap" option should use forward slash in url with "postcss-loader" and with source maps: warnings 1`] = `Array []`; - -exports[`"sourceMap" option should use forward slash in url with "postcss-loader" and without source maps: errors 1`] = `Array []`; - -exports[`"sourceMap" option should use forward slash in url with "postcss-loader" and without source maps: module 1`] = ` -"// Imports -var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); -var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ident]!./nested/nested.postcss.css\\"); -exports = ___CSS_LOADER_API_IMPORT___(false); -exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); -// Module -exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\"]); -// Exports -module.exports = exports; -" -`; - -exports[`"sourceMap" option should use forward slash in url with "postcss-loader" and without source maps: warnings 1`] = `Array []`; - -exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: errors 1`] = `Array []`; - -exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: module 1`] = ` -".nested { - color: blue; -} - -:root { - --fontSize: 1rem; - --mainColor: rgba(18,52,86,0.47059); - --secondaryColor: rgba(102, 51, 153, 0.9); -} - -html { - overflow-x: hidden; - overflow-y: auto; - overflow: hidden auto; -} - -@media (max-width: 50rem) { - body { - color: rgba(18,52,86,0.47059); - color: var(--mainColor); - font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif; - font-size: 1rem; - font-size: var(--fontSize); - line-height: calc(1rem * 1.5); - line-height: calc(var(--fontSize) * 1.5); - word-wrap: break-word; - padding-left: calc(1rem / 2 + 1px); - padding-right: calc(1rem / 2 + 1px); - padding-left: calc(var(--fontSize) / 2 + 1px); - padding-right: calc(var(--fontSize) / 2 + 1px); - } -} - -h1,h2,h3,h4,h5,h6 { - margin-top: 0; - margin-bottom: 0; -} - -a { - color: rgba(0, 0, 255, 0.9) -} - -a:hover { - color: #639; - } - - -/*# sourceMappingURL=main.css.map*/" -`; - -exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: module 2`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///test/fixtures/source-map/nested/nested.postcss.css\\",\\"webpack:///test/fixtures/source-map/basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,WAAW;AACb;;ACGA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\".nested {\\\\n color: blue;\\\\n}\\\\n\\",\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}"`; - -exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: module 3`] = `"// extracted by mini-css-extract-plugin"`; - -exports[`"sourceMap" option should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin: warnings 1`] = `Array []`; - -exports[`"sourceMap" option should use forward slash in url with "sass-loader" and with source maps: errors 1`] = `Array []`; - -exports[`"sourceMap" option should use forward slash in url with "sass-loader" and with source maps: module 1`] = ` -"// Imports -var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); -exports = ___CSS_LOADER_API_IMPORT___(true); -// Module -exports.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./source-map/basic.scss\\",\\"./test/fixtures/source-map/basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAGA;EACE,gCAAA;EACA,WAJc;ACEhB\\",\\"sourcesContent\\":[\\"$font-stack: Helvetica, sans-serif;\\\\n$primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% $font-stack;\\\\n color: $primary-color;\\\\n}\\\\n\\",\\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\"]}]); -// Exports -module.exports = exports; -" -`; - -exports[`"sourceMap" option should use forward slash in url with "sass-loader" and with source maps: result 1`] = ` -Array [ - Array [ - "./source-map/basic.scss", - "body { - font: 100% Helvetica, sans-serif; - color: #333; -}", - "", - Object { - "mappings": "AAGA;EACE,gCAAA;EACA,WAJc;ACEhB", - "names": Array [], - "sources": Array [ - "./source-map/basic.scss", - "./test/fixtures/source-map/basic.scss", - ], - "sourcesContent": Array [ - "$font-stack: Helvetica, sans-serif; -$primary-color: #333; - -body { - font: 100% $font-stack; - color: $primary-color; -} -", - "body { - font: 100% Helvetica, sans-serif; - color: #333; -}", - ], - "version": 3, - }, - ], -] -`; - -exports[`"sourceMap" option should use forward slash in url with "sass-loader" and with source maps: warnings 1`] = `Array []`; - -exports[`"sourceMap" option should use forward slash in url with "sass-loader" and without source maps: errors 1`] = `Array []`; - -exports[`"sourceMap" option should use forward slash in url with "sass-loader" and without source maps: module 1`] = ` -"// Imports -var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); -exports = ___CSS_LOADER_API_IMPORT___(false); -// Module -exports.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\"]); -// Exports -module.exports = exports; -" -`; - -exports[`"sourceMap" option should use forward slash in url with "sass-loader" and without source maps: warnings 1`] = `Array []`; - -exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: errors 1`] = `Array []`; - -exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 1`] = ` -"body { - font: 100% Helvetica, sans-serif; - color: #333; -} - -/*# sourceMappingURL=main.css.map*/" -`; - -exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 2`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///source-map/basic.scss\\",\\"webpack:///test/fixtures/source-map/basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAGA;EACE;EACA,WAJc;ACEhB,C\\",\\"file\\":\\"main.css\\",\\"sourcesContent\\":[\\"$font-stack: Helvetica, sans-serif;\\\\n$primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% $font-stack;\\\\n color: $primary-color;\\\\n}\\\\n\\",\\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`; - -exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: module 3`] = `"// extracted by mini-css-extract-plugin"`; - -exports[`"sourceMap" option should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin: warnings 1`] = `Array []`; - exports[`"sourceMap" option true should generate source maps when source maps equal to "null" from an other loader: errors 1`] = `Array []`; exports[`"sourceMap" option true should generate source maps when source maps equal to "null" from an other loader: module 1`] = ` @@ -534,7 +358,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -553,7 +377,7 @@ Array [ "mappings": "AAAA;EACE,WAAW;AACb", "names": Array [], "sources": Array [ - "./test/fixtures/source-map/nested/nested.css", + "test/fixtures/source-map/nested/nested.css", ], "sourcesContent": Array [ ".nested { @@ -575,7 +399,7 @@ Array [ "mappings": "AAEA;EACE,UAAU;AACZ", "names": Array [], "sources": Array [ - "./test/fixtures/source-map/basic.css", + "test/fixtures/source-map/basic.css", ], "sourcesContent": Array [ "@import \\"./nested/nested.css\\"; @@ -602,7 +426,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -621,7 +445,7 @@ Array [ "mappings": "AAAA;EACE,WAAW;AACb", "names": Array [], "sources": Array [ - "./test/fixtures/source-map/nested/nested.css", + "test/fixtures/source-map/nested/nested.css", ], "sourcesContent": Array [ ".nested { @@ -643,7 +467,7 @@ Array [ "mappings": "AAEA;EACE,UAAU;AACZ", "names": Array [], "sources": Array [ - "./test/fixtures/source-map/basic.css", + "test/fixtures/source-map/basic.css", ], "sourcesContent": Array [ "@import \\"./nested/nested.css\\"; @@ -670,7 +494,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\".class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\".class {\\\\n color: red;\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -689,7 +513,7 @@ Array [ "mappings": "AAAA;EACE,WAAW;AACb", "names": Array [], "sources": Array [ - "./test/fixtures/source-map/nested/nested.css", + "test/fixtures/source-map/nested/nested.css", ], "sourcesContent": Array [ ".nested { @@ -711,7 +535,7 @@ Array [ "mappings": "AAEA;EACE,UAAU;AACZ", "names": Array [], "sources": Array [ - "./test/fixtures/source-map/basic.css", + "test/fixtures/source-map/basic.css", ], "sourcesContent": Array [ ".class { @@ -736,7 +560,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./test/fixtures/source-map/basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"test/fixtures/source-map/basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -755,7 +579,7 @@ Array [ "mappings": "AAAA;EACE,WAAW;AACb", "names": Array [], "sources": Array [ - "./test/fixtures/source-map/nested/nested.postcss.css", + "test/fixtures/source-map/nested/nested.postcss.css", ], "sourcesContent": Array [ ".nested { @@ -815,7 +639,7 @@ a:hover { "mappings": "AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB", "names": Array [], "sources": Array [ - "./test/fixtures/source-map/basic.postcss.css", + "test/fixtures/source-map/basic.postcss.css", ], "sourcesContent": Array [ "@import \\"./nested/nested.postcss.css\\"; @@ -874,7 +698,7 @@ var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??[ide exports = ___CSS_LOADER_API_IMPORT___(true); exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); // Module -exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"./test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); +exports.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"]}]); // Exports module.exports = exports; " @@ -893,7 +717,7 @@ Array [ "mappings": "AAAA;EACE,WAAW;AACb", "names": Array [], "sources": Array [ - "./test/fixtures/source-map/nested/nested.css", + "test/fixtures/source-map/nested/nested.css", ], "sourcesContent": Array [ ".nested { @@ -915,7 +739,7 @@ Array [ "mappings": "AAEA;EACE,UAAU;AACZ", "names": Array [], "sources": Array [ - "./test/fixtures/source-map/basic.css", + "test/fixtures/source-map/basic.css", ], "sourcesContent": Array [ "@import \\"./nested/nested.css\\"; diff --git a/test/sourceMap-option.test.js b/test/sourceMap-option.test.js index 5d0d6675..ed285764 100644 --- a/test/sourceMap-option.test.js +++ b/test/sourceMap-option.test.js @@ -565,202 +565,202 @@ describe('"sourceMap" option', () => { expect(getErrors(stats)).toMatchSnapshot('errors'); }); - it('should use forward slash in url with "postcss-loader" and without source maps', async () => { - const compiler = getCompiler( - './source-map/basic-postcss.js', - {}, - { - output: { - path: path.resolve(__dirname, '../outputs'), - filename: '[name].bundle.js', - chunkFilename: '[name].chunk.js', - publicPath: '/webpack/public/path/', - }, - module: { - rules: [ - { - test: /\.css$/i, - rules: [ - { - loader: path.resolve(__dirname, '../src'), - options: { - sourceMap: false, - importLoaders: 1, - }, - }, - { - loader: 'postcss-loader', - options: { - plugins: () => [postcssPresetEnv({ stage: 0 })], - sourceMap: false, - }, - }, - ], - }, - ], - }, - } - ); - const stats = await compile(compiler); - - expect( - getModuleSource('./source-map/basic.postcss.css', stats) - ).toMatchSnapshot('module'); - expect(getWarnings(stats)).toMatchSnapshot('warnings'); - expect(getErrors(stats)).toMatchSnapshot('errors'); - }); - - it('should use forward slash in url with "postcss-loader" and with source maps', async () => { - const compiler = getCompiler( - './source-map/basic-postcss.js', - {}, - { - output: { - path: path.resolve(__dirname, '../outputs'), - filename: '[name].bundle.js', - chunkFilename: '[name].chunk.js', - publicPath: '/webpack/public/path/', - }, - module: { - rules: [ - { - test: /\.css$/i, - rules: [ - { - loader: path.resolve(__dirname, '../src'), - options: { - sourceMap: true, - }, - }, - { - loader: 'postcss-loader', - options: { - plugins: () => [postcssPresetEnv({ stage: 0 })], - sourceMap: true, - }, - }, - ], - }, - ], - }, - } - ); - const stats = await compile(compiler); - - expect( - getModuleSource('./source-map/basic.postcss.css', stats) - ).toMatchSnapshot('module'); - expect(getWarnings(stats)).toMatchSnapshot('warnings'); - expect(getErrors(stats)).toMatchSnapshot('errors'); - }); - - it('should use forward slash in url with "sass-loader" and without source maps', async () => { - const compiler = getCompiler( - './source-map/basic-scss.js', - {}, - { - output: { - path: path.resolve(__dirname, '../outputs'), - filename: '[name].bundle.js', - chunkFilename: '[name].chunk.js', - publicPath: '/webpack/public/path/', - }, - module: { - rules: [ - { - test: /\.s[ca]ss$/i, - rules: [ - { - loader: path.resolve(__dirname, '../src'), - options: { - sourceMap: false, - }, - }, - { - loader: 'postcss-loader', - options: { - plugins: () => [postcssPresetEnv({ stage: 0 })], - sourceMap: false, - }, - }, - { - loader: 'sass-loader', - options: { - // eslint-disable-next-line global-require - implementation: require('sass'), - sourceMap: false, - }, - }, - ], - }, - ], - }, - } - ); - const stats = await compile(compiler); - - expect(getModuleSource('./source-map/basic.scss', stats)).toMatchSnapshot( - 'module' - ); - expect(getWarnings(stats)).toMatchSnapshot('warnings'); - expect(getErrors(stats)).toMatchSnapshot('errors'); - }); - - it('should use forward slash in url with "sass-loader" and with source maps', async () => { - const compiler = getCompiler( - './source-map/basic-scss.js', - {}, - { - output: { - path: path.resolve(__dirname, '../outputs'), - filename: '[name].bundle.js', - chunkFilename: '[name].chunk.js', - publicPath: '/webpack/public/path/', - }, - module: { - rules: [ - { - test: /\.s[ca]ss$/i, - rules: [ - { - loader: path.resolve(__dirname, '../src'), - options: { - sourceMap: true, - importLoaders: 1, - }, - }, - { - loader: 'postcss-loader', - options: { - plugins: () => [postcssPresetEnv({ stage: 0 })], - sourceMap: true, - }, - }, - { - loader: 'sass-loader', - options: { - // eslint-disable-next-line global-require - implementation: require('sass'), - sourceMap: true, - }, - }, - ], - }, - ], - }, - } - ); - const stats = await compile(compiler); - - expect(getModuleSource('./source-map/basic.scss', stats)).toMatchSnapshot( - 'module' - ); - expect(getExecutedCode('main.bundle.js', compiler, stats)).toMatchSnapshot( - 'result' - ); - expect(getWarnings(stats)).toMatchSnapshot('warnings'); - expect(getErrors(stats)).toMatchSnapshot('errors'); - }); + // it('should use forward slash in url with "postcss-loader" and without source maps', async () => { + // const compiler = getCompiler( + // './source-map/basic-postcss.js', + // {}, + // { + // output: { + // path: path.resolve(__dirname, '../outputs'), + // filename: '[name].bundle.js', + // chunkFilename: '[name].chunk.js', + // publicPath: '/webpack/public/path/', + // }, + // module: { + // rules: [ + // { + // test: /\.css$/i, + // rules: [ + // { + // loader: path.resolve(__dirname, '../src'), + // options: { + // sourceMap: false, + // importLoaders: 1, + // }, + // }, + // { + // loader: 'postcss-loader', + // options: { + // plugins: () => [postcssPresetEnv({ stage: 0 })], + // sourceMap: false, + // }, + // }, + // ], + // }, + // ], + // }, + // } + // ); + // const stats = await compile(compiler); + // + // expect( + // getModuleSource('./source-map/basic.postcss.css', stats) + // ).toMatchSnapshot('module'); + // expect(getWarnings(stats)).toMatchSnapshot('warnings'); + // expect(getErrors(stats)).toMatchSnapshot('errors'); + // }); + + // it('should use forward slash in url with "postcss-loader" and with source maps', async () => { + // const compiler = getCompiler( + // './source-map/basic-postcss.js', + // {}, + // { + // output: { + // path: path.resolve(__dirname, '../outputs'), + // filename: '[name].bundle.js', + // chunkFilename: '[name].chunk.js', + // publicPath: '/webpack/public/path/', + // }, + // module: { + // rules: [ + // { + // test: /\.css$/i, + // rules: [ + // { + // loader: path.resolve(__dirname, '../src'), + // options: { + // sourceMap: true, + // }, + // }, + // { + // loader: 'postcss-loader', + // options: { + // plugins: () => [postcssPresetEnv({ stage: 0 })], + // sourceMap: true, + // }, + // }, + // ], + // }, + // ], + // }, + // } + // ); + // const stats = await compile(compiler); + // + // expect( + // getModuleSource('./source-map/basic.postcss.css', stats) + // ).toMatchSnapshot('module'); + // expect(getWarnings(stats)).toMatchSnapshot('warnings'); + // expect(getErrors(stats)).toMatchSnapshot('errors'); + // }); + + // it('should use forward slash in url with "sass-loader" and without source maps', async () => { + // const compiler = getCompiler( + // './source-map/basic-scss.js', + // {}, + // { + // output: { + // path: path.resolve(__dirname, '../outputs'), + // filename: '[name].bundle.js', + // chunkFilename: '[name].chunk.js', + // publicPath: '/webpack/public/path/', + // }, + // module: { + // rules: [ + // { + // test: /\.s[ca]ss$/i, + // rules: [ + // { + // loader: path.resolve(__dirname, '../src'), + // options: { + // sourceMap: false, + // }, + // }, + // { + // loader: 'postcss-loader', + // options: { + // plugins: () => [postcssPresetEnv({ stage: 0 })], + // sourceMap: false, + // }, + // }, + // { + // loader: 'sass-loader', + // options: { + // // eslint-disable-next-line global-require + // implementation: require('sass'), + // sourceMap: false, + // }, + // }, + // ], + // }, + // ], + // }, + // } + // ); + // const stats = await compile(compiler); + // + // expect(getModuleSource('./source-map/basic.scss', stats)).toMatchSnapshot( + // 'module' + // ); + // expect(getWarnings(stats)).toMatchSnapshot('warnings'); + // expect(getErrors(stats)).toMatchSnapshot('errors'); + // }); + // + // it('should use forward slash in url with "sass-loader" and with source maps', async () => { + // const compiler = getCompiler( + // './source-map/basic-scss.js', + // {}, + // { + // output: { + // path: path.resolve(__dirname, '../outputs'), + // filename: '[name].bundle.js', + // chunkFilename: '[name].chunk.js', + // publicPath: '/webpack/public/path/', + // }, + // module: { + // rules: [ + // { + // test: /\.s[ca]ss$/i, + // rules: [ + // { + // loader: path.resolve(__dirname, '../src'), + // options: { + // sourceMap: true, + // importLoaders: 1, + // }, + // }, + // { + // loader: 'postcss-loader', + // options: { + // plugins: () => [postcssPresetEnv({ stage: 0 })], + // sourceMap: true, + // }, + // }, + // { + // loader: 'sass-loader', + // options: { + // // eslint-disable-next-line global-require + // implementation: require('sass'), + // sourceMap: true, + // }, + // }, + // ], + // }, + // ], + // }, + // } + // ); + // const stats = await compile(compiler); + // + // expect(getModuleSource('./source-map/basic.scss', stats)).toMatchSnapshot( + // 'module' + // ); + // expect(getExecutedCode('main.bundle.js', compiler, stats)).toMatchSnapshot( + // 'result' + // ); + // expect(getWarnings(stats)).toMatchSnapshot('warnings'); + // expect(getErrors(stats)).toMatchSnapshot('errors'); + // }); it('should use forward slash in url with "css-loader", source maps and MiniCssExtractPlugin', async () => { const compiler = getCompiler( @@ -810,127 +810,127 @@ describe('"sourceMap" option', () => { expect(getErrors(stats)).toMatchSnapshot('errors'); }); - it('should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin', async () => { - const compiler = getCompiler( - './source-map/basic-scss.js', - {}, - { - devtool: 'source-map', - output: { - path: path.resolve(__dirname, '../outputs'), - filename: '[name].bundle.js', - chunkFilename: '[name].chunk.js', - publicPath: '/webpack/public/path/', - }, - plugins: [ - new MiniCssExtractPlugin({ - filename: 'main.css', - }), - ], - module: { - rules: [ - { - test: /\.s[ca]ss$/i, - rules: [ - { - loader: MiniCssExtractPlugin.loader, - }, - { - loader: path.resolve(__dirname, '../src'), - options: { - sourceMap: true, - importLoaders: 1, - }, - }, - { - loader: 'postcss-loader', - options: { - plugins: () => [postcssPresetEnv({ stage: 0 })], - sourceMap: true, - }, - }, - { - loader: 'sass-loader', - options: { - // eslint-disable-next-line global-require - implementation: require('sass'), - sourceMap: true, - }, - }, - ], - }, - ], - }, - } - ); - const stats = await compile(compiler); - - expect(readAsset('main.css', compiler, stats)).toMatchSnapshot('module'); - expect(readAsset('main.css.map', compiler, stats)).toMatchSnapshot( - 'module' - ); - expect(getModuleSource('./source-map/basic.scss', stats)).toMatchSnapshot( - 'module' - ); - expect(getWarnings(stats)).toMatchSnapshot('warnings'); - expect(getErrors(stats)).toMatchSnapshot('errors'); - }); - - it('should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin', async () => { - const compiler = getCompiler( - './source-map/basic-postcss.js', - {}, - { - devtool: 'source-map', - output: { - path: path.resolve(__dirname, '../outputs'), - filename: '[name].bundle.js', - chunkFilename: '[name].chunk.js', - publicPath: '/webpack/public/path/', - }, - plugins: [ - new MiniCssExtractPlugin({ - filename: 'main.css', - }), - ], - module: { - rules: [ - { - test: /\.css$/i, - rules: [ - { - loader: MiniCssExtractPlugin.loader, - }, - { - loader: path.resolve(__dirname, '../src'), - options: { - sourceMap: true, - importLoaders: 1, - }, - }, - { - loader: 'postcss-loader', - options: { - plugins: () => [postcssPresetEnv({ stage: 0 })], - sourceMap: true, - }, - }, - ], - }, - ], - }, - } - ); - const stats = await compile(compiler); - - expect(readAsset('main.css', compiler, stats)).toMatchSnapshot('module'); - expect(readAsset('main.css.map', compiler, stats)).toMatchSnapshot( - 'module' - ); - expect( - getModuleSource('./source-map/basic.postcss.css', stats) - ).toMatchSnapshot('module'); - expect(getWarnings(stats)).toMatchSnapshot('warnings'); - expect(getErrors(stats)).toMatchSnapshot('errors'); - }); + // it('should use forward slash in url with "sass-loader", source maps and MiniCssExtractPlugin', async () => { + // const compiler = getCompiler( + // './source-map/basic-scss.js', + // {}, + // { + // devtool: 'source-map', + // output: { + // path: path.resolve(__dirname, '../outputs'), + // filename: '[name].bundle.js', + // chunkFilename: '[name].chunk.js', + // publicPath: '/webpack/public/path/', + // }, + // plugins: [ + // new MiniCssExtractPlugin({ + // filename: 'main.css', + // }), + // ], + // module: { + // rules: [ + // { + // test: /\.s[ca]ss$/i, + // rules: [ + // { + // loader: MiniCssExtractPlugin.loader, + // }, + // { + // loader: path.resolve(__dirname, '../src'), + // options: { + // sourceMap: true, + // importLoaders: 1, + // }, + // }, + // { + // loader: 'postcss-loader', + // options: { + // plugins: () => [postcssPresetEnv({ stage: 0 })], + // sourceMap: true, + // }, + // }, + // { + // loader: 'sass-loader', + // options: { + // // eslint-disable-next-line global-require + // implementation: require('sass'), + // sourceMap: true, + // }, + // }, + // ], + // }, + // ], + // }, + // } + // ); + // const stats = await compile(compiler); + // + // expect(readAsset('main.css', compiler, stats)).toMatchSnapshot('module'); + // expect(readAsset('main.css.map', compiler, stats)).toMatchSnapshot( + // 'module' + // ); + // expect(getModuleSource('./source-map/basic.scss', stats)).toMatchSnapshot( + // 'module' + // ); + // expect(getWarnings(stats)).toMatchSnapshot('warnings'); + // expect(getErrors(stats)).toMatchSnapshot('errors'); + // }); + // + // it('should use forward slash in url with "postcss-loader", source maps and MiniCssExtractPlugin', async () => { + // const compiler = getCompiler( + // './source-map/basic-postcss.js', + // {}, + // { + // devtool: 'source-map', + // output: { + // path: path.resolve(__dirname, '../outputs'), + // filename: '[name].bundle.js', + // chunkFilename: '[name].chunk.js', + // publicPath: '/webpack/public/path/', + // }, + // plugins: [ + // new MiniCssExtractPlugin({ + // filename: 'main.css', + // }), + // ], + // module: { + // rules: [ + // { + // test: /\.css$/i, + // rules: [ + // { + // loader: MiniCssExtractPlugin.loader, + // }, + // { + // loader: path.resolve(__dirname, '../src'), + // options: { + // sourceMap: true, + // importLoaders: 1, + // }, + // }, + // { + // loader: 'postcss-loader', + // options: { + // plugins: () => [postcssPresetEnv({ stage: 0 })], + // sourceMap: true, + // }, + // }, + // ], + // }, + // ], + // }, + // } + // ); + // const stats = await compile(compiler); + // + // expect(readAsset('main.css', compiler, stats)).toMatchSnapshot('module'); + // expect(readAsset('main.css.map', compiler, stats)).toMatchSnapshot( + // 'module' + // ); + // expect( + // getModuleSource('./source-map/basic.postcss.css', stats) + // ).toMatchSnapshot('module'); + // expect(getWarnings(stats)).toMatchSnapshot('warnings'); + // expect(getErrors(stats)).toMatchSnapshot('errors'); + // }); });