From 387026e419ff20a5cc0be7bd8782fe2dc45e4298 Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 7 Apr 2026 18:02:17 -0300 Subject: [PATCH 1/4] perf: replace `yaml` with `yaml.min` --- package-lock.json | 20 +++++++++----------- package.json | 2 +- src/config.ts | 4 ++-- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3278042..7965c56 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "jsonc.min": "^1.1.2", "one-double-zero": "^1.1.1", "toml.min": "^0.1.3", - "yaml": "^2.8.3" + "yaml.min": "^0.1.0" }, "devDependencies": { "@ianvs/prettier-plugin-sort-imports": "^4.7.1", @@ -1737,19 +1737,17 @@ "node": ">=8" } }, - "node_modules/yaml": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz", - "integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==", - "license": "ISC", - "bin": { - "yaml": "bin.mjs" - }, + "node_modules/yaml.min": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yaml.min/-/yaml.min-0.1.0.tgz", + "integrity": "sha512-DapivAF/9X7Knuy+012K8ue76RYWbpJoBC4/O6cnIRRcYqdOn7I9bTUO2C2+vpdqei5kFomORr+dhz+loeBtfQ==", + "license": "MIT", "engines": { - "node": ">= 14.6" + "node": ">=18.0.0" }, "funding": { - "url": "https://github.com/sponsors/eemeli" + "type": "github", + "url": "https://github.com/sponsors/wellwelwel" } }, "node_modules/yocto-queue": { diff --git a/package.json b/package.json index d9eeb6c..8a10eae 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "jsonc.min": "^1.1.2", "one-double-zero": "^1.1.1", "toml.min": "^0.1.3", - "yaml": "^2.8.3" + "yaml.min": "^0.1.0" }, "peerDependencies": { "poku": "^4.1.0" diff --git a/src/config.ts b/src/config.ts index d873edc..8cc965c 100644 --- a/src/config.ts +++ b/src/config.ts @@ -3,7 +3,7 @@ import { existsSync, readFileSync } from 'node:fs'; import { join } from 'node:path'; import { JSONC } from 'jsonc.min'; import { parse as tomlParse } from 'toml.min'; -import YAML from 'yaml'; +import { parse as yamlPaser } from 'yaml.min'; const scriptExtensions = new Set([ '.js', @@ -32,7 +32,7 @@ const getExtension = (filePath: string): string => { const parseConfig = (content: string, filePath: string): CoverageOptions => { if (isToml(filePath)) return tomlParse(content) as CoverageOptions; - if (isYaml(filePath)) return YAML.parse(content) as CoverageOptions; + if (isYaml(filePath)) return yamlPaser(content) as CoverageOptions; return JSONC.parse(content) as CoverageOptions; }; From 3ee32df0c61cdb7e05d9357b5b38bd9db1864aaa Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 7 Apr 2026 18:43:43 -0300 Subject: [PATCH 2/4] chore: improve logic --- src/config.ts | 6 ++++-- src/index.ts | 10 ++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/config.ts b/src/config.ts index 8cc965c..9ceda0d 100644 --- a/src/config.ts +++ b/src/config.ts @@ -39,8 +39,8 @@ const parseConfig = (content: string, filePath: string): CoverageOptions => { export const loadConfig = ( cwd: string, customPath?: string | false -): CoverageOptions | undefined => { - if (customPath === false) return; +): CoverageOptions => { + if (customPath === false) return Object.create(null); const expectedFiles = customPath ? [customPath] @@ -65,4 +65,6 @@ export const loadConfig = ( return parseConfig(content, file); } catch {} } + + return Object.create(null); }; diff --git a/src/index.ts b/src/index.ts index 02d94d7..73b823c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -125,24 +125,22 @@ export const coverage = ( setup(context) { if (options.requireFlag && !process.argv.includes('--coverage')) return; - enabled = true; - - cwd = context.cwd; - if (context.runtime !== 'node') console.warn( `[@pokujs/one-double-zero] V8 coverage is only supported on Node.js (current runtime: ${context.runtime}). Coverage data may not be collected.` ); + enabled = true; + cwd = context.cwd; + const cliConfig = process.argv .find((arg) => arg.startsWith('--coverageConfig')) ?.split('=')[1]; const resolvedConfig = cliConfig ?? options.config; - const fileConfig = loadConfig(context.cwd, resolvedConfig); - if (fileConfig) options = { ...fileConfig, ...options }; + options = { ...fileConfig, ...options }; originalEnv = process.env.NODE_V8_COVERAGE; tempDir = options.coverageDirectory From a43aa5842ae92da8126476836a49624e590233b1 Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 7 Apr 2026 18:52:39 -0300 Subject: [PATCH 3/4] chore: improve types --- src/config.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config.ts b/src/config.ts index 9ceda0d..69465e1 100644 --- a/src/config.ts +++ b/src/config.ts @@ -3,7 +3,7 @@ import { existsSync, readFileSync } from 'node:fs'; import { join } from 'node:path'; import { JSONC } from 'jsonc.min'; import { parse as tomlParse } from 'toml.min'; -import { parse as yamlPaser } from 'yaml.min'; +import { parse as yamlParse } from 'yaml.min'; const scriptExtensions = new Set([ '.js', @@ -31,9 +31,9 @@ const getExtension = (filePath: string): string => { }; const parseConfig = (content: string, filePath: string): CoverageOptions => { - if (isToml(filePath)) return tomlParse(content) as CoverageOptions; - if (isYaml(filePath)) return yamlPaser(content) as CoverageOptions; - return JSONC.parse(content) as CoverageOptions; + if (isToml(filePath)) return tomlParse(content); + if (isYaml(filePath)) return yamlParse(content); + return JSONC.parse(content); }; export const loadConfig = ( From a113880626923471570dc48cbb68d79eddb4128d Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Wed, 8 Apr 2026 08:33:44 -0300 Subject: [PATCH 4/4] chore: update `yaml.min` --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7965c56..d204d0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "jsonc.min": "^1.1.2", "one-double-zero": "^1.1.1", "toml.min": "^0.1.3", - "yaml.min": "^0.1.0" + "yaml.min": "^1.0.0" }, "devDependencies": { "@ianvs/prettier-plugin-sort-imports": "^4.7.1", @@ -1738,9 +1738,9 @@ } }, "node_modules/yaml.min": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yaml.min/-/yaml.min-0.1.0.tgz", - "integrity": "sha512-DapivAF/9X7Knuy+012K8ue76RYWbpJoBC4/O6cnIRRcYqdOn7I9bTUO2C2+vpdqei5kFomORr+dhz+loeBtfQ==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yaml.min/-/yaml.min-1.0.0.tgz", + "integrity": "sha512-p/mX2R20rnblQo57YJHcOpFtbut5JBeq0PLMn2WXQn9XLRMGmisMRQk/ug1rnpA4eBKaTr9O7H332hdIwMUhxA==", "license": "MIT", "engines": { "node": ">=18.0.0" diff --git a/package.json b/package.json index 8a10eae..9e5d152 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "jsonc.min": "^1.1.2", "one-double-zero": "^1.1.1", "toml.min": "^0.1.3", - "yaml.min": "^0.1.0" + "yaml.min": "^1.0.0" }, "peerDependencies": { "poku": "^4.1.0"