@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.
- package/package.json +16 -9
- package/{plugins/html/webpack.config.js → webpack.config.js} +77 -49
- package/.github/workflows/config-publish.yml +0 -23
- package/.github/workflows/plugins-publish.yml +0 -31
- package/.github/workflows/test +0 -29
- package/.gitmodules +0 -3
- package/CHANGELOG.md +0 -273
- package/plugins/a11y/README.md +0 -19
- package/plugins/a11y/aceconfig.js +0 -44
- package/plugins/a11y/changelog.txt +0 -31
- package/plugins/a11y/index.js +0 -271
- package/plugins/a11y/package-lock.json +0 -3303
- package/plugins/a11y/package.json +0 -42
- package/plugins/css-audit/README.md +0 -20
- package/plugins/css-audit/changelog.txt +0 -41
- package/plugins/css-audit/css-audit.config.cjs +0 -5
- package/plugins/css-audit/default.config.js +0 -19
- package/plugins/css-audit/index.js +0 -326
- package/plugins/css-audit/package-lock.json +0 -1522
- package/plugins/css-audit/package.json +0 -53
- package/plugins/css-audit/sample/no-files.html +0 -9
- package/plugins/html/CHANGELOG.md +0 -300
- package/plugins/html/README.md +0 -62
- package/plugins/html/entry/delta.js +0 -19
- package/plugins/html/entry/eureka.js +0 -19
- package/plugins/html/entry/mono.js +0 -19
- package/plugins/html/entry/oceanside.js +0 -19
- package/plugins/html/entry/orangecounty.js +0 -19
- package/plugins/html/entry/pasorobles.js +0 -19
- package/plugins/html/entry/sacramento.js +0 -19
- package/plugins/html/entry/santabarbara.js +0 -19
- package/plugins/html/entry/santacruz.js +0 -19
- package/plugins/html/entry/shasta.js +0 -19
- package/plugins/html/entry/sierra.js +0 -19
- package/plugins/html/entry/trinity.js +0 -19
- package/plugins/html/index.js +0 -105
- package/plugins/html/package-lock.json +0 -22895
- package/plugins/html/package.json +0 -135
- package/plugins/html/sample/blank.html +0 -13
- package/plugins/html/sample/components/alerts.html +0 -32
- package/plugins/html/sample/components/animations.html +0 -7
- package/plugins/html/sample/components/buttons.html +0 -5
- package/plugins/html/sample/components/cards.html +0 -88
- package/plugins/html/sample/components/lists.html +0 -75
- package/plugins/html/sample/components/locations.html +0 -49
- package/plugins/html/sample/components/profile-banners.html +0 -48
- package/plugins/html/sample/components/sections.html +0 -16
- package/plugins/html/sample/components/service-tiles.html +0 -73
- package/plugins/html/sample/components/typography.html +0 -42
- package/plugins/html/sample/default.html +0 -53
- package/plugins/html/sample/favicon.ico +0 -0
- package/plugins/html/sample/images/black_puppy.jpg +0 -0
- package/plugins/html/sample/images/dolphin_marine_mammals_water.jpg +0 -0
- package/plugins/html/sample/images/grayscale_mountain.jpg +0 -0
- package/plugins/html/sample/images/silhouette.png +0 -0
- package/plugins/html/sample/images/squirrel_tail_bushy_tail.jpg +0 -0
- package/plugins/html/sample/index.html +0 -47
- package/plugins/html/sample/missing/content.html +0 -4
- package/plugins/html/sample/search.html +0 -55
- package/plugins/html/sample/structural/branding.html +0 -21
- package/plugins/html/sample/structural/footer.html +0 -47
- package/plugins/html/sample/structural/header.html +0 -16
- package/plugins/html/sample/structural/mobile-controls.html +0 -5
- package/plugins/html/sample/structural/navigation.html +0 -30
- package/plugins/html/sample/structural/search.html +0 -13
- package/plugins/html/sample/structural/utility-header.html +0 -23
- package/plugins/html/scripts/create-entrypoints.js +0 -60
- package/plugins/html/scripts/schemes.js +0 -123
- package/plugins/html/scripts/update-scripts.js +0 -47
- package/plugins/html/scripts/webpack.test.js +0 -41
- package/plugins/jshint/.customrc +0 -29
- package/plugins/jshint/.jshintrc +0 -31
- package/plugins/jshint/README.md +0 -24
- package/plugins/jshint/changelog.txt +0 -36
- package/plugins/jshint/index.js +0 -291
- package/plugins/jshint/package-lock.json +0 -24453
- package/plugins/jshint/package.json +0 -50
- package/plugins/jshint/reporter.cjs +0 -301
- package/plugins/jshint/sample/no-files.html +0 -9
- package/plugins/jshint/scripts/webpack.test.js +0 -18
- package/sample/index.html +0 -364
- package/scripts/update-deps.js +0 -38
- /package/{plugins/html/helpers → helpers}/logic/endsWith.js +0 -0
- /package/{plugins/html/helpers → helpers}/logic/ifCond.js +0 -0
- /package/{plugins/html/helpers → helpers}/object/jsonParse.js +0 -0
- /package/{plugins/html/helpers → helpers}/object/jsonStringify.js +0 -0
- /package/{plugins/html/helpers → helpers}/string/replace.js +0 -0
- /package/{plugins/html/helpers → helpers}/string/toLower.js +0 -0
- /package/{plugins/html/helpers → helpers}/string/toTitleCase.js +0 -0
- /package/{plugins/html/helpers → helpers}/string/toUpper.js +0 -0
- /package/{plugins/html/tsconfig.json → tsconfig.json} +0 -0
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@caweb/jshint-webpack-plugin",
|
|
3
|
-
"version": "2.0.1",
|
|
4
|
-
"description": "CAWebPublishing Webpack Plugin to run JSHint",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "index.js",
|
|
7
|
-
"files": [
|
|
8
|
-
"sample",
|
|
9
|
-
".jshintrc",
|
|
10
|
-
"index.js",
|
|
11
|
-
"reporter.cjs",
|
|
12
|
-
"README.md"
|
|
13
|
-
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"webpack": "webpack",
|
|
16
|
-
"build": "webpack build --config node_modules/@caweb/html-webpack-plugin/webpack.config.js",
|
|
17
|
-
"serve": "set NODE_OPTIONS='--no-audit --no-a11y --no-jshint' && webpack serve --config node_modules/@caweb/html-webpack-plugin/webpack.config.js ./scripts/webpack.test.js --merge",
|
|
18
|
-
"test": "echo \"Error: run tests from root\" && exit 0"
|
|
19
|
-
},
|
|
20
|
-
"author": "CAWebPublishing",
|
|
21
|
-
"license": "ISC",
|
|
22
|
-
"bugs": {
|
|
23
|
-
"url": "https://github.com/CAWebPublishing/webpack/issues"
|
|
24
|
-
},
|
|
25
|
-
"publishConfig": {
|
|
26
|
-
"access": "public"
|
|
27
|
-
},
|
|
28
|
-
"homepage": "https://github.com/CAWebPublishing/webpack/plugins/jshint#readme",
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/CAWebPublishing/webpack.git",
|
|
32
|
-
"directory": "plugins/jshint"
|
|
33
|
-
},
|
|
34
|
-
"keywords": [
|
|
35
|
-
"caweb",
|
|
36
|
-
"cagov",
|
|
37
|
-
"webpack"
|
|
38
|
-
],
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"get-all-files": "^5.0.0",
|
|
41
|
-
"handlebars": "^4.7.8",
|
|
42
|
-
"html-format": "^1.1.7",
|
|
43
|
-
"jshint": "^2.13.6",
|
|
44
|
-
"webpack": "^5.97.1",
|
|
45
|
-
"webpack-cli": "^6.0.1"
|
|
46
|
-
},
|
|
47
|
-
"peerDependencies": {
|
|
48
|
-
"@caweb/html-webpack-plugin": "^1.5.20"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
//"use strict";
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const htmlFormat = require('html-format');
|
|
5
|
-
const HandleBars = require('handlebars');
|
|
6
|
-
|
|
7
|
-
const endsWith = require('@caweb/html-webpack-plugin/helpers/logic/endsWith.js');
|
|
8
|
-
|
|
9
|
-
const templateDir = path.resolve('node_modules', '@caweb', 'html-webpack-plugin', 'sample' );
|
|
10
|
-
|
|
11
|
-
let templatePartials = {
|
|
12
|
-
'header': 'structural/header.html',
|
|
13
|
-
'footer': 'structural/footer.html',
|
|
14
|
-
'../components/alerts.html': 'components/alerts.html',
|
|
15
|
-
'./utility-header.html': 'structural/utility-header.html',
|
|
16
|
-
'./branding.html': 'structural/branding.html',
|
|
17
|
-
'./mobile-controls.html': 'structural/mobile-controls.html',
|
|
18
|
-
'./navigation.html': 'structural/navigation.html',
|
|
19
|
-
'./search.html': 'structural/search.html'
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
let sortedReport = {
|
|
23
|
-
errors: [],
|
|
24
|
-
warnings: [],
|
|
25
|
-
info: []
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
let title = `JSHint Report for ${process.cwd().split('\\').pop()}`;
|
|
29
|
-
|
|
30
|
-
let output = [];
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Process data
|
|
34
|
-
*
|
|
35
|
-
* Data Object
|
|
36
|
-
* {
|
|
37
|
-
* functions,
|
|
38
|
-
* options,
|
|
39
|
-
* errors,
|
|
40
|
-
* globals,
|
|
41
|
-
* unused,
|
|
42
|
-
* member,
|
|
43
|
-
* file
|
|
44
|
-
* }
|
|
45
|
-
*/
|
|
46
|
-
function addBreakdown({
|
|
47
|
-
functions,
|
|
48
|
-
options,
|
|
49
|
-
errors,
|
|
50
|
-
implieds,
|
|
51
|
-
globals,
|
|
52
|
-
unused,
|
|
53
|
-
member,
|
|
54
|
-
file
|
|
55
|
-
}){
|
|
56
|
-
let functionList = [];
|
|
57
|
-
let errorList = [];
|
|
58
|
-
let unusedList = [];
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Process function data
|
|
62
|
-
*
|
|
63
|
-
* Function Data Object
|
|
64
|
-
* {
|
|
65
|
-
* name,
|
|
66
|
-
* param,
|
|
67
|
-
* line,
|
|
68
|
-
* character,
|
|
69
|
-
* last,
|
|
70
|
-
* lastcharacter,
|
|
71
|
-
* metrics {
|
|
72
|
-
* complexity,
|
|
73
|
-
* parameters,
|
|
74
|
-
* statements
|
|
75
|
-
* }
|
|
76
|
-
* }
|
|
77
|
-
*/
|
|
78
|
-
if( functions ){
|
|
79
|
-
functions.forEach(({ name, param, line, character, metrics }) => {
|
|
80
|
-
let { complexity, parameters, statements } = metrics;
|
|
81
|
-
|
|
82
|
-
functionList.push(
|
|
83
|
-
'<li>',
|
|
84
|
-
`<p><b>Name:</b> ${name}</p>`,
|
|
85
|
-
param && param.length ? `<p><b>Parameters:</b> ${param}</p>` : '',
|
|
86
|
-
`<p><b>Line:</b> ${line}</p>`,
|
|
87
|
-
`<p><b>Col:</b> ${character}</p>`,
|
|
88
|
-
`<p><b>Metrics:</b></p>`,
|
|
89
|
-
'<ul>',
|
|
90
|
-
`<li><b>Cyclomatic Complexity Number:</b> ${complexity}</li>`,
|
|
91
|
-
`<li><b>Arguments:</b> ${parameters}</li>`,
|
|
92
|
-
`<li><b>Statements:</b> ${statements}</li>`,
|
|
93
|
-
'</ul>',
|
|
94
|
-
'</li>'
|
|
95
|
-
)
|
|
96
|
-
})
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Process error data
|
|
102
|
-
*
|
|
103
|
-
* Error Data Object
|
|
104
|
-
* {
|
|
105
|
-
* id,
|
|
106
|
-
* raw,
|
|
107
|
-
* code,
|
|
108
|
-
* evidence,
|
|
109
|
-
* line,
|
|
110
|
-
* character,
|
|
111
|
-
* scope,
|
|
112
|
-
* a,
|
|
113
|
-
* b,
|
|
114
|
-
* c,
|
|
115
|
-
* d,
|
|
116
|
-
* reason
|
|
117
|
-
* }
|
|
118
|
-
*/
|
|
119
|
-
if( errors ){
|
|
120
|
-
errors.forEach(({reason, evidence, line, character}) => {
|
|
121
|
-
errorList.push(
|
|
122
|
-
'<li>',
|
|
123
|
-
`<p><b>Reason:</b> ${reason}</p>`,
|
|
124
|
-
`<p><b>Evidence:</b> ${evidence}</p>`,
|
|
125
|
-
`<p><b>Line:</b> ${line}</p>`,
|
|
126
|
-
`<p><b>Col:</b> ${character}</p>`,
|
|
127
|
-
'</li>'
|
|
128
|
-
)
|
|
129
|
-
})
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Unused Data
|
|
134
|
-
* {
|
|
135
|
-
* name,
|
|
136
|
-
* line,
|
|
137
|
-
* character
|
|
138
|
-
* }
|
|
139
|
-
*/
|
|
140
|
-
if( unused ){
|
|
141
|
-
unused.forEach(({name, line, character}) => {
|
|
142
|
-
unusedList.push(
|
|
143
|
-
'<li>',
|
|
144
|
-
`<p><b>Name:</b> ${name}</p>`,
|
|
145
|
-
`<p><b>Line:</b> ${line}</p>`,
|
|
146
|
-
`<p><b>Col:</b> ${character}</p>`,
|
|
147
|
-
'</li>'
|
|
148
|
-
)
|
|
149
|
-
})
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return `<section id="${file.replace(/[\\:\.]/g, '-').toLowerCase()}" class="mb-5 border border-2">
|
|
153
|
-
<div class="bg-light p-4"><h4>File: <a href="file://${file}" target="_blank" class="fst-italic fs-md text-break">${file}</a></h4></div>
|
|
154
|
-
<div class="p-4">
|
|
155
|
-
<h5>Functions: <span class="bg-light rounded-circle p-2">${functions.length}</span></h5>
|
|
156
|
-
${ functionList.length ? `<ol>${functionList.join('\n')}</ol>` : ''}
|
|
157
|
-
<h5>Errors: <span class="bg-light rounded-circle p-2">${errors ? errors.length : 0}</span></h5>
|
|
158
|
-
${ errorList.length ? `<ol>${errorList.join('\n')}</ol>` : '' }
|
|
159
|
-
<h5>Unused: <span class="bg-light rounded-circle p-2">${unused ? unused.length : 0}</span></h5>
|
|
160
|
-
${ unusedList.length ? `<ol>${unusedList.join('\n')}</ol>` : '' }
|
|
161
|
-
</div>
|
|
162
|
-
</section>`;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* JSHint Reporter
|
|
167
|
-
*
|
|
168
|
-
* @param {*} results
|
|
169
|
-
* @param {*} data
|
|
170
|
-
* @param {*} opts
|
|
171
|
-
*/
|
|
172
|
-
function reporter(results, data, opts){
|
|
173
|
-
let outputFolder = process.env.JSHINT_OUTPUT_DIR ?
|
|
174
|
-
path.resolve( process.env.JSHINT_OUTPUT_DIR ) :
|
|
175
|
-
path.join(__dirname, 'public')
|
|
176
|
-
let outputFilename = path.join(outputFolder, `${process.env.JSHINT_OUTPUT_FILENAME ?? 'jshint'}.html` );
|
|
177
|
-
let fileList = [];
|
|
178
|
-
let fileSummary = [];
|
|
179
|
-
let fileBreakdown = [];
|
|
180
|
-
let summaryHeader = [];
|
|
181
|
-
|
|
182
|
-
try{
|
|
183
|
-
|
|
184
|
-
// process results.
|
|
185
|
-
results.forEach((result) => {
|
|
186
|
-
var file = result.file;
|
|
187
|
-
var error = result.error;
|
|
188
|
-
|
|
189
|
-
// add error to sorted report array
|
|
190
|
-
switch( error.code.charAt(0) ){
|
|
191
|
-
case 'E': // errors
|
|
192
|
-
sortedReport.errors.push({...error, file: file})
|
|
193
|
-
break;
|
|
194
|
-
case 'I': // info
|
|
195
|
-
sortedReport.info.push({...error, file: file})
|
|
196
|
-
break;
|
|
197
|
-
case 'W': // warnings
|
|
198
|
-
sortedReport.warnings.push({...error, file: file})
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
fileList.push(
|
|
203
|
-
`<li class="text-break mb-4"><a href="#${ file.replace(/[\\:\.]/g, '-').toLowerCase() }">${file}</a></li>`
|
|
204
|
-
)
|
|
205
|
-
|
|
206
|
-
fileSummary.push(
|
|
207
|
-
`<li class="mb-3"><a href="#${ file.replace(/[\\:\.]/g, '-').toLowerCase( )}">${file}</a>: line ${error.line}, col ${error.character}, ${error.reason}</li>`
|
|
208
|
-
)
|
|
209
|
-
|
|
210
|
-
})
|
|
211
|
-
|
|
212
|
-
data.forEach((d) => {
|
|
213
|
-
fileBreakdown.push( addBreakdown(d) );
|
|
214
|
-
})
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
for(let [category] of Object.entries(sortedReport) ){
|
|
218
|
-
if( sortedReport[category].length ){
|
|
219
|
-
let cCase = capitalCase(category);
|
|
220
|
-
// if there is just 1, drop the plural
|
|
221
|
-
if( 1 === sortedReport[category].length ){
|
|
222
|
-
cCase = cCase.slice(0, -1)
|
|
223
|
-
}
|
|
224
|
-
summaryHeader.push(`${sortedReport[category].length} ${cCase} Detected`)
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
fileList = Array.from( new Set( fileList ) );
|
|
230
|
-
|
|
231
|
-
output.push(
|
|
232
|
-
`<h1 class="page-title my-4">${title}</h1>`,
|
|
233
|
-
'<div class="container">',
|
|
234
|
-
'<div class="row">',
|
|
235
|
-
'<div id="sidebar" class="col-4">',
|
|
236
|
-
'<h2>Files</h2>',
|
|
237
|
-
'<ol class="border-end border-2 pe-3">',
|
|
238
|
-
...fileList,
|
|
239
|
-
'</ol>',
|
|
240
|
-
'</div>',
|
|
241
|
-
'<!-- End of Sidebar Column -->',
|
|
242
|
-
'<div id="content" class="col-8">',
|
|
243
|
-
`<h2>Summary: <em>${summaryHeader.join(' & ')}</em></h2>`,
|
|
244
|
-
'<ol>',
|
|
245
|
-
...fileSummary,
|
|
246
|
-
'</ol>',
|
|
247
|
-
...fileBreakdown,
|
|
248
|
-
'</div>',
|
|
249
|
-
'<!-- End of Content Column -->',
|
|
250
|
-
'</div>',
|
|
251
|
-
'<!-- End of Row -->',
|
|
252
|
-
'</div>',
|
|
253
|
-
'<!-- End of Container -->'
|
|
254
|
-
)
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}catch(err){
|
|
258
|
-
process.stderr.write(err.toString())
|
|
259
|
-
process.exit(1)
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
fs.mkdirSync( outputFolder, {recursive: true} );
|
|
263
|
-
|
|
264
|
-
// Register partials.
|
|
265
|
-
Object.entries(templatePartials).forEach(([p, f]) => HandleBars.registerPartial(p, fs.readFileSync(path.resolve(templateDir, f )).toString() ) );
|
|
266
|
-
|
|
267
|
-
// Register custom helpers.
|
|
268
|
-
HandleBars.registerHelper('endsWith', (w,s,o) => { return w.endsWith(s); } )
|
|
269
|
-
|
|
270
|
-
let template = HandleBars.compile(fs.readFileSync(path.resolve(templateDir, 'default.html')).toString() )
|
|
271
|
-
|
|
272
|
-
// write html file
|
|
273
|
-
fs.writeFileSync(
|
|
274
|
-
outputFilename,
|
|
275
|
-
htmlFormat(
|
|
276
|
-
template({
|
|
277
|
-
title,
|
|
278
|
-
scheme: 'oceanside',
|
|
279
|
-
logo: 'https://caweb.cdt.ca.gov/wp-content/uploads/sites/221/2023/06/caweb-publishing-logo.png',
|
|
280
|
-
htmlWebpackPlugin: {
|
|
281
|
-
options: {
|
|
282
|
-
templateParameters: {
|
|
283
|
-
bodyHtmlSnippet: output.join('\n')
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}),
|
|
288
|
-
" ".repeat(4), 250
|
|
289
|
-
)
|
|
290
|
-
);
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
function capitalCase(str){
|
|
296
|
-
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
module.exports = {
|
|
300
|
-
reporter
|
|
301
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External Dependencies
|
|
3
|
-
*/
|
|
4
|
-
import fs from 'fs';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import JSHintPlugin from '../index.js';
|
|
11
|
-
|
|
12
|
-
let plugins = [
|
|
13
|
-
new JSHintPlugin()
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
plugins
|
|
18
|
-
};
|