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(format): sort exports objects #142

Closed
JamieMason opened this issue Jun 22, 2023 · 1 comment
Closed

feat(format): sort exports objects #142

JamieMason opened this issue Jun 22, 2023 · 1 comment

Comments

@JamieMason
Copy link
Owner

JamieMason commented Jun 22, 2023

Description

Ensure exports are in the correct order

  "exports": {
    ".": {
      "types": "./build/types/lib.d.ts",
      "require": "./build/cjs/lib.js",
      "import": "./build/esm/lib.js",
      "default": "./build/esm/lib.js"
    }
  }

Within the "exports" object, key order is significant. During condition matching, earlier entries have higher priority and take precedence over later entries. The general rule is that conditions should be from most specific to least specific in object order.
https://nodejs.org/api/packages.html#community-conditions-definitions

ht/ https://thesametech.com/how-to-build-typescript-project/

Suggested Solution

  1. Add a new test scenario in https://github.com/JamieMason/syncpack/tree/main/test/scenarios/format which captures how it should work.
  2. Update
    export function format(ctx: Ctx): Effect.Effect<never, never, Ctx> {
@JamieMason
Copy link
Owner Author

Released in 12.3.0.

👋 If anyone reading this finds syncpack useful, please tell people about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant