@caweb/webpack 1.3.44 → 1.4.0-beta.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 (91) hide show
  1. package/package.json +16 -9
  2. package/{plugins/html/webpack.config.js → webpack.config.js} +77 -49
  3. package/.github/workflows/config-publish.yml +0 -23
  4. package/.github/workflows/plugins-publish.yml +0 -31
  5. package/.github/workflows/test +0 -29
  6. package/.gitmodules +0 -3
  7. package/CHANGELOG.md +0 -273
  8. package/plugins/a11y/README.md +0 -19
  9. package/plugins/a11y/aceconfig.js +0 -44
  10. package/plugins/a11y/changelog.txt +0 -31
  11. package/plugins/a11y/index.js +0 -271
  12. package/plugins/a11y/package-lock.json +0 -3303
  13. package/plugins/a11y/package.json +0 -42
  14. package/plugins/css-audit/README.md +0 -20
  15. package/plugins/css-audit/changelog.txt +0 -41
  16. package/plugins/css-audit/css-audit.config.cjs +0 -5
  17. package/plugins/css-audit/default.config.js +0 -19
  18. package/plugins/css-audit/index.js +0 -326
  19. package/plugins/css-audit/package-lock.json +0 -1522
  20. package/plugins/css-audit/package.json +0 -53
  21. package/plugins/css-audit/sample/no-files.html +0 -9
  22. package/plugins/html/CHANGELOG.md +0 -300
  23. package/plugins/html/README.md +0 -62
  24. package/plugins/html/entry/delta.js +0 -19
  25. package/plugins/html/entry/eureka.js +0 -19
  26. package/plugins/html/entry/mono.js +0 -19
  27. package/plugins/html/entry/oceanside.js +0 -19
  28. package/plugins/html/entry/orangecounty.js +0 -19
  29. package/plugins/html/entry/pasorobles.js +0 -19
  30. package/plugins/html/entry/sacramento.js +0 -19
  31. package/plugins/html/entry/santabarbara.js +0 -19
  32. package/plugins/html/entry/santacruz.js +0 -19
  33. package/plugins/html/entry/shasta.js +0 -19
  34. package/plugins/html/entry/sierra.js +0 -19
  35. package/plugins/html/entry/trinity.js +0 -19
  36. package/plugins/html/index.js +0 -105
  37. package/plugins/html/package-lock.json +0 -22895
  38. package/plugins/html/package.json +0 -135
  39. package/plugins/html/sample/blank.html +0 -13
  40. package/plugins/html/sample/components/alerts.html +0 -32
  41. package/plugins/html/sample/components/animations.html +0 -7
  42. package/plugins/html/sample/components/buttons.html +0 -5
  43. package/plugins/html/sample/components/cards.html +0 -88
  44. package/plugins/html/sample/components/lists.html +0 -75
  45. package/plugins/html/sample/components/locations.html +0 -49
  46. package/plugins/html/sample/components/profile-banners.html +0 -48
  47. package/plugins/html/sample/components/sections.html +0 -16
  48. package/plugins/html/sample/components/service-tiles.html +0 -73
  49. package/plugins/html/sample/components/typography.html +0 -42
  50. package/plugins/html/sample/default.html +0 -53
  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 +0 -47
  58. package/plugins/html/sample/missing/content.html +0 -4
  59. package/plugins/html/sample/search.html +0 -55
  60. package/plugins/html/sample/structural/branding.html +0 -21
  61. package/plugins/html/sample/structural/footer.html +0 -47
  62. package/plugins/html/sample/structural/header.html +0 -16
  63. package/plugins/html/sample/structural/mobile-controls.html +0 -5
  64. package/plugins/html/sample/structural/navigation.html +0 -30
  65. package/plugins/html/sample/structural/search.html +0 -13
  66. package/plugins/html/sample/structural/utility-header.html +0 -23
  67. package/plugins/html/scripts/create-entrypoints.js +0 -60
  68. package/plugins/html/scripts/schemes.js +0 -123
  69. package/plugins/html/scripts/update-scripts.js +0 -47
  70. package/plugins/html/scripts/webpack.test.js +0 -41
  71. package/plugins/jshint/.customrc +0 -29
  72. package/plugins/jshint/.jshintrc +0 -31
  73. package/plugins/jshint/README.md +0 -24
  74. package/plugins/jshint/changelog.txt +0 -36
  75. package/plugins/jshint/index.js +0 -291
  76. package/plugins/jshint/package-lock.json +0 -24453
  77. package/plugins/jshint/package.json +0 -50
  78. package/plugins/jshint/reporter.cjs +0 -301
  79. package/plugins/jshint/sample/no-files.html +0 -9
  80. package/plugins/jshint/scripts/webpack.test.js +0 -18
  81. package/sample/index.html +0 -364
  82. package/scripts/update-deps.js +0 -38
  83. /package/{plugins/html/helpers → helpers}/logic/endsWith.js +0 -0
  84. /package/{plugins/html/helpers → helpers}/logic/ifCond.js +0 -0
  85. /package/{plugins/html/helpers → helpers}/object/jsonParse.js +0 -0
  86. /package/{plugins/html/helpers → helpers}/object/jsonStringify.js +0 -0
  87. /package/{plugins/html/helpers → helpers}/string/replace.js +0 -0
  88. /package/{plugins/html/helpers → helpers}/string/toLower.js +0 -0
  89. /package/{plugins/html/helpers → helpers}/string/toTitleCase.js +0 -0
  90. /package/{plugins/html/helpers → helpers}/string/toUpper.js +0 -0
  91. /package/{plugins/html/tsconfig.json → tsconfig.json} +0 -0
