Skip to content

Commit fc0232f

Browse files
committedMar 25, 2022
Remove use of node:platform in browsers
1 parent cdec694 commit fc0232f

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed
 

‎lib/index.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,14 @@ import {stringifyPosition} from 'unist-util-stringify-position'
3535
import {statistics} from 'vfile-statistics'
3636
import {sort} from 'vfile-sort'
3737
import {color} from './color.js'
38+
import {platform} from './platform.js'
3839

3940
const own = {}.hasOwnProperty
4041

4142
// `log-symbols` without chalk, ignored for Windows:
4243
/* c8 ignore next 4 */
4344
const chars =
44-
process.platform === 'win32'
45-
? {error: '×', warning: '‼'}
46-
: {error: '✖', warning: '⚠'}
45+
platform === 'win32' ? {error: '×', warning: '‼'} : {error: '✖', warning: '⚠'}
4746

4847
const labels = {
4948
true: 'error',

‎lib/platform.browser.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const platform = 'darwin'

‎lib/platform.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import process from 'node:process'
2+
3+
export const platform = process.platform

‎package.json

+4-6
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
"type": "module",
3434
"main": "index.js",
3535
"browser": {
36-
"./lib/color.js": "./lib/color.browser.js"
36+
"./lib/color.js": "./lib/color.browser.js",
37+
"./lib/platform.js": "./lib/platform.browser.js"
3738
},
3839
"types": "index.d.ts",
3940
"files": [
@@ -53,7 +54,7 @@
5354
"@types/tape": "^4.0.0",
5455
"c8": "^7.0.0",
5556
"cross-env": "^7.0.0",
56-
"figures": "^4.0.0",
57+
"figures": "^3.0.0",
5758
"prettier": "^2.0.0",
5859
"remark-cli": "^10.0.0",
5960
"remark-preset-wooorm": "^9.0.0",
@@ -82,10 +83,7 @@
8283
"trailingComma": "none"
8384
},
8485
"xo": {
85-
"prettier": true,
86-
"rules": {
87-
"node/prefer-global/process": "off"
88-
}
86+
"prettier": true
8987
},
9088
"remarkConfig": {
9189
"plugins": [

0 commit comments

Comments
 (0)
Please sign in to comment.