return function importer(url: string, prev: string) {
    const nodeSassOptions = this.options;
    // Create a context for the current importer run.
    // An importer run is different from an importer instance,
    // one importer instance can spawn infinite importer runs.
    if (!this.nodeSassOnceImporterContext) {
      this.nodeSassOnceImporterContext = {
        store: new Set(),
      };
    }

    // Each importer run has it's own new store, otherwise
    // files already imported in a previous importer run
    // would be detected as multiple imports of the same file.
    const store = this.nodeSassOnceImporterContext.store;
    const includePaths = buildIncludePaths(
      nodeSassOptions.includePaths,
      prev,
    );
    const resolvedUrl = resolveUrl(
      url,
      includePaths,
    );

    if (store.has(resolvedUrl)) {
      return EMPTY_IMPORT;
    }

    store.add(resolvedUrl);

    return null;
  };
  return function importer(url: string, prev: string) {
    const nodeSassOptions = this.options;
    const selectorFilters = parseSelectorFilters(url);

    if (selectorFilters.length === 0) {
      return null;
    }

    const includePaths = buildIncludePaths(
      nodeSassOptions.includePaths,
      prev,
    );

    const cleanedUrl = cleanImportUrl(url);
    const resolvedUrl = resolveUrl(cleanedUrl, includePaths);
    const css = fs.readFileSync(resolvedUrl, { encoding: `utf8` });
    const contents = cssSelectorExtract.processSync({
      css,
      filters: selectorFilters,
      postcssSyntax,
      preserveLines: true,
    });

    return contents ? {
      file: resolvedUrl,
      contents,
    } : null;
  };