@s-ui/bundler 9.74.0 → 9.75.0

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.
@@ -20,6 +20,10 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'production'
20
20
  program
21
21
  .option('-C, --clean', 'Remove public folder before create a new one')
22
22
  .option('-S, --save-stats', 'Save stats.json in public folder')
23
+ .option(
24
+ '--stats-options [options]',
25
+ 'Stats options as JSON string (e.g., \'{"modules":true,"assets":true,"chunks":true}\')'
26
+ )
23
27
  .option(
24
28
  '-l, --link-package [package]',
25
29
  'Replace each occurrence of this package with an absolute path to this folder',
@@ -35,13 +39,14 @@ program
35
39
  console.log('')
36
40
  console.log(' $ sui-bundler build -S')
37
41
  console.log(' $ sui-bundler build -SC')
42
+ console.log(' $ sui-bundler build -S --stats-options \'{"modules":true,"assets":true}\'')
38
43
  console.log(' $ sui-bundler dev --link-package /my/domain/folder')
39
44
  console.log(' $ sui-bundler build --help')
40
45
  console.log('')
41
46
  })
42
47
  .parse(process.argv)
43
48
 
44
- const {clean = false, context, saveStats, linkPackage: packagesToLink = []} = program.opts()
49
+ const {clean = false, context, saveStats, statsOptions, linkPackage: packagesToLink = []} = program.opts()
45
50
 
46
51
  config.context = context || config.context
47
52
 
@@ -85,9 +90,21 @@ compiler.run(async (error, stats) => {
85
90
 
86
91
  console.log(`Webpack stats: ${stats}`)
87
92
 
88
- if (saveStats) {
93
+ if (saveStats && stats) {
89
94
  const filePath = `${process.cwd()}/public/stats.json`
90
- fs.writeFileSync(filePath, JSON.stringify(stats.toJson(), null, 2), {
95
+ let statsConfig
96
+
97
+ if (statsOptions) {
98
+ try {
99
+ statsConfig = JSON.parse(statsOptions)
100
+ } catch (err) {
101
+ log.error('Invalid JSON format for --stats-options')
102
+ return process.exit(1)
103
+ }
104
+ }
105
+
106
+ const statsData = statsConfig ? stats.toJson(statsConfig) : stats.toJson()
107
+ fs.writeFileSync(filePath, JSON.stringify(statsData, null, 2), {
91
108
  encoding: 'utf8'
92
109
  })
93
110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s-ui/bundler",
3
- "version": "9.74.0",
3
+ "version": "9.75.0",
4
4
  "description": "Config-free bundler for ES6 React apps.",
5
5
  "bin": {
6
6
  "sui-bundler": "./bin/sui-bundler.js"