Skip to content

Commit b3b3b4d

Browse files
committed
refactor: From TS to JSDoc for the preprocessor + svelte-preprocess-react alias
1 parent 860c4ec commit b3b3b4d

File tree

30 files changed

+1282
-2984
lines changed

30 files changed

+1282
-2984
lines changed

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ You're also able to use libraries from the react ecosystem, react-youtube for ex
3939
The snippet above would be generate:
4040

4141
```svelte
42+
<!-- generated by svelte-preprocess-react -->
4243
<script>
4344
import sveltify from "svelte-preprocess-react/sveltify";
4445
import { createPortal } from "react-dom";
@@ -72,23 +73,18 @@ export default {
7273
};
7374
```
7475

75-
When using other processors like [@sveltejs/vite-plugin-svelte](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/preprocess.md) or [svelte-preprocess](https://github.com/sveltejs/svelte-preprocess) use:
76+
When using other processors like [@sveltejs/vite-plugin-svelte](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/preprocess.md) or [svelte-preprocess](https://github.com/sveltejs/svelte-preprocess) add preprocessReact preprocessor as the last processor:
7677

7778
```js
7879
// svelte.config.js
7980
import { vitePreprocess } from "@sveltejs/kit/vite";
8081
import preprocessReact from "svelte-preprocess-react/preprocessReact";
8182

8283
export default {
83-
preprocess: preprocessReact({
84-
preprocess: vitePreprocess(),
85-
}),
84+
preprocess: [vitePreprocess(), preprocessReact()],
8685
};
8786
```
8887

89-
svelte-preprocess-react is a _markup_ preprocessor, these run before the _script_ preprocessors,
90-
The preprocessor that is passed as an option is applied before running the preprocessReact preprocessor.
91-
9288
## Using Svelte inside React components
9389

9490
> Extend
@@ -110,7 +106,7 @@ function MyComponent() {
110106

111107
> Extinguish
112108
113-
Using multiple frontend frameworks add overhead both in User and Developer experience.
109+
Using multiple frontend frameworks adds overhead both in User and Developer experience.
114110

115111
- Increased download size
116112
- Slower (each framework boundary adds overhead)

docs/hooks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The `hooks()` function uses Svelte lifecycle functions, so you can only call the
99

1010
```svelte
1111
<script lang="ts">
12-
import { hooks } from "$lib";
12+
import { hooks } from "svelte-preprocess-react";
1313
1414
const store = hooks(() => useState(0));
1515
</script>

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"license": "MIT",
1515
"type": "module",
1616
"scripts": {
17-
"dev": "node ./src/pre-dev.js && svelte-package && vite dev",
17+
"dev": "vite dev",
1818
"build": "vite build",
1919
"preview": "vite preview",
20-
"package": "svelte-package",
20+
"package": "svelte-package -i src/svelte-preprocess-react",
2121
"lint": "concurrently -c \"#c596c7\",\"#676778\",\"#3074c0\",\"#7c7cea\" --kill-others-on-fail \"npm:lint:*\"",
2222
"lint:prettier": "prettier --check \"src/**/*.svelte\"",
2323
"lint:svelte-check": "svelte-check --fail-on-warnings",
@@ -49,7 +49,7 @@
4949
"@playwright/test": "^1.36.2",
5050
"@sveltejs/adapter-static": "^2.0.2",
5151
"@sveltejs/kit": "^1.22.3",
52-
"@sveltejs/package": "^2.0.0",
52+
"@sveltejs/package": "^2.2.0",
5353
"@testing-library/react": "^14.0.0",
5454
"@testing-library/svelte": "^4.0.3",
5555
"@types/react": "^18.2.17",
@@ -61,7 +61,7 @@
6161
"eslint": "^8.45.0",
6262
"eslint-config-airbnb-base": "^15.0.0",
6363
"eslint-config-airbnb-typescript": "^17.1.0",
64-
"eslint-config-prettier": "^8.8.0",
64+
"eslint-config-prettier": "^8.9.0",
6565
"eslint-config-triple": "^1.1.3",
6666
"eslint-import-resolver-typescript": "^3.5.5",
6767
"eslint-plugin-import": "^2.27.5",
@@ -73,7 +73,7 @@
7373
"lint-staged": "^13.2.3",
7474
"postcss": "^8.4.27",
7575
"prettier": "^3.0.0",
76-
"prettier-plugin-svelte": "^3.0.1",
76+
"prettier-plugin-svelte": "^3.0.2",
7777
"react": "^18.2.0",
7878
"react-dom": "^18.2.0",
7979
"sass": "^1.64.1",

0 commit comments

Comments
 (0)