@caweb/webpack 1.6.1 → 1.6.2

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/lib/args.js CHANGED
@@ -1,41 +1,34 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { parseArgs } from 'node:util';
5
+
1
6
  // flags can be passed via argv0
2
7
  // we also add args from NODE_OPTIONS
3
- let flags = [].concat(
4
- processArgs(process.argv),
5
- processArgs(process.argv0.split(' ')),
6
- processArgs(process.env.NODE_OPTIONS ? process.env.NODE_OPTIONS.split(' ') : []),
7
- )
8
-
9
- // this function processes an array of arguments
10
- // and returns an array of flags and values
11
- function processArgs( arr ){
12
- let tmp = [];
13
-
14
- arr.filter(Boolean).map((o) => {
15
- return o.replaceAll("'", '').split('=').forEach((e => tmp.push(e)))
16
- });
17
-
18
- return tmp
19
- }
8
+ let { values: flags } = parseArgs( {
9
+ args: [
10
+ ...process.argv,
11
+ ...process.argv0.split(' '),
12
+ process.env.NODE_OPTIONS ? process.env.NODE_OPTIONS.split(' ') : []
13
+ ].filter( Boolean ),
14
+ strict: false,
15
+ } )
20
16
 
21
17
  // function to add a flag
22
18
  function addFlag(flag, value = null){
23
19
  if( ! flagExists(flag) ){
24
- flags.push(flag);
25
- if( value ){
26
- flags.push(value);
27
- }
20
+ flags[flag] = value;
28
21
  }
29
22
  }
30
23
 
31
24
  // check if a flag exists
32
25
  function flagExists(flag){
33
- return flags.includes(flag)
26
+ return Object.keys(flags).includes(flag)
34
27
  }
35
28
 
36
29
  // get the value of a flag
37
30
  function getArgVal(flag, defaultValue = null){
38
- return flagExists(flag) ? flags[flags.indexOf(flag) + 1] : (defaultValue ?? false);
31
+ return flagExists(flag) ? flags[flag] : (defaultValue ?? false);
39
32
  }
40
33
 
41
34
  export {
package/lib/server.js CHANGED
@@ -40,6 +40,9 @@ let watchFiles = fs.readdirSync(
40
40
 
41
41
  // base dev server config
42
42
  let devServer = {
43
+ devMiddleware: {
44
+ writeToDisk: true,
45
+ },
43
46
  server,
44
47
  host,
45
48
  port,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caweb/webpack",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "CAWebPublishing Webpack Configuration",
5
5
  "main": "webpack.config.js",
6
6
  "files": [