function importAssertionPlugin({ sourcemap }) {
	return {
		name: 'import-assertion',
		options(opts) {
			// @ts-ignore
			opts.acornInjectPlugins = [importAssertions, ...(opts.acornInjectPlugins || [])];
			return opts;
		},
		transform(code, id) {
			if (!/\.[tj]sx?$/.test(id)) return;

			const res = transform(code, {
				parse: this.parse,
				plugins: [transformImportAssertions],
				filename: id,
				// Default is to generate sourcemaps, needs an explicit
				// boolean
				sourceMaps: !!sourcemap
			});

			return {
				code: res.code,
				map: res.map
			};
		}
	};
}
Rewrite import assertions to url prefixes. This is done because
import assertions are not widely available yet.

```js
// Before
import foo from "./foo.json" assert { type: "json" };

// After
import foo from "json:./foo.json";
```

@param {object} options
@param {boolean} options.sourcemap
@returns {import("rollup").Plugin}