-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update
get-modules-graph
to 0.0.9
chore: update devDependencies (eslint, @typescript-eslint/*, etc) fix: add type `FilePathFromRoot` to public API fix: duration for long time intervals (in HTML report)
- Loading branch information
Showing
12 changed files
with
265 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export type {Graph, Module, Package} from 'get-modules-graph'; | ||
export type {Graph, Module, Options, Package} from 'get-modules-graph'; | ||
export {getModulesGraph, resolveImports, resolveReexports} from 'get-modules-graph'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
import {sanitizeHtml as clientSanitizeHtml} from '../sanitizeHtml'; | ||
import {createSafeHtmlWithoutSanitize as clientCreateSafeHtmlWithoutSanitize} from '../sanitizeHtml'; | ||
|
||
import type {SafeHtml} from '../../../../types/internal'; | ||
|
||
const sanitizeHtml = clientSanitizeHtml; | ||
const createSafeHtmlWithoutSanitize = clientCreateSafeHtmlWithoutSanitize; | ||
|
||
/** | ||
* Renders the duration of time interval in minutes and seconds. | ||
* Renders the duration of time interval in hours, minutes, seconds and milliseconds. | ||
* This base client function should not use scope variables (except other base functions). | ||
* @internal | ||
*/ | ||
export function renderDuration(durationMs: number): SafeHtml { | ||
const durationInSeconds = Math.round(durationMs / 1000); | ||
const minutes = Math.floor(durationInSeconds / 60); | ||
const minutesString = minutes === 0 ? '' : `${minutes}m `; | ||
const secondsString = `${durationInSeconds % 60}s`; | ||
export function renderDuration(durationInMs: number): SafeHtml { | ||
const remainderInMs = durationInMs % 1000; | ||
const durationInSeconds = Math.round((durationInMs - remainderInMs) / 1000); | ||
const remainderInSeconds = durationInSeconds % 60; | ||
const durationInMinutes = Math.round((durationInSeconds - remainderInSeconds) / 60); | ||
const remainderInMinutes = durationInMinutes % 60; | ||
const durationInHours = Math.round((durationInMinutes - remainderInMinutes) / 60); | ||
|
||
return sanitizeHtml`${minutesString}${secondsString}`; | ||
const parts: string[] = [`${remainderInMs}ms`]; | ||
|
||
if (remainderInSeconds > 0) { | ||
parts.unshift(`${remainderInSeconds}s`); | ||
} | ||
|
||
if (remainderInMinutes > 0) { | ||
parts.unshift(`${remainderInMinutes}m`); | ||
} | ||
|
||
if (durationInHours > 0) { | ||
parts.unshift(`${durationInHours}h`); | ||
} | ||
|
||
return createSafeHtmlWithoutSanitize`${parts.slice(-2).join(' ')}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters