Is there a way to specify a transformer when importing individual files using Metro bundler?

In webpack, you can add loadername! prefix to your import statements if you don't want to edit the webpack config or want a specific loader for a specific file.

Is there something similar for metro bundler? The documentation is incredibly lacking imo.

I've got the following string transformer that loads a file as a string: string_transformer.js:

const metroTransformer = require("metro-react-native-babel-transformer");
const path = require("path");

module.exports.transform = function ({ src, filename, options }) {
  if (path.extname(filename) === ".html") {
    return metroTransformer.transform({
      src: "export default " + JSON.stringify(src) + ";",
      filename,
      options,
    });
  }
  return metroTransformer.transform({ src, filename, options });
};

Without the loadername! feature or similar, I have to edit metro config as something like this:

const { getDefaultConfig } = require("metro-config");
const path = require("path");

module.exports = (async () => {
  const {
    resolver: { sourceExts, assetExts },
  } = await getDefaultConfig();
  return {
    transformer: {
      babelTransformerPath: path.resolve("./string_transformer.js"),
    },
    resolver: {
      assetExts: assetExts.filter((ext) => ext !== "html"),
      sourceExts: [...sourceExts, "html"],
    },
  };
})();

, which isn't ideal.

Is there a better solution? Because this is used internally by my package, and it doesn't make sense to make users change their configs for an internal detail.