@seyuna/postcss 1.0.0-canary.24 → 1.0.0-canary.25

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 CHANGED
@@ -1,3 +1,10 @@
1
+ # [1.0.0-canary.25](https://github.com/seyuna-corp/seyuna-postcss/compare/v1.0.0-canary.24...v1.0.0-canary.25) (2026-01-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * resolve deadlock by correctly passing Result object for warnings ([f7766a0](https://github.com/seyuna-corp/seyuna-postcss/commit/f7766a0f3914c19368aa2a73dfca4b2217a47072))
7
+
1
8
  # [1.0.0-canary.24](https://github.com/seyuna-corp/seyuna-postcss/compare/v1.0.0-canary.23...v1.0.0-canary.24) (2026-01-10)
2
9
 
3
10
 
package/dist/errors.d.ts CHANGED
@@ -3,4 +3,4 @@ export declare function reportError(message: string, node: any, context: PluginC
3
3
  word?: string;
4
4
  index?: number;
5
5
  }): void;
6
- export declare function reportWarning(message: string, node: any): void;
6
+ export declare function reportWarning(message: string, node: any, context?: PluginContext): void;
package/dist/errors.js CHANGED
@@ -5,10 +5,15 @@ export function reportError(message, node, context, options = {}) {
5
5
  throw node.error(formattedMessage, options);
6
6
  }
7
7
  else {
8
- reportWarning(formattedMessage, node);
8
+ reportWarning(formattedMessage, node, context);
9
9
  }
10
10
  }
11
- export function reportWarning(message, node) {
12
- const result = node.root().toResult();
13
- node.warn(result, `[Seyuna PostCSS] ${message}`);
11
+ export function reportWarning(message, node, context) {
12
+ if (context?.result) {
13
+ node.warn(context.result, `[Seyuna PostCSS] ${message}`);
14
+ }
15
+ else {
16
+ // Fallback if no result is available (should not happen in main flow)
17
+ console.warn(`[Seyuna PostCSS Warning] ${message}`);
18
+ }
14
19
  }
package/dist/plugin.js CHANGED
@@ -9,17 +9,25 @@ export const dynamicFunctionsPlugin = (opts = {}) => {
9
9
  return {
10
10
  postcssPlugin: "postcss-dynamic-functions",
11
11
  async Once() {
12
- const { config, options } = await loadConfigAsync(opts);
13
- fnMap = { ...functions, ...opts.functions };
14
- context = {
15
- config,
16
- options,
17
- functions: fnMap,
18
- };
12
+ try {
13
+ const { config, options } = await loadConfigAsync(opts);
14
+ fnMap = { ...functions, ...opts.functions };
15
+ context = {
16
+ config,
17
+ options,
18
+ functions: fnMap,
19
+ result: undefined
20
+ };
21
+ }
22
+ catch (e) {
23
+ throw e;
24
+ }
19
25
  },
20
- Declaration(decl) {
26
+ Declaration(decl, { result }) {
21
27
  if (!context || !fnMap)
22
28
  return;
29
+ // Update context with the current result object
30
+ context.result = result;
23
31
  const newValue = processFunctions(decl.value, fnMap, decl, context);
24
32
  if (newValue !== decl.value) {
25
33
  decl.value = newValue;
package/dist/types.d.ts CHANGED
@@ -56,4 +56,5 @@ export interface PluginContext {
56
56
  config: SeyunaConfig;
57
57
  options: Required<PluginOptions>;
58
58
  functions: FunctionMap;
59
+ result?: any;
59
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seyuna/postcss",
3
- "version": "1.0.0-canary.24",
3
+ "version": "1.0.0-canary.25",
4
4
  "description": "Seyuna UI's postcss plugin",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/errors.ts CHANGED
@@ -13,11 +13,15 @@ export function reportError(
13
13
  if (pluginOptions.strict) {
14
14
  throw node.error(formattedMessage, options);
15
15
  } else {
16
- reportWarning(formattedMessage, node);
16
+ reportWarning(formattedMessage, node, context);
17
17
  }
18
18
  }
19
19
 
20
- export function reportWarning(message: string, node: any) {
21
- const result = node.root().toResult();
22
- node.warn(result, `[Seyuna PostCSS] ${message}`);
20
+ export function reportWarning(message: string, node: any, context?: PluginContext) {
21
+ if (context?.result) {
22
+ node.warn(context.result, `[Seyuna PostCSS] ${message}`);
23
+ } else {
24
+ // Fallback if no result is available (should not happen in main flow)
25
+ console.warn(`[Seyuna PostCSS Warning] ${message}`);
26
+ }
23
27
  }
package/src/plugin.ts CHANGED
@@ -15,18 +15,26 @@ export const dynamicFunctionsPlugin: any = (
15
15
  postcssPlugin: "postcss-dynamic-functions",
16
16
 
17
17
  async Once() {
18
- const { config, options } = await loadConfigAsync(opts);
19
- fnMap = { ...functions, ...(opts as any).functions };
20
- context = {
21
- config,
22
- options,
23
- functions: fnMap as FunctionMap,
24
- };
18
+ try {
19
+ const { config, options } = await loadConfigAsync(opts);
20
+ fnMap = { ...functions, ...(opts as any).functions };
21
+ context = {
22
+ config,
23
+ options,
24
+ functions: fnMap as FunctionMap,
25
+ result: undefined
26
+ };
27
+ } catch (e) {
28
+ throw e;
29
+ }
25
30
  },
26
31
 
27
- Declaration(decl: any) {
32
+ Declaration(decl: any, { result }: any) {
28
33
  if (!context || !fnMap) return;
29
34
 
35
+ // Update context with the current result object
36
+ context.result = result;
37
+
30
38
  const newValue = processFunctions(decl.value, fnMap, decl, context);
31
39
 
32
40
  if (newValue !== decl.value) {
package/src/types.ts CHANGED
@@ -69,4 +69,5 @@ export interface PluginContext {
69
69
  config: SeyunaConfig;
70
70
  options: Required<PluginOptions>;
71
71
  functions: FunctionMap;
72
+ result?: any; // PostCSS Result
72
73
  }