@ecopages/postcss-processor 0.2.0-alpha.19 → 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 +1 -0
- package/package.json +3 -3
- package/src/plugin.d.ts +9 -0
- package/src/plugin.js +14 -1
- package/src/presets/tailwind-v4.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,7 @@ All notable changes to `@ecopages/postcss-processor` are documented here.
|
|
|
13
13
|
### Bug Fixes
|
|
14
14
|
|
|
15
15
|
- Fixed runtime PostCSS config loading and stylesheet rebuilds for Tailwind-driven template changes.
|
|
16
|
+
|
|
16
17
|
- Fixed direct stylesheet processing and preset output so Tailwind v4 preserves injected references and nested BEM selectors.
|
|
17
18
|
|
|
18
19
|
### Tests
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecopages/postcss-processor",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.20",
|
|
4
4
|
"description": "Postcss processor, transform string or postcss file to css",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"postcss",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"directory": "packages/processors/postcss-processor"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@ecopages/file-system": "0.2.0-alpha.
|
|
20
|
+
"@ecopages/file-system": "0.2.0-alpha.20",
|
|
21
21
|
"@ecopages/logger": "^0.2.3",
|
|
22
22
|
"autoprefixer": "^10.4.0",
|
|
23
23
|
"browserslist": "^4.28.1",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"postcss-nested": "^7.0.2"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@ecopages/core": "0.2.0-alpha.
|
|
30
|
+
"@ecopages/core": "0.2.0-alpha.20",
|
|
31
31
|
"@tailwindcss/postcss": ">=4",
|
|
32
32
|
"tailwindcss": ">=3"
|
|
33
33
|
},
|
package/src/plugin.d.ts
CHANGED
|
@@ -26,6 +26,13 @@ export interface PostCssProcessorPluginConfig {
|
|
|
26
26
|
* Regex filter to match files to process
|
|
27
27
|
*/
|
|
28
28
|
filter?: RegExp;
|
|
29
|
+
/**
|
|
30
|
+
* CSS entry files to rebuild when a non-CSS dependency changes.
|
|
31
|
+
*
|
|
32
|
+
* Use this when the processor watches template or script files that affect a
|
|
33
|
+
* known stylesheet entry, such as a Tailwind reference file.
|
|
34
|
+
*/
|
|
35
|
+
dependencyEntryPaths?: string[];
|
|
29
36
|
/**
|
|
30
37
|
* Function to transform the contents of the file.
|
|
31
38
|
* It can be handy to add a custom header or footer to the file.
|
|
@@ -106,6 +113,8 @@ export declare class PostCssProcessorPlugin extends Processor<PostCssProcessorPl
|
|
|
106
113
|
private refreshConfiguredPlugins;
|
|
107
114
|
private enqueueWatchTask;
|
|
108
115
|
private getTrackedCssFiles;
|
|
116
|
+
private getTrackedCssEntryFiles;
|
|
117
|
+
private getDependencyEntryFiles;
|
|
109
118
|
private handleDependencyChange;
|
|
110
119
|
constructor(config?: Omit<ProcessorConfig<PostCssProcessorPluginConfig>, 'name' | 'description'>);
|
|
111
120
|
/**
|
package/src/plugin.js
CHANGED
|
@@ -184,11 +184,24 @@ class PostCssProcessorPlugin extends Processor {
|
|
|
184
184
|
(filePath) => this.matchesFileFilter(filePath) && fileSystem.exists(filePath)
|
|
185
185
|
);
|
|
186
186
|
}
|
|
187
|
+
getTrackedCssEntryFiles() {
|
|
188
|
+
const importedCssFiles = new Set(this.cssDependencyMap.keys());
|
|
189
|
+
return this.getTrackedCssFiles().filter((filePath) => !importedCssFiles.has(filePath));
|
|
190
|
+
}
|
|
191
|
+
getDependencyEntryFiles() {
|
|
192
|
+
const configuredEntryPaths = this.options?.dependencyEntryPaths;
|
|
193
|
+
if (!configuredEntryPaths || configuredEntryPaths.length === 0) {
|
|
194
|
+
return this.getTrackedCssEntryFiles();
|
|
195
|
+
}
|
|
196
|
+
return configuredEntryPaths.filter(
|
|
197
|
+
(filePath) => this.matchesFileFilter(filePath) && fileSystem.exists(filePath)
|
|
198
|
+
);
|
|
199
|
+
}
|
|
187
200
|
async handleDependencyChange(bridge) {
|
|
188
201
|
if (!this.context) {
|
|
189
202
|
return;
|
|
190
203
|
}
|
|
191
|
-
const cssFiles = this.
|
|
204
|
+
const cssFiles = this.getDependencyEntryFiles();
|
|
192
205
|
if (cssFiles.length === 0) {
|
|
193
206
|
return;
|
|
194
207
|
}
|
|
@@ -22,6 +22,7 @@ function tailwindV4Preset(options) {
|
|
|
22
22
|
cssnano: () => cssnano()
|
|
23
23
|
};
|
|
24
24
|
return {
|
|
25
|
+
dependencyEntryPaths: [referencePath],
|
|
25
26
|
/**
|
|
26
27
|
* Instantiate the initial plugin list for the active processor instance.
|
|
27
28
|
* Fresh instances can later be recreated from `pluginFactories`.
|