Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): remove is-builtin-module #6579

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -111,7 +111,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.