chisel-scripts 2.0.0-alpha.6 → 2.1.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  <!-- INSERT-NEW-ENTRIES-HERE -->
4
4
 
5
+ ## 2.1.0 (2025-12-15)
6
+
7
+ - 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))
8
+
9
+ ## 2.0.0 (2025-12-04)
10
+
11
+ - update chisel scripts peerDependencies ([7110a79](https://github.com/xfiveco/generator-chisel/commit/7110a79))
12
+
13
+ ## 2.0.0-2.0.0-alpha.8.1 (2025-03-18)
14
+
15
+ - fix Interfaces and Traits namespaces in php < 8, add nvmrc to root folder ([cb60f42](https://github.com/xfiveco/generator-chisel/commit/cb60f42))
16
+
17
+ ## 2.0.0-2.0.0-alpha.8.0 (2025-02-04)
18
+
19
+ - config local update ([ce2a342](https://github.com/xfiveco/generator-chisel/commit/ce2a342))
20
+
5
21
  ## 2.0.0-alpha.6 (2025-02-04)
6
22
 
7
23
  - blocks, scripts, images optimize, mega menu settings ([d8a8b3c](https://github.com/xfiveco/generator-chisel/commit/d8a8b3c))
package/composer.phar CHANGED
Binary file
package/index.js CHANGED
@@ -32,7 +32,7 @@ function adjustWebpackConfig(baseConfig, directory) {
32
32
  );
33
33
 
34
34
  const entry = {
35
- ...(blockMetadataFiles.length > 0 && baseConfig.entry()),
35
+ ...(blockMetadataFiles.length > 0 && typeof baseConfig.entry === 'function' ? baseConfig.entry() : baseConfig.entry || {}),
36
36
  ...entriesFromFiles(scriptsFiles),
37
37
  ...entriesFromFiles(stylesFiles),
38
38
  };
@@ -42,11 +42,10 @@ function adjustWebpackConfig(baseConfig, directory) {
42
42
 
43
43
  return () =>
44
44
  (url ||= (() => {
45
- const { execFileSync } = require('node:child_process');
45
+ const { execSync } = require('node:child_process');
46
46
  try {
47
- const stdout = execFileSync(
48
- 'npm',
49
- ['run', '--silent', 'wp', 'option', 'get', 'home'],
47
+ const stdout = execSync(
48
+ 'npm run --silent wp option get home',
50
49
  {
51
50
  cwd: directory,
52
51
  encoding: 'utf8',
@@ -60,44 +59,109 @@ function adjustWebpackConfig(baseConfig, directory) {
60
59
  })());
61
60
  })();
62
61
 
63
- const updatedConfig = {
64
- ...baseConfig,
65
- entry,
66
- resolve: {
67
- ...baseConfig.resolve,
68
- alias: {
69
- ...baseConfig.resolve.alias,
70
- '~design$': pathMod.join(src, 'design'),
62
+ const performance = {
63
+ maxAssetSize: 512 * 1024,
64
+ maxEntrypointSize: 512 * 1024,
65
+ hints: isProduction ? 'warning' : false,
66
+ };
67
+
68
+ const isMultiConfig = Array.isArray(baseConfig);
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: {
93
+ ...(config.resolve || {}),
94
+ alias: {
95
+ ...((config.resolve && config.resolve.alias) || {}),
96
+ '~design$': pathMod.join(src, 'design'),
97
+ },
98
+ },
99
+ performance: performance,
100
+ devServer: config.devServer && {
101
+ ...config.devServer,
102
+ allowedHosts: [new URL(getUrl()).host],
103
+ ...(process.env.CHISEL_PORT && {
104
+ host: '0.0.0.0',
105
+ port: Number(process.env.CHISEL_PORT) + 1,
106
+ client: {
107
+ ...config.devServer.client,
108
+ overlay: {
109
+ errors: true,
110
+ warnings: false,
111
+ runtimeErrors: false,
112
+ },
113
+ webSocketURL: new URL(getUrl())
114
+ .toString()
115
+ .replace(process.env.CHISEL_PORT, Number(process.env.CHISEL_PORT) + 1),
116
+ },
117
+ }),
71
118
  },
72
- },
73
- devServer: baseConfig.devServer && {
74
- ...baseConfig.devServer,
119
+ optimization: {
120
+ ...config.optimization,
121
+ ...(!isProduction && { runtimeChunk: index === 0 ? 'single' : false }),
122
+ },
123
+ plugins: [
124
+ ...config.plugins,
125
+ new CopyWebpackPlugin({
126
+ patterns: [
127
+ {
128
+ from: '**/*.twig',
129
+ context: 'src',
130
+ noErrorOnMissing: true,
131
+ },
132
+ ],
133
+ }),
134
+ ],
135
+ };
136
+ })
137
+ : {
138
+ ...baseConfig,
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,
75
150
  allowedHosts: [new URL(getUrl()).host],
76
151
  ...(process.env.CHISEL_PORT && {
77
152
  host: '0.0.0.0',
78
153
  port: Number(process.env.CHISEL_PORT) + 1,
79
- ...(() => {
80
- const webSocketURL = new URL(getUrl());
81
- webSocketURL.protocol = webSocketURL.protocol.replace('http', 'ws');
82
- webSocketURL.pathname = '/ws';
83
- const webSocketURLString = webSocketURL.toString();
84
-
85
- if (!webSocketURLString.includes(process.env.CHISEL_PORT)) {
86
- return;
87
- }
88
-
89
- return {
90
- client: {
91
- ...baseConfig.devServer.client,
92
- webSocketURL: webSocketURL
93
- .toString()
94
- .replace(
95
- process.env.CHISEL_PORT,
96
- Number(process.env.CHISEL_PORT) + 1,
97
- ),
98
- },
99
- };
100
- })(),
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
+ },
101
165
  }),
102
166
  },
103
167
  optimization: {
@@ -20,14 +20,12 @@ function loadExtensions() {
20
20
  export default function wpScripts(api) {
21
21
  api.registerCommand(
22
22
  'build',
23
- (command) => command.description('build for production'),
24
- // .option(
25
- // '--no-clean',
26
- // 'do not remove the dist directory before building the project',
27
- // )
28
- // .option('--watch', 'watch for changes')
29
- // .option('--report', 'generate report to help analyze bundles content')
30
- async () => {
23
+ (command) => command.description('build for production')
24
+ .option(
25
+ '--experimental-modules',
26
+ 'do not enable experimental modules',
27
+ ),
28
+ async (options) => {
31
29
  process.env.NODE_ENV = 'production';
32
30
 
33
31
  for (const extension of await loadExtensions()) {
@@ -36,7 +34,13 @@ export default function wpScripts(api) {
36
34
  await extension.build(api);
37
35
  }
38
36
 
39
- await runLocalWithExit(['wp-scripts', 'build'], {
37
+ const args = ['wp-scripts', 'build'];
38
+
39
+ if (options.experimentalModules) { // Disabled by default. Enable with `--experimental-modules`.
40
+ args.push('--experimental-modules');
41
+ }
42
+
43
+ await runLocalWithExit(args, {
40
44
  cwd: api.resolve(),
41
45
  });
42
46
  },
@@ -44,8 +48,12 @@ export default function wpScripts(api) {
44
48
 
45
49
  api.registerCommand(
46
50
  'start',
47
- (command) => command.description('start development server'),
48
- async () => {
51
+ (command) => command.description('start development server')
52
+ .option(
53
+ '--experimental-modules',
54
+ 'do not enable experimental modules',
55
+ ),
56
+ async (options) => {
49
57
  process.env.NODE_ENV = 'development';
50
58
 
51
59
  const extensions = await loadExtensions();
@@ -62,7 +70,13 @@ export default function wpScripts(api) {
62
70
  await extension.start(api);
63
71
  }
64
72
 
65
- await runLocalWithExit(['wp-scripts', 'start', '--hot'], {
73
+ const args = ['wp-scripts', 'start', '--hot'];
74
+
75
+ if (options.experimentalModules) { // Disabled by default. Enable with `--experimental-modules`.
76
+ args.push('--experimental-modules');
77
+ }
78
+
79
+ await runLocalWithExit(args, {
66
80
  cwd: api.resolve(),
67
81
  });
68
82
  },
@@ -0,0 +1 @@
1
+ 20.12.2
@@ -48,6 +48,7 @@ $table_prefix = '<%= tablePrefix %>';
48
48
  *
49
49
  * @link https://codex.wordpress.org/Debugging_in_WordPress
50
50
  */
51
+
51
52
  define( 'WP_DEBUG', true );
52
53
  define( 'WP_DEBUG_LOG', true );
53
54
  define( 'WP_DEBUG_DISPLAY', false );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "chisel-scripts",
3
- "version": "2.0.0-alpha.6",
4
- "description": "TODO",
3
+ "version": "2.1.0",
4
+ "description": "Chisel scripts",
5
5
  "bin": {
6
6
  "chisel-scripts": "bin/chisel-scripts.js"
7
7
  },
@@ -37,7 +37,7 @@
37
37
  "svgo": "^3.3.2"
38
38
  },
39
39
  "peerDependencies": {
40
- "@wordpress/scripts": "^27.9.0"
40
+ "@wordpress/scripts": "^27.9.0 || ^31.0.0 || ^31.1.0"
41
41
  },
42
- "gitHead": "21320eb0f55ecd1f1df445265608df0778101c8e"
42
+ "gitHead": "f5cb01894754a85b6842fa10412986bb745ea43a"
43
43
  }
package/wp-cli.phar CHANGED
Binary file