@utoo/pack 1.1.21 → 1.1.22

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.
Files changed (2) hide show
  1. package/README.md +34 -26
  2. package/package.json +9 -9
package/README.md CHANGED
@@ -31,7 +31,7 @@
31
31
  ## 📦 Installation
32
32
 
33
33
  ```bash
34
- npm install @utoo/pack
34
+ ut install @utoo/pack --save-dev
35
35
  ```
36
36
 
37
37
  ## 🚀 Quick Start
@@ -46,50 +46,58 @@ const { build, dev } = require('@utoo/pack');
46
46
  // Production build
47
47
  async function runBuild() {
48
48
  await build({
49
- root: process.cwd(),
50
- config: {
51
- entry: [
52
- {
53
- key: 'main',
54
- value: './src/index.ts'
49
+ mode: "production",
50
+ entry: [
51
+ {
52
+ import: "./src/index.ts",
53
+ html: {
54
+ template: "./index.html"
55
55
  }
56
- ],
57
- mode: 'production'
58
- }
56
+ }
57
+ ],
58
+ output: {
59
+ path: "./dist",
60
+ filename: "[name].[contenthash:8].js",
61
+ chunkFilename: "[name].[contenthash:8].js",
62
+ clean: true
63
+ },
64
+ sourceMaps: true
59
65
  });
60
66
  }
61
67
 
62
68
  // Development mode with HMR
63
69
  async function startDev() {
64
70
  const server = await dev({
65
- root: process.cwd(),
66
- config: {
67
- mode: 'development'
68
- }
71
+ mode: "development",
72
+ entry: [
73
+ {
74
+ import: "./src/index.ts",
75
+ html: {
76
+ template: "./index.html"
77
+ }
78
+ }
79
+ ],
80
+ output: {
81
+ path: "./dist",
82
+ filename: "[name].[contenthash:8].js",
83
+ chunkFilename: "[name].[contenthash:8].js",
84
+ clean: true
85
+ },
86
+ sourceMaps: true
69
87
  });
70
88
  }
71
89
  ```
72
90
 
73
91
  ## 🔌 Webpack Compatibility Mode
74
92
 
75
- `@utoo/pack` provides a partial compatibility layer for Webpack. This allows you to use your existing `webpack.config.js` with minimal changes.
76
-
77
- ### Usage via CLI
78
-
79
- ```bash
80
- up build --webpack
81
- ```
82
-
83
- ### Programmatic Usage
93
+ `@utoo/pack` provides a partial compatibility layer for Webpack.
84
94
 
85
95
  ```javascript
86
96
  const { build } = require('@utoo/pack');
87
- const { compatOptionsFromWebpack } = require('@utoo/pack/webpack-compat');
88
97
  const webpackConfig = require('./webpack.config.js');
89
98
 
90
99
  async function run() {
91
- const options = compatOptionsFromWebpack(webpackConfig);
92
- await build(options);
100
+ await build({ ...webpackConfig, webpackMode: true });
93
101
  }
94
102
  ```
95
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/pack",
3
- "version": "1.1.21",
3
+ "version": "1.1.22",
4
4
  "main": "cjs/index.js",
5
5
  "module": "esm/index.js",
6
6
  "types": "esm/index.d.ts",
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@babel/code-frame": "7.22.5",
41
41
  "@swc/helpers": "0.5.15",
42
- "@utoo/pack-shared": "1.1.21",
42
+ "@utoo/pack-shared": "1.1.22",
43
43
  "@utoo/style-loader": "^1.0.0",
44
44
  "domparser-rs": "^0.0.5",
45
45
  "find-up": "4.1.0",
@@ -86,12 +86,12 @@
86
86
  },
87
87
  "repository": "git@github.com:utooland/utoo.git",
88
88
  "optionalDependencies": {
89
- "@utoo/pack-darwin-arm64": "1.1.21",
90
- "@utoo/pack-darwin-x64": "1.1.21",
91
- "@utoo/pack-linux-arm64-gnu": "1.1.21",
92
- "@utoo/pack-linux-arm64-musl": "1.1.21",
93
- "@utoo/pack-linux-x64-gnu": "1.1.21",
94
- "@utoo/pack-linux-x64-musl": "1.1.21",
95
- "@utoo/pack-win32-x64-msvc": "1.1.21"
89
+ "@utoo/pack-darwin-arm64": "1.1.22",
90
+ "@utoo/pack-darwin-x64": "1.1.22",
91
+ "@utoo/pack-linux-arm64-gnu": "1.1.22",
92
+ "@utoo/pack-linux-arm64-musl": "1.1.22",
93
+ "@utoo/pack-linux-x64-gnu": "1.1.22",
94
+ "@utoo/pack-linux-x64-musl": "1.1.22",
95
+ "@utoo/pack-win32-x64-msvc": "1.1.22"
96
96
  }
97
97
  }