Skip to content

Commit bb2e20e

Browse files
committed
Remove vulnerable transitive dependencies braces and sprintf-js.
1 parent 7c4f540 commit bb2e20e

4 files changed

Lines changed: 42 additions & 258 deletions

File tree

‎packages/ts-ssg/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"test": "vitest"
4242
},
4343
"dependencies": {
44-
"@node-minify/html-minifier": "^11.0.0",
44+
"@11ty/gray-matter": "^3.0.0",
4545
"@purestack/ts-common": "workspace:^",
4646
"@purestack/ts-components": "workspace:^",
4747
"@purestack/ts-html": "workspace:^",
@@ -53,10 +53,10 @@
5353
"@purestack/ts-util": "workspace:^",
5454
"@purestack/ts-util-node": "workspace:^",
5555
"esbuild": "^0.28.0",
56-
"gray-matter": "^4.0.3",
5756
"hast-util-from-html": "^2.0.3",
5857
"hast-util-to-html": "^9.0.5",
5958
"highlight.js": "^11.11.1",
59+
"html-minifier-next": "^4.19.1",
6060
"logpot": "^1.0.7",
6161
"mdast-util-to-hast": "^13.2.1",
6262
"pagefind": "^1.4.0",

‎packages/ts-ssg/src/build/io.ts‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from 'node:fs/promises'
2-
import { htmlMinifier } from '@node-minify/html-minifier'
32
import { ensureDir } from '@purestack/ts-util-node'
3+
import { minify } from 'html-minifier-next'
44

55
export async function readSource(absPath: string) {
66
return fs.readFile(absPath, 'utf-8')
@@ -30,16 +30,20 @@ export async function prepareOutDir(
3030
}
3131

3232
async function minifyHtml(input: string): Promise<string> {
33-
const result = await htmlMinifier({
34-
content: input,
35-
settings: {
36-
compressor: async () => ({ code: '' }),
37-
options: {
38-
collapseInlineTagWhitespace: false,
39-
removeOptionalTags: false,
40-
conservativeCollapse: true,
41-
},
42-
},
33+
return minify(input, {
34+
collapseBooleanAttributes: true,
35+
collapseInlineTagWhitespace: false,
36+
collapseWhitespace: true,
37+
conservativeCollapse: true,
38+
minifyCSS: true,
39+
minifyJS: true,
40+
removeAttributeQuotes: true,
41+
removeComments: true,
42+
removeEmptyAttributes: true,
43+
removeOptionalTags: false,
44+
removeRedundantAttributes: true,
45+
removeScriptTypeAttributes: true,
46+
removeStyleLinkTypeAttributes: true,
47+
useShortDoctype: true,
4348
})
44-
return result.code
4549
}

‎packages/ts-ssg/src/frontmatter/frontmatter.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import matter from '@11ty/gray-matter'
12
import type {
23
FrontmatterEmbedOptions,
34
FrontmatterLayoutOptions,
@@ -6,7 +7,6 @@ import type {
67
PreviewConfig,
78
} from '@purestack/ts-common'
89
import { pickSemanticTone } from '@purestack/ts-style'
9-
import matter from 'gray-matter'
1010

1111
export function parseFrontmatterSource(
1212
source: string,

0 commit comments

Comments
 (0)