Skip to content

Commit ff094cf

Browse files
feat: remove is-builtin-module dependency (tailwindlabs#970)
* feat: remove is-builtin-module dependency Node provides a list of built ins via `builtinModules`. We can test against this rather than including an extra (redundant) dependency. In future, if we introduce a version constraint of node `>=16`, we can use `isBuiltin` which node provides: ```ts import {isBuiltin} from 'node:module'; isBuiltin('fs'); // true ``` * Simplify code --------- Co-authored-by: Jordan Pittman <jordan@cryptica.me>
1 parent 28cefbf commit ff094cf

File tree

3 files changed

+4
-33
lines changed

3 files changed

+4
-33
lines changed

package-lock.json

Lines changed: 0 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/tailwindcss-language-server/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
"enhanced-resolve": "^5.16.1",
6767
"fast-glob": "3.2.4",
6868
"find-up": "5.0.0",
69-
"is-builtin-module": "3.2.1",
7069
"klona": "2.0.4",
7170
"license-checker": "25.0.1",
7271
"minimist": "^1.2.8",

packages/tailwindcss-language-server/src/lib/env.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import Module from 'module'
2-
import * as path from 'path'
1+
import Module from 'node:module'
2+
import { isBuiltin } from 'node:module'
3+
import * as path from 'node:path'
34
import resolveFrom from '../util/resolveFrom'
4-
import isBuiltinModule from 'is-builtin-module'
55

66
process.env.TAILWIND_MODE = 'build'
77
process.env.TAILWIND_DISABLE_TOUCH = 'true'
88

99
let oldResolveFilename = (Module as any)._resolveFilename
1010

1111
;(Module as any)._resolveFilename = (id: any, parent: any) => {
12-
if (typeof id === 'string' && isBuiltinModule(id)) {
12+
if (typeof id === 'string' && isBuiltin(id)) {
1313
return oldResolveFilename(id, parent)
1414
}
1515

0 commit comments

Comments
 (0)