Skip to content

Commit 08d21b3

Browse files
committed
bundle stuff with tsc, fix exports
1 parent 1c6773e commit 08d21b3

22 files changed

+56
-54
lines changed

package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,20 @@
2525
},
2626
"type": "module",
2727
"files": [
28-
"dist",
29-
"src/cli"
28+
"dist"
3029
],
31-
"main": "dist/css-code-coverage.js",
30+
"bin": {
31+
"css-coverage": "dist/cli/cli.js"
32+
},
33+
"main": "dist/lib/index.js",
3234
"exports": {
33-
"types": "./dist/index.d.ts",
34-
"default": "./dist/css-code-coverage.js"
35+
"types": "./dist/lib/index.d.ts",
36+
"default": "./dist/lib/index.js"
3537
},
36-
"types": "dist/index.d.ts",
38+
"types": "dist/lib/index.d.ts",
3739
"scripts": {
3840
"test": "c8 --reporter=text playwright test",
39-
"build": "vite build",
41+
"build": "tsc",
4042
"check": "tsc --noEmit",
4143
"lint": "oxlint --config .oxlintrc.json",
4244
"lint-package": "publint"

src/cli/cli.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env node
22

3-
import { validate_arguments, parse_arguments, InvalidArgumentsError } from './arguments.ts'
4-
import { program, MissingDataError } from './program.ts'
5-
import { read } from './file-reader.ts'
6-
import { print as pretty } from './reporters/pretty.ts'
7-
import { print as tap } from './reporters/tap.ts'
3+
import { validate_arguments, parse_arguments, InvalidArgumentsError } from './arguments.js'
4+
import { program, MissingDataError } from './program.js'
5+
import { read } from './file-reader.js'
6+
import { print as pretty } from './reporters/pretty.js'
7+
import { print as tap } from './reporters/tap.js'
88

99
async function cli(cli_args: string[]) {
1010
const args = parse_arguments(cli_args)

src/cli/file-reader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { readFile, stat, readdir } from 'node:fs/promises'
22
import { join } from 'node:path'
3-
import { parse_coverage, type Coverage } from '../lib/parse-coverage.ts'
3+
import { parse_coverage, type Coverage } from '../lib/parse-coverage.js'
44

55
export async function read(coverage_dir: string): Promise<Coverage[]> {
66
let s = await stat(coverage_dir)

src/cli/program.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { calculate_coverage, type Coverage, type CoverageResult } from '../lib/index.ts'
1+
import { calculate_coverage, type Coverage, type CoverageResult } from '../lib/index.js'
22
import { DOMParser } from 'linkedom'
33

44
function parse_html(html: string) {

src/cli/reporters/pretty.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// oxlint-disable max-depth
22
import { styleText } from 'node:util'
3-
import type { Report } from '../program'
4-
import type { CliArguments } from '../arguments'
3+
import type { Report } from '../program.js'
4+
import type { CliArguments } from '../arguments.js'
55

66
// Re-indent because tabs in the terminal tend to be bigger than usual
77
function indent(line?: string): string {

src/cli/reporters/tap.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { CliArguments } from '../arguments'
2-
import type { Report } from '../program'
1+
import type { CliArguments } from '../arguments.js'
2+
import type { Report } from '../program.js'
33

44
function version() {
55
console.log('TAP version 13')
File renamed without changes.

src/lib/decuplicate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Coverage, Range } from './parse-coverage.ts'
1+
import type { Coverage, Range } from './parse-coverage.js'
22
/**
33
* @description
44
* prerequisites

src/lib/deduplicate.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { test, expect } from '@playwright/test'
2-
import { deduplicate_entries } from './decuplicate.ts'
2+
import { deduplicate_entries } from './decuplicate.js'
33

44
test('handles a single entry', () => {
55
let entry = {

src/lib/ext.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { test, expect } from '@playwright/test'
2-
import { ext } from './ext.ts'
2+
import { ext } from './ext.js'
33

44
let valid = [
55
'https://example.com/style.css',

0 commit comments

Comments
 (0)