import { __name } from './chunk-6AXVLTU5.js';
import { LogLevelLabel } from '@storm-software/config-tools/types';
import { readFile } from '@stryke/fs/read-file';
import { normalizeWindowsPath } from '@stryke/path/correct-path';

function compilerPlugin(log, context, options) {
  return {
    name: "storm-stack:compiler",
    setup(build) {
      build.onLoad({
        filter: /\.ts$/
      }, async (args) => {
        log(LogLevelLabel.TRACE, `Transforming ${args.path} with Storm Stack compiler`);
        return {
          contents: await context.compiler.compile(context, normalizeWindowsPath(args.path), await readFile(args.path), options)
        };
      });
    }
  };
}
__name(compilerPlugin, "compilerPlugin");

export { compilerPlugin };
//# sourceMappingURL=chunk-UTOXKP6U.js.map
//# sourceMappingURL=chunk-UTOXKP6U.js.map