create-packer 1.25.22 → 1.25.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-packer",
3
- "version": "1.25.22",
3
+ "version": "1.25.24",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -4,6 +4,7 @@
4
4
  /node_modules
5
5
  /.pnp
6
6
  .pnp.js
7
+ .history
7
8
 
8
9
  # testing
9
10
  /coverage
@@ -23,6 +24,7 @@
23
24
  npm-debug.log*
24
25
  yarn-debug.log*
25
26
  yarn-error.log*
27
+ pnpm-lock.yaml
26
28
 
27
29
  # local env files
28
30
  .env*.local
@@ -31,6 +31,7 @@
31
31
  "@commitlint/cli": "17.6.7",
32
32
  "@commitlint/config-conventional": "17.6.7",
33
33
  "@commitlint/cz-commitlint": "17.6.7",
34
+ "commitizen": "4.3.0",
34
35
  "eslint-plugin-import": "2.27.5",
35
36
  "eslint-plugin-prettier": "5.0.0",
36
37
  "husky": "8.0.3",
@@ -1,4 +1,5 @@
1
1
  export { default as useLoadingAction } from './useLoadingAction'
2
2
  export { default as useInterval } from './useInterval'
3
3
  export { default as useVisible } from './useVisible'
4
+ export { default as useLowPriorityState } from './useLowPriorityState'
4
5
  export * from './useSyncState'
@@ -0,0 +1,26 @@
1
+ import { useEffect, useState, useTransition, DependencyList } from 'react'
2
+
3
+ /**
4
+ *
5
+ * @param callback
6
+ * @param watches If set, it is autorun callback
7
+ * @returns
8
+ */
9
+ export default function useLowPriorityState<V>(callback: () => V, watches?: DependencyList) {
10
+ const [value, setValue] = useState<V>(callback)
11
+ const [loading, startTransition] = useTransition()
12
+
13
+ function startLoad() {
14
+ startTransition(() => {
15
+ setValue(callback())
16
+ })
17
+ }
18
+
19
+ useEffect(() => {
20
+ if (watches) {
21
+ startLoad()
22
+ }
23
+ }, watches)
24
+
25
+ return [value, { loading, startLoad }] as const
26
+ }
@@ -1,4 +1,5 @@
1
1
  export { default as useLoadingAction } from './useLoadingAction'
2
2
  export { default as useInterval } from './useInterval'
3
3
  export { default as useVisible } from './useVisible'
4
+ export { default as useLowPriorityState } from './useLowPriorityState'
4
5
  export * from './useSyncState'
@@ -0,0 +1,26 @@
1
+ import { useEffect, useState, useTransition, DependencyList } from 'react'
2
+
3
+ /**
4
+ *
5
+ * @param callback
6
+ * @param watches If set, it is autorun callback
7
+ * @returns
8
+ */
9
+ export default function useLowPriorityState<V>(callback: () => V, watches?: DependencyList) {
10
+ const [value, setValue] = useState<V>(callback)
11
+ const [loading, startTransition] = useTransition()
12
+
13
+ function startLoad() {
14
+ startTransition(() => {
15
+ setValue(callback())
16
+ })
17
+ }
18
+
19
+ useEffect(() => {
20
+ if (watches) {
21
+ startLoad()
22
+ }
23
+ }, watches)
24
+
25
+ return [value, { loading, startLoad }] as const
26
+ }
@@ -43,7 +43,9 @@ export default function (env) {
43
43
  publicPath,
44
44
  clean: true
45
45
  },
46
- bail: true,
46
+ experiments: {
47
+ lazyCompilation: true
48
+ },
47
49
  mode: isProd ? 'production' : 'development',
48
50
  stats: isProd ? 'normal' : 'errors-only',
49
51
  performance: {
@@ -5,14 +5,14 @@
5
5
  "private": true,
6
6
  "main": "index.js",
7
7
  "scripts": {
8
- "build": "ts-node ./scripts/build.ts",
8
+ "build": "pnpm run clean:dist && ts-node ./scripts/build.ts",
9
9
  "changeVersion": "pnpm changeset && pnpm changeset version && pnpm run clear:changelog",
10
10
  "clear:changelog": "pnpm -r exec rimraf CHANGELOG.md",
11
11
  "commit": "git add . && cz",
12
12
  "push": "pnpm run commit && git push",
13
13
  "login": "npm login --registry http://registry.npmjs.org",
14
14
  "clean:dist": "pnpm -r exec rimraf dist",
15
- "pub": "pnpm run changeVersion && pnpm run build && pnpm run push && pnpm -r publish --registry https://registry.npmjs.org"
15
+ "pub": "pnpm run build && pnpm run changeVersion && pnpm run push && pnpm -r publish --registry https://registry.npmjs.org"
16
16
  },
17
17
  "keywords": [],
18
18
  "author": "kevily",