fscss 1.1.21 → 1.1.22

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.
@@ -123,42 +123,37 @@ function parseConditionBlocks(block) {
123
123
  }
124
124
  return blocks;
125
125
  }
126
+
126
127
  function procExC(css) {
127
128
  const regex = /exec\((_log|_error|_warn|_info),\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\)/g;
128
- let jsCode = '';
129
- let match;
130
-
131
- // Replace exec(...) with nothing (remove from CSS) while collecting code
129
+
130
+ const methodMap = {
131
+ _log: console.log,
132
+ _error: console.error,
133
+ _warn: console.warn,
134
+ _info: console.info,
135
+ };
136
+
132
137
  const cleanedCSS = css.replace(regex, (full, method, dQ, sQ, raw) => {
133
- const arg = dQ || sQ || raw;
134
-
135
- if (!['_log', '_error', '_warn', '_info'].includes(method)) {
138
+ const arg = dQ ?? sQ ?? raw;
139
+
140
+ if (!methodMap[method]) {
136
141
  console.warn(`fscss[exec(console)]: Unsupported method: ${method}`);
137
- return ''; // strip it from CSS
142
+ return '';
138
143
  }
139
-
144
+
140
145
  if (!arg) {
141
146
  console.warn(`fscss[exec(console)]: Empty argument for method: ${method}`);
142
- return ''; // strip it from CSS
147
+ return '';
143
148
  }
144
-
145
- jsCode += `console.${method.slice(1)}("${arg.replace(/"/g, '\\"')}");\n`;
146
- return ''; // ensure CSS isn’t broken
149
+
150
+ methodMap[method](arg);
151
+ return '';
147
152
  });
148
-
149
- // Run console code safely
150
- if (jsCode) {
151
- try {
152
- new Function(jsCode)();
153
- } catch (e) {
154
- console.error("fscss[exec(console)]: Error executing transformed code:", e);
155
- }
156
- }
157
-
153
+
158
154
  return cleanedCSS;
159
155
  }
160
156
 
161
-
162
157
  function procEv(css) {
163
158
  const functionMap = {};
164
159
  const funcDefRegex = /@event\s+([\w-]+)\(([^)]*)\)\s*:?{/g;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fscss",
3
3
  "description": "Figured Shorthand Cascading Style Sheet",
4
- "version": "1.1.21",
4
+ "version": "1.1.22",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "bin": {