Skip to content

Commit

Permalink
fix: update qwik support (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhthomas committed Jul 11, 2023
1 parent 25848d6 commit d3a852f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 21 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,12 @@ Type Declarations
<details>
<summary>Qwik</summary><br>

Qwik support requires peer dependency `@svgx/core`:

```bash
npm i -D @svgx/core
```

```ts
Icons({ compiler: 'qwik' })
```
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
},
"peerDependencies": {
"@svgr/core": ">=7.0.0",
"@svgx/core": "^1.0.1",
"@vue/compiler-sfc": "^3.0.2 || ^2.7.0",
"vue-template-compiler": "^2.6.12",
"vue-template-es2015-compiler": "^1.9.0"
Expand All @@ -124,6 +125,9 @@
"@svgr/core": {
"optional": true
},
"@svgx/core": {
"optional": true
},
"@vue/compiler-sfc": {
"optional": true
},
Expand Down
30 changes: 13 additions & 17 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/core/compilers/qwik.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ export const QwikCompiler = (async (
}
const mergedOptions = Object.assign({}, defaultOptions, options)
const svgx = await importModule('@svgx/core')
// check for v6 transform, v5 default and previous versions
const toJsComponent = svgx.toJsComponent || svgx.default || svgx
const res = toJsComponent(svg, {
const toJsxComponent = svgx.toJsxComponent
const res = toJsxComponent(svg, {
...mergedOptions,
defaultExport: true,
})
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const unplugin = createUnplugin<Options | undefined>((options = {}) => {
case 'jsx':
return `${res}.jsx`
case 'qwik':
return `${res}.tsx`
return `${res}.jsx`
case 'marko':
return `${res}.marko`
case 'svelte':
Expand Down

0 comments on commit d3a852f

Please sign in to comment.