@flairjs/parcel-transformer 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 CHANGED
@@ -225,6 +225,9 @@ const transformCode = (code, filePath, options) => {
225
225
  (result?.logs ?? []).forEach((log) => {
226
226
  if (logger[log.level]) logger[log.level](log.message);
227
227
  });
228
+ result.unusedClassnames.forEach((unused) => {
229
+ logger.warn(`Unused classname detected: "${unused.className}" in file "${filePath}" at line ${unused.line}`);
230
+ });
228
231
  return result;
229
232
  };
230
233
 
@@ -257,12 +260,12 @@ const transformer = new __parcel_plugin.Transformer({
257
260
  const result = transformCode(code, asset.filePath, {
258
261
  appendTimestampToCssFile: false,
259
262
  classNameList: config?.classNameList,
260
- cssPreprocessor: config?.cssPreprocessor ? (css) => config.cssPreprocessor(css, asset.filePath) : void 0,
263
+ cssPreprocessor: config?.cssPreprocessor ? (cssData) => config.cssPreprocessor(cssData, asset.filePath) : void 0,
261
264
  theme: config.userTheme?.theme,
262
265
  useTheme: !!config.userTheme,
263
266
  cssOutDir
264
267
  });
265
- if (!result) return [asset];
268
+ if (!result?.success) return [asset];
266
269
  if (!result.generatedCssName) return [asset];
267
270
  asset.addURLDependency(node_path.resolve(cssOutDir, result.generatedCssName), { pipeline: "css" });
268
271
  asset.setCode(result.code);
package/dist/esm/index.js CHANGED
@@ -190,6 +190,9 @@ const transformCode$1 = (code, filePath, options) => {
190
190
  (result?.logs ?? []).forEach((log) => {
191
191
  if (logger[log.level]) logger[log.level](log.message);
192
192
  });
193
+ result.unusedClassnames.forEach((unused) => {
194
+ logger.warn(`Unused classname detected: "${unused.className}" in file "${filePath}" at line ${unused.line}`);
195
+ });
193
196
  return result;
194
197
  };
195
198
 
@@ -222,12 +225,12 @@ const transformer = new Transformer({
222
225
  const result = transformCode$1(code, asset.filePath, {
223
226
  appendTimestampToCssFile: false,
224
227
  classNameList: config?.classNameList,
225
- cssPreprocessor: config?.cssPreprocessor ? (css) => config.cssPreprocessor(css, asset.filePath) : void 0,
228
+ cssPreprocessor: config?.cssPreprocessor ? (cssData) => config.cssPreprocessor(cssData, asset.filePath) : void 0,
226
229
  theme: config.userTheme?.theme,
227
230
  useTheme: !!config.userTheme,
228
231
  cssOutDir
229
232
  });
230
- if (!result) return [asset];
233
+ if (!result?.success) return [asset];
231
234
  if (!result.generatedCssName) return [asset];
232
235
  asset.addURLDependency(path$2.resolve(cssOutDir, result.generatedCssName), { pipeline: "css" });
233
236
  asset.setCode(result.code);
@@ -1,3 +1,4 @@
1
+ import { CssData } from '@flairjs/core';
1
2
  import { FlairThemeConfig } from '@flairjs/client';
2
3
  import type { Transformer } from '@parcel/plugin';
3
4
 
@@ -12,7 +13,7 @@ declare interface SharedPluginOptions {
12
13
  * @param id the id of the file being processed
13
14
  * @returns the processed css
14
15
  */
15
- cssPreprocessor?: (css: string, id: string) => string;
16
+ cssPreprocessor?: (cssData: CssData, id: string) => string;
16
17
  include?: string | string[];
17
18
  exclude?: string | string[];
18
19
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flairjs/parcel-transformer",
3
- "version": "0.0.2",
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,7 +22,7 @@
22
22
  "rimraf": "^6.0.1",
23
23
  "rolldown": "1.0.0-beta.37",
24
24
  "typescript": "^5.8.2",
25
- "@flairjs/bundler-shared": "0.0.2"
25
+ "@flairjs/bundler-shared": "1.0.0-beta.1"
26
26
  },
27
27
  "engines": {
28
28
  "parcel": ">=2.0.0"
@@ -32,7 +32,7 @@
32
32
  "@parcel/source-map": "^2.1.1",
33
33
  "esbuild": "^0.25.10",
34
34
  "picomatch": "^4.0.3",
35
- "@flairjs/core": "0.0.2"
35
+ "@flairjs/core": "0.1.0-beta.1"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "rimraf dist && tsc && api-extractor run --local && rolldown -c && rimraf dist/types-temp",