@pandacss/parser 0.13.0 → 0.14.0

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/index.js CHANGED
@@ -528,10 +528,10 @@ var NodeTypes = {
528
528
  var vueToTsx = (code) => {
529
529
  try {
530
530
  const parsed = (0, import_compiler_sfc.parse)(code);
531
- const fileStr = new import_magic_string.default(code);
531
+ const fileStr = new import_magic_string.default(`<template>${parsed.descriptor.template?.content}</template>` ?? "");
532
532
  const rewriteProp = (prop) => {
533
533
  if (prop.type === NodeTypes.DIRECTIVE && prop.exp?.type === NodeTypes.SIMPLE_EXPRESSION && prop.arg?.type === NodeTypes.SIMPLE_EXPRESSION) {
534
- fileStr.update(prop.loc.start.offset, prop.loc.end.offset, `${prop.arg.content}={${prop.exp.content}}`);
534
+ fileStr.replace(prop.loc.source, `${prop.arg.content}={${prop.exp.content}}`);
535
535
  }
536
536
  };
537
537
  const stack = [...parsed.descriptor.template.ast.children];
@@ -544,13 +544,9 @@ var vueToTsx = (code) => {
544
544
  node.children.forEach((child) => stack.push(child));
545
545
  }
546
546
  }
547
- const templateStart = code.indexOf("<template");
548
- const templateEnd = code.indexOf("</template>") + "</template>".length;
549
547
  const scriptContent = (parsed.descriptor.scriptSetup ?? parsed.descriptor.script)?.content + "\n";
550
- const transformed = new import_magic_string.default(
551
- `${scriptContent}
552
- const render = ${fileStr.snip(templateStart, templateEnd).toString()}`
553
- );
548
+ const transformed = new import_magic_string.default(`${scriptContent}
549
+ const render = ${fileStr.toString()}`);
554
550
  return transformed.toString();
555
551
  } catch (err) {
556
552
  return "";
package/dist/index.mjs CHANGED
@@ -490,10 +490,10 @@ var NodeTypes = {
490
490
  var vueToTsx = (code) => {
491
491
  try {
492
492
  const parsed = parse(code);
493
- const fileStr = new MagicString(code);
493
+ const fileStr = new MagicString(`<template>${parsed.descriptor.template?.content}</template>` ?? "");
494
494
  const rewriteProp = (prop) => {
495
495
  if (prop.type === NodeTypes.DIRECTIVE && prop.exp?.type === NodeTypes.SIMPLE_EXPRESSION && prop.arg?.type === NodeTypes.SIMPLE_EXPRESSION) {
496
- fileStr.update(prop.loc.start.offset, prop.loc.end.offset, `${prop.arg.content}={${prop.exp.content}}`);
496
+ fileStr.replace(prop.loc.source, `${prop.arg.content}={${prop.exp.content}}`);
497
497
  }
498
498
  };
499
499
  const stack = [...parsed.descriptor.template.ast.children];
@@ -506,13 +506,9 @@ var vueToTsx = (code) => {
506
506
  node.children.forEach((child) => stack.push(child));
507
507
  }
508
508
  }
509
- const templateStart = code.indexOf("<template");
510
- const templateEnd = code.indexOf("</template>") + "</template>".length;
511
509
  const scriptContent = (parsed.descriptor.scriptSetup ?? parsed.descriptor.script)?.content + "\n";
512
- const transformed = new MagicString(
513
- `${scriptContent}
514
- const render = ${fileStr.snip(templateStart, templateEnd).toString()}`
515
- );
510
+ const transformed = new MagicString(`${scriptContent}
511
+ const render = ${fileStr.toString()}`);
516
512
  return transformed.toString();
517
513
  } catch (err) {
518
514
  return "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/parser",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "The static parser for panda css",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -16,17 +16,17 @@
16
16
  "magic-string": "^0.30.2",
17
17
  "ts-morph": "19.0.0",
18
18
  "ts-pattern": "5.0.4",
19
- "@pandacss/config": "^0.13.0",
20
- "@pandacss/extractor": "0.13.0",
21
- "@pandacss/is-valid-prop": "0.13.0",
22
- "@pandacss/logger": "0.13.0",
23
- "@pandacss/shared": "0.13.0",
24
- "@pandacss/types": "0.13.0"
19
+ "@pandacss/config": "^0.14.0",
20
+ "@pandacss/extractor": "0.14.0",
21
+ "@pandacss/is-valid-prop": "0.14.0",
22
+ "@pandacss/logger": "0.14.0",
23
+ "@pandacss/shared": "0.14.0",
24
+ "@pandacss/types": "0.14.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "hookable": "5.5.3",
28
- "@pandacss/fixture": "0.13.0",
29
- "@pandacss/generator": "0.13.0"
28
+ "@pandacss/fixture": "0.14.0",
29
+ "@pandacss/generator": "0.14.0"
30
30
  },
31
31
  "files": [
32
32
  "dist"