Skip to content

Commit

Permalink
Change to use export map
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jun 13, 2023
1 parent 0973e65 commit d6b6d5c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
1 change: 0 additions & 1 deletion lib/color.browser.js

This file was deleted.

8 changes: 1 addition & 7 deletions lib/color.js
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
import supportsColor from 'supports-color'

/** @type {boolean} */
// @ts-expect-error Types are incorrect.
const color = supportsColor.stderr.hasBasic

export {color}
export const color = false
7 changes: 7 additions & 0 deletions lib/color.node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import supportsColor from 'supports-color'

/** @type {boolean} */
// @ts-expect-error Types are incorrect.
const color = supportsColor.stderr.hasBasic

export {color}
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import stringWidth from 'string-width'
import {stringifyPosition} from 'unist-util-stringify-position'
import {compareFile, compareMessage} from 'vfile-sort'
import {statistics} from 'vfile-statistics'
import {color} from './color.js'
import {color} from 'vfile-reporter/do-not-use-color'

const eol = /\r?\n|\r/

Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@
],
"sideEffects": false,
"type": "module",
"main": "index.js",
"browser": {
"./lib/color.js": "./lib/color.browser.js",
"./lib/platform.js": "./lib/platform.browser.js"
"exports": {
".": "./index.js",
"./do-not-use-color": {
"node": "./lib/color.node.js",
"default": "./lib/color.js"
}
},
"types": "index.d.ts",
"files": [
"lib/",
"index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import assert from 'node:assert/strict'
import test from 'node:test'
import strip from 'strip-ansi'
import {VFile} from 'vfile'
import {reporter} from './index.js'
import {reporter} from 'vfile-reporter'

/* eslint-disable no-undef */
/** @type {Error} */
Expand Down

0 comments on commit d6b6d5c

Please sign in to comment.