-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a206294
commit a66b827
Showing
11 changed files
with
3,029 additions
and
892 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
@import 'tailwindcss'; | ||
|
||
html { | ||
font-size: 14px; | ||
} | ||
|
||
* { | ||
scrollbar-width: thin; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<div class="flex mb-4 items-center h-12"> | ||
<div class="grow flex gap-4"> | ||
<p class="col-span-12 text-2xl font-bold text-gray-900">Warnings</p> | ||
</div> | ||
</div> | ||
|
||
{#if groupedIssues['duplicate-dependency']} | ||
<p class="col-span-12 text-xl font-bold text-gray-900 mb-2">Duplicated dependencies</p> | ||
|
||
<div class="relative overflow-x-auto"> | ||
<table class="w-full text-sm text-left table-auto text-gray-500"> | ||
<thead class="text-xs text-gray-700 uppercase bg-gray-50"> | ||
<tr> | ||
<th class="px-6 py-3">Name</th> | ||
<th class="px-6 py-3">Paths</th> | ||
<th class="px-6 py-3">Used in</th> | ||
</tr> | ||
</thead> | ||
<tbody class="align-top"> | ||
{#each groupedIssues['duplicate-dependency'] as dependency} | ||
<tr class="bg-white border-b border-gray-200"> | ||
<th class="px-6 py-4 whitespace-nowrap font-medium text-gray-900">{ dependency.name }</th> | ||
<td class="px-6 py-4"> | ||
<ul> | ||
{#each store.report.dependencies[ dependency.name ] as path} | ||
<li>{ path }</li> | ||
{/each} | ||
</ul> | ||
</td> | ||
<td class="px-6 py-4 text-gray-900 whitespace-nowrap"> | ||
<ul> | ||
{#each getUsedIn( dependency.name ) as path} | ||
<li> | ||
<a | ||
href={ '#/assets/' + path } | ||
class="text-blue-500 hover:underline underline-offset-4" | ||
> | ||
{ path } | ||
</a> | ||
</li> | ||
{/each} | ||
</ul> | ||
</td> | ||
</tr> | ||
{/each} | ||
</tbody> | ||
</table> | ||
</div> | ||
{/if} | ||
|
||
<script lang="ts"> | ||
import { store } from '$lib/store.svelte.js'; | ||
const groupedIssues = store.report.issues.reduce( ( acc, issue ) => { | ||
acc[ issue.type ] ||= []; | ||
acc[ issue.type ].push( issue.data ); | ||
return acc; | ||
}, {} as Record<string, any> ); | ||
function getUsedIn( dependencyName: string ) { | ||
return Object.entries( store.report.outputs ) | ||
.filter( ( [ , output ] ) => { | ||
return Object.keys( output.inputs ).some( input => input.includes( dependencyName ) ) | ||
} ) | ||
.map( ( [ name ] ) => name ); | ||
} | ||
</script> |
This file was deleted.
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,22 +1,20 @@ | ||
import type { JsonReport } from '../types'; | ||
import type { JsonReport, IssueDuplicateDependency } from '../types'; | ||
|
||
/** | ||
* Find issues with the bundles. | ||
*/ | ||
export function getIssues( report: JsonReport ): JsonReport['issues'] { | ||
const issues: JsonReport['issues'] = {}; | ||
const duplicateDependencies = getDuplicateDependencies( report ); | ||
|
||
if ( duplicateDependencies.length > 0 ) { | ||
issues.duplicateDependencies = duplicateDependencies; | ||
} | ||
|
||
return issues; | ||
return [ | ||
...getDuplicateDependencies( report ) | ||
]; | ||
} | ||
|
||
function getDuplicateDependencies( report: JsonReport ): Array<string> { | ||
function getDuplicateDependencies( report: JsonReport ): Array<IssueDuplicateDependency> { | ||
return Object | ||
.entries( report.dependencies ) | ||
.filter( ( [ , paths ] ) => paths.length > 1 ) | ||
.map( ( [ packageName ] ) => packageName ); | ||
.map( ( [ name ] ) => ( { | ||
type: 'duplicate-dependency', | ||
data: { name } | ||
} ) ); | ||
} |
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