@wix/cli-app 1.0.68 → 1.0.69

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/client.d.ts ADDED
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,41 @@
1
+ /* eslint-disable no-param-reassign */
2
+ /// <reference types="vite/client" />
3
+ import type { ComponentType } from 'react';
4
+ import { useState, useRef, useEffect } from 'react';
5
+
6
+ export function createHotPageWrapper(
7
+ OriginalPage: ComponentType<unknown>,
8
+ hotData: {
9
+ page?: ComponentType<unknown>;
10
+ setPage?: (NewPage: ComponentType<unknown>) => void;
11
+ }
12
+ ) {
13
+ const Wrapper = import.meta.hot
14
+ ? () => {
15
+ const [WrappedPage, setPage] = useState<ComponentType<unknown>>(
16
+ hotData.page ?? OriginalPage
17
+ );
18
+ const isMountedRef = useRef(false);
19
+
20
+ useEffect(() => {
21
+ hotData.setPage = (NewPage) => {
22
+ hotData.page = NewPage;
23
+ if (isMountedRef.current) {
24
+ setPage(NewPage);
25
+ }
26
+ };
27
+ }, [setPage]);
28
+
29
+ useEffect(() => {
30
+ isMountedRef.current = true;
31
+
32
+ return () => {
33
+ isMountedRef.current = false;
34
+ };
35
+ }, []);
36
+ return WrappedPage;
37
+ }
38
+ : OriginalPage;
39
+
40
+ return Wrapper;
41
+ }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@wix/cli-app",
3
3
  "description": "CLI tool for Wix apps",
4
- "version": "1.0.68",
4
+ "version": "1.0.69",
5
5
  "author": "Amit Dahan",
6
6
  "dependencies": {
7
7
  "@vitejs/plugin-react-swc": "3.3.0",
8
- "vite": "4.3.3"
8
+ "vite": "4.3.4"
9
9
  },
10
10
  "devDependencies": {
11
11
  "@rollup/plugin-virtual": "^3.0.1",
@@ -56,13 +56,16 @@
56
56
  "./client": {
57
57
  "types": "./client.d.ts"
58
58
  },
59
+ "./internal/hot-page": "./internal/hot-page.ts",
59
60
  "./tsconfig.app.json": "./tsconfig.app.json",
60
61
  "./package.json": "./package.json"
61
62
  },
62
63
  "files": [
63
64
  "build",
64
65
  "!build/**/*.d.ts",
65
- "tsconfig.app.json"
66
+ "tsconfig.app.json",
67
+ "client.d.ts",
68
+ "internal"
66
69
  ],
67
70
  "peerDependencies": {
68
71
  "react": "^16.14 || ^17 || ^18",
@@ -105,5 +108,5 @@
105
108
  ]
106
109
  }
107
110
  },
108
- "falconPackageHash": "0694ff52537f2d1b93d7162b4dd9dac9797c975c976220a0bb5593e0"
111
+ "falconPackageHash": "e7446e68106dbaa351d2cfac33daf9d22a0a0d661ef6b690e17fdba6"
109
112
  }
package/tsconfig.app.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "target": "ESNext",
4
- "module": "commonjs",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
5
6
  "esModuleInterop": true,
6
7
  "forceConsistentCasingInFileNames": true,
7
8
  "strict": true,