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

Nullish coalescing operator (??) in dist in 8.18.0 #1169

Closed
leroydev opened this issue Sep 19, 2022 · 17 comments · Fixed by #1170
Closed

Nullish coalescing operator (??) in dist in 8.18.0 #1169

leroydev opened this issue Sep 19, 2022 · 17 comments · Fixed by #1170
Assignees

Comments

@leroydev
Copy link

leroydev commented Sep 19, 2022

@testing-library/[email protected] has a nullish coalescing operator in the distributed build in the file dist/@testing-library/dom.esm.js.
This results in only Node.js 14 and up being able to execute this code and in errors in Cypress 9.1.0:
image

Check here, 8.17.1, lines 409 to 413: https://unpkg.com/browse/@testing-library/[email protected]/dist/@testing-library/dom.esm.js

And in 8.18.0, lines 428 to 430: https://unpkg.com/browse/@testing-library/[email protected]/dist/@testing-library/dom.esm.js

@rmoralp
Copy link

rmoralp commented Sep 19, 2022

It seems to be related to last kcd-scripts updates.

Could @kentcdodds check it?

@sneridagh
Copy link

@kentcdodds This is quite important, probably breaking the build of a lot of people...

@MichaelDeBoey
Copy link
Member

@rmoralp @sneridagh It can't be because the latest changes in kcd-scripts as @testing-library/dom is still using v11 & kcd-scripts is already at v12.3

"kcd-scripts": "^11.0.0",

@sneridagh
Copy link

It's because of Cypress... no kcd-scripts involved...

@MichaelDeBoey
Copy link
Member

Since I can't assign this ticket to a team, I'll ping @testing-library/dom to look into this

@eps1lon eps1lon self-assigned this Sep 19, 2022
@eps1lon
Copy link
Member

eps1lon commented Sep 19, 2022

I'm on it. Will pin kcd-scripts. Future updates to tooling need a more thorough audit

@sneridagh
Copy link

@MichaelDeBoey @eps1lon The culprit is in @testing-library/cypress since it has @testing-library/dom as a dependency with caret:

https://github.com/testing-library/cypress-testing-library/blob/main/package.json#L44

@MichaelDeBoey
Copy link
Member

@eps1lon Pinning kcd-scripts won't help, as we're not using latest version yet (as I described in #1169 (comment))

@eps1lon
Copy link
Member

eps1lon commented Sep 19, 2022

The culprit is in @testing-library/cypress since it has @testing-library/dom as a dependency with caret:

That is not the culprit. The culprit is that we introduced syntax (nullish coalescing) in a minor release. However, we still support Node.js 12 which does not support nullish coalescing. The minor release should've been a major release with a proper changelog (drop support for Node.js 12).

@eps1lon
Copy link
Member

eps1lon commented Sep 19, 2022

Pinning kcd-scripts won't help, as we're not using latest version yet

We need to pin some build dependency. But we do need to pin since previous releases did produce correct builds. But since we have no lockfile, a new build used newer build tooling that no longer compiled away nullish coalescing. kcd-scripts is the start point of that depencency tree that needs to be pinned since it's responsible for bundling.

@sneridagh
Copy link

@eps1lon +1, I meant my culprit, what caused my projects to fail :)

@sneridagh
Copy link

@sneridagh
Copy link

oh, of course it does not run on Node... is webpack cypress who tries to load it.

@eps1lon
Copy link
Member

eps1lon commented Sep 19, 2022

We previously always transpiled targetting whatever Browserlist returned in its default preset. However, this is a pretty weak API contract to have. I'm pinning the supported versions to the ones returned by the default preset used in 8.17.x (last known good release) + Node.js 12 (since kcd-scripts mistakes the module entrypoint as the one for browsers).

@eps1lon
Copy link
Member

eps1lon commented Sep 19, 2022

🎉 This fix is included in version 8.18.1 🎉: https://unpkg.com/browse/@testing-library/[email protected]/dist/@testing-library/dom.esm.js

The release is available on:

@eps1lon eps1lon closed this as completed Sep 19, 2022
@sneridagh
Copy link

Thanks a lot @eps1lon !

@sneridagh
Copy link

I can confirm it works now without pinning.

ankush added a commit to frappe/frappe that referenced this issue Sep 20, 2022
…18181)

* perf: initialise field map when initialising meta

(cherry picked from commit df8399f)

* perf: simpler, faster meta cache

(cherry picked from commit 6c6a969)

* fix: ensure error is thrown

