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

module: expose exports conditions to loaders #31303

Closed
wants to merge 1 commit into from

Conversation

@jkrems
Copy link
Contributor

jkrems commented Jan 10, 2020

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
@jkrems

This comment has been minimized.

Copy link
Contributor Author

jkrems commented Jan 10, 2020

lib/internal/modules/esm/resolve.js Outdated Show resolved Hide resolved
src/module_wrap.cc Outdated Show resolved Hide resolved
src/module_wrap.cc Outdated Show resolved Hide resolved
src/module_wrap.cc Outdated Show resolved Hide resolved
src/module_wrap.cc Outdated Show resolved Hide resolved
src/module_wrap.cc Outdated Show resolved Hide resolved
src/module_wrap.cc Outdated Show resolved Hide resolved
src/module_wrap.cc Outdated Show resolved Hide resolved
src/module_wrap.cc Outdated Show resolved Hide resolved
src/module_wrap.cc Outdated Show resolved Hide resolved
@guybedford

This comment has been minimized.

Copy link
Contributor

guybedford commented Jan 11, 2020

Nice work, this approach seems great!

test/fixtures/es-module-loaders/loader-with-custom-condition.mjs Outdated Show resolved Hide resolved
@jkrems jkrems force-pushed the jkrems:loader-conditions branch 9 times, most recently Feb 10, 2020
@jkrems jkrems marked this pull request as ready for review Feb 10, 2020
@jkrems

This comment has been minimized.

Copy link
Contributor Author

jkrems commented Feb 10, 2020

Cleaned up and marking as ready for review. I updated the implementation to use a std::set instead of V8::Set. In the process the conditions cache got moved into C++, JS only creates the key (\0-separated condition names).

Copy link
Contributor

guybedford left a comment

Seems like a nice approach.

src/module_wrap.cc Outdated Show resolved Hide resolved
test/fixtures/es-module-loaders/loader-with-custom-condition.mjs Outdated Show resolved Hide resolved
@jkrems jkrems force-pushed the jkrems:loader-conditions branch Mar 2, 2020
@jkrems

This comment has been minimized.

Copy link
Contributor Author

jkrems commented Mar 2, 2020

Ping @nodejs/modules-active-members, this is still lacking some reviews/approvals before we can land it. Adding it to the agenda in case it's still open by our next meeting. :)

@bmeck
bmeck approved these changes Mar 2, 2020
Copy link
Member

bmeck left a comment

I really like this PR! This falls into some things we are starting to see from the community about custom conditions like https://twitter.com/sebmarkbage/status/1234223477424447488 .

@nodejs-github-bot

This comment was marked as outdated.

@jkrems jkrems added the author ready label Mar 2, 2020
test/fixtures/es-module-loaders/loader-with-custom-condition.mjs Outdated Show resolved Hide resolved
@nodejs-github-bot

This comment was marked as outdated.

Copy link
Contributor

guybedford left a comment

Would be great to see this moving forward :)

src/module_wrap.cc Outdated Show resolved Hide resolved
test/fixtures/es-module-loaders/loader-with-custom-condition.mjs Outdated Show resolved Hide resolved
doc/api/esm.md Show resolved Hide resolved
@jkrems jkrems force-pushed the jkrems:loader-conditions branch Mar 17, 2020
@nodejs-github-bot

This comment has been minimized.

Copy link
Contributor

guybedford left a comment

Looks good, thanks.

doc/api/esm.md Outdated Show resolved Hide resolved
@jkrems jkrems force-pushed the jkrems:loader-conditions branch to 19b2f4f Mar 17, 2020
@nodejs nodejs deleted a comment from jkrems Mar 20, 2020
lib/internal/modules/esm/resolve.js Outdated Show resolved Hide resolved
lib/internal/modules/esm/resolve.js Show resolved Hide resolved
@nodejs-github-bot

This comment has been minimized.

Copy link

nodejs-github-bot commented Mar 29, 2020

@jkrems jkrems force-pushed the jkrems:loader-conditions branch from 19b2f4f to a14ba1e Mar 30, 2020
@nodejs-github-bot

This comment was marked as outdated.

@jkrems jkrems force-pushed the jkrems:loader-conditions branch from a14ba1e to 8108485 Mar 30, 2020
@jkrems jkrems force-pushed the jkrems:loader-conditions branch from 8108485 to 2267d17 Mar 30, 2020
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@jkrems jkrems force-pushed the jkrems:loader-conditions branch from 2267d17 to 1549bc4 Mar 31, 2020
@nodejs-github-bot

This comment has been minimized.

@jkrems

This comment has been minimized.

Copy link
Contributor Author

jkrems commented Mar 31, 2020

There's one C++ test that seems to fail on linuxone. I look into it briefly but I don't see a clear reason why it would fail (or what the failure really means). I'm surprised that this PR would affect low-level worker interactions but can't rule it out.

@addaleax

This comment has been minimized.

Copy link
Member

addaleax commented Apr 2, 2020

@jkrems See #32563 – I just landed a fix for that. :) Is this still ready to land, apart from waiting for a green CI?

@nodejs-github-bot

This comment has been minimized.

@jkrems

This comment has been minimized.

Copy link
Contributor Author

jkrems commented Apr 2, 2020

Is this still ready to land, apart from waiting for a green CI?

Yes! This should be good to go, assuming CI comes back green.

(And thanks for being on top of these build failures, much appreciated. :))

@nodejs-github-bot

This comment has been minimized.

addaleax added a commit that referenced this pull request Apr 2, 2020
PR-URL: #31303
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
@addaleax

This comment has been minimized.

Copy link
Member

addaleax commented Apr 2, 2020

Landed in 9129ab1

@addaleax addaleax closed this Apr 2, 2020
DerekNonGeneric added a commit to DerekNonGeneric/node-runtime that referenced this pull request Apr 3, 2020
* Add/re-add context.conditions prop

Refs: nodejs#31303
DerekNonGeneric added a commit to DerekNonGeneric/node-runtime that referenced this pull request Apr 4, 2020
* Remove import of URL & process as they are unnecessary
* Update bare-import check to match language used in error
* Improve accuracy of hook's thrown error message
* Improve accuracy of parameter & return type annotations
* Remove unncessary async keyword in hook functions
* Add missing conditions property to resolve hook types
* Incorporate relevant findings into documentation

Refs: nodejs#31303
Fixes: nodejs#29610
DerekNonGeneric added a commit to DerekNonGeneric/node-runtime that referenced this pull request Apr 5, 2020
* Add JSDoc typings to function boundaries
* Remove import of URL & process as they are unnecessary
* Update bare-specifier check to match language used in error
* Improve accuracy of hook's thrown error message

Refs: nodejs#31303
DerekNonGeneric added a commit to DerekNonGeneric/node-runtime that referenced this pull request Apr 5, 2020
* Add JSDoc typings to function boundaries
* Remove import of URL & process as they are unnecessary
* Update bare-specifier check to match language used in error
* Improve accuracy of hook's thrown error message
* Move destructuring assignment of default to within function

Refs: nodejs#31303
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

9 participants
You can’t perform that action at this time.