Skip to content

Commit 78f6012

Browse files
feat: inline @box-extractor/core as @pandacss/extractor (#387)
Co-authored-by: Segun Adebayo <[email protected]>
1 parent d6f0215 commit 78f6012

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+22731
-2119
lines changed

.changeset/fresh-paws-cry.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@pandacss/extractor': minor
3+
'@pandacss/parser': minor
4+
'@pandacss/types': minor
5+
---
6+
7+
refactor: swap dependency from @box-extractor/core to @pandacss/extractor

docs/recipe/03-atomic-recipe.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ The inline recipe takes the following properties:
88
- `variants`: The variant styles for the recipe
99
- `defaultVariants`: The default variants for the recipe
1010

11-
To define an inline recipe, you’d need to use the `recipe` function like this.
11+
To define an inline recipe, you’d need to use the `cva` function like this.
1212

1313
```jsx
14-
import { recipe } from '../panda/css'
14+
import { cva } from '../panda/css'
1515

16-
const button = recipe({
16+
const button = cva({
1717
base: {
1818
display: 'flex',
1919
},

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
"@types/node": "18.15.11",
3434
"@typescript-eslint/eslint-plugin": "5.58.0",
3535
"@typescript-eslint/parser": "5.58.0",
36-
"concurrently": "^8.0.0",
36+
"concurrently": "^8.0.1",
3737
"husky": "8.0.3",
3838
"lint-staged": "13.2.1",
3939
"prettier": "2.8.7",
40-
"ts-morph": "17.0.1",
40+
"ts-morph": "18.0.0",
4141
"tsup": "6.7.0",
4242
"tsx": "3.12.6",
4343
"typescript": "5.0.4",
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { Project, ts } from 'ts-morph'
2+
import { extract } from '../src/extract'
3+
import { type ExtractOptions } from '../src/types'
4+
5+
export const createProject = () => {
6+
return new Project({
7+
compilerOptions: {
8+
jsx: ts.JsxEmit.React,
9+
jsxFactory: 'React.createElement',
10+
jsxFragmentFactory: 'React.Fragment',
11+
module: ts.ModuleKind.ESNext,
12+
target: ts.ScriptTarget.ESNext,
13+
noUnusedParameters: false,
14+
noEmit: true,
15+
useVirtualFileSystem: true,
16+
allowJs: true,
17+
},
18+
skipAddingFilesFromTsConfig: true,
19+
skipFileDependencyResolution: true,
20+
skipLoadingLibFiles: true,
21+
})
22+
}
23+
24+
export type TestExtractOptions = Omit<ExtractOptions, 'ast'> & { tagNameList?: string[]; functionNameList?: string[] }
25+
export const getTestExtract = (
26+
project: Project,
27+
code: string,
28+
{ tagNameList, functionNameList, ...options }: TestExtractOptions,
29+
) => {
30+
const sourceFile = project.createSourceFile('file.tsx', code, { overwrite: true, scriptKind: ts.ScriptKind.TSX })
31+
return extract({
32+
ast: sourceFile,
33+
...options,
34+
components: tagNameList
35+
? {
36+
matchTag: ({ tagName }) => tagNameList.includes(tagName),
37+
matchProp: () => true,
38+
}
39+
: options.components,
40+
functions: functionNameList
41+
? {
42+
matchFn: ({ fnName }) => functionNameList.includes(fnName),
43+
matchProp: () => true,
44+
matchArg: () => true,
45+
}
46+
: options.functions,
47+
})
48+
}

0 commit comments

Comments
 (0)