Skip to content

Commit

Permalink
feat(cli): remove is-builtin-module (#6579)
Browse files Browse the repository at this point in the history
  • Loading branch information
43081j authored Dec 11, 2024
1 parent a643239 commit 2982082
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
11 changes: 2 additions & 9 deletions packages/@sanity/cli/package.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-disable no-sync */
import fs from 'node:fs'
import {isBuiltin} from 'node:module'
import path from 'node:path'

import baseConfig from '@repo/package.config'
import {nodeResolve} from '@rollup/plugin-node-resolve'
import {defineConfig} from '@sanity/pkg-utils'
import isBuiltin from 'is-builtin-module'

const workersDir = path.join(__dirname, 'src', 'workers')

Expand All @@ -17,21 +17,14 @@ const workerNames = fs
export default defineConfig({
...baseConfig,

// This is a workaround for an issue where the `readable-stream` package imports
// from `string_decoder/` instead of `string_decoder` (note the trailing slash),
// which _should_ tell rollup not to use the built-in `string_decoder` module,
// which it unfortunately does not. Hoping we can get rid of this hack soon:
// https://github.com/rollup/plugins/issues/1211
// https://github.com/sindresorhus/is-builtin-module/issues/7
// https://github.com/sindresorhus/builtin-modules/pull/17
rollup: {
plugins: (plugins) => [
...plugins.filter((plugin) => plugin.name !== 'node-resolve'),
nodeResolve({
browser: false,
extensions: ['.cjs', '.mjs', '.js', '.jsx', '.json', '.node'],
preferBuiltins: false,
resolveOnly: (moduleName) => moduleName === 'string_decoder' || !isBuiltin(moduleName),
resolveOnly: (moduleName) => !isBuiltin(moduleName),
}),
],
},
Expand Down
1 change: 0 additions & 1 deletion packages/@sanity/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@
"get-latest-version": "^5.0.0",
"git-user-info": "^2.0.3",
"inquirer": "^6.0.0",
"is-builtin-module": "^3.2.0",
"is-installed-globally": "^0.4.0",
"leven": "^3.1.0",
"lodash": "^4.17.21",
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

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

0 comments on commit 2982082

Please sign in to comment.