Skip to content

chore: enable isolatedDeclarations - #3293

Merged
Lightning00Blade merged 1 commit into
mainfrom
feat/isolated-declarations
Oct 21, 2026
Merged

Lightning00Blade merged 1 commit into
mainfrom
feat/isolated-declarations

Conversation

@Lightning00Blade

Copy link
Copy Markdown
Collaborator

Stacked on #3290.

Enables isolatedDeclarations in tsconfig.json. The option requires declaration, so that is enabled too.

isolatedDeclarations requires explicit types on exports, so the CLI option types are now declared instead of inferred from the Yargs option objects:

  • BrowserArguments, PuppeteerArguments, ToolArguments, CategoryArguments and McpArguments declare the parsed value of each option. ParsedArguments is now defined in mcp-options.ts from McpArguments instead of InferredOptionTypes<typeof mcpOptions>.
  • McpOptionsFor<TArgs, TBase> derives the type of an option map from its arguments interface. It checks each option's type, default, choices and coerce against the declared value type. A required argument must have a default. An optional (?) argument has no default.
  • ParsedArguments is imported from mcp-options.ts everywhere. The re-exports from ServerConfig.ts and ConfigParser.ts are removed, and so is an unused McpOption re-export.
  • package.json excludes the emitted .d.ts files from the npm package. npm matches a negated files entry such as !*.d.ts only at the package root, so the entry is !**/*.d.ts.

User-visible changes

None. The option definitions, defaults and generated docs do not change (npm run gen produces no diff). npm pack --dry-run lists no .d.ts files.

Testing

  • npm run format
  • npm run test
  • npm run gen (no changes)

Base automatically changed from chore/remove-allowjs to main October 21, 2026 17:21
Enable `isolatedDeclarations` (and `declaration`, which it requires) in
tsconfig.json.

Declare the parsed option types explicitly instead of inferring them
from the Yargs option objects:

- Add `BrowserArguments`, `PuppeteerArguments`, `ToolArguments`,
  `CategoryArguments` and `McpArguments`. `ParsedArguments` is now
  defined in mcp-options.ts from `McpArguments`.
- Add `McpOptionsFor<TArgs>`, which derives the Yargs option map from an
  arguments interface and checks each option's `type`, `default`,
  `choices` and `coerce` against it. Optional (`?`) arguments are the
  options without a default.
- Import `ParsedArguments` from mcp-options.ts everywhere and drop the
  re-exports from ServerConfig.ts and ConfigParser.ts.

Exclude the emitted `.d.ts` files from the npm package so that the
published contents do not change.
@Lightning00Blade
Lightning00Blade added this pull request to the merge queue Oct 21, 2026
Merged via the queue into main with commit 2c0931b Oct 21, 2026
19 of 21 checks passed
@Lightning00Blade
Lightning00Blade deleted the feat/isolated-declarations branch October 21, 2026 17:54
yashdesai87 pushed a commit to yashdesai87/chrome-devtools-mcp that referenced this pull request Oct 21, 2026
Stacked on ChromeDevTools#3293.

ChromeDevTools#1948 enabled source maps for local debugging and added `!*.js.map` to
`files` in `package.json` to keep them out of the npm package. npm
matches a negated `files` entry only at the package root, so the entry
never matched the source maps in `build/src`, and the package has
included them since then. This PR changes the entry to `!**/*.js.map`,
the same form that ChromeDevTools#3293 uses for `.d.ts` files.

The published maps were of little use: they do not embed
`sourcesContent`, and the TypeScript sources that they reference are not
in the package.

## User-visible changes

- The npm package no longer includes `.js.map` files (100 files in a
local `npm pack --dry-run`).
- The published `.js` files still end with `//# sourceMappingURL=`
comments, which now point to files that are not in the package. Tools
that load source maps, such as debuggers, can warn that the map is
missing.

## Testing

- `npm pack --dry-run` lists no `.js.map` files and still lists the
`.js` files.
- `npm run format`
- `npm run test`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants