Skip to content

Conversation

@Morklympious
Copy link
Contributor

@Morklympious Morklympious commented Nov 18, 2021

Went ahead and put up a PR for this.

Obviously I might be missing some kinda coverage here in tests, the helpers for the test environment seemed really dense so I mostly sought out a copy/paste job to make a "okay this should just render the same as the test that renders with the meta tag.

  • Added component-helper.js
  • Added helper.test.js
  • Changed export default ComponentTree to commonjs because I couldn't find an easy way to support mixed exports
  • no rush on this, honestly!

Copy link
Owner

@tivac tivac 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 overall! Don't change the exports, we can adjust the package.json and build system instead I think.

export default ComponentTree;
module.exports = ComponentTree;

exports.component = require("./component-helper.js");
Copy link
Owner

Choose a reason for hiding this comment

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

Instead of converting this module to commonjs let's leave it as-is, instead we can make some changes to package.json to expose this as import component from "xstate-component-tree/component-helper" for maximum tree-shaking support.

Preserves modules being ESM for authoring, but does a better job exposing everything.

Also updated tests a bit to handle new export strategy.
BREAKING CHANGE: Need to `import { ComponentTree } from 'xstate-component-tree';` now.
Not supported until node@14
@tivac tivac merged commit 051dfc0 into tivac:main Nov 23, 2021
tivac added a commit that referenced this pull request Nov 24, 2021
Co-authored-by: Bradley Stafford <bstaffo@amazon.com>
Co-authored-by: Pat Cavit <github@patcavit.com>
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