Skip to content

Commit

Permalink
Updated cheerio types
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianRappl committed Dec 26, 2024
1 parent 8db417b commit ed683f7
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1,827 deletions.
12 changes: 6 additions & 6 deletions packages/piral-cli-rspack/src/html.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Configuration, Entry, HtmlRspackPlugin } from '@rspack/core';
import { load } from 'cheerio';
import { CheerioAPI, load } from 'cheerio';
import { readFileSync } from 'fs';
import { dirname, join } from 'path';

Expand All @@ -21,15 +21,15 @@ export function isLocal(path: string) {
return false;
}

export function extractParts(content: cheerio.Root) {
export function extractParts(content: CheerioAPI) {
const sheets = content('link[href][rel=stylesheet]')
.filter((_, e: cheerio.TagElement) => isLocal(e.attribs.href))
.filter((_, e) => isLocal(e.attribs.href))
.remove()
.toArray() as Array<cheerio.TagElement>;
.toArray();
const scripts = content('script[src]')
.filter((_, e: cheerio.TagElement) => isLocal(e.attribs.src))
.filter((_, e) => isLocal(e.attribs.src))
.remove()
.toArray() as Array<cheerio.TagElement>;
.toArray();
const files: Array<string> = [];

for (const sheet of sheets) {
Expand Down
Loading

0 comments on commit ed683f7

Please sign in to comment.