Skip to content

Add barrel export and exports map to packages/components#6130

Merged
michaell-workday merged 11 commits intomainfrom
feat/barrel-export
Apr 6, 2026
Merged

Add barrel export and exports map to packages/components#6130
michaell-workday merged 11 commits intomainfrom
feat/barrel-export

Conversation

@michaell-workday
Copy link
Copy Markdown
Contributor

@michaell-workday michaell-workday commented Apr 2, 2026

Summary

  • Adds an exports field to packages/components/package.json to declare the official public API surface of flowise-components
  • Introduces packages/components/nodes/index.ts as a stable barrel entry point for MCP node utilities
  • Pins es-iterator-helpers@1.0.15 in pnpm overrides to resolve a transitive dependency conflict with pre-commit hooks

Background

flowise-components had no exports field, meaning Node.js resolved imports by directly walking the filesystem. This worked for flowise-components (the main entry) but meant flowise-components/nodes had no defined entry — nodes/index.ts compiles to dist/nodes/index.js, not nodes/index.js, so the import failed at runtime with MODULE_NOT_FOUND.

Changes

packages/components/nodes/index.ts

New barrel file that re-exports MCP toolkit utilities (MCPToolkit, MCPTool, validation helpers) from nodes/tools/MCP/core. Consumers should import from flowise-components/nodes rather than deep paths, insulating them from internal refactors.

packages/components/package.jsonexports field

"exports": {
    ".": {                                                                                                                                                                         
        "types": "./dist/src/index.d.ts",                                                                                                                                        
        "default": "./dist/src/index.js"
    },
    "./nodes": {
        "types": "./dist/nodes/index.d.ts",
        "default": "./dist/nodes/index.js"                                                                                                                                         
    }
}                                                                                                                                                                                  

Two explicit entry points:

  • . — the existing main entry (flowise-components), no change in behavior
  • ./nodes — new stable entry for MCP utilities (flowise-components/nodes)

All other subpath imports (deep paths, dist/-prefixed paths) are intentionally not exposed.

package.json (root)

Added "es-iterator-helpers": "1.0.15" to pnpm.overrides to resolve a transitive version conflict surfaced in pre-commit hooks.

Breaking change

Adding an exports field opts out of CJS automatic extension guessing and restricts the importable subpaths to those explicitly listed. Any consumer importing subpaths other than flowise-components or flowise-components/nodes will receive ERR_PACKAGE_PATH_NOT_EXPORTED. The fix is to migrate to one of the two supported entry points.

Comment thread packages/components/package.json Outdated
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces subpath exports for the flowise-components package, establishing a stable entry point for node-level utilities and adding a dependency override for es-iterator-helpers. Review feedback highlights potential issues with the wildcard export mapping that could lead to incorrect file resolution when extensions are used, and suggests narrowing the broad catch-all export to avoid exposing internal package files.

Comment thread packages/components/package.json Outdated
Comment thread packages/components/package.json Outdated
@michaell-workday
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces subpath exports for the flowise-components package, adds a new entry point for node-level utilities, and includes a dependency override. Feedback was provided regarding the exports configuration in package.json, specifically that the catch-all mapping could break backward compatibility for existing deep imports and access to root files like package.json.

Comment thread packages/components/package.json Outdated
@michaell-workday
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new barrel file for node-level utilities and configures package exports in packages/components/package.json to expose them. It also adds a dependency override for es-iterator-helpers in the root package.json. Feedback was provided to refine the exports configuration, specifically suggesting a mapping for node subpaths to ensure they resolve correctly to the dist directory and avoid potential module resolution errors.

Comment thread packages/components/package.json Outdated
Copy link
Copy Markdown

@muratkaratekeli muratkaratekeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing on the exports map: the "./": "./" catch-all exposes the entire package directory as importable paths. I see you went back and forth on this in the commits, narrowed to dist only, then went back to export all. Could we tighten this to just the two explicit entries (. and ./nodes) without the wildcard? Keeps the public API surface small and makes it easier to refactor internals later without worrying about breaking consumers.

@muratkaratekeli
Copy link
Copy Markdown

One thing on the exports map: the "./": "./" catch-all exposes the entire package directory as importable paths. I see you went back and forth on this in the commits, narrowed to dist only, then went back to export all. Could we tighten this to just the two explicit entries (. and ./nodes) without the wildcard? Keeps the public API surface small and makes it easier to refactor internals later without worrying about breaking consumers.

changes look good

Copy link
Copy Markdown

@muratkaratekeli muratkaratekeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@michaell-workday michaell-workday merged commit 833f911 into main Apr 6, 2026
7 checks passed
@michaell-workday michaell-workday deleted the feat/barrel-export branch April 6, 2026 17:09
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.

4 participants