@ecopages/postcss-processor 0.2.0-alpha.2 → 0.2.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -7
- package/README.md +32 -68
- package/package.json +6 -6
- package/src/index.d.ts +2 -2
- package/src/index.js +2 -2
- package/src/plugin.d.ts +77 -2
- package/src/plugin.js +241 -16
- package/src/presets/index.d.ts +2 -2
- package/src/presets/index.js +2 -2
- package/src/presets/tailwind-v3.d.ts +2 -0
- package/src/presets/tailwind-v3.js +10 -7
- package/src/presets/tailwind-v4.d.ts +2 -0
- package/src/presets/tailwind-v4.js +17 -7
- package/src/runtime/css-loader-plugin.d.ts +1 -1
- package/src/runtime/css-loader-plugin.js +1 -1
- package/src/runtime/css-loader.bun.d.ts +1 -1
- package/src/runtime/css-loader.bun.js +1 -1
- package/src/index.ts +0 -2
- package/src/plugin.ts +0 -354
- package/src/postcss-processor.ts +0 -157
- package/src/presets/index.ts +0 -7
- package/src/presets/tailwind-v3.ts +0 -61
- package/src/presets/tailwind-v4.ts +0 -113
- package/src/runtime/css-loader-plugin.ts +0 -37
- package/src/runtime/css-loader.bun.ts +0 -30
- package/src/runtime/css-runtime-contract.ts +0 -6
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { EcoBuildPlugin } from '@ecopages/core/build/build-types';
|
|
2
|
-
|
|
3
|
-
import { getFileAsBuffer } from '../postcss-processor';
|
|
4
|
-
import type { CssTransform } from './css-runtime-contract';
|
|
5
|
-
|
|
6
|
-
type CssLoaderOptions = {
|
|
7
|
-
name: string;
|
|
8
|
-
filter: RegExp;
|
|
9
|
-
transform: CssTransform;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const createCssLoaderPlugin = ({ name, filter, transform }: CssLoaderOptions): EcoBuildPlugin => ({
|
|
13
|
-
name,
|
|
14
|
-
setup(build) {
|
|
15
|
-
build.onLoad({ filter }, (args) => {
|
|
16
|
-
const rawFile = getFileAsBuffer(args.path);
|
|
17
|
-
const css = transform({
|
|
18
|
-
contents: rawFile,
|
|
19
|
-
filePath: args.path,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
if (css instanceof Promise) {
|
|
23
|
-
return css.then((resolved) => ({
|
|
24
|
-
exports: { default: resolved },
|
|
25
|
-
loader: 'object' as const,
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
exports: {
|
|
31
|
-
default: css as string,
|
|
32
|
-
},
|
|
33
|
-
loader: 'object' as const,
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { EcoBuildPlugin } from '@ecopages/core/build/build-types';
|
|
2
|
-
|
|
3
|
-
import { getFileAsBuffer } from '../postcss-processor';
|
|
4
|
-
import type { CssTransform } from './css-runtime-contract';
|
|
5
|
-
|
|
6
|
-
type BunCssLoaderOptions = {
|
|
7
|
-
name: string;
|
|
8
|
-
filter: RegExp;
|
|
9
|
-
transform: CssTransform;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const createBunCssLoaderPlugin = ({ name, filter, transform }: BunCssLoaderOptions): EcoBuildPlugin => ({
|
|
13
|
-
name,
|
|
14
|
-
setup(build) {
|
|
15
|
-
build.onLoad({ filter }, async (args) => {
|
|
16
|
-
const rawFile = await getFileAsBuffer(args.path);
|
|
17
|
-
const css = await transform({
|
|
18
|
-
contents: rawFile,
|
|
19
|
-
filePath: args.path,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
exports: {
|
|
24
|
-
default: css,
|
|
25
|
-
},
|
|
26
|
-
loader: 'object',
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
});
|