@caweb/webpack 1.2.27 → 1.3.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.
Files changed (83) hide show
  1. package/.github/workflows/config-publish.yml +33 -0
  2. package/.github/workflows/plugins-publish.yml +45 -0
  3. package/.github/workflows/test +29 -0
  4. package/.gitmodules +3 -0
  5. package/README.md +1 -2
  6. package/changelog.txt +137 -0
  7. package/package.json +9 -16
  8. package/plugins/a11y/README.md +19 -0
  9. package/plugins/a11y/aceconfig.js +44 -0
  10. package/plugins/a11y/changelog.txt +31 -0
  11. package/plugins/a11y/index.js +271 -0
  12. package/plugins/a11y/package-lock.json +3303 -0
  13. package/plugins/a11y/package.json +42 -0
  14. package/plugins/css-audit/README.md +20 -0
  15. package/plugins/css-audit/changelog.txt +41 -0
  16. package/plugins/css-audit/css-audit.config.cjs +5 -0
  17. package/plugins/css-audit/default.config.js +19 -0
  18. package/plugins/css-audit/index.js +326 -0
  19. package/plugins/css-audit/package-lock.json +1522 -0
  20. package/plugins/css-audit/package.json +53 -0
  21. package/plugins/css-audit/sample/no-files.html +9 -0
  22. package/plugins/html/README.md +40 -0
  23. package/plugins/html/changelog.txt +134 -0
  24. package/plugins/html/entry/delta.js +20 -0
  25. package/plugins/html/entry/eureka.js +20 -0
  26. package/plugins/html/entry/mono.js +20 -0
  27. package/plugins/html/entry/oceanside.js +20 -0
  28. package/plugins/html/entry/orangecounty.js +20 -0
  29. package/plugins/html/entry/pasorobles.js +20 -0
  30. package/plugins/html/entry/sacramento.js +20 -0
  31. package/plugins/html/entry/santabarbara.js +20 -0
  32. package/plugins/html/entry/santacruz.js +20 -0
  33. package/plugins/html/entry/shasta.js +20 -0
  34. package/plugins/html/entry/sierra.js +20 -0
  35. package/plugins/html/entry/trinity.js +20 -0
  36. package/plugins/html/index.js +96 -0
  37. package/plugins/html/package-lock.json +21977 -0
  38. package/plugins/html/package.json +70 -0
  39. package/plugins/html/sample/blank.html +13 -0
  40. package/plugins/html/sample/components/alerts.html +32 -0
  41. package/plugins/html/sample/components/animations.html +7 -0
  42. package/plugins/html/sample/components/buttons.html +5 -0
  43. package/plugins/html/sample/components/cards.html +73 -0
  44. package/plugins/html/sample/components/lists.html +75 -0
  45. package/plugins/html/sample/components/locations.html +49 -0
  46. package/plugins/html/sample/components/profile-banners.html +48 -0
  47. package/plugins/html/sample/components/sections.html +16 -0
  48. package/plugins/html/sample/components/service-tiles.html +73 -0
  49. package/plugins/html/sample/components/typography.html +42 -0
  50. package/plugins/html/sample/default.html +31 -0
  51. package/plugins/html/sample/favicon.ico +0 -0
  52. package/plugins/html/sample/images/black_puppy.jpg +0 -0
  53. package/plugins/html/sample/images/dolphin_marine_mammals_water.jpg +0 -0
  54. package/plugins/html/sample/images/grayscale_mountain.jpg +0 -0
  55. package/plugins/html/sample/images/silhouette.png +0 -0
  56. package/plugins/html/sample/images/squirrel_tail_bushy_tail.jpg +0 -0
  57. package/plugins/html/sample/index.html +48 -0
  58. package/plugins/html/sample/missing/content.html +4 -0
  59. package/plugins/html/sample/structural/branding.html +15 -0
  60. package/plugins/html/sample/structural/footer.html +47 -0
  61. package/plugins/html/sample/structural/header.html +16 -0
  62. package/plugins/html/sample/structural/mobile-controls.html +5 -0
  63. package/plugins/html/sample/structural/navigation.html +26 -0
  64. package/plugins/html/sample/structural/search.html +15 -0
  65. package/plugins/html/sample/structural/utility-header.html +23 -0
  66. package/plugins/html/scripts/create-entrypoints.js +62 -0
  67. package/plugins/html/scripts/icon.js +60 -0
  68. package/plugins/html/scripts/webpack.test.js +41 -0
  69. package/plugins/html/webpack.config.js +279 -0
  70. package/plugins/jshint/.jshintrc +31 -0
  71. package/plugins/jshint/README.md +26 -0
  72. package/plugins/jshint/changelog.txt +30 -0
  73. package/plugins/jshint/index.js +296 -0
  74. package/plugins/jshint/package-lock.json +1779 -0
  75. package/plugins/jshint/package.json +45 -0
  76. package/plugins/jshint/reporter.cjs +663 -0
  77. package/plugins/jshint/sample/jshint.css +247 -0
  78. package/plugins/jshint/sample/jshint.html +7 -0
  79. package/plugins/jshint/sample/jshint.js +25 -0
  80. package/plugins/jshint/sample/no-files.html +9 -0
  81. package/sample/index.html +364 -0
  82. package/scripts/update-deps.js +38 -0
  83. package/webpack.config.js +0 -54
