[
  {
    "path": ".github/workflows/test.yaml",
    "content": "name: Node.js CI\non:\n  push:\n    branches: [v5, v4, v3, v2]\n  pull_request:\n    branches: [v5, v4, v3, v2]\njobs:\n  build:\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        node-version: [14.x, 16.x, 18.x]\n    steps:\n      - uses: actions/checkout@v3\n      - name: Use Node.js ${{ matrix.node-version }}\n        uses: actions/setup-node@v3\n        with:\n          node-version: ${{ matrix.node-version }}\n      - run: yarn --frozen-lockfile\n      - run: yarn build\n      - run: yarn test\n"
  },
  {
    "path": ".gitignore",
    "content": "# Logs\nlogs\n*.log\nnpm-debug.log*\n\n# Dependency directory\nnode_modules\n\n# Unwanted\n.idea\n.DS_Store\n\n# Build files\nindex.cjs.js\nindex.d.ts\nindex.es.js\n/test/**/output.*\n"
  },
  {
    "path": ".prettierignore",
    "content": "expected.*"
  },
  {
    "path": ".vscode/settings.json",
    "content": "{\n  \"editor.formatOnSave\": true,\n  \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n  \"editor.codeActionsOnSave\": {\n    \"source.fixAll.eslint\": true\n  },\n  \"workbench.colorCustomizations\": {\n    \"activityBar.background\": \"#240\",\n    \"activityBarBadge.background\": \"#690\",\n    \"activityBar.activeBorder\": \"#690\"\n  }\n}\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to `rollup-plugin-scss` will be documented in this file.\n\n## [Unreleased]\n\n## [3.0.0] - 2021-06-29\n\n### Added\n\n- Add insert option @syJSdev\n- Add `sourceMap` option to enable generation of source map @astappiev\n- Add Yarn PnP support` @eagerestwolf\n- Refactor to Typescript\n- Automated testing using Github Actions\n\n### Updated\n\n- Prefer sass over node-sass\n- A `processor` can receive map as second parameter and return `{ css: string, map?: string }`\n- Remove `node-sass` from optionalDependencies @astappiev <br/>\n  **You have to specify `node-sass` or `sass` in your project dependencies alongside `rollup-plugin-scss`**\n\n## [2.6.1] - 2020-10-01\n\n### Updated\n\n- Move node-sass to optionalDependencies @weizhenye\n\n## [2.6.0] - 2020-08-14\n\n### Fixed\n\n- Resolve processor as a promise during transform step @geotrev\n\n### Added\n\n- Add support for postcss processor\n\n## [2.5.0] - 2020-05-07\n\n### Updated\n\n- Fix includePaths before processing @mach25\n\n## [2.4.0] - 2020-04-13\n\n### Added\n\n- Add `sass` option @riri\n\n## [2.2.0] - 2020-04-11\n\n### Added\n\n- Add `watch` option @JimSchofield\n\n## [2.1.0] - 2019-12-22\n\n### Added\n\n- Add `prefix` option @jackprosser\n\n## [2.0.0] - 2019-12-22\n\n### Changed\n\n- Add `node_modules/` in includePaths by default\n- Fix cases where output `css` is null or undefined\n- Update dependencies\n\n## [1.0.0] - 2019-02-04\n\n### Update\n\n- Update `ongenerate` to `generateBundle`\n\n[unreleased]: https://github.com/thgh/rollup-plugin-scss/compare/v2.2.0...HEAD\n[2.2.0]: https://github.com/thgh/rollup-plugin-scss/compare/v2.1.0...v2.2.0\n[2.1.0]: https://github.com/thgh/rollup-plugin-scss/compare/v2.0.0...v2.1.0\n[2.0.0]: https://github.com/thgh/rollup-plugin-scss/compare/v1.0.0...v2.0.0\n[1.0.0]: https://github.com/thgh/rollup-plugin-scss/compare/v0.0.1...v1.0.0\n[0.0.1]: https://github.com/thgh/rollup-plugin-scss/releases\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2016 Thomas Ghysels\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# Rollup multiple .scss, .sass and .css imports\n\n<a href=\"LICENSE\">\n  <img src=\"https://img.shields.io/badge/license-MIT-brightgreen.svg\" alt=\"Software License\" />\n</a>\n<a href=\"https://github.com/thgh/rollup-plugin-scss/issues\">\n  <img src=\"https://img.shields.io/github/issues/thgh/rollup-plugin-scss.svg\" alt=\"Issues\" />\n</a>\n<a href=\"http://standardjs.com/\">\n  <img src=\"https://img.shields.io/badge/code%20style-standard-brightgreen.svg\" alt=\"JavaScript Style Guide\" />\n</a>\n<a href=\"https://npmjs.org/package/rollup-plugin-scss\">\n  <img src=\"https://img.shields.io/npm/v/rollup-plugin-scss.svg?style=flat-squar\" alt=\"NPM\" />\n</a>\n<a href=\"https://github.com/thgh/rollup-plugin-scss/releases\">\n  <img src=\"https://img.shields.io/github/release/thgh/rollup-plugin-scss.svg\" alt=\"Latest Version\" />\n</a>\n\n## Installation\n\n```\nnpm install --save-dev rollup-plugin-scss sass\n```\n\nIf any of them is installed, it will be used automatically, if both installed `sass` will be used.\n\n## Usage\n\n```js\n// rollup.config.js\nimport scss from 'rollup-plugin-scss'\n\nexport default {\n  input: 'input.js',\n  output: {\n    file: 'output.js',\n    format: 'esm',\n    // Removes the hash from the asset filename\n    assetFileNames: '[name][extname]'\n  },\n  plugins: [\n    scss() // will output compiled styles to output.css\n  ]\n}\n\n// OR\n\nexport default {\n  input: 'input.js',\n  output: { file: 'output.js', format: 'esm' },\n  plugins: [\n    scss({ fileName: 'bundle.css' }) // will output compiled styles to \"bundle.css\"\n  ]\n}\n\n// OR\n\nexport default {\n  input: 'input.js',\n  output: { file: 'output.js', format: 'esm' },\n  plugins: [\n    scss() // will output compiled styles to \"assets/output-123hash.css\"\n  ]\n}\n```\n\n```js\n// entry.js\nimport './reset.scss'\n```\n\n### Options\n\nOptions are passed to the sass compiler ([node-sass] by default). Refer to [ the Sass docs](https://sass-lang.com/documentation/js-api#options) for more details on these options. <br/>\nOne notable option is `indentedSyntax` which you'll need if you're parsing Sass syntax instead of Scss syntax. (e.g. when extracting a Vue `<style lang=\"sass\">` tag) <br/>\nBy default the plugin will base the filename for the css on the bundle destination.\n\n```js\nscss({\n  // Defaults to output.css, Rollup may add a hash to this!\n  name: 'output.css',\n\n  // Literal asset filename, bypasses the automated filenaming transformations\n  fileName: 'output.css',\n\n  // Callback that will be called ongenerate with two arguments:\n  // - styles: the contents of all style tags combined: 'body { color: green }'\n  // - styleNodes: an array of style objects: { filename: 'body { ... }' }\n  output: function (styles, styleNodes) {\n    writeFileSync('bundle.css', styles)\n  },\n\n  // Disable any style output or callbacks, import as string\n  output: false,\n\n  // Enables/disables generation of source map (default: false)\n  sourceMap: true,\n\n  // Choose files to include in processing (default: ['/**/*.css', '/**/*.scss', '/**/*.sass'])\n  include: [],\n\n  // Choose files to exclude from processing (default: undefined)\n  exclude: [],\n\n  // Determine if node process should be terminated on error (default: false)\n  failOnError: true,\n\n  // Prefix global scss. Useful for variables and mixins.\n  prefix: `@import \"./fonts.scss\";`,\n\n  // A Sass (sass compatible) compiler to use\n  // - sass and node-sass packages are picked up automatically\n  // - you can use this option to specify custom package (e.g. a fork of one of them)\n  sass: require('node-sass'),\n\n  // Run postcss processor before output\n  processor: () => postcss([autoprefixer({ overrideBrowserslist: 'Edge 18' })]),\n\n  // Process resulting CSS\n  processor: (css, map) => ({\n    css: css.replace('/*date*/', '/* ' + new Date().toJSON() + ' */'),\n    map\n  }),\n\n  // or, just string (for backward compatiblity with v2 or simplicity)\n  processor: css =>\n    css.replace('/*date*/', '/* ' + new Date().toJSON() + ' */'),\n\n  // Log filename and size of generated CSS files (default: true)\n  verbose: true\n\n  // Add file/folder to be monitored in watch mode so that changes to these files will trigger rebuilds.\n  // Do not choose a directory where rollup output or dest is pointed to as this will cause an infinite loop\n  watch: 'src/styles/components',\n  watch: ['src/styles/components', 'src/multiple/folders']\n\n  // Any other options are passed to the sass compiler\n  includePaths: ...\n})\n```\n\n## Examples\n\nUsing postcss + autoprefixer + includePaths (sass option)\n\n```js\nimport scss from 'rollup-plugin-scss'\nimport postcss from 'postcss'\nimport autoprefixer from 'autoprefixer'\n\nexport default {\n  input: 'input.js',\n  output: {\n    file: 'output.js',\n    format: 'esm'\n  },\n  plugins: [\n    scss({\n      processor: () => postcss([autoprefixer()]),\n      includePaths: [\n        path.join(__dirname, '../../node_modules/'),\n        'node_modules/'\n      ]\n    })\n  ]\n}\n```\n\nMinify CSS output:\n\n```js\nscss({\n  outputStyle: 'compressed'\n})\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nContributions and feedback are very welcome. New features should include a test.\n\nTo get it running:\n\n1. Clone the project.\n2. `npm install`\n\n## Credits\n\n- [Thomas Ghysels](https://github.com/thgh)\n- [All Contributors][link-contributors]\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n\n[link-author]: https://github.com/thgh\n[link-contributors]: ../../contributors\n[rollup-plugin-vue]: https://www.npmjs.com/package/rollup-plugin-vue\n[rollup-plugin-buble]: https://www.npmjs.com/package/rollup-plugin-buble\n[rollup-plugin-babel]: https://www.npmjs.com/package/rollup-plugin-babel\n[node-sass]: https://www.npmjs.com/package/node-sass\n[sass]: https://www.npmjs.com/package/sass\n"
  },
  {
    "path": "index.ts",
    "content": "import { dirname } from 'path'\nimport { createFilter, CreateFilter } from 'rollup-pluginutils'\n\nimport type { Plugin } from 'rollup'\n\nexport interface CSSPluginOptions {\n  exclude?: Parameters<CreateFilter>[1]\n  failOnError?: boolean\n  /** Literal asset filename, bypasses any hashes in the filename */\n  fileName?: string\n  include?: Parameters<CreateFilter>[0]\n  includePaths?: string[]\n  insert?: boolean\n  /** Asset name, defaults to output.css, Rollup may add a hash to this! Check out RollupConfig.output.assetFileNames */\n  name?: string\n  /** @deprecated Use `fileName` instead, currently still available for backwards compatibility */\n  output?: string | false | ((css: string, styles: Styles) => void)\n  prefix?: string\n  processor?: (\n    css: string,\n    map: string,\n    styles: Styles\n  ) => CSS | Promise<CSS> | PostCSSProcessor\n  sass?: SassRenderer\n  sourceMap?: boolean\n  verbose?: boolean\n  watch?: string | string[]\n  outputStyle?: string\n}\n\ntype ImporterReturnType = { file: string } | { contents: string } | Error | null\n\ntype ImporterDoneCallback = (data: ImporterReturnType) => void\n\ntype CSS = string | { css: string; map: string }\n\ninterface MappedCSS {\n  css: string\n  map: string\n}\n\ninterface Styles {\n  [id: string]: string\n}\n\ninterface PostCSSProcessor {\n  process: (css: string, options?: any) => MappedCSS\n}\n\ninterface SassRenderer {\n  renderSync: (options: SassOptions) => SassResult\n}\n\ninterface SassOptions {\n  data: string\n}\n\ninterface SassResult {\n  css: Buffer\n  map?: Buffer\n}\n\nexport default function scss(options: CSSPluginOptions = {}): Plugin {\n  const filter = createFilter(\n    options.include || ['/**/*.css', '/**/*.scss', '/**/*.sass'],\n    options.exclude\n  )\n  const insertStyleFnName = '___$insertStylesToHeader'\n\n  const styles: Styles = {}\n  const fileName =\n    options.fileName ||\n    (options.output === 'string' ? options.output : undefined)\n  const name = options.name || 'output.css'\n  const prefix = options.prefix ? options.prefix + '\\n' : ''\n  let includePaths = options.includePaths || ['node_modules/']\n  includePaths.push(process.cwd())\n\n  const compileToCSS = async function (scss: string) {\n    // Compile SASS to CSS\n    if (scss.length) {\n      includePaths = includePaths.filter((v, i, a) => a.indexOf(v) === i)\n      try {\n        const sass = options.sass || loadSassLibrary()\n\n        const render = sass.renderSync(\n          Object.assign(\n            {\n              data: prefix + scss,\n              outFile: fileName || name,\n              includePaths,\n              importer: (\n                url: string,\n                prev: string,\n                done: ImporterDoneCallback\n              ): ImporterReturnType | void => {\n                /* If a path begins with `.`, then it's a local import and this\n                 * importer cannot handle it. This check covers both `.` and\n                 * `..`.\n                 *\n                 * Additionally, if an import path begins with `url` or `http`,\n                 * then it's a remote import, this importer also cannot handle\n                 * that. */\n                if (\n                  url.startsWith('.') ||\n                  url.startsWith('url') ||\n                  url.startsWith('http')\n                ) {\n                  /* The importer returns `null` to defer processing the import\n                   * back to the sass compiler. */\n                  return null\n                }\n\n                /* If the requested path begins with a `~`, we remove it. This\n                 * character is used by webpack-contrib's sass-loader to\n                 * indicate the import is from the node_modules folder. Since\n                 * this is so standard in the JS world, the importer supports\n                 * it, by removing it and ignoring it. */\n                const cleanUrl = url.startsWith('~')\n                  ? url.replace('~', '')\n                  : url\n\n                /* Now, the importer uses `require.resolve()` to attempt\n                 * to resolve the path to the requested file. In the case\n                 * of a standard node_modules project, this will use Node's\n                 * `require.resolve()`. In the case of a Plug 'n Play project,\n                 * this will use the `require.resolve()` provided by the\n                 * package manager.\n                 *\n                 * This statement is surrounded by a try/catch block because\n                 * if Node or the package manager cannot resolve the requested\n                 * file, they will throw an error, so the importer needs to\n                 * defer to sass, by returning `null`.\n                 *\n                 * The paths property tells `require.resolve()` where to begin\n                 * resolution (i.e. who is requesting the file). */\n                try {\n                  let resolved = require.resolve(cleanUrl, {\n                    paths: [prefix + scss]\n                  })\n\n                  const allowedExtensions: string[] = ['.css', '.scss', '.sass'];\n\n                  const resolvedHasAllowedExtension = allowedExtensions.some((allowedExtension: string) => {\n                    return resolved.endsWith(allowedExtension)\n                  });\n\n                  /* It is possible that the `resolved` value is unintentionally\n                   * a path to an unintended file which shares the same name\n                   * but has a different file extension. */\n                  if (!resolvedHasAllowedExtension) {\n                    for (const [index, allowedExtension] of allowedExtensions.entries()) {\n                      try {\n                        /* Make an additional attempt to resolve the path by\n                         * specifying the file extension. */\n                        resolved = require.resolve(cleanUrl + allowedExtension, {\n                          paths: [prefix + scss]\n                        })\n\n                        /* For the first file extension that allows the path to\n                         * be reolved, break out of the loop. */\n                        break\n                      /* If not the path could not be resolved with the\n                       * file extension. */\n                      } catch (e) {\n                        if (index < allowedExtensions.length - 1) {\n                          /* If not the final iteration then proceed\n                           *  to the next. */\n                          continue\n                        } else {\n                          /* If the final iteration then re-throw the error\n                           *  onto the next catch. */\n                          throw e\n                        }\n                      }\n                    }\n                  }\n\n                  /* Since `require.resolve()` will throw an error if a file\n                   * doesn't exist. It's safe to assume the file exists and\n                   * pass it off to the sass compiler. */\n                  return { file: resolved }\n                } catch (e: any) {\n                  /* Just because `require.resolve()` couldn't find the file\n                   * doesn't mean it doesn't exist. It may still be a local\n                   * import that just doesn't list a relative path, so defer\n                   * processing back to sass by returning `null` */\n                  return null\n                }\n              }\n            },\n            options\n          )\n        )\n\n        const css = render.css.toString()\n        const map = render.map ? render.map.toString() : ''\n\n        // Possibly process CSS (e.g. by PostCSS)\n        if (typeof options.processor === 'function') {\n          const result = await options.processor(css, map, styles)\n\n          // TODO: figure out how to check for\n          // @ts-ignore\n          const postcss: PostCSSProcessor = result\n\n          // PostCSS support\n          if (typeof postcss.process === 'function') {\n            return Promise.resolve(\n              postcss.process(css, {\n                from: undefined,\n                to: fileName || name,\n                map: map ? { prev: map, inline: false } : null\n              })\n            )\n          }\n\n          // @ts-ignore\n          const output: string | MappedCSS = result\n\n          return stringToCSS(output)\n        }\n        return { css, map }\n      } catch (e: any) {\n        if (options.failOnError) {\n          throw e\n        }\n        console.log()\n        console.log(red('Error:\\n\\t' + e.message))\n        if (e.message.includes('Invalid CSS')) {\n          console.log(green('Solution:\\n\\t' + 'fix your Sass code'))\n          console.log('Line:   ' + e.line)\n          console.log('Column: ' + e.column)\n        }\n        if (e.message.includes('sass') && e.message.includes('find module')) {\n          console.log(green('Solution:\\n\\t' + 'npm install --save-dev sass'))\n        }\n        if (e.message.includes('node-sass') && e.message.includes('bindings')) {\n          console.log(green('Solution:\\n\\t' + 'npm rebuild node-sass --force'))\n        }\n        console.log()\n      }\n    }\n    return { css: '', map: '' }\n  }\n\n  return {\n    name: 'scss',\n    intro() {\n      return options.insert === true\n        ? insertStyleFn.replace(/insertStyleFn/, insertStyleFnName)\n        : ''\n    },\n    async transform(code, id) {\n      if (!filter(id)) {\n        return\n      }\n\n      // Add the include path before doing any processing\n      includePaths.push(dirname(id))\n\n      // Rebuild all scss files if anything happens to this folder\n      // TODO: check if it's possible to get a list of all dependent scss files\n      //       and only watch those\n      if (options.watch) {\n        const files = Array.isArray(options.watch)\n          ? options.watch\n          : [options.watch]\n        files.forEach(file => this.addWatchFile(file))\n      }\n\n      if (options.insert === true) {\n        // When the 'insert' is enabled, the stylesheet will be inserted into <head/> tag.\n        const { css, map } = await compileToCSS(code)\n        return {\n          code:\n            'export default ' +\n            insertStyleFnName +\n            '(' +\n            JSON.stringify(css) +\n            ')',\n          map: { mappings: '' }\n        }\n      } else if (options.output === false) {\n        // When output is disabled, the stylesheet is exported as a string\n        const { css, map } = await compileToCSS(code)\n        return {\n          code: 'export default ' + JSON.stringify(css),\n          map: { mappings: '' }\n        }\n      }\n\n      // Map of every stylesheet\n      styles[id] = code\n\n      return ''\n    },\n    async generateBundle(opts) {\n      // No stylesheet needed\n      if (options.output === false || options.insert === true) {\n        return\n      }\n\n      // Combine all stylesheets\n      let scss = ''\n      for (const id in styles) {\n        scss += styles[id] || ''\n      }\n\n      const compiled = await compileToCSS(scss)\n\n      if (typeof compiled !== 'object' || typeof compiled.css !== 'string') {\n        return\n      }\n\n      // Emit styles through callback\n      if (typeof options.output === 'function') {\n        options.output(compiled.css, styles)\n        return\n      }\n\n      // Don't create unwanted empty stylesheets\n      if (!compiled.css.length) {\n        return\n      }\n\n      // Emit styles to file\n      this.emitFile({\n        type: 'asset',\n        source: compiled.css,\n        name,\n        fileName\n      })\n\n      if (options.sourceMap && compiled.map) {\n        let sourcemap = compiled.map\n        if (typeof compiled.map.toString === 'function') {\n          sourcemap = compiled.map.toString()\n        }\n\n        this.emitFile({\n          type: 'asset',\n          source: sourcemap,\n          name: name && name + '.map',\n          fileName: fileName && fileName + '.map'\n        })\n      }\n    }\n  }\n}\n\n/**\n * Create a style tag and append to head tag\n *\n * @param {String} css style\n * @return {String} css style\n */\nconst insertStyleFn = `function insertStyleFn(css) {\n  if (!css) {\n    return\n  }\n  if (typeof window === 'undefined') {\n    return\n  }\n\n  const style = document.createElement('style');\n\n  style.setAttribute('type', 'text/css');\n  style.innerHTML = css;\n  document.head.appendChild(style);\n  return css\n}`\n\nfunction loadSassLibrary(): SassRenderer {\n  try {\n    return require('sass')\n  } catch (e) {\n    return require('node-sass')\n  }\n}\n\nfunction stringToCSS(input: string | CSS): MappedCSS {\n  if (typeof input === 'string') {\n    return { css: input, map: '' }\n  }\n  return input\n}\n\nfunction red(text: string) {\n  return '\\x1b[1m\\x1b[31m' + text + '\\x1b[0m'\n}\n\nfunction green(text: string) {\n  return '\\x1b[1m\\x1b[32m' + text + '\\x1b[0m'\n}\n\nfunction getSize(bytes: number) {\n  return bytes < 10000\n    ? bytes.toFixed(0) + ' B'\n    : bytes < 1024000\n    ? (bytes / 1024).toPrecision(3) + ' kB'\n    : (bytes / 1024 / 1024).toPrecision(4) + ' MB'\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"rollup-plugin-scss\",\n  \"version\": \"4.0.0\",\n  \"description\": \"Rollup multiple .scss, .sass and .css imports\",\n  \"main\": \"index.cjs.js\",\n  \"module\": \"index.es.js\",\n  \"jsnext:main\": \"index.es.js\",\n  \"scripts\": {\n    \"build\": \"rollup -c\",\n    \"dev\": \"rollup -cw\",\n    \"lint\": \"standard rollup.config.js index.es.js\",\n    \"fix\": \"prettier --write . \",\n    \"test:node-sass\": \"cd test/node-sass && rm -f output.* && rollup -c && cmp output.js ../expected.js && cmp output.css expected.css && cd ../..\",\n    \"test:sass\": \"cd test/sass && rm -f output.* && rollup -c && cmp nested/output.js ../expected.js && cmp nested/output.css expected.css && cd ../..\",\n    \"test:insert\": \"cd test/insert && rm -f output.* && rollup -c && cmp output.js expected.js && cd ../..\",\n    \"test:postcss\": \"cd test/postcss && rm -f output.* && rollup -c && cmp output.js ../expected.js && cmp output.css expected.css && cd ../..\",\n    \"test:processor\": \"cd test/processor && rm -f output.* && rollup -c && cmp output.js ../expected.js && cmp output.css expected.css && cd ../..\",\n    \"test:sourcemap\": \"cd test/sourcemap && rm -f output.* && rollup -c && cmp output.js ../expected.js && cmp nested/output.css expected.css && cmp nested/output.css.map expected.css.map && cd ../..\",\n    \"test:import-resolution\": \"cd test/import-resolution && node setup.js && rm -f output.* && rollup -c && node teardown.js && cmp output.js expected.js && cmp output.css expected.css && cd ../..\",\n    \"test\": \"npm run test:node-sass && npm run test:sass && npm run test:processor && npm run test:postcss && npm run test:sourcemap && npm run test:insert && npm run test:import-resolution\",\n    \"testw\": \"cd test/node-sass && rm -f output.* && rollup -cw; cd ..\",\n    \"prepare\": \"rollup -c\"\n  },\n  \"keywords\": [\n    \"rollup-plugin\",\n    \"css\",\n    \"sass\",\n    \"scss\"\n  ],\n  \"license\": \"MIT\",\n  \"author\": \"Thomas Ghysels <info@thomasg.be>\",\n  \"homepage\": \"https://github.com/thgh/rollup-plugin-scss\",\n  \"bugs\": {\n    \"url\": \"https://github.com/thgh/rollup-plugin-scss/issues\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/thgh/rollup-plugin-scss\"\n  },\n  \"files\": [\n    \"index.cjs.js\",\n    \"index.d.ts\",\n    \"index.es.js\"\n  ],\n  \"dependencies\": {\n    \"rollup-pluginutils\": \"^2.3.3\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^14.14.30\",\n    \"@types/node-sass\": \"^4.11.1\",\n    \"@types/sass\": \"^1.16.0\",\n    \"autoprefixer\": \"^9.8.6\",\n    \"node-sass\": \"^8\",\n    \"postcss\": \"^7.0.32\",\n    \"prettier\": \"2\",\n    \"rollup\": \"2\",\n    \"rollup-plugin-buble\": \"0\",\n    \"rollup-plugin-typescript2\": \"^0.34.0\",\n    \"sass\": \"^1.26.3\",\n    \"typescript\": \"^4.1.5\"\n  },\n  \"prettier\": {\n    \"arrowParens\": \"avoid\",\n    \"bracketSpacing\": true,\n    \"insertPragma\": false,\n    \"jsxBracketSameLine\": false,\n    \"printWidth\": 80,\n    \"proseWrap\": \"preserve\",\n    \"requirePragma\": false,\n    \"semi\": false,\n    \"singleQuote\": true,\n    \"tabWidth\": 2,\n    \"trailingComma\": \"none\",\n    \"useTabs\": false\n  }\n}\n"
  },
  {
    "path": "rollup.config.js",
    "content": "import typescript from 'rollup-plugin-typescript2'\n\nexport default {\n  input: 'index.ts',\n  output: [\n    {\n      exports: 'default',\n      file: 'index.es.js',\n      format: 'es'\n    },\n    {\n      exports: 'default',\n      file: 'index.cjs.js',\n      format: 'cjs'\n    }\n  ],\n  plugins: [typescript()],\n  external: ['fs', 'path', 'rollup-pluginutils']\n}\n"
  },
  {
    "path": "test/expected.js",
    "content": "console.log('scss imported');\n"
  },
  {
    "path": "test/import-resolution/expected.css",
    "content": ".importable {\n  color: red;\n}\n\n.rollup .plugin .scss {\n  color: green;\n  user-select: none;\n}"
  },
  {
    "path": "test/import-resolution/expected.js",
    "content": "console.log('scss imported from native files and node_modules');\n"
  },
  {
    "path": "test/import-resolution/input.js",
    "content": "import './input.scss'\n\nconsole.log('scss imported from native files and node_modules')\n"
  },
  {
    "path": "test/import-resolution/input.scss",
    "content": "@import 'import-resolution-test/main';\n\n.rollup {\n  .plugin {\n    .scss {\n      color: green;\n      user-select: none;\n    }\n  }\n}\n"
  },
  {
    "path": "test/import-resolution/main.js",
    "content": "// A .js file with the same name as the intended .scss file to be imported.\n"
  },
  {
    "path": "test/import-resolution/main.scss",
    "content": ".importable {\n  color: red;\n}\n"
  },
  {
    "path": "test/import-resolution/rollup.config.js",
    "content": "import scss from '../../index.es.js'\n\nexport default {\n  input: './input.js',\n  output: {\n    file: 'output.js',\n    format: 'esm'\n  },\n  plugins: [scss({ fileName: 'output.css' })]\n}\n"
  },
  {
    "path": "test/import-resolution/setup.js",
    "content": "const fs = require('node:fs');\nconst path = require('node:path');\n\nconst NODE_MODULES_MOCK_PACKAGE_PATH = path.join(__dirname, '../../node_modules/import-resolution-test');\nconst CURRENT_DIRECTORY_PATH = path.join(__dirname, '.');\n\nconst IMPORTABLE_FILE_NAME = 'main';\nconst IMPORTABLE_JS_FILE_NAME = `${IMPORTABLE_FILE_NAME}.js`;\nconst IMPORTABLE_SCSS_FILE_NAME = `${IMPORTABLE_FILE_NAME}.scss`;\n\n/* If one does not already exist,\n * create a path to the node_modules mock package. */\nif (!fs.existsSync(NODE_MODULES_MOCK_PACKAGE_PATH)) {\n  fs.mkdirSync(NODE_MODULES_MOCK_PACKAGE_PATH);\n}\n\n/* Copy the specified file with the .js extension\n * to the node_modules mock package. */\nfs.copyFile(\n  `${CURRENT_DIRECTORY_PATH}/${IMPORTABLE_JS_FILE_NAME}`,\n  `${NODE_MODULES_MOCK_PACKAGE_PATH}/${IMPORTABLE_JS_FILE_NAME}`,\n  error => {\n    if (error) {\n      console.log(error);\n    }\n  }\n)\n\n/* Copy the specified file with the .scss extension\n * to the node_modules mock package. */\nfs.copyFile(\n  `${CURRENT_DIRECTORY_PATH}/${IMPORTABLE_SCSS_FILE_NAME}`,\n  `${NODE_MODULES_MOCK_PACKAGE_PATH}/${IMPORTABLE_SCSS_FILE_NAME}`,\n  error => {\n    if (error) {\n      console.log(error);\n    }\n  }\n)"
  },
  {
    "path": "test/import-resolution/teardown.js",
    "content": "const fs = require('node:fs');\nconst path = require('node:path');\n\nconst NODE_MODULES_MOCK_PACKAGE_PATH = path.join(__dirname, '../../node_modules/import-resolution-test');\n\n/* Now that it has served its purpose,\n * remove the node_modules mock package. */\nfs.rm(\n  NODE_MODULES_MOCK_PACKAGE_PATH,\n  { recursive: true, force: true },\n  error => {\n    if (error) {\n      throw error;\n    }\n  }\n);"
  },
  {
    "path": "test/input.js",
    "content": "import './input.scss'\n\nconsole.log('scss imported')\n"
  },
  {
    "path": "test/input.scss",
    "content": ".rollup {\n  .plugin {\n    .scss {\n      color: green;\n      user-select: none;\n    }\n  }\n}\n"
  },
  {
    "path": "test/insert/expected.js",
    "content": "function ___$insertStylesToHeader(css) {\n  if (!css) {\n    return\n  }\n  if (typeof window === 'undefined') {\n    return\n  }\n\n  const style = document.createElement('style');\n\n  style.setAttribute('type', 'text/css');\n  style.innerHTML = css;\n  document.head.appendChild(style);\n  return css\n}\n\n___$insertStylesToHeader(\".rollup .plugin .scss {\\n  color: green;\\n  user-select: none;\\n}\");\n\nconsole.log('scss imported');\n"
  },
  {
    "path": "test/insert/rollup.config.js",
    "content": "import scss from '../../index.es.js'\n\nexport default {\n  input: '../input.js',\n  output: {\n    file: 'output.js',\n    format: 'esm'\n  },\n  plugins: [scss({ fileName: 'output.css', insert: true })]\n}\n"
  },
  {
    "path": "test/node-sass/expected.css",
    "content": ".rollup .plugin .scss {\n  color: green;\n  user-select: none; }\n"
  },
  {
    "path": "test/node-sass/rollup.config.js",
    "content": "import scss from '../../index.es.js'\nimport sass from 'node-sass'\n\nexport default {\n  input: '../input.js',\n  output: {\n    file: 'output.js',\n    format: 'esm'\n  },\n  plugins: [scss({ fileName: 'output.css', sass })]\n}\n"
  },
  {
    "path": "test/postcss/expected.css",
    "content": ".rollup .plugin .scss {\n  color: green;\n  -ms-user-select: none;\n      user-select: none;\n}"
  },
  {
    "path": "test/postcss/rollup.config.js",
    "content": "import scss from '../../index.es.js'\nimport postcss from 'postcss'\nimport autoprefixer from 'autoprefixer'\n\nexport default {\n  input: '../input.js',\n  output: {\n    file: 'output.js',\n    format: 'esm'\n  },\n  plugins: [\n    scss({\n      fileName: 'output.css',\n      processor: () =>\n        postcss([autoprefixer({ overrideBrowserslist: 'Edge 18' })])\n    })\n  ]\n}\n"
  },
  {
    "path": "test/processor/expected.css",
    "content": ".rollup .plugin .scss {\n  color: green;\n  -ms-user-select: none;\n      user-select: none;\n}"
  },
  {
    "path": "test/processor/rollup.config.js",
    "content": "import scss from '../../index.es.js'\nimport postcss from 'postcss'\nimport autoprefixer from 'autoprefixer'\n\nexport default {\n  input: '../input.js',\n  output: {\n    file: 'output.js',\n    format: 'esm'\n  },\n  plugins: [\n    scss({\n      fileName: 'output.css',\n      processor: css => {\n        return Promise.resolve(\n          postcss([\n            autoprefixer({ overrideBrowserslist: 'Edge 18' })\n          ]).process(css, { from: undefined })\n        )\n      }\n    })\n  ]\n}\n"
  },
  {
    "path": "test/sass/expected.css",
    "content": ".rollup .plugin .scss {\n  color: green;\n  user-select: none;\n}"
  },
  {
    "path": "test/sass/rollup.config.js",
    "content": "import scss from '../../index.es.js'\n\nexport default {\n  input: '../input.js',\n  output: {\n    file: 'nested/output.js',\n    format: 'esm',\n    assetFileNames: '[name][extname]'\n  },\n  plugins: [scss()]\n}\n"
  },
  {
    "path": "test/sourcemap/expected.css",
    "content": ".rollup .plugin .scss {\n  color: green;\n  user-select: none;\n}\n\n/*# sourceMappingURL=output.css.map */"
  },
  {
    "path": "test/sourcemap/rollup.config.js",
    "content": "import scss from '../../index.es.js'\n\nexport default {\n  input: '../input.js',\n  output: {\n    file: 'output.js',\n    format: 'esm'\n  },\n  plugins: [scss({ fileName: 'nested/output.css', sourceMap: true })]\n}\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"display\": \"Node 12\",\n  \"compilerOptions\": {\n    \"lib\": [\"es2019\", \"es2020.promise\", \"es2020.bigint\", \"es2020.string\"],\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"node\",\n    \"target\": \"ES2019\",\n    \"declaration\": true,\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"skipLibCheck\": true,\n    \"forceConsistentCasingInFileNames\": true\n  }\n}\n"
  }
]