create-packer 1.35.6 → 1.35.8

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.35.6",
3
+ "version": "1.35.8",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -2,16 +2,28 @@
2
2
  import 'styled-components'
3
3
  import { themeType } from './shared/theme'
4
4
 
5
- declare module 'styled-components' {
6
- export interface DefaultTheme extends themeType {}
7
- }
5
+ declare global {
6
+ declare module 'styled-components' {
7
+ export interface DefaultTheme extends themeType {}
8
+ }
8
9
 
9
- interface ImportMetaEnv {
10
- // import.meta.env.PUBLIC_FOO
11
- readonly PUBLIC_BASE_URL: string
12
- readonly PUBLIC_API_HOST: string
13
- }
10
+ interface ImportMetaEnv {
11
+ // import.meta.env.PUBLIC_FOO
12
+ readonly PUBLIC_BASE_URL: string
13
+ readonly PUBLIC_API_HOST: string
14
+ }
15
+
16
+ interface ImportMeta {
17
+ readonly env: ImportMetaEnv
18
+ }
19
+
20
+ declare module '*.svg' {
21
+ const content: string
22
+ export default content
23
+ }
14
24
 
15
- interface ImportMeta {
16
- readonly env: ImportMetaEnv
25
+ declare module '*.svg?react' {
26
+ const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement>>
27
+ export default ReactComponent
28
+ }
17
29
  }
@@ -1,4 +1,4 @@
1
- import { defineConfig, loadEnv, CacheGroups } from '@rsbuild/core'
1
+ import { defineConfig, loadEnv } from '@rsbuild/core'
2
2
  import { pluginReact } from '@rsbuild/plugin-react'
3
3
  import { pluginStyledComponents } from '@rsbuild/plugin-styled-components'
4
4
  import { pluginEslint } from '@rsbuild/plugin-eslint'
@@ -7,29 +7,7 @@ import { pluginTypeCheck } from '@rsbuild/plugin-type-check'
7
7
  import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
8
8
  import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin'
9
9
  import { pluginSvgr } from '@rsbuild/plugin-svgr'
10
-
11
- function createChunks(chunks: Array<{ name: string; libs: string[] | RegExp; priority?: number }>) {
12
- const result: CacheGroups = {
13
- vendors: {
14
- test: /[\\/]node_modules[\\/]/,
15
- chunks: 'all',
16
- name: 'vendors',
17
- priority: -1
18
- }
19
- }
20
- chunks.forEach(({ name, libs, priority }) => {
21
- result[name] = {
22
- test: Array.isArray(libs)
23
- ? new RegExp(`[\\\\/]node_modules[\\\\/](${libs.join('|')})[\\\\/]`)
24
- : libs,
25
- chunks: 'all',
26
- name,
27
- priority
28
- }
29
- return result
30
- })
31
- return result
32
- }
10
+ import { createChunks } from './scripts/createChunks'
33
11
 
34
12
  export default defineConfig(({ envMode, command }) => {
35
13
  const { parsed: env } = loadEnv()
@@ -0,0 +1,26 @@
1
+ import { CacheGroups } from '@rsbuild/core'
2
+
3
+ export function createChunks(
4
+ chunks: Array<{ name: string; libs: string[] | RegExp; priority?: number }>
5
+ ) {
6
+ const result: CacheGroups = {
7
+ vendors: {
8
+ test: /[\\/]node_modules[\\/]/,
9
+ chunks: 'all',
10
+ name: 'vendors',
11
+ priority: -1
12
+ }
13
+ }
14
+ chunks.forEach(({ name, libs, priority }) => {
15
+ result[name] = {
16
+ test: Array.isArray(libs)
17
+ ? new RegExp(`[\\\\/]node_modules[\\\\/](${libs.join('|')})[\\\\/]`)
18
+ : libs,
19
+ chunks: 'all',
20
+ name,
21
+ priority
22
+ }
23
+ return result
24
+ })
25
+ return result
26
+ }
@@ -0,0 +1 @@
1
+ export * from './createChunks'