({
original,
opts,
}: {
original: Printer<any>
opts: TransformOptions<any>
})
| 106 | } |
| 107 | |
| 108 | function createPrinter({ |
| 109 | original, |
| 110 | opts, |
| 111 | }: { |
| 112 | original: Printer<any> |
| 113 | opts: TransformOptions<any> |
| 114 | }) { |
| 115 | let printer: Printer<any> = { ...original } |
| 116 | |
| 117 | let reprint = opts.reprint |
| 118 | |
| 119 | // Hook into the preprocessing phase to load the config |
| 120 | if (reprint) { |
| 121 | printer.print = new Proxy(original.print, { |
| 122 | apply(target, thisArg, args) { |
| 123 | let [path, options] = args as Parameters<typeof original.print> |
| 124 | let env = options.__tailwindcss__ as TransformerEnv |
| 125 | reprint(path, { ...env, options: options }) |
| 126 | return Reflect.apply(target, thisArg, args) |
| 127 | }, |
| 128 | }) |
| 129 | |
| 130 | if (original.embed) { |
| 131 | printer.embed = new Proxy(original.embed, { |
| 132 | apply(target, thisArg, args) { |
| 133 | let [path, options] = args as Parameters<typeof original.embed> |
| 134 | let env = options.__tailwindcss__ as TransformerEnv |
| 135 | reprint(path, { ...env, options: options as any }) |
| 136 | return Reflect.apply(target, thisArg, args) |
| 137 | }, |
| 138 | }) |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | return printer |
| 143 | } |
| 144 | |
| 145 | async function loadPlugins<T>(fns: PluginLoad[]) { |
| 146 | let plugin: Plugin<T> = { |
no outgoing calls
no test coverage detected
searching dependent graphs…