-
-
Notifications
You must be signed in to change notification settings - Fork 717
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
Improve exports #3601
Improve exports #3601
Conversation
* Fixed custom define AMD function in order work with esm exports * Refactored custom define function to be a bit more stable for changes It still fragile to changes of dependencies order tho
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3601 +/- ##
==========================================
- Coverage 83.28% 74.89% -8.40%
==========================================
Files 244 242 -2
Lines 32223 19229 -12994
Branches 4398 4257 -141
==========================================
- Hits 26837 14401 -12436
+ Misses 5138 4828 -310
+ Partials 248 0 -248 ☔ View full report in Codecov by Sentry. |
Ok, seems like I fixes the tests, which is good. |
@HarelM do you have understand/stats on what your users prefer to use more - "standalone" version or csp one? IMO "standalone" version is helpful for tests and playgrounds, but esm version (or as you call it "csp") is a way to go in most of the cases. Reasons as I see it:
I'm not saying removing "standalone" version completely (I'm sure you might find it useful it tests or a playground), but at least change the defaults and do not let people misuse it (e.g. by playing with |
I think most people are using the standalone version, it's a lot easier to set up and most of the wrapping libraries I saw do not contain the docs to allow using the csp version. I don't have any statistics, but I assume most people use the standalone version, it's a lot more simple... |
After seeing what you did here, simple for you might be very complicated for normal developers 🤪 |
Co-authored-by: Evgeniy Timokhov <[email protected]>
Co-authored-by: Evgeniy Timokhov <[email protected]>
Yeah that makes sense. I'd still recommend at least to change the defaults (csp by default) but leave an ability to load a standalone version via different import path. The fact that some people don't read the docs should affect the design of the library 😂 they might use the standalone version because it's the default now... but yeah, it's totally up to you. In this case I think you might need to bring the umd thing back as I assumed (wrongly) that a standalone version isn't used to import the library as a module (option 3 in your examples), only to "add it to the bundle" via import and then rely on the "global" object that was created as a result of a side-effect of that import. Apologies |
The render tests and the examples are using the global object, so the original option 1 is OK, there's no tests for option 3, I should probably add one somehow... |
Seems like the docs broke in pre.4 release and not by this PR. |
Still a few TODOs I need to solve before I can merge this. |
Docs are still broken though, I need to think what to do with them... |
@HarelM is it related to the generated bundle declaration file? |
I don't think so, but it uses the entry point and exported stuff to generate the API docs, which now seems a bit different, due to the changes, but also missing some grouping which I'm not sure how to solve... |
This is generally ready for review. |
I have removed the duplicate stuff that were here and in the docs fix PR.
|
It really depends on whether you want to your consumers use import and use |
Well, the type is part of a constructor argument, the |
FWIW, I find the exported constructor argument types to be quite important. The options are not always defined in the same place that the controls are constructed. |
The type is exported in both the docs and the d.ts file. |
@HarelM That's exactly why In v10 it would be even more error-prone - the tool will fail instead of just warnings. At least it can prevent you from accidental "hiding" of a type (this can happen right now if you don't monitor warnings). The only advice I can give - try to avoid using names that are available globally in DOM or NodeJS API (
Are you running typedoc on the generated bundle dts file or |
I'm running it on the index.ts file. |
Well, I get the following warnings when I run typedoc on the d.ts file:
|
Some of the problems here are due to the rename of |
Launch Checklist
This is also part of version 4 breaking changes in order to solve the mess we have with the typescript exports.
This mainly removes the getters and setters and the global default exported static object in favor of functions and named exports.
CHANGELOG.md
under the## main
section.