Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 19 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@
"private": false,
"version": "0.8.1",
"description": "☔️ The world's first V8 and JSC coverage tool to generate reports for Node.js, Bun, Deno, and TypeScript at the same time.",
"type": "commonjs",
"type": "module",
"main": "./lib/index.js",
"module": "./lib/index.js",
"types": "./lib/index.d.ts",
"exports": {
".": {
"types": "./lib/index.d.ts",
"import": "./lib/index.js",
"require": "./lib/index.cjs",
"default": "./lib/index.js"
}
},
"bin": {
"coverage": "./lib/bin/cli.js"
},
Expand Down Expand Up @@ -47,7 +56,7 @@
},
"peerDependencies": {
"poku": "^4.3.0",
"typescript": "^6.0.3"
"typescript": "^5.9.3 || ^6.0.3"
},
"peerDependenciesMeta": {
"poku": {
Expand All @@ -63,22 +72,18 @@
"@sveltejs/acorn-typescript": "^1.0.9",
"@types/lcov-parse": "^1.0.2",
"@types/node": "^25.6.0",
"acorn": "^8.16.0",
"cross-env": "^10.1.0",
"domhandler": "^6.0.1",
"dts-bundle-generator": "^9.5.1",
"esbuild": "^0.28.0",
"fast-xml-parser": "^5.7.2",
"htmlparser2": "^12.0.0",
"jsonc.min": "^1.1.2",
"lcov-parse": "^1.0.0",
"packages-update": "^2.0.0",
"poku": "^4.3.0",
"prettier": "^3.8.3",
"toml.min": "^1.0.0",
"tsx": "^4.21.0",
"typescript": "^6.0.3",
"yaml.min": "^1.0.0"
"typescript": "^6.0.3"
},
"publishConfig": {
"access": "public"
Expand Down Expand Up @@ -124,5 +129,11 @@
"monocart-coverage-reports",
"monocart",
"one-double-zero"
]
],
"dependencies": {
"acorn": "^8.16.0",
"jsonc.min": "^1.1.2",
"toml.min": "^1.0.0",
"yaml.min": "^1.0.0"
}
}
27 changes: 14 additions & 13 deletions poku.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
// @ts-check

'use strict';

const { cp, readdir, rm } = require('node:fs/promises');
const { homedir, platform } = require('node:os');
const { basename, join } = require('node:path');
const { env } = require('node:process');
const { defineConfig } = require('poku');
const { coverage } = require('./lib/index.js');

const fixturesRoot = join(__dirname, 'test', '__fixtures__', 'e2e');
const snapshotsRoot = join(__dirname, 'test', '__snapshots__', 'e2e');
import { cp, readdir, rm } from 'node:fs/promises';
import { homedir, platform } from 'node:os';
import { basename, dirname, join } from 'node:path';
import { env } from 'node:process';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'poku';
import { coverage } from './lib/index.js';

const rootDir = dirname(fileURLToPath(import.meta.url));

const fixturesRoot = join(rootDir, 'test', '__fixtures__', 'e2e');
const snapshotsRoot = join(rootDir, 'test', '__snapshots__', 'e2e');
const reportersResourcesRoot = join(
__dirname,
rootDir,
'test',
'__resources__',
'e2e',
Expand Down Expand Up @@ -117,7 +118,7 @@ const clearPlatformSnapshots = async (directory = snapshotsRoot) => {
);
};

