@pikacss/integration 0.0.38 → 0.0.39

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/README.md CHANGED
@@ -49,7 +49,7 @@ See how it's used in existing integrations:
49
49
 
50
50
  ## Documentation
51
51
 
52
- For complete documentation, visit: [PikaCSS Documentation](https://pikacss.dev)
52
+ For complete documentation, visit: [PikaCSS Documentation](https://pikacss.github.io/pikacss/)
53
53
 
54
54
  ## License
55
55
 
package/dist/index.cjs CHANGED
@@ -355,12 +355,49 @@ function useTransform({ cwd, cssCodegenFilepath, tsCodegenFilepath, scan, fnName
355
355
  let end = start + fnName$1.length;
356
356
  let depth = 1;
357
357
  let inString = false;
358
- while (depth > 0) {
358
+ let isEscaped = false;
359
+ while (depth > 0 && end < code.length) {
359
360
  end++;
360
- if (inString === false && code[end] === "(") depth++;
361
- else if (inString === false && code[end] === ")") depth--;
362
- else if (inString === false && (code[end] === "'" || code[end] === "\"")) inString = code[end];
363
- else if (inString === code[end]) inString = false;
361
+ const char = code[end];
362
+ if (isEscaped) {
363
+ isEscaped = false;
364
+ continue;
365
+ }
366
+ if (char === "\\") {
367
+ isEscaped = true;
368
+ continue;
369
+ }
370
+ if (inString !== false) {
371
+ if (char === inString) inString = false;
372
+ else if (inString === "`" && char === "$" && code[end + 1] === "{") {
373
+ end++;
374
+ depth++;
375
+ }
376
+ continue;
377
+ }
378
+ if (char === "(") depth++;
379
+ else if (char === ")") depth--;
380
+ else if (char === "'" || char === "\"" || char === "`") inString = char;
381
+ else if (char === "/" && code[end + 1] === "/") {
382
+ const lineEnd = code.indexOf("\n", end);
383
+ if (lineEnd === -1) {
384
+ _pikacss_core.log.warn(`Unclosed function call at position ${start}`);
385
+ break;
386
+ }
387
+ end = lineEnd;
388
+ } else if (char === "/" && code[end + 1] === "*") {
389
+ const commentEnd = code.indexOf("*/", end + 2);
390
+ if (commentEnd === -1) {
391
+ _pikacss_core.log.warn(`Unclosed comment in function call at position ${start}`);
392
+ break;
393
+ }
394
+ end = commentEnd + 1;
395
+ }
396
+ }
397
+ if (depth !== 0) {
398
+ _pikacss_core.log.warn(`Malformed function call at position ${start}, skipping`);
399
+ matched = RE.exec(code);
400
+ continue;
364
401
  }
365
402
  const snippet = code.slice(start, end + 1);
366
403
  result.push({
package/dist/index.mjs CHANGED
@@ -329,12 +329,49 @@ function useTransform({ cwd, cssCodegenFilepath, tsCodegenFilepath, scan, fnName
329
329
  let end = start + fnName$1.length;
330
330
  let depth = 1;
331
331
  let inString = false;
332
- while (depth > 0) {
332
+ let isEscaped = false;
333
+ while (depth > 0 && end < code.length) {
333
334
  end++;
334
- if (inString === false && code[end] === "(") depth++;
335
- else if (inString === false && code[end] === ")") depth--;
336
- else if (inString === false && (code[end] === "'" || code[end] === "\"")) inString = code[end];
337
- else if (inString === code[end]) inString = false;
335
+ const char = code[end];
336
+ if (isEscaped) {
337
+ isEscaped = false;
338
+ continue;
339
+ }
340
+ if (char === "\\") {
341
+ isEscaped = true;
342
+ continue;
343
+ }
344
+ if (inString !== false) {
345
+ if (char === inString) inString = false;
346
+ else if (inString === "`" && char === "$" && code[end + 1] === "{") {
347
+ end++;
348
+ depth++;
349
+ }
350
+ continue;
351
+ }
352
+ if (char === "(") depth++;
353
+ else if (char === ")") depth--;
354
+ else if (char === "'" || char === "\"" || char === "`") inString = char;
355
+ else if (char === "/" && code[end + 1] === "/") {
356
+ const lineEnd = code.indexOf("\n", end);
357
+ if (lineEnd === -1) {
358
+ log.warn(`Unclosed function call at position ${start}`);
359
+ break;
360
+ }
361
+ end = lineEnd;
362
+ } else if (char === "/" && code[end + 1] === "*") {
363
+ const commentEnd = code.indexOf("*/", end + 2);
364
+ if (commentEnd === -1) {
365
+ log.warn(`Unclosed comment in function call at position ${start}`);
366
+ break;
367
+ }
368
+ end = commentEnd + 1;
369
+ }
370
+ }
371
+ if (depth !== 0) {
372
+ log.warn(`Malformed function call at position ${start}, skipping`);
373
+ matched = RE.exec(code);
374
+ continue;
338
375
  }
339
376
  const snippet = code.slice(start, end + 1);
340
377
  result.push({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pikacss/integration",
3
3
  "type": "module",
4
- "version": "0.0.38",
4
+ "version": "0.0.39",
5
5
  "author": "DevilTea <ch19980814@gmail.com>",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -49,7 +49,7 @@
49
49
  "micromatch": "^4.0.8",
50
50
  "pathe": "^2.0.3",
51
51
  "perfect-debounce": "^2.0.0",
52
- "@pikacss/core": "0.0.38"
52
+ "@pikacss/core": "0.0.39"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/micromatch": "^4.0.10"