<commit_before>// @flow

import path from 'path'
import { NEWLINE_REGEXP, createFileTransformer } from 'pundle-api'

import manifest from '../package.json'
import { getNodeSass } from './helpers'

function createComponent({ extensions = ['.scss'], options = {} }: { extensions?: Array<string>, options?: Object } = {}) {
  return createFileTransformer({
    name: 'pundle-transformer-sass',
    version: manifest.version,
    priority: 2000,
    async callback({ file, context }) {
      const extName = path.extname(file.filePath)
      if (!extensions.includes(extName)) return null

      const sass = getNodeSass(context.config.rootDirectory)
      if (!sass) {
        throw new Error(`'node-sass' not found in '${context.config.rootDirectory}'`)
      }

      const processed = await new Promise(function(resolve, reject) {
        sass.render(
          {
            data: typeof file.contents === 'string' ? file.contents : file.contents.toString(),
            outFile: '/dev/null',<commit_msg>:bug: Fix @imports in sass<commit_after>// @flow

import path from 'path'
import { NEWLINE_REGEXP, createFileTransformer } from 'pundle-api'

import manifest from '../package.json'
import { getNodeSass } from './helpers'

function createComponent({ extensions = ['.scss'], options = {} }: { extensions?: Array<string>, options?: Object } = {}) {
  return createFileTransformer({
    name: 'pundle-transformer-sass',
    version: manifest.version,
    priority: 2000,
    async callback({ file, context }) {
      const extName = path.extname(file.filePath)
      if (!extensions.includes(extName)) return null

      const sass = getNodeSass(context.config.rootDirectory)
      if (!sass) {
        throw new Error(`'node-sass' not found in '${context.config.rootDirectory}'`)
      }

      const processed = await new Promise(function(resolve, reject) {
        sass.render(
          {
            data: typeof file.contents === 'string' ? file.contents : file.contents.toString(),
            includePaths: [path.dirname(file.filePath)],
            outFile: '/dev/null',
{'fraction_non_alphanumeric': 0.13798076923076924, 'fraction_numerical': 0.0038461538461538464, 'mean_word_length': 3.2382892057026478, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4930218', 'n_tokens_mistral': 601, 'n_tokens_neox': 591, 'n_words': 153}