Skip to content

Commit 8fb9fb4

Browse files
authored
refactor: updated http-auth dependency (#1379)
* refactor: updated http-auth dependency http-auth: added necessary new dependency http-auth-connect that provides the method .connect that got extracted from the original one. * chore: formatting * chore: code optimizations that are mentioned by the github pipeline as well * Revert "chore: formatting" This reverts commit 5b7a95b.
1 parent e284703 commit 8fb9fb4

File tree

9 files changed

+1964
-1864
lines changed

9 files changed

+1964
-1864
lines changed

packages/core/src/lib/compose.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,8 @@ module.exports = async function (pattern, patternlab) {
205205
);
206206

207207
// Allows serializing the compile state
208-
patternlab.graph.node(
209-
pattern
210-
).compileState = pattern.compileState = CompileState.CLEAN;
208+
patternlab.graph.node(pattern).compileState =
209+
pattern.compileState = CompileState.CLEAN;
211210
logger.info('Built pattern: ' + pattern.patternPartial);
212211
}
213212
);

packages/core/src/lib/expandPartials.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@ module.exports = function (currentPattern, patternlab) {
6464
`within ${currentPattern.patternPartial}, replacing extendedTemplate partial ${foundPartial} with ${cleanPartialPattern.patternPartial}'s extendedTemplate`
6565
);
6666

67-
currentPattern.extendedTemplate = currentPattern.extendedTemplate.replace(
68-
foundPartial,
69-
cleanPartialPattern.extendedTemplate
70-
);
67+
currentPattern.extendedTemplate =
68+
currentPattern.extendedTemplate.replace(
69+
foundPartial,
70+
cleanPartialPattern.extendedTemplate
71+
);
7172

7273
// update the extendedTemplate in the partials object in case this
7374
// pattern is consumed later

packages/core/src/lib/loadPattern.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,12 @@ module.exports = function (relPath, patternlab) {
133133
currentPattern.template = fs.readFileSync(templatePath, 'utf8');
134134

135135
//find any stylemodifiers that may be in the current pattern
136-
currentPattern.stylePartials = currentPattern.findPartialsWithStyleModifiers();
136+
currentPattern.stylePartials =
137+
currentPattern.findPartialsWithStyleModifiers();
137138

138139
//find any pattern parameters that may be in the current pattern
139-
currentPattern.parameteredPartials = currentPattern.findPartialsWithPatternParameters();
140+
currentPattern.parameteredPartials =
141+
currentPattern.findPartialsWithPatternParameters();
140142

141143
[
142144
templatePath,

packages/core/src/lib/object_factory.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,16 +381,14 @@ Pattern.prototype = {
381381
.map((o, i) => {
382382
if (i === 0) {
383383
// TODO: Remove when prefix gets deprecated
384-
info.patternGroupOrder = Pattern.prototype.setPatternOrderDataForInfo(
385-
o
386-
);
384+
info.patternGroupOrder =
385+
Pattern.prototype.setPatternOrderDataForInfo(o);
387386
}
388387

389388
if (i === 1) {
390389
// TODO: Remove when prefix gets deprecated
391-
info.patternSubgroupOrder = Pattern.prototype.setPatternOrderDataForInfo(
392-
o
393-
);
390+
info.patternSubgroupOrder =
391+
Pattern.prototype.setPatternOrderDataForInfo(o);
394392
}
395393

396394
return o.replace(prefixMatcher, '');

packages/core/src/lib/pattern_engines.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ const PatternEngines = Object.create({
248248
}
249249

250250
// not a hidden pattern, let's dig deeper
251-
const supportedPatternFileExtensions = PatternEngines.getSupportedFileExtensions();
251+
const supportedPatternFileExtensions =
252+
PatternEngines.getSupportedFileExtensions();
252253
return (
253254
supportedPatternFileExtensions.lastIndexOf(extension) !== -1 ||
254255
PatternEngines.isPseudoPatternJSON(filename)

packages/core/src/lib/ui_builder.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,8 @@ const ui_builder = function () {
402402
] = {};
403403
groupedPatterns.patternGroups[pattern.patternGroup][
404404
pattern.patternSubgroup
405-
][
406-
'viewall-' + pattern.patternGroup + '-' + pattern.patternSubgroup
407-
] = injectDocumentationBlock(pattern, patternlab, true);
405+
]['viewall-' + pattern.patternGroup + '-' + pattern.patternSubgroup] =
406+
injectDocumentationBlock(pattern, patternlab, true);
408407

409408
addToViewAllPaths(patternlab, pattern);
410409
addPatternSubgroupItem(patternlab, pattern, true);
@@ -588,9 +587,8 @@ const ui_builder = function () {
588587
`Omitting ${patternGroupName}/${patternName} from building a viewall page because its patternSubgroup is specified in styleguideExcludes.`
589588
);
590589
} else {
591-
styleguideGroupedPatterns = styleguideGroupedPatterns.concat(
592-
subgroupPatterns
593-
);
590+
styleguideGroupedPatterns =
591+
styleguideGroupedPatterns.concat(subgroupPatterns);
594592
}
595593

596594
groupedPatterns = groupedPatterns.concat(subgroupPatterns);

packages/live-server/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,12 @@ LiveServer.start = function (options) {
247247
// Use http-auth if configured
248248
if (htpasswd !== null) {
249249
const auth = require('http-auth');
250+
const authConnect = require('http-auth-connect');
250251
const basic = auth.basic({
251252
realm: 'Please authorize',
252253
file: htpasswd,
253254
});
254-
app.use(auth.connect(basic));
255+
app.use(authConnect(basic));
255256
}
256257

257258
if (cors) {

packages/live-server/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"cors": "2.8.5",
1919
"event-stream": "3.3.4",
2020
"faye-websocket": "0.11.x",
21-
"http-auth": "3.2.x",
21+
"http-auth": "4.1.x",
22+
"http-auth-connect": "^1.0.5",
2223
"morgan": "1.10.0",
2324
"object-assign": "4.1.1",
2425
"opn": "5.3.0",

0 commit comments

Comments
 (0)