@pandacss/parser 0.6.0 → 0.7.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
@@ -467,15 +467,21 @@ var vueToTsx = (code) => {
467
467
  try {
468
468
  const parsed = (0, import_compiler_sfc.parse)(code);
469
469
  const fileStr = new import_magic_string.default(code);
470
- parsed.descriptor.template.ast.children.forEach((node) => {
470
+ const rewriteProp = (prop) => {
471
+ if (prop.type === NodeTypes.DIRECTIVE && prop.exp?.type === NodeTypes.SIMPLE_EXPRESSION && prop.arg?.type === NodeTypes.SIMPLE_EXPRESSION) {
472
+ fileStr.update(prop.loc.start.offset, prop.loc.end.offset, `${prop.arg.content}={${prop.exp.content}}`);
473
+ }
474
+ };
475
+ const stack = [...parsed.descriptor.template.ast.children];
476
+ while (stack.length) {
477
+ const node = stack.pop();
478
+ if (!node)
479
+ continue;
471
480
  if (node.type === NodeTypes.ELEMENT) {
472
- node.props.forEach((prop) => {
473
- if (prop.type === NodeTypes.DIRECTIVE && prop.exp?.type === NodeTypes.SIMPLE_EXPRESSION && prop.arg?.type === NodeTypes.SIMPLE_EXPRESSION) {
474
- fileStr.update(prop.loc.start.offset, prop.loc.end.offset, `${prop.arg.content}={${prop.exp.content}}`);
475
- }
476
- });
481
+ node.props.forEach(rewriteProp);
482
+ node.children.forEach((child) => stack.push(child));
477
483
  }
478
- });
484
+ }
479
485
  const templateStart = code.indexOf("<template");
480
486
  const templateEnd = code.indexOf("</template>") + "</template>".length;
481
487
  const scriptContent = (parsed.descriptor.scriptSetup ?? parsed.descriptor.script)?.content + "\n";
package/dist/index.mjs CHANGED
@@ -429,15 +429,21 @@ var vueToTsx = (code) => {
429
429
  try {
430
430
  const parsed = parse(code);
431
431
  const fileStr = new MagicString(code);
432
- parsed.descriptor.template.ast.children.forEach((node) => {
432
+ const rewriteProp = (prop) => {
433
+ if (prop.type === NodeTypes.DIRECTIVE && prop.exp?.type === NodeTypes.SIMPLE_EXPRESSION && prop.arg?.type === NodeTypes.SIMPLE_EXPRESSION) {
434
+ fileStr.update(prop.loc.start.offset, prop.loc.end.offset, `${prop.arg.content}={${prop.exp.content}}`);
435
+ }
436
+ };
437
+ const stack = [...parsed.descriptor.template.ast.children];
438
+ while (stack.length) {
439
+ const node = stack.pop();
440
+ if (!node)
441
+ continue;
433
442
  if (node.type === NodeTypes.ELEMENT) {
434
- node.props.forEach((prop) => {
435
- if (prop.type === NodeTypes.DIRECTIVE && prop.exp?.type === NodeTypes.SIMPLE_EXPRESSION && prop.arg?.type === NodeTypes.SIMPLE_EXPRESSION) {
436
- fileStr.update(prop.loc.start.offset, prop.loc.end.offset, `${prop.arg.content}={${prop.exp.content}}`);
437
- }
438
- });
443
+ node.props.forEach(rewriteProp);
444
+ node.children.forEach((child) => stack.push(child));
439
445
  }
440
- });
446
+ }
441
447
  const templateStart = code.indexOf("<template");
442
448
  const templateEnd = code.indexOf("</template>") + "</template>".length;
443
449
  const scriptContent = (parsed.descriptor.scriptSetup ?? parsed.descriptor.script)?.content + "\n";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/parser",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "The static parser for panda css",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -13,19 +13,19 @@
13
13
  "dependencies": {
14
14
  "@vue/compiler-sfc": "^3.3.4",
15
15
  "lil-fp": "1.4.5",
16
- "magic-string": "^0.30.0",
16
+ "magic-string": "^0.30.1",
17
17
  "ts-morph": "18.0.0",
18
- "ts-pattern": "4.3.0",
19
- "@pandacss/extractor": "0.6.0",
20
- "@pandacss/is-valid-prop": "0.6.0",
21
- "@pandacss/logger": "0.6.0",
22
- "@pandacss/shared": "0.6.0",
23
- "@pandacss/types": "0.6.0"
18
+ "ts-pattern": "5.0.1",
19
+ "@pandacss/extractor": "0.7.0",
20
+ "@pandacss/is-valid-prop": "0.7.0",
21
+ "@pandacss/logger": "0.7.0",
22
+ "@pandacss/shared": "0.7.0",
23
+ "@pandacss/types": "0.7.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "hookable": "5.5.3",
27
- "@pandacss/fixture": "0.6.0",
28
- "@pandacss/generator": "0.6.0"
27
+ "@pandacss/fixture": "0.7.0",
28
+ "@pandacss/generator": "0.7.0"
29
29
  },
30
30
  "files": [
31
31
  "dist"