chisel-scripts 2.1.0 → 2.1.1
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/CHANGELOG.md +4 -0
- package/index.js +67 -83
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- INSERT-NEW-ENTRIES-HERE -->
|
|
4
4
|
|
|
5
|
+
## <small>2.1.1 (2025-12-16)</small>
|
|
6
|
+
|
|
7
|
+
- add wp interactivity api support, optimize css build, refactor webpack config ([319d822](https://github.com/xfiveco/generator-chisel/commit/319d822))
|
|
8
|
+
|
|
5
9
|
## 2.1.0 (2025-12-15)
|
|
6
10
|
|
|
7
11
|
- add wp exp-modules support, update wp scripts, build file size limits, auto clear patterns cache, no ([728f566](https://github.com/xfiveco/generator-chisel/commit/728f566))
|
package/index.js
CHANGED
|
@@ -59,46 +59,27 @@ function adjustWebpackConfig(baseConfig, directory) {
|
|
|
59
59
|
})());
|
|
60
60
|
})();
|
|
61
61
|
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const updatedConfig = isMultiConfig
|
|
71
|
-
? baseConfig.map((config, index) => {
|
|
72
|
-
let configEntry = {};
|
|
73
|
-
|
|
74
|
-
// Config 0: standard build - JS + styles
|
|
75
|
-
if (index === 0) {
|
|
76
|
-
configEntry = {
|
|
77
|
-
...(blockMetadataFiles.length > 0 && typeof config.entry === 'function' ? config.entry() : config.entry || {}),
|
|
78
|
-
...entriesFromFiles(scriptsFiles),
|
|
79
|
-
...entriesFromFiles(stylesFiles),
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
// Config 1: ESM build - For block only
|
|
83
|
-
else if (index === 1) {
|
|
84
|
-
configEntry = {
|
|
85
|
-
...(blockMetadataFiles.length > 0 && typeof config.entry === 'function' ? config.entry() : config.entry || {}),
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
...config,
|
|
91
|
-
entry: configEntry,
|
|
92
|
-
resolve: {
|
|
62
|
+
const preparedConfig = (config, index = null) => {
|
|
63
|
+
return {
|
|
64
|
+
...config,
|
|
65
|
+
output: {
|
|
66
|
+
...config.output,
|
|
67
|
+
clean: isProduction,
|
|
68
|
+
},
|
|
69
|
+
resolve: {
|
|
93
70
|
...(config.resolve || {}),
|
|
94
71
|
alias: {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
},
|
|
72
|
+
...((config.resolve && config.resolve.alias) || {}),
|
|
73
|
+
'~design$': pathMod.join(src, 'design'),
|
|
98
74
|
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
75
|
+
},
|
|
76
|
+
performance: {
|
|
77
|
+
maxAssetSize: 512 * 1024,
|
|
78
|
+
maxEntrypointSize: 512 * 1024,
|
|
79
|
+
hints: isProduction ? 'warning' : false,
|
|
80
|
+
},
|
|
81
|
+
devServer: config.devServer && {
|
|
82
|
+
...config.devServer,
|
|
102
83
|
allowedHosts: [new URL(getUrl()).host],
|
|
103
84
|
...(process.env.CHISEL_PORT && {
|
|
104
85
|
host: '0.0.0.0',
|
|
@@ -115,6 +96,15 @@ function adjustWebpackConfig(baseConfig, directory) {
|
|
|
115
96
|
.replace(process.env.CHISEL_PORT, Number(process.env.CHISEL_PORT) + 1),
|
|
116
97
|
},
|
|
117
98
|
}),
|
|
99
|
+
setupMiddlewares: (middlewares, devServer) => {
|
|
100
|
+
if (!devServer) {
|
|
101
|
+
return middlewares;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
console.log(`🌐 Dev server ready at: ${getUrl()}`);
|
|
105
|
+
|
|
106
|
+
return middlewares;
|
|
107
|
+
}
|
|
118
108
|
},
|
|
119
109
|
optimization: {
|
|
120
110
|
...config.optimization,
|
|
@@ -132,55 +122,49 @@ function adjustWebpackConfig(baseConfig, directory) {
|
|
|
132
122
|
],
|
|
133
123
|
}),
|
|
134
124
|
],
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
entry,
|
|
140
|
-
resolve: {
|
|
141
|
-
...(baseConfig.resolve || {}),
|
|
142
|
-
alias: {
|
|
143
|
-
...((baseConfig.resolve && baseConfig.resolve.alias) || {}),
|
|
144
|
-
'~design$': pathMod.join(src, 'design'),
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
performance: performance,
|
|
148
|
-
devServer: baseConfig.devServer && {
|
|
149
|
-
...baseConfig.devServer,
|
|
150
|
-
allowedHosts: [new URL(getUrl()).host],
|
|
151
|
-
...(process.env.CHISEL_PORT && {
|
|
152
|
-
host: '0.0.0.0',
|
|
153
|
-
port: Number(process.env.CHISEL_PORT) + 1,
|
|
154
|
-
client: {
|
|
155
|
-
...baseConfig.devServer.client,
|
|
156
|
-
overlay: {
|
|
157
|
-
errors: true,
|
|
158
|
-
warnings: false,
|
|
159
|
-
runtimeErrors: false,
|
|
160
|
-
},
|
|
161
|
-
webSocketURL: new URL(getUrl())
|
|
162
|
-
.toString()
|
|
163
|
-
.replace(process.env.CHISEL_PORT, Number(process.env.CHISEL_PORT) + 1),
|
|
164
|
-
},
|
|
165
|
-
}),
|
|
166
|
-
},
|
|
167
|
-
optimization: {
|
|
168
|
-
...baseConfig.optimization,
|
|
169
|
-
...(!isProduction && { runtimeChunk: 'single' }),
|
|
170
|
-
},
|
|
171
|
-
plugins: [
|
|
172
|
-
...baseConfig.plugins,
|
|
173
|
-
new CopyWebpackPlugin({
|
|
174
|
-
patterns: [
|
|
125
|
+
module: {
|
|
126
|
+
...(config.module || {}),
|
|
127
|
+
rules: [
|
|
128
|
+
...(config.module?.rules || []),
|
|
175
129
|
{
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
noErrorOnMissing: true,
|
|
130
|
+
test: /\.(png|jpe?g|gif|svg)$/i,
|
|
131
|
+
type: 'asset/resource', // Load as file, not base64 in css - for smaller css file size.
|
|
179
132
|
},
|
|
180
133
|
],
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
}
|
|
134
|
+
},
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const isMultiConfig = Array.isArray(baseConfig);
|
|
139
|
+
|
|
140
|
+
const updatedConfig = isMultiConfig
|
|
141
|
+
? baseConfig.map((config, index) => {
|
|
142
|
+
let configEntry = {};
|
|
143
|
+
|
|
144
|
+
// Config 0: standard build - JS + styles
|
|
145
|
+
if (index === 0) {
|
|
146
|
+
configEntry = {
|
|
147
|
+
...(blockMetadataFiles.length > 0 && typeof config.entry === 'function' ? config.entry() : config.entry || {}),
|
|
148
|
+
...entriesFromFiles(scriptsFiles),
|
|
149
|
+
...entriesFromFiles(stylesFiles),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
// Config 1: ESM build - For blocks only
|
|
153
|
+
else if (index === 1) {
|
|
154
|
+
configEntry = {
|
|
155
|
+
...(blockMetadataFiles.length > 0 && typeof config.entry === 'function' ? config.entry() : config.entry || {}),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
...preparedConfig(config, index),
|
|
161
|
+
entry: configEntry,
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
: {
|
|
165
|
+
...preparedConfig(baseConfig),
|
|
166
|
+
entry,
|
|
167
|
+
}
|
|
184
168
|
|
|
185
169
|
return updatedConfig;
|
|
186
170
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chisel-scripts",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Chisel scripts",
|
|
5
5
|
"bin": {
|
|
6
6
|
"chisel-scripts": "bin/chisel-scripts.js"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@wordpress/scripts": "^27.9.0 || ^31.0.0 || ^31.1.0"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "eeef8803f7213be257ef9a48b02a1dc1790d2409"
|
|
43
43
|
}
|