Rename
This commit is contained in:
24
src/index.ts
24
src/index.ts
@ -256,21 +256,25 @@ function babelTailwind(
|
||||
*/
|
||||
export const babelPlugin = ({
|
||||
filter = /\.[jt]sx?$/,
|
||||
getPlugins,
|
||||
plugins: getPlugins,
|
||||
}: {
|
||||
filter?: RegExp;
|
||||
getPlugins(file: { path: string; contents: string }): babel.PluginItem[];
|
||||
plugins:
|
||||
| babel.PluginItem[]
|
||||
| ((file: { path: string; contents: string }) => babel.PluginItem[]);
|
||||
}): esbuild.Plugin => ({
|
||||
name: "babel-plugin",
|
||||
setup(build) {
|
||||
build.onLoad({ filter }, ({ path }) => {
|
||||
const load = once(() => readFileSync(path, "utf-8"));
|
||||
const plugins = getPlugins({
|
||||
path,
|
||||
get contents() {
|
||||
return load();
|
||||
},
|
||||
});
|
||||
const plugins = Array.isArray(getPlugins)
|
||||
? getPlugins
|
||||
: getPlugins({
|
||||
path,
|
||||
get contents() {
|
||||
return load();
|
||||
},
|
||||
});
|
||||
|
||||
if (!plugins.length) {
|
||||
return;
|
||||
@ -278,7 +282,7 @@ export const babelPlugin = ({
|
||||
|
||||
const { code } = transformSync(load(), {
|
||||
parserOpts: {
|
||||
plugins: ["jsx", "typescript"],
|
||||
plugins: ["jsx", "decorators", "typescript", "importAttributes"],
|
||||
},
|
||||
filename: path,
|
||||
plugins,
|
||||
@ -339,7 +343,7 @@ const esbuildPlugin = (
|
||||
build.onLoad({ filter: /.*/, namespace: ESBUILD_NAMESPACE }, async ({ path }) => {
|
||||
if (path === "directive:base") {
|
||||
return {
|
||||
contents: (await compile(`@tailwind base;`)).css!,
|
||||
contents: (await compile(`@tailwind base;`)).css,
|
||||
loader: "css",
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user