@@ -1,31 +0,0 @@
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
- }
@@ -1,24 +0,0 @@
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 JSHintPlugin from '@caweb/jshint-webpack-plugin';
18
-
19
- export default {
20
- plugins: [
21
- new JSHintPlugin()
22
- ]
23
- }
24
- </pre>
@@ -1,36 +0,0 @@
1
- v2.0.1
2
- - Updated peerDeps
3
-
4
- v2.0.0
5
- - reporter now uses @caweb/html-webpack-plugin when creating report
6
-
7
- v1.0.9
8
- - Update npm packages
9
- - Added npm devDependencies packages
10
-
11
- v1.0.8
12
- - Updated Readme
13
-
14
- v1.0.7
15
- - Fixed issue with hot module replacement not loading
16
-
17
- v1.0.6
18
- - Added sample file for when no files are reported
19
-
20
- v1.0.5
21
- - Added a11y and css-audit HRM update file to ignore list
22
-
23
- v1.0.4
24
- - Updated jshint esversion from 6 to
25
-
26
- v1.0.3
27
- - Fixed issue with hot module replacement
28
-
29
- v1.0.2
30
- - Fixed issue with hot module replacement
31
-
32
- v1.0.1
33
- - Fixed issue with reporter file missing
34
-
35
- v1.0.0
36
- - JSHint Webpack Plugin
@@ -1,291 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * External dependencies
5
- */
6
- import spawn from 'cross-spawn';
7
- import { getAllFilesSync } from 'get-all-files'
8
- import EntryDependency from "webpack/lib/dependencies/EntryDependency.js";
9
- import path from 'path';
10
- import fs from 'fs';
11
- import deepmerge from 'deepmerge';
12
- import chalk from 'chalk';
13
- import { fileURLToPath, URL } from 'url';
14
-
15
- const boldWhite = chalk.bold.white;
16
- const boldGreen = chalk.bold.green;
17
- const boldBlue = chalk.bold.hex('#03a7fc');
18
- const currentPath = path.dirname(fileURLToPath(import.meta.url));
19
-
20
- // JSHint Plugin
21
- class JSHintPlugin {
22
- config = {
23
- outputFilename: 'jshint',
24
- outputFolder: path.join(currentPath, 'public'),
25
- }
26
-
27
- constructor(opts = {}) {
28
- // outputFolder must be resolved
29
- if( opts.outputFolder ){
30
- opts.outputFolder = path.join(process.cwd(), opts.outputFolder);
31
- }
32
- this.config = deepmerge(this.config, opts);
33
- }
34
-
35
- apply(compiler) {
36
- const staticDir = {
37
- directory: this.config.outputFolder,
38
- watch: true
39
- }
40
- let { devServer } = compiler.options;
41
- let hostUrl = 'localhost' === devServer.host ? `http://${devServer.host}`: devServer.host;
42
- let hostPort = devServer.port;
43
-
44
- if( hostPort && 80 !== hostPort )
45
- {
46
- hostUrl = `${hostUrl}:${hostPort}`;
47
- }
48
-
49
- // if dev server allows for multiple pages to be opened
50
- // add jshint.html to open property.
51
- if( Array.isArray(devServer.open) ){
52
- devServer.open.push(`${hostUrl}/${this.config.outputFilename}.html`)
53
- }else if( 'object' === typeof devServer.open && Array.isArray(devServer.open.target) ){
54
- devServer.open.target.push(`${hostUrl}/${this.config.outputFilename}.html`)
55
- }
56
-
57
- // add our static directory
58
- if( Array.isArray(devServer.static) ){
59
- devServer.static.push(staticDir)
60
- }else{
61
- devServer.static = [].concat(devServer.static, staticDir );
62
- }
63
-
64
- // Wait for configuration preset plugins to apply all configure webpack defaults
65
- compiler.hooks.initialize.tap('JSHint Plugin', () => {
66
- compiler.hooks.compilation.tap(
67
- "JSHint Plugin",
68
- (compilation, { normalModuleFactory }) => {
69
- compilation.dependencyFactories.set(
70
- EntryDependency,
71
- normalModuleFactory
72
- );
73
- }
74
- );
75
-
76
- //const dep = new EntryDependency(path.join( this.config.outputFolder, 'jshint.js'));
77
- const dep = new EntryDependency(path.resolve( 'src', 'index.js'));
78
- dep.loc = {
79
- name: 'jshint'
80
- };
81
-
82
- if( ! fs.existsSync(path.resolve(this.config.outputFolder))){
83
- fs.mkdirSync( path.resolve(this.config.outputFolder), {recursive: true} );
84
- }
85
-
86
- fs.writeFileSync(
87
- path.join(this.config.outputFolder, `jshint.js`),
88
- `` // required for hot-update to compile on our page, blank script for now
89
- );
90
-
91
-
92
- compiler.hooks.thisCompilation.tap('JSHint Plugin',
93
- /**
94
- * Hook into the webpack compilation
95
- * @param {Compilation} compilation
96
- */
97
- (compilation) => {
98
-
99
- compiler.hooks.make.tapAsync("JSHint Plugin", (compilation, callback) => {
100
-
101
- compilation.addEntry(
102
- 'jshint',
103
- dep,
104
- {
105
- name: 'jshint'
106
- },
107
- err => {
108
- callback(err);
109
- });
110
- });
111
-
112
- // process assets and run the jshint on appropriate assets.
113
- compilation.hooks.processAssets.tapAsync(
114
- {
115
- name: 'JSHint Plugin',
116
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
117
- },
118
- /**
119
- * Hook into the process assets hook
120
- * @param {any} _
121
- * @param {(err?: Error) => void} callback
122
- */
123
- (assets, callback) => {
124
- let files = [];
125
-
126
- Object.entries(assets).forEach(([pathname, source]) => {
127
- if( pathname.endsWith('.js') ){
128
- if( source['_source'] && source['_source']['_children'] ){
129
- source['_source']['_children'].forEach((s, i) => {
130
- if(
131
- 'string' === typeof s && // is a string and
132
- 0 < s.indexOf('.js') && // has a .js reference and
133
- 0 > s.indexOf('node_modules') && // not referencing node_modules directory
134
- 0 > s.indexOf('jshint.js') && // not referencing our update javascript
135
- 0 > s.indexOf('a11y.update.js') && // not referencing our a11y javascript
136
- 0 > s.indexOf('audit.update.js') // not referencing our css-audit javascript
137
- ){
138
- files.push( path.resolve(s.replace(/[\n\s\S\w]*"(.*)"[\n\s\S\w]*/, '$1')) )
139
- }
140
- })
141
- }
142
- }
143
- })
144
-
145
- console.log(`<i> ${boldGreen('[webpack-dev-middleware] Running JSHint...')}`);
146
-
147
- let result = this.hint(files, this.config);
148
-
149
- if( result ){
150
- // we have to inject the jshint.update.js file into the head in order for the webpack-dev-server scripts to load.
151
- let pageContent = fs.readFileSync(path.join(staticDir.directory, `${this.config.outputFilename}.html`))
152
-
153
- fs.writeFileSync(
154
- path.join(staticDir.directory, `${this.config.outputFilename}.html`),
155
- pageContent.toString().replace('</head>', `<script src="./jshint.update.js"></script>\n</head>`)
156
- )
157
- }
158
-
159
- console.log(`<i> ${boldGreen('[webpack-dev-middleware] JSHint can be viewed at')} ${ boldBlue(new URL(`${hostUrl}/${this.config.outputFilename}.html`).toString()) }`);
160
-
161
- callback();
162
- });
163
-
164
- });
165
-
166
- });
167
-
168
- }
169
-
170
- /**
171
- * Run JSHint
172
- *
173
- * @link https://www.npmjs.com/package/jshint
174
- *
175
- * @param {Array} files
176
- * @param {Object} options
177
- * @param {boolean} options.debug
178
- * @param {boolean} options.outputFilename Filename for the scan results.
179
- * @param {boolean} options.outputFolder Where the scan results should be saved.
180
- */
181
- hint(files, {
182
- debug,
183
- outputFolder,
184
- outputFilename
185
- }){
186
-
187
- let outputLocation = path.resolve(path.join(outputFolder, `${outputFilename}.html`));
188
- let filesToBeAuditted = [];
189
- let filesWithIssues = [];
190
-
191
- files.forEach( (paths, i) => {
192
- let resolvePath = path.resolve(paths);
193
-
194
- try {
195
- // if given path is a directory
196
- if( fs.statSync(resolvePath).isDirectory() ){
197
-
198
- // get all .js files
199
- getAllFilesSync(resolvePath).toArray().forEach(f => {
200
- if( f.endsWith('.js') ){
201
- filesToBeAuditted.push(f)
202
- }
203
- })
204
- // if given path is a file and a .js file
205
- }else if( fs.statSync(paths).isFile() && paths.endsWith('.js') ){
206
- filesToBeAuditted.push(paths)
207
- }
208
- // invalid path/file
209
- } catch (error) {
210
- filesWithIssues.push(paths)
211
- }
212
-
213
- });
214
-
215
- if( ! filesToBeAuditted.length ){
216
- console.log('No file(s) or directory path(s) were given or default directory was not found.')
217
- console.log('Hinter did not execute.');
218
-
219
- fs.copyFileSync(
220
- path.join(currentPath, 'sample', 'no-files.html'),
221
- outputLocation,
222
- )
223
- return
224
- }
225
-
226
- let hintConfigFile = path.join(currentPath, '.jshintrc');
227
-
228
- /**
229
- * JSHint does not allow for multiple configs so we have to merge and write 1 file
230
- */
231
- if( fs.existsSync(path.join(process.cwd(), '.jshintrc')) ){
232
- let hintConfig = fs.readFileSync(hintConfigFile);
233
- let customConfig = fs.readFileSync(path.join(process.cwd(), '.jshintrc'));
234
-
235
- hintConfig = hintConfig.toString().replace(/[\r\t\n]|\/{2}.*/g, '')
236
- hintConfig = JSON.parse(hintConfig)
237
-
238
- customConfig = customConfig.toString().replace(/[\r\t\n]|\/{2}.*/g, '')
239
- customConfig = JSON.parse(customConfig)
240
-
241
- hintConfigFile = path.join(currentPath, '.customrc');
242
- fs.writeFileSync(
243
- hintConfigFile ,
244
- JSON.stringify(deepmerge(hintConfig, customConfig), null, 4)
245
- )
246
- }
247
-
248
- // Set the env for our reporter.
249
- process.env.JSHINT_OUTPUT_DIR = outputFolder;
250
- process.env.JSHINT_OUTPUT_FILENAME = outputFilename;
251
-
252
- let hintArgs = [
253
- '--config',
254
- hintConfigFile,
255
- '--reporter',
256
- path.join(currentPath, 'reporter.cjs')
257
- ].filter( e => e)
258
-
259
- let { stdout, stderr } = spawn.sync(
260
- 'jshint',
261
- [
262
- ...filesToBeAuditted,
263
- ...hintArgs
264
- ],
265
- {
266
- stdio: 'pipe',
267
- }
268
- )
269
-
270
- if( stderr && stderr.toString() ){
271
- console.log( stderr.toString())
272
- }
273
-
274
- if( stdout ){
275
- if( 'jshint' === process.argv[2] ){
276
- console.log( stdout.toString() );
277
- console.log( outputLocation )
278
- }else{
279
- return outputLocation;
280
- }
281
- }else{
282
- console.log( 'No output generated.')
283
- return false;
284
- }
285
-
286
- } // end of hint
287
-
288
- } // end of class
289
-
290
-
291
- export default JSHintPlugin;