Add ESM loader support to @kbn/babel-register with regex-based allowlist and fix package.json exports resolution#71
Draft
Copilot wants to merge 7 commits into
Draft
Conversation
* Initial plan * Implement ink-based CLI with React components - Created new cli_ink directory with React/ink implementation - Implemented core components: Header, Menu, Input, LogsDisplay - Implemented screens: MainMenu, SelectStream, SelectConnector, SetTimeRange, StreamActions, OnboardingMenu, DescribeDataset, ChatWithData, WorkflowResult - Created utilities for log buffering and time range management - Integrated all workflows (partition, onboarding, etc.) - Added global key handlers: 'l' for logs, 'q' for back, CMD+C for clean exit - Updated main index.ts to use new ink implementation Co-authored-by: dgieselaar <352732+dgieselaar@users.noreply.github.com> * Add AnalyzeStream screen and update documentation - Created AnalyzeStream screen (placeholder for future implementation) - Wire partition-stream action to workflow execution - Updated README with comprehensive documentation - Added navigation flow diagram and usage instructions Co-authored-by: dgieselaar <352732+dgieselaar@users.noreply.github.com> * Fix code review issues - Add missing workflows: description and field-definitions - Add error handling for undefined workflows - Fix custom time range handling in computeTimeRangeBounds - Add ESC key support for Input component - Update help text to clarify 'q' behavior in input fields - Properly propagate custom time ranges through state Co-authored-by: dgieselaar <352732+dgieselaar@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dgieselaar <352732+dgieselaar@users.noreply.github.com>
…xports handling Co-authored-by: dgieselaar <352732+dgieselaar@users.noreply.github.com>
Co-authored-by: dgieselaar <352732+dgieselaar@users.noreply.github.com>
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
[WIP] Rewrite streams-ai-cli using React ink
Add ESM loader support to @kbn/babel-register and fix package.json exports resolution
Nov 22, 2025
dgieselaar
reviewed
Nov 23, 2025
Owner
dgieselaar
left a comment
There was a problem hiding this comment.
@copilot:
- create two separate files, install_esm.js and install_cjs.js
- make sure kbn-babel-register exports only install(), which calls both installCJS and installESM
- do not add READMEs or tests for existing functionality. Only add tests for new changes. Undo any changes in this PR that do not meet these requirements
- in node_preset, which contains the Babel config, add an override that sets module: false instead of module: cjs, based on an includelist. Add @kbn/streams-ai-cli to this list, this package should use ESM and not CJS.
- consider whether this allowlist should be shared with kbn-babel-register. If so, figure out the right way to do this, without copying files.
…allowlist - Split install logic into install_cjs.js and install_esm.js - Main index.js now exports only install() which calls both installers - Created esm_allowlist.js with @kbn/streams-ai-cli - Updated node_preset.js to use module: false for allowlisted packages - Removed unnecessary README updates and tests for existing functionality - Kept only tests for new ESM functionality (esm_loader.test.js) Co-authored-by: dgieselaar <352732+dgieselaar@users.noreply.github.com>
Author
Completed all requested changes in commit 5319e20: Structural changes:
ESM allowlist:
Cleanup:
|
Copilot
AI
changed the title
Add ESM loader support to @kbn/babel-register and fix package.json exports resolution
Add ESM loader support to @kbn/babel-register with allowlist and fix package.json exports resolution
Nov 23, 2025
dgieselaar
reviewed
Nov 23, 2025
Owner
|
@copilot Use regexes (e.g. /kbn-streams-ai-cli/) and overrides for the ESM allowlist. |
- Changed ESM_ALLOWLIST to use regex patterns (e.g., /kbn-streams-ai-cli/) - Updated node_preset.js to use Babel's overrides feature instead of manual filename checking - Simplified logic by leveraging Babel's built-in test matching with regex patterns - Removed custom isInEsmAllowlist function and Path dependency Co-authored-by: dgieselaar <352732+dgieselaar@users.noreply.github.com>
Author
Implemented in commit c55b165:
Implemented in commit c55b165:
|
Copilot
AI
changed the title
Add ESM loader support to @kbn/babel-register with allowlist and fix package.json exports resolution
Add ESM loader support to @kbn/babel-register with regex-based allowlist and fix package.json exports resolution
Nov 23, 2025
328b855 to
da68802
Compare
6d69934 to
663895e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds ESM module support to
@kbn/babel-registerusing Node.js 22'smodule.register()API, creates a shared regex-based ESM allowlist for configuring which packages use ESM vs CommonJS using Babel's overrides feature, and fixes@kbn/import-resolverto handle{ default: string }in package.json exports field.Changes
@kbn/babel-register
install_cjs.jsandinstall_esm.jsmodules for better separation of concernsinstall()function now calls bothinstallCJS()andinstallESM()automatically.ts|.tsx|.js|.jsxextensions and checking for index filesesm_allowlist.jscontaining regex patterns for packages that should use ESM (e.g.,/kbn-streams-ai-cli/)@kbn/babel-preset (node_preset)
overridesfeature to apply ESM configuration based on regex pattern matching@kbn/babel-register/esm_allowlistto ensure consistency@kbn/streams-ai-cli) to output ESM (module: false) instead of CJS (module: 'cjs')@kbn/import-resolver
tryExportsResolve()to handle package root exports with{ ".": { "default": "./dist/index.js" } }patternsubPathPartsis empty, entry is now"."instead of early exit nullChecklist
release_note:breakinglabel should be applied in these situations.release_note:*label is applied per the guidelinesbackport:*labels.Identify risks
overridesfeature, scoped to allowlisted packages only via regex matching, no impact on existing packages✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.