async function createCssTransform(style, config) {
	/** @type {import('vite').ResolvedConfig} */
	let resolvedConfig;
	// @ts-expect-error special prop added if running in v-p-s
	if (style.__resolvedConfig) {
		// @ts-expect-error not typed
		resolvedConfig = style.__resolvedConfig;
	} else if (isResolvedConfig(config)) {
		resolvedConfig = config;
	} else {
		// default to "build" if no NODE_ENV is set to avoid running in dev mode for svelte-check etc.
		const useBuild = !process.env.NODE_ENV || process.env.NODE_ENV === 'production';
		const command = useBuild ? 'build' : 'serve';
		const defaultMode = useBuild ? 'production' : 'development';
		resolvedConfig = await resolveConfig(config, command, defaultMode, defaultMode, false);
	}
	return async (code, filename) => {
		return preprocessCSS(code, filename, resolvedConfig);
	};
}
@param {import('svelte/compiler').Preprocessor} style
@param {import('vite').ResolvedConfig | import('vite').InlineConfig} config
@returns {Promise<CssTransform>}