create-packer 1.44.1 → 1.44.2

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.44.1",
3
+ "version": "1.44.2",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -2,6 +2,6 @@ import { defineStore } from 'define-zustand'
2
2
 
3
3
  export const useApp = defineStore({
4
4
  state: () => ({}),
5
- getter: {},
5
+ getters: {},
6
6
  actions: () => ({})
7
7
  })
@@ -1,6 +1,6 @@
1
1
  import { FunctionComponent } from 'react'
2
2
  import { Outlet } from 'react-router'
3
- import { last } from 'lodash-es'
3
+ import { last } from 'es-toolkit'
4
4
  import { routeType, useMatchRoutes } from '@/domain/router'
5
5
 
6
6
  export interface propsType {
@@ -1,7 +1,7 @@
1
1
  import { FunctionComponent } from 'react'
2
2
  import { Outlet } from 'react-router'
3
3
  import { useMount } from 'react-use'
4
- import { last } from 'lodash-es'
4
+ import { last } from 'es-toolkit'
5
5
  import { useMatchRoutes, useRouter, routeType } from '@/domain/router'
6
6
 
7
7
  export interface propsType {
@@ -21,9 +21,9 @@
21
21
  "dependencies": {
22
22
  "@tanstack/react-query": "5.51.15",
23
23
  "axios": "1.7.9",
24
- "define-zustand": "3.2.1",
24
+ "define-zustand": "3.4.0",
25
+ "es-toolkit": "1.37.2",
25
26
  "immer": "10.0.1",
26
- "lodash-es": "4.17.21",
27
27
  "qs": "6.11.2",
28
28
  "react": "18.3.1",
29
29
  "react-dom": "18.3.1",
@@ -45,7 +45,6 @@
45
45
  "@rsbuild/plugin-type-check": "1.2.1",
46
46
  "@rsdoctor/rspack-plugin": "0.4.13",
47
47
  "@tailwindcss/postcss": "4.1.4",
48
- "@types/lodash-es": "4.17.12",
49
48
  "@types/node": "18.16.0",
50
49
  "@types/qs": "6.9.7",
51
50
  "@types/react": "18.3.3",
@@ -10,7 +10,7 @@ export default function defineRouter(router: ReturnType<typeof createBrowserRout
10
10
  state: () => ({
11
11
  routes: cloneDeep(router.routes) as routeType[]
12
12
  }),
13
- getter: {
13
+ getters: {
14
14
  routesById: state => {
15
15
  return (function flat(routes: routeType[], parentRoute?: routeByIdType) {
16
16
  return reduce(
@@ -36,7 +36,7 @@ export default function defineRouter(router: ReturnType<typeof createBrowserRout
36
36
  })(state.routes)
37
37
  }
38
38
  },
39
- actions: (getState, action) => {
39
+ actions: (setState, getState) => {
40
40
  function posToLodashPath(pos: string) {
41
41
  if (pos) {
42
42
  return `[${split(pos, '-').join('].children[')}]`
@@ -52,7 +52,7 @@ export default function defineRouter(router: ReturnType<typeof createBrowserRout
52
52
  const newRoute = cloneDeep(omit(route, ['element', 'errorElement', 'children']))
53
53
  updator(newRoute)
54
54
  assign(route, newRoute)
55
- action.setState({ routes: newRoutes })
55
+ setState({ routes: newRoutes })
56
56
  }
57
57
  function getRoute(id: routeType['id'], path?: string | string[]) {
58
58
  const { routesById } = getState()
@@ -1,12 +1,12 @@
1
1
  import { useRef, useState, Dispatch, SetStateAction } from 'react'
2
- import { isFunction } from 'lodash-es'
2
+ import { isFunction } from 'es-toolkit'
3
3
 
4
4
  export function useSyncState<S>(initialState: S | (() => S)) {
5
5
  const [state, setState] = useState(initialState)
6
6
  const syncState = useRef<S>(state)
7
7
 
8
8
  const $setState: Dispatch<SetStateAction<S>> = newState => {
9
- const $newState = isFunction(newState) ? newState(state) : newState
9
+ const $newState = (isFunction(newState) ? newState(state) : newState) as S
10
10
  setState($newState)
11
11
  syncState.current = $newState
12
12
  }
@@ -1,5 +1,5 @@
1
1
  import { useState } from 'react'
2
- import { isFunction } from 'lodash-es'
2
+ import { isFunction } from 'es-toolkit'
3
3
 
4
4
  export interface useVisibleConfigType {
5
5
  defaultVisible?: boolean
@@ -1,7 +1,7 @@
1
- import { useQuery, UndefinedInitialDataOptions } from '@tanstack/react-query'
1
+ import { useQuery, QueryOptions } from '@tanstack/react-query'
2
2
  import { HOME_DATA } from './api'
3
3
 
4
- export const useHomeData = (options?: UndefinedInitialDataOptions) => {
4
+ export const useHomeData = (options?: QueryOptions) => {
5
5
  return useQuery({
6
6
  ...options,
7
7
  queryKey: [HOME_DATA, ...(options?.queryKey || [])]
@@ -2,6 +2,6 @@ import { defineStore } from 'define-zustand'
2
2
 
3
3
  export const useApp = defineStore({
4
4
  state: () => ({}),
5
- getter: {},
5
+ getters: {},
6
6
  actions: () => ({})
7
7
  })
@@ -1,22 +1,22 @@
1
- import { FunctionComponent, ReactNode } from 'react'
2
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
3
- import { request } from '@/shared/service'
4
-
5
- const queryClient = new QueryClient({
6
- defaultOptions: {
7
- queries: {
8
- queryFn: async ({ queryKey }) => {
9
- const { data } = await request.get(queryKey[0] as string, {
10
- params: queryKey[1]
11
- })
12
- return data
13
- }
14
- }
15
- }
16
- })
17
- export interface propsType {
18
- children: ReactNode
19
- }
20
- export const Root: FunctionComponent<propsType> = props => {
21
- return <QueryClientProvider client={queryClient}>{props.children}</QueryClientProvider>
22
- }
1
+ import { FunctionComponent, ReactNode } from 'react'
2
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
3
+ import { request } from '@/shared/service'
4
+
5
+ const queryClient = new QueryClient({
6
+ defaultOptions: {
7
+ queries: {
8
+ queryFn: async ({ queryKey }) => {
9
+ const { data } = await request.get(queryKey[0] as string, {
10
+ params: queryKey[1]
11
+ })
12
+ return data
13
+ }
14
+ }
15
+ }
16
+ })
17
+ export interface propsType {
18
+ children: ReactNode
19
+ }
20
+ export const Root: FunctionComponent<propsType> = props => {
21
+ return <QueryClientProvider client={queryClient}>{props.children}</QueryClientProvider>
22
+ }
@@ -1,24 +1,24 @@
1
- import { useLayoutEffect, Suspense } from 'react'
2
- import { RouterProvider } from 'react-router/dom'
3
- import { request } from '@/shared/service'
4
- import { routerInstance } from '@/domain/router'
5
- import * as AppContext from './app-context'
6
-
7
- export const Root = () => {
8
- useLayoutEffect(() => {
9
- request.interceptors.response.use(
10
- res => res,
11
- error => {
12
- console.log(error)
13
- }
14
- )
15
- }, [])
16
-
17
- return (
18
- <AppContext.Root>
19
- <Suspense fallback={<>loading...</>}>
20
- <RouterProvider router={routerInstance} />
21
- </Suspense>
22
- </AppContext.Root>
23
- )
24
- }
1
+ import { useLayoutEffect, Suspense } from 'react'
2
+ import { RouterProvider } from 'react-router/dom'
3
+ import { request } from '@/shared/service'
4
+ import { routerInstance } from '@/domain/router'
5
+ import * as AppContext from './app-context'
6
+
7
+ export const Root = () => {
8
+ useLayoutEffect(() => {
9
+ request.interceptors.response.use(
10
+ res => res,
11
+ error => {
12
+ console.log(error)
13
+ }
14
+ )
15
+ }, [])
16
+
17
+ return (
18
+ <AppContext.Root>
19
+ <Suspense fallback={<>loading...</>}>
20
+ <RouterProvider router={routerInstance} />
21
+ </Suspense>
22
+ </AppContext.Root>
23
+ )
24
+ }
@@ -20,9 +20,9 @@
20
20
  "dependencies": {
21
21
  "@tanstack/react-query": "5.51.15",
22
22
  "axios": "1.7.9",
23
- "define-zustand": "3.2.1",
23
+ "define-zustand": "3.4.0",
24
+ "es-toolkit": "1.37.2",
24
25
  "immer": "10.0.1",
25
- "lodash-es": "4.17.21",
26
26
  "qs": "6.11.2",
27
27
  "react": "18.3.1",
28
28
  "react-dom": "18.3.1",
@@ -40,7 +40,6 @@
40
40
  "@eslint/js": "9.15.0",
41
41
  "@faker-js/faker": "8.4.1",
42
42
  "@tailwindcss/vite": "4.1.4",
43
- "@types/lodash-es": "4.17.12",
44
43
  "@types/node": "18.16.0",
45
44
  "@types/qs": "6.9.7",
46
45
  "@types/react": "18.3.3",
@@ -10,7 +10,7 @@ export default function defineRouter(router: ReturnType<typeof createBrowserRout
10
10
  state: () => ({
11
11
  routes: cloneDeep(router.routes) as routeType[]
12
12
  }),
13
- getter: {
13
+ getters: {
14
14
  routesById: state => {
15
15
  return (function flat(routes: routeType[], parentRoute?: routeByIdType) {
16
16
  return reduce(
@@ -36,7 +36,7 @@ export default function defineRouter(router: ReturnType<typeof createBrowserRout
36
36
  })(state.routes)
37
37
  }
38
38
  },
39
- actions: (getState, action) => {
39
+ actions: (setState, getState) => {
40
40
  function posToLodashPath(pos: string) {
41
41
  if (pos) {
42
42
  return `[${split(pos, '-').join('].children[')}]`
@@ -52,7 +52,7 @@ export default function defineRouter(router: ReturnType<typeof createBrowserRout
52
52
  const newRoute = cloneDeep(omit(route, ['element', 'errorElement', 'children']))
53
53
  updator(newRoute)
54
54
  assign(route, newRoute)
55
- action.setState({ routes: newRoutes })
55
+ setState({ routes: newRoutes })
56
56
  }
57
57
  function getRoute(id: routeType['id'], path?: string | string[]) {
58
58
  const { routesById } = getState()
@@ -1,7 +1,7 @@
1
- import { useQuery, UndefinedInitialDataOptions } from '@tanstack/react-query'
1
+ import { useQuery, QueryOptions } from '@tanstack/react-query'
2
2
  import { HOME_DATA } from './api'
3
3
 
4
- export const useHomeData = (options?: UndefinedInitialDataOptions) => {
4
+ export const useHomeData = (options?: QueryOptions) => {
5
5
  return useQuery({
6
6
  ...options,
7
7
  queryKey: [HOME_DATA, ...(options?.queryKey || [])]
@@ -1,12 +1,12 @@
1
- /// <reference types="vite/client" />
2
- /// <reference types="vite-plugin-svgr/client" />
3
-
4
- interface ImportMetaEnv {
5
- readonly VITE_BASE_URL: string
6
- readonly VITE_API_HOST: string
7
- // 更多环境变量...
8
- }
9
-
10
- interface ImportMeta {
11
- readonly env: ImportMetaEnv
12
- }
1
+ /// <reference types="vite/client" />
2
+ /// <reference types="vite-plugin-svgr/client" />
3
+
4
+ interface ImportMetaEnv {
5
+ readonly VITE_BASE_URL: string
6
+ readonly VITE_API_HOST: string
7
+ // 更多环境变量...
8
+ }
9
+
10
+ interface ImportMeta {
11
+ readonly env: ImportMetaEnv
12
+ }
@@ -1,80 +1,80 @@
1
- import { defineConfig, loadEnv } from 'vite'
2
- import react from '@vitejs/plugin-react'
3
- import svgr from 'vite-plugin-svgr'
4
- import mockDevServer from 'vite-plugin-mock-dev-server'
5
- import checker from 'vite-plugin-checker'
6
- import { visualizer } from 'rollup-plugin-visualizer'
7
- import { includes } from 'lodash-es'
8
- import tailwindcss from '@tailwindcss/vite'
9
- import { createChunks } from './scripts'
10
-
11
- // https://vitejs.dev/config/
12
- export default defineConfig(({ mode }) => {
13
- const env = loadEnv(mode, process.cwd(), '')
14
- const proxyBaseUrl = env.VITE_BASE_URL + env.VITE_API_HOST
15
- const plugins: any[] = [
16
- tailwindcss(),
17
- svgr(),
18
- mockDevServer({
19
- include: ['**/*.mock.{ts,js}']
20
- }),
21
- checker({
22
- enableBuild: false,
23
- typescript: true,
24
- eslint: { useFlatConfig: true, lintCommand: 'eslint', dev: { logLevel: ['error'] } }
25
- }),
26
- react({
27
- babel: {
28
- plugins: [
29
- [
30
- 'babel-plugin-styled-components',
31
- {
32
- ssr: false,
33
- displayName: false,
34
- fileName: false,
35
- transpileTemplateLiterals: false
36
- }
37
- ]
38
- ]
39
- }
40
- })
41
- ]
42
-
43
- if (mode === 'analyse') {
44
- plugins.push(visualizer({ open: true, sourcemap: true, brotliSize: true, gzipSize: true }))
45
- }
46
-
47
- return {
48
- base: env.VITE_BASE_URL,
49
- plugins,
50
- resolve: {
51
- alias: {
52
- '@': __dirname
53
- }
54
- },
55
- esbuild: {
56
- drop: includes(['production', 'analyse'], mode) ? ['console', 'debugger'] : []
57
- },
58
- build: {
59
- sourcemap: mode === 'analyse',
60
- reportCompressedSize: mode === 'analyse',
61
- rollupOptions: {
62
- output: {
63
- manualChunks: createChunks({
64
- react: ['react', 'react-dom']
65
- })
66
- }
67
- }
68
- },
69
- server: {
70
- host: '0.0.0.0',
71
- proxy: {
72
- [proxyBaseUrl]: {
73
- target: 'http://127.0.0.1',
74
- changeOrigin: true,
75
- rewrite: path => path.replace(proxyBaseUrl, '')
76
- }
77
- }
78
- }
79
- }
80
- })
1
+ import { defineConfig, loadEnv } from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+ import svgr from 'vite-plugin-svgr'
4
+ import mockDevServer from 'vite-plugin-mock-dev-server'
5
+ import checker from 'vite-plugin-checker'
6
+ import { visualizer } from 'rollup-plugin-visualizer'
7
+ import { includes } from 'lodash-es'
8
+ import tailwindcss from '@tailwindcss/vite'
9
+ import { createChunks } from './scripts'
10
+
11
+ // https://vitejs.dev/config/
12
+ export default defineConfig(({ mode }) => {
13
+ const env = loadEnv(mode, process.cwd(), '')
14
+ const proxyBaseUrl = env.VITE_BASE_URL + env.VITE_API_HOST
15
+ const plugins: any[] = [
16
+ tailwindcss(),
17
+ svgr(),
18
+ mockDevServer({
19
+ include: ['**/*.mock.{ts,js}']
20
+ }),
21
+ checker({
22
+ enableBuild: false,
23
+ typescript: true,
24
+ eslint: { useFlatConfig: true, lintCommand: 'eslint', dev: { logLevel: ['error'] } }
25
+ }),
26
+ react({
27
+ babel: {
28
+ plugins: [
29
+ [
30
+ 'babel-plugin-styled-components',
31
+ {
32
+ ssr: false,
33
+ displayName: false,
34
+ fileName: false,
35
+ transpileTemplateLiterals: false
36
+ }
37
+ ]
38
+ ]
39
+ }
40
+ })
41
+ ]
42
+
43
+ if (mode === 'analyse') {
44
+ plugins.push(visualizer({ open: true, sourcemap: true, brotliSize: true, gzipSize: true }))
45
+ }
46
+
47
+ return {
48
+ base: env.VITE_BASE_URL,
49
+ plugins,
50
+ resolve: {
51
+ alias: {
52
+ '@': __dirname
53
+ }
54
+ },
55
+ esbuild: {
56
+ drop: includes(['production', 'analyse'], mode) ? ['console', 'debugger'] : []
57
+ },
58
+ build: {
59
+ sourcemap: mode === 'analyse',
60
+ reportCompressedSize: mode === 'analyse',
61
+ rollupOptions: {
62
+ output: {
63
+ manualChunks: createChunks({
64
+ react: ['react', 'react-dom']
65
+ })
66
+ }
67
+ }
68
+ },
69
+ server: {
70
+ host: '0.0.0.0',
71
+ proxy: {
72
+ [proxyBaseUrl]: {
73
+ target: 'http://127.0.0.1',
74
+ changeOrigin: true,
75
+ rewrite: path => path.replace(proxyBaseUrl, '')
76
+ }
77
+ }
78
+ }
79
+ }
80
+ })
@@ -26,7 +26,6 @@
26
26
  "@sveltejs/adapter-auto": "3.3.1",
27
27
  "@sveltejs/kit": "2.15.0",
28
28
  "@sveltejs/vite-plugin-svelte": "5.0.3",
29
- "@types/lodash-es": "4.17.12",
30
29
  "commitizen": "4.3.0",
31
30
  "cross-env": "7.0.3",
32
31
  "cssnano": "6.0.1",
@@ -51,7 +50,7 @@
51
50
  "vite-plugin-checker": "0.9.0"
52
51
  },
53
52
  "dependencies": {
54
- "lodash-es": "4.17.21",
53
+ "es-toolkit": "1.37.2",
55
54
  "svelte": "5.16.0"
56
55
  }
57
56
  }
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "axios": "1.7.9",
23
- "lodash-es": "4.17.21",
23
+ "es-toolkit": "1.37.2",
24
24
  "pinia": "2.3.1",
25
25
  "tailwindcss": "4.1.4",
26
26
  "type-fest": "4.33.0",
@@ -34,7 +34,6 @@
34
34
  "@eslint/js": "9.15.0",
35
35
  "@faker-js/faker": "8.4.1",
36
36
  "@tailwindcss/vite": "4.1.4",
37
- "@types/lodash-es": "4.17.12",
38
37
  "@types/mockjs": "1.0.10",
39
38
  "@vitejs/plugin-vue": "5.2.1",
40
39
  "@vitejs/plugin-vue-jsx": "4.1.1",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "axios": "1.7.9",
24
- "lodash-es": "4.17.21",
24
+ "es-toolkit": "1.37.2",
25
25
  "pinia": "2.3.1",
26
26
  "tailwindcss": "4.1.4",
27
27
  "type-fest": "4.33.0",
@@ -40,7 +40,6 @@
40
40
  "@rsbuild/plugin-vue": "1.0.7",
41
41
  "@rsdoctor/rspack-plugin": "0.4.13",
42
42
  "@tailwindcss/postcss": "4.1.4",
43
- "@types/lodash-es": "4.17.12",
44
43
  "@types/mockjs": "1.0.10",
45
44
  "autoprefixer": "10.4.14",
46
45
  "commitizen": "4.3.0",
@@ -28,9 +28,9 @@
28
28
  "@tanstack/react-query": "5.51.15",
29
29
  "@webext-core/messaging": "2.2.0",
30
30
  "axios": "1.7.9",
31
- "define-zustand": "3.2.1",
31
+ "define-zustand": "3.4.0",
32
+ "es-toolkit": "1.37.2",
32
33
  "immer": "10.0.1",
33
- "lodash-es": "4.17.21",
34
34
  "qs": "6.11.2",
35
35
  "react": "18.3.1",
36
36
  "react-dom": "18.3.1",
@@ -44,7 +44,6 @@
44
44
  "@commitlint/cz-commitlint": "17.5.0",
45
45
  "@eslint/js": "9.15.0",
46
46
  "@types/chrome": "0.0.254",
47
- "@types/lodash-es": "4.17.12",
48
47
  "@types/node": "18.16.0",
49
48
  "@types/qs": "6.9.7",
50
49
  "@types/react": "18.3.3",