(cherry picked from commit b529c27)

* refactor: drop _allow_dict support

This is not required anymore since we store full doc anyway. Also since
they share same cache key calling get_cached_value and get_cached_doc
can end up doing duplicate / double work.

(cherry picked from commit abd0187)

* fix: pickle doc objects directly

This seems to be missed out and causes performance regression in IRL
usage when get_doc is called on cached doc already.

(cherry picked from commit bcb5fe9)

* test: basic perf test for rps on get_list

(cherry picked from commit c28ddcc)

* build: pin testing-library/dom temporarily

refer testing-library/dom-testing-library#1169

(cherry picked from commit 40f6a34)

* chore: semantic changes to document caching code

* fix: drop Meta cache during update

Revert "fix: drop Meta cache during update" (#18186)

* Revert "fix: drop Meta cache during update (#18182)"

This reverts commit 656f6df.

* fix: replace meta cache keys

Old keys stored different types of data `dict` changing key to indicate
change in type.

* perf: cache `FormMeta` directly (#18165)

* perf: cache `FormMeta` directly

* perf: check if `dt` is table, use `db.get_value` instead of `get_all`

Co-authored-by: Sagar Vora <[email protected]>
Co-authored-by: Ankush Menat <[email protected]>
stephenBDT pushed a commit to alias/frappe that referenced this issue Sep 30, 2022
…8164) (frappe#18181)

* perf: initialise field map when initialising meta

(cherry picked from commit df8399f)

* perf: simpler, faster meta cache

(cherry picked from commit 6c6a969)

* fix: ensure error is thrown

(cherry picked from commit b529c27)

* refactor: drop _allow_dict support

This is not required anymore since we store full doc anyway. Also since
they share same cache key calling get_cached_value and get_cached_doc
can end up doing duplicate / double work.

(cherry picked from commit abd0187)

* fix: pickle doc objects directly

This seems to be missed out and causes performance regression in IRL
usage when get_doc is called on cached doc already.

(cherry picked from commit bcb5fe9)

* test: basic perf test for rps on get_list

(cherry picked from commit c28ddcc)

* build: pin testing-library/dom temporarily

refer testing-library/dom-testing-library#1169

(cherry picked from commit 40f6a34)

* chore: semantic changes to document caching code

* fix: drop Meta cache during update

Revert "fix: drop Meta cache during update" (frappe#18186)

* Revert "fix: drop Meta cache during update (frappe#18182)"

This reverts commit 656f6df.

* fix: replace meta cache keys

Old keys stored different types of data `dict` changing key to indicate
change in type.

* perf: cache `FormMeta` directly (frappe#18165)

* perf: cache `FormMeta` directly

* perf: check if `dt` is table, use `db.get_value` instead of `get_all`

Co-authored-by: Sagar Vora <[email protected]>
Co-authored-by: Ankush Menat <[email protected]>
developmentforpeople pushed a commit to developmentforpeople/frappe that referenced this issue Jan 3, 2023
…8164) (frappe#18181)

* perf: initialise field map when initialising meta

(cherry picked from commit df8399f)

* perf: simpler, faster meta cache

(cherry picked from commit 6c6a969)

* fix: ensure error is thrown

(cherry picked from commit b529c27)

* refactor: drop _allow_dict support

This is not required anymore since we store full doc anyway. Also since
they share same cache key calling get_cached_value and get_cached_doc
can end up doing duplicate / double work.

(cherry picked from commit abd0187)

* fix: pickle doc objects directly

This seems to be missed out and causes performance regression in IRL
usage when get_doc is called on cached doc already.

(cherry picked from commit bcb5fe9)

* test: basic perf test for rps on get_list

(cherry picked from commit c28ddcc)

* build: pin testing-library/dom temporarily

refer testing-library/dom-testing-library#1169

(cherry picked from commit 40f6a34)

* chore: semantic changes to document caching code

* fix: drop Meta cache during update

Revert "fix: drop Meta cache during update" (frappe#18186)

* Revert "fix: drop Meta cache during update (frappe#18182)"

This reverts commit 656f6df.

* fix: replace meta cache keys

Old keys stored different types of data `dict` changing key to indicate
change in type.

* perf: cache `FormMeta` directly (frappe#18165)

* perf: cache `FormMeta` directly

* perf: check if `dt` is table, use `db.get_value` instead of `get_all`

Co-authored-by: Sagar Vora <[email protected]>
Co-authored-by: Ankush Menat <[email protected]>
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 a pull request may close this issue.

5 participants