Skip to content

Commit ff7c46f

Browse files
committed
Merge tag '6.2.0' into develop
v6.2.0
2 parents d875fc8 + 31658b5 commit ff7c46f

26 files changed

+65
-70
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
## [v6.2.0](https://github.com/studiometa/webpack-config/compare/6.1.0..6.2.0) (2024-10-03)
10+
911
### Added
1012

1113
- Export presets from the root package entrypoint ([55ba53d](https://github.com/studiometa/webpack-config/commit/55ba53d))

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "studiometa/webpack-config",
3-
"version": "6.1.0",
3+
"version": "6.2.0",
44
"description": "PHP Helpers for @studiometa/webpack-config",
55
"type": "library",
66
"require": {

package-lock.json

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@studiometa/webpack-config-root",
3-
"version": "6.1.0",
3+
"version": "6.2.0",
44
"private": true,
55
"type": "module",
66
"workspaces": [

packages/demo/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@studiometa/webpack-config-demo",
3-
"version": "6.1.0",
3+
"version": "6.2.0",
44
"private": true,
55
"type": "module",
66
"scripts": {

packages/demo/src/templates/pages/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @returns {Promise<object>}
3+
*/
14
export async function data() {
25
return {
36
head: {

packages/demo/src/templates/pages/posts/[slug].js

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
*
3+
*/
14
export async function data({ slug } = {}) {
25
return {
36
bar: 'This is the default post data loader',

packages/demo/src/templates/pages/posts/bar.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { data as defaultData } from './[slug].js';
22

3+
/**
4+
*
5+
*/
36
export async function data({ slug } = {}) {
47
const mainData = await defaultData({ slug });
58
return {

packages/demo/src/templates/pages/posts/hello-world.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @returns {Promise<{ foo: string[] }>}
3+
*/
14
export async function data() {
25
return {
36
foo: ['foo', 'buz'],

packages/preset-markdown/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@studiometa/webpack-config-preset-markdown",
3-
"version": "6.1.0",
3+
"version": "6.2.0",
44
"publishConfig": {
55
"access": "public"
66
},

packages/preset-prototyping/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@studiometa/webpack-config-preset-prototyping",
3-
"version": "6.1.0",
3+
"version": "6.2.0",
44
"publishConfig": {
55
"access": "public"
66
},

packages/preset-prototyping/src/index.js

+1-10
Original file line numberDiff line numberDiff line change
@@ -148,27 +148,22 @@ export function prototyping(options) {
148148

149149
const extendTwig = typeof opts.twig.extend === 'function' ? opts.twig.extend : () => {};
150150
opts.twig.functions = {
151-
...(opts?.twig?.functions || {}),
152-
// eslint-disable-next-line camelcase
151+
...opts?.twig?.functions,
153152
html_styles(styles) {
154153
return Html.renderStyleAttribute(styles);
155154
},
156-
// eslint-disable-next-line camelcase
157155
html_attributes(attributes) {
158156
return Html.renderAttributes(attributes);
159157
},
160-
// eslint-disable-next-line camelcase
161158
html_classes(classes) {
162159
return Html.renderClass(classes);
163160
},
164-
// eslint-disable-next-line camelcase
165161
merge_html_attributes(attributes = {}, defaultAttributes = {}, requiredAttributes = {}) {
166162
return Html.mergeAttributes(attributes, defaultAttributes, requiredAttributes);
167163
},
168164
dump(...args) {
169165
return args.map((arg) => `<pre>${JSON.stringify(arg, null, 2)}</pre>`).join('\n');
170166
},
171-
// eslint-disable-next-line camelcase
172167
is_dev() {
173168
return isDev;
174169
},
@@ -298,9 +293,7 @@ export function prototyping(options) {
298293
cache: true,
299294
template: `${templatePath}?${params}`,
300295
templateParameters: {
301-
// eslint-disable-next-line camelcase
302296
updated_at: stats.mtime,
303-
// eslint-disable-next-line camelcase
304297
created_at: stats.birthtime,
305298
template: file,
306299
...Object.fromEntries(params.entries()),
@@ -366,9 +359,7 @@ export function prototyping(options) {
366359
cache: true,
367360
template: `${templatePath}?${params}`,
368361
templateParameters: {
369-
// eslint-disable-next-line camelcase
370362
created_at: stats.birthtime,
371-
// eslint-disable-next-line camelcase
372363
updated_at: stats.mtime,
373364
template: file,
374365
...Object.fromEntries(params.entries()),

packages/preset-vue-2/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@studiometa/webpack-config-preset-vue-2",
3-
"version": "6.1.0",
3+
"version": "6.2.0",
44
"publishConfig": {
55
"access": "public"
66
},

packages/preset-vue-3/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@studiometa/webpack-config-preset-vue-3",
3-
"version": "6.1.0",
3+
"version": "6.2.0",
44
"publishConfig": {
55
"access": "public"
66
},

packages/webpack-config/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@studiometa/webpack-config",
3-
"version": "6.1.0",
3+
"version": "6.2.0",
44
"description": "A basic webpack config",
55
"type": "module",
66
"main": "src/index.js",

packages/webpack-config/src/dev.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default async function dev(options = {}) {
1818
const server = await getServer(config);
1919

2020
const webpackBar = webpackConfig.plugins.find(
21-
(plugin) => plugin.constructor.name === 'WebpackBarPlugin'
21+
(plugin) => plugin.constructor.name === 'WebpackBarPlugin',
2222
);
2323

2424
let webpackBarHasRunOnce = false;
@@ -68,7 +68,7 @@ export default async function dev(options = {}) {
6868
Object.entries(webpackConfig.entry).map(([name, value]) => [
6969
name,
7070
['webpack-hot-middleware/client?reload=true', ...(Array.isArray(value) ? value : [value])],
71-
])
71+
]),
7272
);
7373

7474
const bundler = webpack(webpackConfig);
@@ -84,7 +84,7 @@ export default async function dev(options = {}) {
8484
assets: true,
8585
colors: true,
8686
excludeAssets: [/\.map$/, /hot-update/, /^manifest\.(js|json)$/],
87-
})
87+
}),
8888
);
8989
console.log('');
9090
console.log('');

packages/webpack-config/src/index.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const {
3838

3939
/**
4040
* Define the configuration.
41-
*
4241
* @template {import('./index').MetaConfig} T
4342
* @param {T} config
4443
* @returns {T}
@@ -49,13 +48,12 @@ export function defineConfig(config) {
4948

5049
/**
5150
* Get the generated Webpack configuration.
52-
*
53-
* @param {Object} options
51+
* @param {object} options
5452
* @param {'production'|'development'} [options.mode]
5553
* @returns {import('webpack').Configuration}
5654
*/
5755
export function getWebpackConfig({ mode = process.env.NODE_ENV } = {}) {
58-
const config = getMetaConfig({ target: [target] });
56+
const config = getMetaConfig({ mode });
5957
return mode === 'production' ? getWebpackProdConfig(config) : getWebpackDevConfig(config);
6058
}
6159

packages/webpack-config/src/presets/https.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function createCertificates() {
1616

1717
const cachePath = path.join(
1818
process.env.PWD,
19-
'node_modules/.cache/@studiometa/webpack-config/certificates/'
19+
'node_modules/.cache/@studiometa/webpack-config/certificates/',
2020
);
2121

2222
execSync(`mkdir -p ${cachePath}`);

packages/webpack-config/src/presets/tailwindcss.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@ export default function tailwindcss(options = {}) {
2222
path: require.resolve('tailwindcss', { paths: [configPath] }),
2323
configViewerPath: '/_tailwind',
2424
},
25-
options
25+
options,
2626
);
2727

2828
if (isDev) {
2929
const { default: createServer } = await import('tailwind-config-viewer/server/index.js');
3030
await extendBrowsersync(config, async (bsConfig) => {
3131
const tailwindConfigViewerServer = createServer({
3232
tailwindConfigProvider: () =>
33-
// eslint-disable-next-line import/no-dynamic-require
3433
require(findUpSync(['tailwind.config.js', 'tailwind.config.cjs'])),
3534
}).asMiddleware();
3635

@@ -44,8 +43,8 @@ export default function tailwindcss(options = {}) {
4443
bsConfig.infos.push(
4544
(url) =>
4645
`Tailwind Viewer runnning at ${chalk.blue(
47-
withTrailingSlash(url + opts.configViewerPath)
48-
)}`
46+
withTrailingSlash(url + opts.configViewerPath),
47+
)}`,
4948
);
5049
});
5150
}
@@ -76,7 +75,7 @@ export default function tailwindcss(options = {}) {
7675
}
7776

7877
const postcssIndex = rule.use.findIndex(
79-
(use) => use === 'postcss-loader' || use.loader === 'postcss-loader'
78+
(use) => use === 'postcss-loader' || use.loader === 'postcss-loader',
8079
);
8180

8281
if (postcssIndex > -1) {

packages/webpack-config/src/presets/yaml.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function yaml(options = {}) {
1212
{
1313
loaderOptions: {},
1414
},
15-
options
15+
options,
1616
);
1717

1818
return {

packages/webpack-config/src/utils/extend-browsersync-config.js

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
/**
88
* Extends the `server` configuration property.
9-
*
109
* @param {MetaConfig} config
1110
* @param {(config:BrowsersyncOptions, instance:BrowserSyncInstance)=> void} fn
1211
*/

packages/webpack-config/src/utils/extend-webpack-config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
/**
77
* Extends the `webpack` configuration property.
8-
*
98
* @param {MetaConfig} config
109
* @param {(config:WebpackConfig, isDev: boolean) => Promise<void>} fn
1110
*/
1211
export default async function extendWebpackConfig(config, fn) {
12+
// eslint-disable-next-line no-empty-function
1313
const oldWebpackConfig = typeof config.webpack === 'function' ? config.webpack : () => {};
1414

1515
config.webpack = async (webpackConfig, isDev) => {

packages/webpack-config/src/utils/get-browsersync.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async function getConfig(metaConfig) {
5353
const [fileGlob, callback] = glob;
5454
if (typeof callback !== 'function') {
5555
throw new Error(
56-
'A watch item should implement the following schema: [glob:string, callback:function]'
56+
'A watch item should implement the following schema: [glob:string, callback:function]',
5757
);
5858
}
5959
instance.watch(fileGlob, { cwd: metaConfig.context }, (event, file) => {

0 commit comments

Comments
 (0)