Rename
This commit is contained in:
parent
39851182ec
commit
8c789367af
2
.gitignore
vendored
2
.gitignore
vendored
@ -130,3 +130,5 @@ dist
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
repl.ts
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@aet/babel-tailwind",
|
||||
"version": "0.0.1-beta.3",
|
||||
"version": "0.0.1-beta.4",
|
||||
"main": "dist/index.js",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
|
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",
|
||||
};
|
||||
}
|
||||
|
@ -12,10 +12,7 @@ export default defineConfig({
|
||||
define: {
|
||||
"process.env.BABEL_TAILWIND_BUILD": "true",
|
||||
},
|
||||
esbuildOptions(options) {
|
||||
options.banner = {
|
||||
...options.banner,
|
||||
js: "/* eslint-disable */",
|
||||
};
|
||||
banner: {
|
||||
js: "/* eslint-disable */",
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user