@@ -0,0 +1,47 @@
1
+ <footer class="global-footer">
2
+ <div class="container">
3
+ <div class="d-flex">
4
+ {{#if nav.footer }}
5
+ <ul class="nav footer-links">
6
+ <li class="nav-item">
7
+ <a href="https://www.ca.gov?utm_campaign=state_template_link&amp;utm_medium=footer&amp;utm_source=external" class="nav-link ps-0" title="CA.gov" target="_blank">
8
+ <span class="ca-gov-logo-svg"></span>
9
+ </a>
10
+ </li>
11
+ {{#each nav.footer }}
12
+ {{#if this.url }}{{#if this.label }}
13
+ <li class="nav-item">
14
+ <a href="{{ this.url }}" class="nav-link">{{ this.label }}</a>
15
+ </li>
16
+ {{/if}}{{/if}}
17
+ {{/each}}
18
+ </ul>
19
+ {{/if}}
20
+ {{#if social }}
21
+ <ul class="nav social-share-links">
22
+ {{#each social }}
23
+ {{#if this }}
24
+ <li class="nav-item">
25
+ <a href="{{ this }}" class="nav-link ca-gov-icon-{{ @key }}"></a>
26
+ </li>
27
+ {{/if}}
28
+ {{/each}}
29
+ </ul>
30
+ {{/if}}
31
+ </div>
32
+ </div>
33
+ <!-- Copyright Statement -->
34
+ <div class="copyright container">
35
+ <p>
36
+ ©
37
+ <span id="thisyear">
38
+ <script>
39
+ document.getElementById('thisyear').appendChild(document.createTextNode(new Date().getFullYear()))
40
+ </script>
41
+ </span>
42
+ State of California
43
+ </p>
44
+ </div>
45
+
46
+ <button class="return-top">Back to top</button>
47
+ </footer>
@@ -0,0 +1,16 @@
1
+ <header role="banner" id="header" class="global-header">
2
+ <div id="skip-to-content">
3
+ <a href="#main-content">Skip to Main Content</a>
4
+ </div>
5
+
6
+ {{> '../components/alerts.html' }}
7
+
8
+ {{> './utility-header.html' }}
9
+
10
+ {{> './branding.html' }}
11
+
12
+ {{> './mobile-controls.html' }}
13
+
14
+ {{> './navigation.html' }}
15
+
16
+ </header>
@@ -0,0 +1,5 @@
1
+ <!-- Mobile Navigation Controls -->
2
+ <div class="mobile-controlled overlay collapse collapse-horizontal">
3
+ <button class="mobile-control toggle-menu ca-gov-icon-close-mark fs-1" data-bs-toggle="collapse" data-bs-target=".mobile-controlled" aria-expanded="false" aria-controls="mobile-controls">
4
+ </button>
5
+ </div>
@@ -0,0 +1,26 @@
1
+ <!-- Navigation -->
2
+ <div class="navigation border-bottom mobile-controlled collapse collapse-horizontal show">
3
+ <div class="container">
4
+ {{#if nav.header }}
5
+ <ul class="nav" aria-label="Main navigation">
6
+ {{#each nav.header }}
7
+ {{#if this.sub }}
8
+ <li class="nav-item dropdown">
9
+ <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">{{ this.label }}</a>
10
+ <ul class="dropdown-menu">
11
+ {{#each this.sub }}
12
+ <li class="nav-item">
13
+ <a class="nav-link" href="{{ this.url }}">{{ this.label }}</a>
14
+ </li>
15
+ {{/each}}
16
+ </ul>
17
+ {{else}}
18
+ <li class="nav-item">
19
+ <a class="nav-link" href="{{ this.url }}">{{ this.label }}</a>
20
+ {{/if}}
21
+ </li>
22
+ {{/each}}
23
+ </ul>
24
+ {{/if}}
25
+ </div>
26
+ </div>
@@ -0,0 +1,15 @@
1
+ {{#if google.search }}
2
+ <!-- Search -->
3
+ <div class="search-container">
4
+ <form action="/serp.html" role="search">
5
+ <div class="input-group">
6
+ <span class="sr-only" id="SearchInput">Custom Google Search</span>
7
+ <input type="search" name="q" aria-labelledby="SearchInput" placeholder="Search" class="search-textfield form-control">
8
+ <button type="submit" class="search-button">
9
+ <span class="ca-gov-icon-search" aria-hidden="true"></span>
10
+ <span class="sr-only">Submit</span>
11
+ </button>
12
+ </div>
13
+ </form>
14
+ </div>
15
+ {{/if}}
@@ -0,0 +1,23 @@
1
+ <!-- Utility Header -->
2
+ <div class="utility-header">
3
+ <div class="container d-flex flex-row">
4
+ <div class="social-media-links">
5
+ <div class="header-cagov-logo">
6
+ <a href="https://www.ca.gov?utm_campaign=state_template_link&amp;utm_medium=header&amp;utm_source=external">
7
+ <span class="sr-only">CA.gov</span>
8
+ <span class="ca-gov-logo-svg"></span>
9
+ </a>
10
+ </div>
11
+ <p class="official-tag">Official website of the State of California</p>
12
+ </div>
13
+ <div class="settings-links">
14
+ {{#if utility-links }}
15
+ {{#each utility-links }}
16
+ {{#if this.url }}{{#if this.label }}
17
+ <a href="{{ this.url }}">{{ this.label }}</a>
18
+ {{/if}}{{/if}}
19
+ {{/each}}
20
+ {{/if}}
21
+ </div>
22
+ </div>
23
+ </div>
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import fs from 'fs';
7
+ import path from 'path';
8
+ import { fileURLToPath } from 'url';
9
+
10
+ const currentPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
11
+
12
+ let entry = {
13
+ 'font-only': path.join(currentPath, 'src', 'styles', 'font-only.css')
14
+ };
15
+
16
+ // create the entry directory
17
+ fs.mkdirSync('entry', {recursive: true});
18
+
19
+ let heading = `/**
20
+ * Autogenerated Entrypoint
21
+ * DO NOT MODIFY
22
+ */\n`;
23
+
24
+ // iterate over all colorschemes
25
+ fs.readdirSync(path.join(currentPath, 'src', 'styles', 'colorschemes')).forEach((c) => {
26
+ let scheme = c.substring(0, c.indexOf('.')).replace(' ', '');
27
+ let files = [
28
+ path.join(currentPath, 'src', 'styles', 'font-only.css'),
29
+ path.join(currentPath, 'src', 'styles', 'colorschemes', c),
30
+ path.join(currentPath, 'src', 'scripts', 'index.js')
31
+ ]
32
+ // add entries for each colorscheme
33
+ entry[scheme] = files;
34
+
35
+ let correctFiles = files.map(f => `'${f.replace(process.cwd(), '').replaceAll('\\', '/')}'`)
36
+ let output = `
37
+ import path from 'path';
38
+ import { fileURLToPath } from 'url';
39
+ const currentPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
40
+
41
+ export default {
42
+ entry: {
43
+ 'font-only': path.join(currentPath, 'src', 'styles', 'font-only.css'),
44
+ ${scheme}: [
45
+ path.join(currentPath, ${correctFiles.join('),\n' + `\t`.repeat(3) + 'path.join(currentPath, ')})
46
+ ]
47
+ }
48
+ };
49
+ `;
50
+
51
+
52
+ // write and entrypoint
53
+ // this allows for serving of a specific entry.
54
+ fs.writeFileSync(
55
+ `./entry/${scheme}.js`,
56
+ `${heading} ${output}`
57
+ )
58
+
59
+ })
60
+
61
+
62
+ export default {entry};
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import fs from 'fs';
7
+ import path from 'path';
8
+ import { fileURLToPath } from 'url';
9
+
10
+ const currentPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
11
+ const fontBuildPath = path.join(currentPath, 'build', 'fonts');
12
+
13
+
14
+ // iterate over all svg files
15
+ fs.readdirSync(fontBuildPath).filter( (e) => e.endsWith('.svg')).forEach((c) => {
16
+
17
+ // we can't use a parser otherwise some of the unicodes will be encoded
18
+ // we parse the file ourselves.
19
+ let svgContent = fs.readFileSync(path.join(fontBuildPath, c)).toString();
20
+
21
+ // we only want the glyph with unicodes
22
+ let icons = [ ...svgContent.matchAll(/glyph unicode=[^\n].*/g) ].map((i) => {
23
+ let raw = i[0];
24
+ let glyph = raw.match(/glyph-name="([\S]+)"/);
25
+
26
+ // only if there is a name associated with the glyph.
27
+ if( glyph ){
28
+
29
+ let unicode = raw.match(/unicode="([\S]+)"/)[1];
30
+ let name = glyph[1];
31
+ let ws = name.replace(/[_-]/g, ' ').split(' ');
32
+
33
+ // the styles is applied by certain editors/builders
34
+ // divi - Applies Divi Theme Support
35
+ // line - Applies Line Styles
36
+ // solid - Applied Solid Styles
37
+ let styles = [
38
+ 'divi',
39
+ ws.includes('line') ? 'line' : 'solid'
40
+ ]
41
+
42
+ return {
43
+ glyph: name,
44
+ unicode,
45
+ name: ws.map(w => w.charAt(0).toUpperCase() + w.substring(1)).join(' '), // uppercase all words and join with a space
46
+ search_terms: ws.join(' '),
47
+ styles
48
+ }
49
+ }
50
+
51
+
52
+ }).filter(e=>e); // clear out any null values
53
+
54
+ // write svg json output
55
+ fs.writeFileSync(
56
+ path.join(fontBuildPath, `${c.substring(0, c.lastIndexOf('.'))}.json`),
57
+ JSON.stringify( icons, null, 4 )
58
+ )
59
+
60
+ })
@@ -0,0 +1,41 @@
1
+ /**
2
+ * External Dependencies
3
+ */
4
+ import fs from 'fs';
5
+ import path from 'path';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import CAWebHTMLPlugin from '../index.js';
11
+
12
+ const componentDir = path.join(process.cwd(), 'sample', 'components');
13
+
14
+ let plugins = [];
15
+
16
+ fs.readdirSync(componentDir).forEach((c) => {
17
+ let p = fs.readFileSync( path.join(componentDir, c) ).toString();
18
+ let t = c.replace(/\.*/, '').replace('-', ' ');
19
+
20
+ plugins.push(
21
+ new CAWebHTMLPlugin({
22
+ filename: `components/${c}`,
23
+ title: t.charAt(0).toUpperCase() + t.substring(1),
24
+ templateParameters: {
25
+ scheme: false, // we use the entrypoints for testing
26
+ bodyHtmlSnippet: p,
27
+ },
28
+ skipAssets: [
29
+ /.*-rtl.css/, // we skip the Right-to-Left Styles
30
+ /css-audit.*/, // we skip the CSSAudit Files
31
+ /a11y.*/, // we skip the A11y Files
32
+ /jshint.*/, // we skip the JSHint Files
33
+ /font-only.*/, // we skip the font-only Files
34
+ ]
35
+ })
36
+ )
37
+ })
38
+
39
+ export default {
40
+ plugins
41
+ };
@@ -0,0 +1,279 @@
1
+ /**
2
+ * WebPack Configuration for California Department of Technology
3
+ *
4
+ * Utilizes WordPress Scripts Webpack configuration as base.
5
+ *
6
+ * @link https://webpack.js.org/configuration/
7
+ */
8
+
9
+ /**
10
+ * External Dependencies
11
+ */
12
+ import baseConfig from '@wordpress/scripts/config/webpack.config.js';
13
+ import fs from 'fs';
14
+ import path from 'path';
15
+ import { fileURLToPath } from 'url';
16
+
17
+ // webpack plugins
18
+ import MiniCSSExtractPlugin from 'mini-css-extract-plugin';
19
+ import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
20
+ import RtlCssPlugin from 'rtlcss-webpack-plugin';
21
+ import {HtmlWebpackSkipAssetsPlugin} from 'html-webpack-skip-assets-plugin';
22
+ import {HtmlWebpackLinkTypePlugin} from 'html-webpack-link-type-plugin';
23
+
24
+ import JSHintPlugin from '@caweb/jshint-webpack-plugin';
25
+ import CSSAuditPlugin from '@caweb/css-audit-webpack-plugin';
26
+ import A11yPlugin from '@caweb/a11y-webpack-plugin';
27
+
28
+ /**
29
+ * Internal dependencies
30
+ */
31
+ import CAWebHTMLPlugin from './index.js';
32
+
33
+ const webpackCommand = 'build' === process.argv[2] ? 'build' : 'serve' ;
34
+
35
+ // flags can be passed via argv0
36
+ // we also add args from NODE_OPTIONS
37
+ const flags = [].concat(
38
+ processArgs(process.argv),
39
+ processArgs(process.argv0.split(' ')),
40
+ processArgs(process.env.NODE_OPTIONS ? process.env.NODE_OPTIONS.split(' ') : [])
41
+ )
42
+
43
+ function processArgs( arr ){
44
+ let tmp = [];
45
+
46
+ arr.filter(Boolean).map((o) => {
47
+ return o.replaceAll("'", '').split('=').forEach((e => tmp.push(e)))
48
+ })
49
+
50
+ return tmp
51
+ }
52
+
53
+ function getArgVal(flag){
54
+ return flags.includes(flag) ? flags[flags.indexOf(flag) + 1] : false;
55
+ }
56
+
57
+
58
+ // Update some of the default WordPress webpack rules.
59
+ baseConfig.module.rules.forEach((rule, i) => {
60
+ const r = new RegExp(rule.test).toString();
61
+
62
+ switch(r){
63
+ // WordPress adds a hash to asset file names we remove that hash.
64
+ case new RegExp(/\.(bmp|png|jpe?g|gif|webp)$/i).toString():
65
+ rule.generator.filename = 'images/[name][ext]';
66
+ break;
67
+ case new RegExp(/\.(woff|woff2|eot|ttf|otf)$/i).toString():
68
+ rule.generator.filename = 'fonts/[name][ext]';
69
+ break;
70
+ case new RegExp(/\.svg$/).toString():
71
+ // we don't want SVG to be asset/inline otherwise the resource may not be available.
72
+ // the asset should be an asset/resource we move them to the fonts folder.
73
+ if( 'asset/inline' === rule.type ){
74
+ rule.type = 'asset/resource';
75
+ rule.generator = { filename: 'fonts/[name][ext]' };
76
+
77
+ delete rule.issuer;
78
+ }
79
+ break;
80
+ }
81
+ });
82
+
83
+ // we remove the WordPress CleanWebpackPlugin definition
84
+ // instead we use the Webpack output.clean definition
85
+ baseConfig.plugins.splice(1,1, false);
86
+
87
+ /**
88
+ * we remove the WordPress devServer declaration since we can only have 1 when exporting multiple configurations
89
+ *
90
+ * @see https://github.com/webpack/webpack-cli/issues/2408#issuecomment-793052542
91
+ */
92
+ delete baseConfig.devServer;
93
+
94
+ // Wordpress ignores the webpack --mode flag
95
+ // if the flag is passed we use that mode
96
+ // otherwise use whatever Wordpress is using
97
+ let mode = getArgVal('--mode') ? getArgVal('--mode') : baseConfig.mode;
98
+
99
+ let webpackConfig = {
100
+ mode,
101
+ name: 'uncompressed',
102
+ target: 'web',
103
+ cache: false,
104
+ stats: 'errors',
105
+ output: {
106
+ clean: mode === 'production'
107
+ },
108
+ performance: {
109
+ maxAssetSize: 500000,
110
+ maxEntrypointSize: 500000
111
+ },
112
+ module:{
113
+ rules: [
114
+ /**
115
+ * Default template loader for html is lodash,
116
+ * lets switch to handlebars
117
+ */
118
+ {
119
+ test: /\.html$/,
120
+ loader: 'handlebars-loader',
121
+ options:{
122
+ rootRelative: process.cwd(),
123
+ partialResolver: function(partial, callback){
124
+ /**
125
+ * All template partials are loaded from the root sample directory
126
+ * if the file doesn't exist we fallback to our sample template partials
127
+ */
128
+ let partialPath = path.join( process.cwd(), 'sample' );
129
+ let partialStructurePath = path.join( partialPath, 'structural' );
130
+
131
+ // template parameter specific partials
132
+ switch( partial ){
133
+ // header/footer is served from the /sample/structural/ directory
134
+ case 'footer':
135
+ case 'header':
136
+ partialPath = fs.existsSync(path.join( partialStructurePath, `/${partial}.html` )) ? path.join( partialStructurePath, `/${partial}.html` ) :
137
+ `./structural/${partial}.html`
138
+
139
+ break;
140
+
141
+ case 'content':
142
+ // content is served from /sample/index.html
143
+ partialPath = fs.existsSync(path.join( partialPath, '/index.html' )) ? path.join( partialPath, '/index.html' ) :
144
+ './missing/content.html';
145
+
146
+ break;
147
+
148
+ // if not a template parameter we let the loader handle it
149
+ default:
150
+ partialPath = partial;
151
+ }
152
+
153
+
154
+ callback(false, partialPath );
155
+ }
156
+ }
157
+ }
158
+ ]
159
+ },
160
+ };
161
+
162
+ /**
163
+ * Serve Only
164
+ */
165
+ if( 'serve' === webpackCommand ){
166
+ const appPath = process.cwd();
167
+ let template = flags.includes('--template') ? getArgVal('--template') : 'default';
168
+ let scheme = flags.includes('--scheme') ? getArgVal('--scheme') : 'oceanside';
169
+
170
+ // Dev Server is added
171
+ webpackConfig.devServer = {
172
+ devMiddleware: {
173
+ writeToDisk: true,
174
+ },
175
+ hot: true,
176
+ compress: true,
177
+ allowedHosts: 'auto',
178
+ host: 'localhost',
179
+ port: 9000,
180
+ open: [ 'http://localhost:9000' ],
181
+ static: [
182
+ /**
183
+ * Static files are served from the following files in the following order
184
+ * we don't have to add the build directory since that is the output.path and proxied
185
+ * public - Default
186
+ * sample - Allows loading sample files
187
+ * node_modules - Allows loading files from other npm packages
188
+ * src - Allows loading files that aren't compiled
189
+ */
190
+ {
191
+ directory: path.join(appPath, 'public'),
192
+ },
193
+ {
194
+ directory: path.join(appPath, 'sample'),
195
+ },
196
+ {
197
+ directory: path.join(appPath, 'node_modules'),
198
+ },
199
+ {
200
+ directory: path.join(appPath, 'src'),
201
+ },
202
+ ],
203
+ proxy:[
204
+ /**
205
+ * WordPress Proxy Configuration is deprecated
206
+ * @since 28.2.0
207
+ */
208
+ {
209
+ context: ['/build'],
210
+ target: 'http://localhost:9000',
211
+ pathRewrite: {
212
+ '^/build': ''
213
+ },
214
+ logLevel: 'info'
215
+ },
216
+ /**
217
+ * We proxy the node_modules and src so they serve from the root
218
+ */
219
+ {
220
+ context: ['/node_modules'],
221
+ target: 'http://localhost:9000',
222
+ pathRewrite: { '^/node_modules': '' },
223
+ },
224
+ {
225
+ context: ['/src'],
226
+ target: 'http://localhost:9000',
227
+ pathRewrite: { '^/src': '' },
228
+ }
229
+ ]
230
+ }
231
+
232
+ // Page Template and additional plugins
233
+ webpackConfig.plugins = [
234
+ new CAWebHTMLPlugin({
235
+ template,
236
+ templateParameters: {
237
+ scheme: 'false' !== scheme ? scheme : false
238
+ },
239
+ skipAssets: [
240
+ /.*-rtl.css/, // we skip the Right-to-Left Styles
241
+ /css-audit.*/, // we skip the CSSAudit Files
242
+ /a11y.*/, // we skip the A11y Files
243
+ /jshint.*/, // we skip the JSHint Files
244
+ /font-only.js/, // we skip the font-only Files
245
+ ]
246
+ }),
247
+ new HtmlWebpackSkipAssetsPlugin(),
248
+ new HtmlWebpackLinkTypePlugin(),
249
+ ! getArgVal('--no-jshint') ? new JSHintPlugin() : false,
250
+ ! getArgVal('--no-audit') ? new CSSAuditPlugin() : false,
251
+ ! getArgVal('--no-a11y') ? new A11yPlugin() : false
252
+ ]
253
+ }
254
+
255
+ export default [
256
+ baseConfig,
257
+ webpackConfig,
258
+ mode === 'production' ?
259
+ {
260
+ name: 'compressed',
261
+ dependencies: ['uncompressed'],
262
+ devtool: false,
263
+ output: {
264
+ filename: '[name].min.js',
265
+ chunkFilename: '[name].min.js?v=[chunkhash]',
266
+ },
267
+ plugins: [
268
+ new MiniCSSExtractPlugin( { filename: '[name].min.css' } ),
269
+ new RtlCssPlugin( { filename: '[name]-rtl.min.css' } ),
270
+ ],
271
+ optimization:{
272
+ minimize: true,
273
+ minimizer: [
274
+ `...`,
275
+ new CssMinimizerPlugin({test: /\.min\.css$/})
276
+ ]
277
+ }
278
+ } : false
279
+ ].filter(Boolean);
@@ -0,0 +1,31 @@
1
+ {
2
+ "boss": true,
3
+ "curly": true,
4
+ "eqeqeq": true,
5
+ "eqnull": true,
6
+ "esversion": 11,
7
+ "expr": true,
8
+ "immed": true,
9
+ "noarg": true,
10
+ "nonbsp": true,
11
+ "quotmark": "single",
12
+ "undef": true,
13
+ "unused": true,
14
+
15
+ "browser": true,
16
+
17
+ "globals": {
18
+ "_": false,
19
+ "Backbone": false,
20
+ "jQuery": false,
21
+ "JSON": false,
22
+ "wp": false,
23
+ "export": false,
24
+ "module": false,
25
+ "require": false,
26
+ "WorkerGlobalScope": false,
27
+ "self": false,
28
+ "OffscreenCanvas": false,
29
+ "Promise": false
30
+ }
31
+ }
@@ -0,0 +1,26 @@
1
+ This is a Webpack Plugin that utilizes [JSHint](https://www.npmjs.com/package/jshint) to detect errors and potential problems in Javascript code.
2
+
3
+ The JSHint Settings used are an adapation of the [WordPress JavaScript Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/javascript/). The default WordPress JSHint Settings can be viewed [here](https://develop.svn.wordpress.org/trunk/.jshintrc).
4
+
5
+ Our standard differs from the guidelines in the following ways:
6
+ - ESVersion has been updated from 6 to 11
7
+
8
+
9
+
10
+ ## Installation
11
+ <pre>npm install --save-dev @caweb/jshint-webpack-plugin</pre>
12
+
13
+ ## Get Started
14
+ In your Webpack configuration simply add the plugin to your existing plugin array.
15
+
16
+ <pre>
17
+ import CSSAuditPlugin from '@caweb/css-audit-webpack-plugin';
18
+
19
+ export default {
20
+ plugins: [
21
+ new JSHintPlugin()
22
+ ]
23
+ }
24
+ </pre>
25
+
26
+ ## Options
@@ -0,0 +1,30 @@
1
+ v1.0.9
2
+ - Update npm packages
3
+ - Added npm devDependencies packages
4
+
5
+ v1.0.8
6
+ - Updated Readme
7
+
8
+ v1.0.7
9
+ - Fixed issue with hot module replacement not loading
10
+
11
+ v1.0.6
12
+ - Added sample file for when no files are reported
13
+
14
+ v1.0.5
15
+ - Added a11y and css-audit HRM update file to ignore list
16
+
17
+ v1.0.4
18
+ - Updated jshint esversion from 6 to
19
+
20
+ v1.0.3
21
+ - Fixed issue with hot module replacement
22
+
23
+ v1.0.2
24
+ - Fixed issue with hot module replacement
25
+
26
+ v1.0.1
27
+ - Fixed issue with reporter file missing
28
+
29
+ v1.0.0
30
+ - JSHint Webpack Plugin