@porotkin/vite-plugin-react-kotlinjs 0.0.1 → 0.0.3

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/README.md CHANGED
@@ -10,7 +10,7 @@ This plugin is inspired by the original
10
10
  Add the following dependency to your `build.gradle.kts`:
11
11
  ```kotlin
12
12
  dependencies {
13
- jsMainImplementation(devNpm("@porotkin/vite-plugin-react-kotlinjs", "^0.0.1"))
13
+ jsMainImplementation(devNpm("@porotkin/vite-plugin-react-kotlinjs", "^0.0.3"))
14
14
  }
15
15
  ```
16
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@porotkin/vite-plugin-react-kotlinjs",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Support React fast refresh in Kotlin/JS",
5
5
  "license": "MIT",
6
6
  "author": "Mikhail Porotkin",
package/src/index.js CHANGED
@@ -16,7 +16,7 @@ export default (options) => {
16
16
 
17
17
  const derivedOptions = {
18
18
  skipFastRefresh: true,
19
- getComponentName: (code) => code.match(/function ([A-Za-z]+)\$lambda\(\$this\$FC\) {/)?.[1],
19
+ getComponentName: (code) => code.match(/function ([A-Za-z]+)\$lambda\(\$this\$FC(, props)?\) {/)?.[1],
20
20
  filter,
21
21
  ...options,
22
22
  };
@@ -16,8 +16,7 @@ export function addRefreshWrapper(code, pluginName, id, getComponentName) {
16
16
  import * as RefreshRuntime from "${runtimePublicPath}";
17
17
  const inWebWorker = typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope;
18
18
  if (import.meta.hot && !inWebWorker) {
19
- const component = get_${componentName}?.()
20
- $RefreshReg$(component, "${componentName}")
19
+ $RefreshReg$(get_${componentName}?.(), "${componentName}")
21
20
  RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
22
21
  RefreshRuntime.registerExportsForReactRefresh(${JSON.stringify(id)}, currentExports);
23
22
  import.meta.hot.accept((nextExports) => {
@@ -35,7 +34,7 @@ function normalizeExports(value) {
35
34
  }
36
35
  }
37
36
  function $RefreshReg$(type, id) {
38
- return RefreshRuntime.register(type, "/Users/mikhail.porotkin_1/Projects/Open-source/use-action-state/src/App.tsx " + id);
37
+ return RefreshRuntime.register(type, ${JSON.stringify(id)} + " " + id);
39
38
  }
40
39
  function $RefreshSig$() {
41
40
  return RefreshRuntime.createSignatureFunctionForTransform();