module.exports = defineConfig({
export default defineConfig({
include: ['test/e2e'],
reporter: 'compact',
timeout: 30000,
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint-types.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fi

doubleCastHits="$(
cd "$repositoryRoot" && find . \
\( -path './.git' -o -path './node_modules' -o -path './lib' -o -path './tools/debug' \) -prune -o \
\( -path './.git' -o -name 'node_modules' -o -path './lib' -o -path './tools/debug' \) -prune -o \
-type f \( -name '*.ts' -o -name '*.mts' -o -name '*.cts' \) \
! -name "$(basename "${BASH_SOURCE[0]}")" \
-print0 \
Expand Down
1 change: 0 additions & 1 deletion src/converters/shared/ast-cache.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Options, Program } from 'acorn';
// @ts-expect-error: ESM-only package
import { tsPlugin } from '@sveltejs/acorn-typescript';
import { Parser } from 'acorn';

Expand Down
3 changes: 2 additions & 1 deletion src/reporters/html-spa/copy-assets.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { join } from 'node:path';
import { moduleDir } from '../../utils/module-dir.js';
import { copyAssetSet } from '../shared/html/copy-assets.js';
import {
HTML_ASSET_FILENAMES,
Expand All @@ -12,7 +13,7 @@ const SPA_ASSET_FILENAMES: readonly string[] = [
];

const spaAssetsDir = (): string =>
join(__dirname, '..', 'resources', 'html-spa');
join(moduleDir.from(import.meta.url), '..', 'resources', 'html-spa');

export const copyAssets = (reportsDir: string): void => {
copyAssetSet(reportsDir, htmlAssetsDir(), HTML_ASSET_FILENAMES);
Expand Down
3 changes: 2 additions & 1 deletion src/reporters/shared/html/html-assets.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { join } from 'node:path';
import { moduleDir } from '../../../utils/module-dir.js';

export const HTML_ASSET_FILENAMES: readonly string[] = [
'base.css',
Expand All @@ -11,4 +12,4 @@ export const HTML_ASSET_FILENAMES: readonly string[] = [
];

export const htmlAssetsDir = (): string =>
join(__dirname, '..', 'resources', 'html');
join(moduleDir.from(import.meta.url), '..', 'resources', 'html');
6 changes: 5 additions & 1 deletion src/runtimes/bun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { CoverageOptions, CoverageState } from '../@types/coverage.js';
import type { JscInspectorHandle } from '../@types/jsc.js';
import type { DataListener } from '../@types/runtimes.js';
import { join } from 'node:path';
import { moduleDir } from '../utils/module-dir.js';
import { strings } from '../utils/strings.js';
import { jscInspector } from './bun/inspector.js';
import { FLUSH_MARKER } from './bun/marker.js';
Expand All @@ -12,7 +13,10 @@ import { lifecycle } from './lifecycle.js';
const INSPECTOR_URL_PATTERN =
/ws:\/\/(?:\d{1,3}(?:\.\d{1,3}){3}|\[[0-9a-fA-F:]+\]|[A-Za-z0-9.-]+):\d{1,5}\/[A-Za-z0-9._-]+/;

const PRELOAD_SCRIPT_PATH = join(__dirname, 'preload-bun.js');
const PRELOAD_SCRIPT_PATH = join(
moduleDir.from(import.meta.url),
'preload-bun.js'
);

const makeLineFilter = (
file: string,
Expand Down
6 changes: 6 additions & 0 deletions src/utils/module-dir.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';

const from = (metaUrl: string): string => dirname(fileURLToPath(metaUrl));

export const moduleDir = { from } as const;
26 changes: 22 additions & 4 deletions tools/build.mts
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,49 @@ const buildOptions: BuildOptions = {
target: 'node16',
logLevel: 'info',
treeShaking: true,
format: 'cjs',
external: ['jsonc.min', 'poku', 'poku/plugin', 'toml.min', 'yaml.min'],
minifySyntax: true,
external: [
'acorn',
'jsonc.min',
'poku',
'poku/plugin',
'toml.min',
'yaml.min',
],
};

await rm('lib', { recursive: true, force: true });
await mkdir('lib', { recursive: true });
await Promise.all([
build({
...buildOptions,
format: 'esm',
entryPoints: ['src/index.ts'],
outfile: 'lib/index.js',
minifySyntax: true,
}),
build({
...buildOptions,
format: 'cjs',
entryPoints: ['src/index.ts'],
outfile: 'lib/index.cjs',
banner: {
js: "const __importMetaUrl = require('node:url').pathToFileURL(__filename).href;",
},
define: { 'import.meta.url': '__importMetaUrl' },
}),
build({
...buildOptions,
format: 'esm',
entryPoints: ['src/runtimes/bun/preload.ts'],
outfile: 'lib/preload-bun.js',
minify: true,
}),
build({
...buildOptions,
format: 'esm',
entryPoints: ['src/bin/cli.ts'],
outfile: 'lib/bin/cli.js',
banner: { js: '#!/usr/bin/env node' },
minifySyntax: true,
external: ['../index.js'],
}),
writeFile('lib/index.d.ts', dtsBundle, 'utf-8'),
Expand Down
Loading