@caweb/webpack 1.3.44 → 1.4.0-beta.1

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 +17 -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
- v1.0.9
2
- - Update npm packages
3
- - Added npm devDependencies packages
4
-
5
- v1.0.8
6
- - Update npm packages
7
-
8
- v1.0.7
9
- - Updated Readme
10
-
11
- v1.0.6
12
- - Fixed issue with hot module replacement not loading
13
-
14
- v1.0.5
15
- - Fixed issue when publicPath is set to auto
16
-
17
- v1.0.4
18
- - Removed console message
19
-
20
- v1.0.3
21
- - If output.publicPath is set to auto the scanner will scan the public directory
22
-
23
- v1.0.2
24
- - Report is ran once compilation is done
25
-
26
- v1.0.1
27
- - Removed timeout from a11y check
28
- - Fixed issue with hot module replacement
29
-
30
- v1.0.0
31
- - Accessibility Checker Webpack Plugin
@@ -1,271 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * External dependencies
5
- */
6
- import { sync as resolveBin } from 'resolve-bin';
7
- import spawn from 'cross-spawn';
8
- import { getAllFilesSync } from 'get-all-files'
9
- import EntryDependency from "webpack/lib/dependencies/EntryDependency.js";
10
- import path from 'path';
11
- import { isUrl, isValidUrl } from 'check-valid-url';
12
- import fs from 'fs';
13
- import deepmerge from 'deepmerge';
14
- import chalk from 'chalk';
15
- import { fileURLToPath, URL } from 'url';
16
-
17
- // default configuration
18
- import {default as DefaultConfig} from './aceconfig.js';
19
-
20
- const boldWhite = chalk.bold.white;
21
- const boldGreen = chalk.bold.green;
22
- const boldBlue = chalk.bold.hex('#03a7fc');
23
- const currentPath = path.dirname(fileURLToPath(import.meta.url));
24
-
25
- // IBM Accessibility Checker Plugin
26
- class A11yPlugin {
27
- config = {}
28
-
29
- constructor(opts = {}) {
30
- // outputFolder must be resolved
31
- if( opts.outputFolder ){
32
- opts.outputFolder = path.join(process.cwd(), opts.outputFolder);
33
- }
34
- this.config = deepmerge(
35
- DefaultConfig,
36
- {
37
- outputFolder: path.join(currentPath, DefaultConfig.outputFolder)
38
- },
39
- opts
40
- );
41
- }
42
-
43
- apply(compiler) {
44
- const staticDir = {
45
- directory: this.config.outputFolder,
46
- watch: true
47
- }
48
-
49
- let { devServer, output } = compiler.options;
50
- let hostUrl = 'localhost' === devServer.host ? `http://${devServer.host}`: devServer.host;
51
- let hostPort = devServer.port;
52
-
53
- if( hostPort && 80 !== hostPort )
54
- {
55
- hostUrl = `${hostUrl}:${hostPort}`;
56
- }
57
-
58
- // if dev server allows for multiple pages to be opened
59
- // add outputFilename.html to open property.
60
- if( Array.isArray(devServer.open) ){
61
- devServer.open.push(`${hostUrl}/${this.config.outputFilename}.html`)
62
- }else if( 'object' === typeof devServer.open && Array.isArray(devServer.open.target) ){
63
- devServer.open.target.push(`${hostUrl}/${this.config.outputFilename}.html`)
64
- }
65
-
66
- // add our static directory
67
- if( Array.isArray(devServer.static) ){
68
- devServer.static.push(staticDir)
69
- }else{
70
- devServer.static = [].concat(devServer.static, staticDir );
71
- }
72
-
73
- // Wait for configuration preset plugins to apply all configure webpack defaults
74
- compiler.hooks.initialize.tap('IBM Accessibility Plugin', () => {
75
- compiler.hooks.compilation.tap(
76
- "IBM Accessibility Plugin",
77
- (compilation, { normalModuleFactory }) => {
78
- compilation.dependencyFactories.set(
79
- EntryDependency,
80
- normalModuleFactory
81
- );
82
- }
83
- );
84
-
85
- const { entry, options, context } = {
86
- entry: path.join( this.config.outputFolder, 'a11y.update.js'),
87
- options: {
88
- name: 'a11y.update'
89
- },
90
- context: 'a11y'
91
- };
92
-
93
- const dep = new EntryDependency(entry);
94
- dep.loc = {
95
- name: options.name
96
- };
97
- if( ! fs.existsSync(path.resolve(this.config.outputFolder))){
98
- fs.mkdirSync( path.resolve(this.config.outputFolder), {recursive: true} );
99
- }
100
-
101
- fs.writeFileSync(
102
- path.join(this.config.outputFolder, `a11y.update.js`),
103
- `` // required for hot-update to compile on our page, blank script for now
104
- );
105
-
106
-
107
- compiler.hooks.thisCompilation.tap('IBM Accessibility Plugin',
108
- /**
109
- * Hook into the webpack compilation
110
- * @param {Compilation} compilation
111
- */
112
- (compilation) => {
113
-
114
- compiler.hooks.make.tapAsync("IBM Accessibility Plugin", (compilation, callback) => {
115
-
116
- compilation.addEntry(
117
- context,
118
- dep,
119
- options,
120
- err => {
121
- callback(err);
122
- });
123
- });
124
-
125
- });
126
-
127
- compiler.hooks.done.tapAsync(
128
- 'IBM Accessibility Plugin',
129
- /**
130
- * Hook into the process assets hook
131
- * @param {any} _
132
- * @param {(err?: Error) => void} callback
133
- */
134
- (stats, callback) => {
135
-
136
- console.log(`<i> ${boldGreen('[webpack-dev-middleware] Running IBM Accessibility scan...')}`);
137
-
138
- let result = this.a11yCheck('auto' === output.publicPath ? output.path : output.publicPath, this.config );
139
-
140
- if( result ){
141
- // we have to inject the a11y.update.js file into the head in order for the webpack-dev-server scripts to load.
142
- let pageContent = fs.readFileSync(path.join(staticDir.directory, `${this.config.outputFilename}.html`))
143
-
144
- fs.writeFileSync(
145
- path.join(staticDir.directory, `${this.config.outputFilename}.html`),
146
- pageContent.toString().replace('</head>', `<script src="./a11y.update.js"></script>\n</head>`)
147
- )
148
- }
149
-
150
- console.log(`<i> ${boldGreen('[webpack-dev-middleware] IBM Accessibilty Report can be viewed at')} ${ boldBlue(new URL(`${hostUrl}/${this.config.outputFilename}.html`).toString()) }`);
151
-
152
- callback();
153
- });
154
-
155
- });
156
-
157
- }
158
-
159
- /**
160
- * Run accessibility checks
161
- *
162
- * @param {Object} options
163
- * @param {boolean} options.debug True if debug mode is enabled.
164
- * @param {boolean} options.ruleArchive Specify the rule archive.
165
- * @param {boolean} options.policies Specify one or many policies to scan.
166
- * @param {boolean} options.failLevels Specify one or many violation levels on which to fail the test.
167
- * @param {boolean} options.reportLevels Specify one or many violation levels that should be reported.
168
- * @param {boolean} options.labels Specify labels that you would like associated to your scan.
169
- * @param {boolean} options.outputFormat In which formats should the results be output.
170
- * @param {boolean} options.outputFilename Filename for the scan results.
171
- * @param {boolean} options.outputFolder Where the scan results should be saved.
172
- * @param {boolean} options.outputFilenameTimestamp Should the timestamp be included in the filename of the reports?
173
- */
174
- a11yCheck(url, {
175
- debug,
176
- ruleArchive,
177
- policies,
178
- failLevels,
179
- reportLevels,
180
- labels,
181
- outputFormat,
182
- outputFilename,
183
- outputFolder,
184
- outputFilenameTimestamp
185
- }){
186
-
187
- let acheckerArgs = [
188
- '--ruleArchive',
189
- ruleArchive,
190
- '--policies',
191
- Array.isArray(policies) ? policies.filter(e => e).join(',') : policies,
192
- '--failLevels',
193
- Array.isArray(failLevels) ? failLevels.filter(e => e).join(',') : failLevels,
194
- '--reportLevels',
195
- Array.isArray(reportLevels) ? reportLevels.filter(e => e).join(',') : reportLevels,
196
- '--outputFolder',
197
- outputFolder,
198
- '--outputFormat',
199
- outputFormat,
200
- '---outputFilenameTimestamp',
201
- outputFilenameTimestamp,
202
- url
203
- ];
204
-
205
- let isValid = false;
206
-
207
- if( fs.existsSync( url ) ){
208
- if( fs.statSync(url).isDirectory() && path.join( url, 'index.html') ){
209
- url = path.join( url, 'index.html')
210
- }
211
- isValid = true;
212
- }else{
213
- isValid = 'localhost' === new URL(url).hostname || isUrl( url )
214
- }
215
-
216
- if( isValid ){
217
- let originalFileName = `${fs.existsSync( url ) ?
218
- path.resolve(url).replace(':', '_') :
219
- url.replace(/http[s]+:\/\//, '')}.html`;
220
- let originalJsonFileName = `${fs.existsSync( url ) ?
221
- path.resolve(url).replace(':', '_') :
222
- url.replace(/http[s]+:\/\//, '')}.json`;
223
-
224
- let outputDir = path.resolve('.', outputFolder );
225
-
226
- let {stderr, stdout} = spawn.sync(
227
- resolveBin('accessibility-checker', {executable: 'achecker'}),
228
- acheckerArgs,
229
- {
230
- stdio: 'pipe'
231
- }
232
- )
233
-
234
- if( stderr && stderr.toString() ){
235
- console.log( stderr.toString() );
236
- }
237
-
238
- if( stdout && stdout.toString()){
239
- let reportedFile = path.join(outputDir, originalFileName );
240
- let reportedJSon = path.join(outputDir, originalJsonFileName );
241
-
242
- // if output file name option was passed
243
- if( outputFilename ){
244
-
245
- reportedFile = path.join( outputDir, `${outputFilename}.html` );
246
- reportedJSon = path.join( outputDir, `${outputFilename}.json` );
247
-
248
- // rename the output files
249
- fs.renameSync(path.join(outputDir, originalFileName), reportedFile );
250
- fs.renameSync(path.join(outputDir, originalJsonFileName), reportedJSon );
251
-
252
- // delete any empty directories.
253
- fs.rmSync( path.join(outputDir, originalFileName.split(path.sep).shift()), {recursive: true} )
254
- }
255
-
256
- if( 'a11y' === process.argv[2] ){
257
- console.log( reportedFile )
258
- }else{
259
- return reportedFile;
260
- }
261
- }
262
- }else{
263
- console.log( `${url} is not a valid url.` )
264
- }
265
-
266
- } // end of a11yCheck
267
-
268
- } // end of class
269
-
270
-
271
- export default A11yPlugin;