source: frontend/node_modules/workbox-precaching/src/utils/printInstallDetails.ts

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 Copyright 2018 Google LLC
3
4 Use of this source code is governed by an MIT-style
5 license that can be found in the LICENSE file or at
6 https://opensource.org/licenses/MIT.
7*/
8
9import {logger} from 'workbox-core/_private/logger.js';
10import '../_version.js';
11
12/**
13 * @param {string} groupTitle
14 * @param {Array<string>} urls
15 *
16 * @private
17 */
18function _nestedGroup(groupTitle: string, urls: string[]): void {
19 if (urls.length === 0) {
20 return;
21 }
22
23 logger.groupCollapsed(groupTitle);
24
25 for (const url of urls) {
26 logger.log(url);
27 }
28
29 logger.groupEnd();
30}
31
32/**
33 * @param {Array<string>} urlsToPrecache
34 * @param {Array<string>} urlsAlreadyPrecached
35 *
36 * @private
37 * @memberof workbox-precaching
38 */
39export function printInstallDetails(
40 urlsToPrecache: string[],
41 urlsAlreadyPrecached: string[],
42): void {
43 const precachedCount = urlsToPrecache.length;
44 const alreadyPrecachedCount = urlsAlreadyPrecached.length;
45
46 if (precachedCount || alreadyPrecachedCount) {
47 let message = `Precaching ${precachedCount} file${
48 precachedCount === 1 ? '' : 's'
49 }.`;
50
51 if (alreadyPrecachedCount > 0) {
52 message +=
53 ` ${alreadyPrecachedCount} ` +
54 `file${alreadyPrecachedCount === 1 ? ' is' : 's are'} already cached.`;
55 }
56
57 logger.groupCollapsed(message);
58
59 _nestedGroup(`View newly precached URLs.`, urlsToPrecache);
60 _nestedGroup(`View previously precached URLs.`, urlsAlreadyPrecached);
61 logger.groupEnd();
62 }
63}
Note: See TracBrowser for help on using the repository browser.