@flairjs/webpack-loader 0.0.2 → 0.1.0-beta.1
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/dist/cjs/index.js +5 -2
- package/dist/esm/index.js +5 -2
- package/dist/types/index.d.ts +2 -1
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -221,6 +221,9 @@ const transformCode = (code, filePath, options) => {
|
|
|
221
221
|
(result?.logs ?? []).forEach((log) => {
|
|
222
222
|
if (logger[log.level]) logger[log.level](log.message);
|
|
223
223
|
});
|
|
224
|
+
result.unusedClassnames.forEach((unused) => {
|
|
225
|
+
logger.warn(`Unused classname detected: "${unused.className}" in file "${filePath}" at line ${unused.line}`);
|
|
226
|
+
});
|
|
224
227
|
return result;
|
|
225
228
|
};
|
|
226
229
|
|
|
@@ -257,12 +260,12 @@ async function flairJsLoader(source, sourceMap) {
|
|
|
257
260
|
const result = transformCode(source, fileName, {
|
|
258
261
|
appendTimestampToCssFile: false,
|
|
259
262
|
classNameList: options?.classNameList,
|
|
260
|
-
cssPreprocessor: options?.cssPreprocessor ? (
|
|
263
|
+
cssPreprocessor: options?.cssPreprocessor ? (cssData) => options.cssPreprocessor(cssData, fileName) : void 0,
|
|
261
264
|
theme: userTheme?.theme,
|
|
262
265
|
useTheme: !!userTheme,
|
|
263
266
|
cssOutDir: cssGeneratedDir
|
|
264
267
|
});
|
|
265
|
-
if (!result) return callback(null, source, sourceMap);
|
|
268
|
+
if (!result.success) return callback(null, source, sourceMap);
|
|
266
269
|
if (!result.generatedCssName) return callback(null, source, sourceMap);
|
|
267
270
|
this.addDependency(path.resolve(result.generatedCssName));
|
|
268
271
|
let resultSourcemap = null;
|
package/dist/esm/index.js
CHANGED
|
@@ -188,6 +188,9 @@ const transformCode$1 = (code, filePath, options) => {
|
|
|
188
188
|
(result?.logs ?? []).forEach((log) => {
|
|
189
189
|
if (logger[log.level]) logger[log.level](log.message);
|
|
190
190
|
});
|
|
191
|
+
result.unusedClassnames.forEach((unused) => {
|
|
192
|
+
logger.warn(`Unused classname detected: "${unused.className}" in file "${filePath}" at line ${unused.line}`);
|
|
193
|
+
});
|
|
191
194
|
return result;
|
|
192
195
|
};
|
|
193
196
|
|
|
@@ -224,12 +227,12 @@ async function flairJsLoader(source, sourceMap) {
|
|
|
224
227
|
const result = transformCode$1(source, fileName, {
|
|
225
228
|
appendTimestampToCssFile: false,
|
|
226
229
|
classNameList: options?.classNameList,
|
|
227
|
-
cssPreprocessor: options?.cssPreprocessor ? (
|
|
230
|
+
cssPreprocessor: options?.cssPreprocessor ? (cssData) => options.cssPreprocessor(cssData, fileName) : void 0,
|
|
228
231
|
theme: userTheme?.theme,
|
|
229
232
|
useTheme: !!userTheme,
|
|
230
233
|
cssOutDir: cssGeneratedDir
|
|
231
234
|
});
|
|
232
|
-
if (!result) return callback(null, source, sourceMap);
|
|
235
|
+
if (!result.success) return callback(null, source, sourceMap);
|
|
233
236
|
if (!result.generatedCssName) return callback(null, source, sourceMap);
|
|
234
237
|
this.addDependency(path$2.resolve(result.generatedCssName));
|
|
235
238
|
let resultSourcemap = null;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CssData } from '@flairjs/core';
|
|
1
2
|
import { FlairThemeConfig } from '@flairjs/client';
|
|
2
3
|
import { LoaderContext } from 'webpack';
|
|
3
4
|
|
|
@@ -15,7 +16,7 @@ declare interface SharedPluginOptions {
|
|
|
15
16
|
* @param id the id of the file being processed
|
|
16
17
|
* @returns the processed css
|
|
17
18
|
*/
|
|
18
|
-
cssPreprocessor?: (
|
|
19
|
+
cssPreprocessor?: (cssData: CssData, id: string) => string;
|
|
19
20
|
include?: string | string[];
|
|
20
21
|
exclude?: string | string[];
|
|
21
22
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flairjs/webpack-loader",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.1.0-beta.1",
|
|
4
4
|
"main": "./dist/cjs/index.js",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"rolldown": "1.0.0-beta.37",
|
|
23
23
|
"typescript": "^5.8.2",
|
|
24
24
|
"webpack": "^5.101.0",
|
|
25
|
-
"@flairjs/bundler-shared": "0.0.
|
|
25
|
+
"@flairjs/bundler-shared": "1.0.0-beta.1"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"esbuild": "^0.25.10",
|
|
29
29
|
"picomatch": "^4.0.3",
|
|
30
|
-
"@flairjs/core": "0.0.
|
|
30
|
+
"@flairjs/core": "0.1.0-beta.1"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "rimraf dist && tsc && api-extractor run --local && rolldown -c && rimraf dist/types-temp",
|