-
Notifications
You must be signed in to change notification settings - Fork 2
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
added submodule tests #26
Conversation
this will not be ready tonight/today |
parts of scoped packages would be affected so scoped package tests should be added to the main test file |
tests are passing, but a few extra things are needed,
|
the "index.js" files should be renamed eg "index.test.js" so they won't be returned through legacy cjs-resolving functions where "index.js" is automatically returned. |
c631758
to
e9118ac
Compare
resolvewithplus.js
Outdated
@@ -191,6 +203,91 @@ export default (o => { | |||
return o.getasfilesync(temppath, opts) || o.getasdirsync(temppath, opts); | |||
}; | |||
|
|||
o.getasesmimportpathfrompjson = (targetpath, specifier, pjson) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits: the func name is really hard to read. lol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was renamed to "esmparseimportpkg" if you prefer a different name it could be changed and readability improvements could be made in a follow up PR
e9118ac
to
587d056
Compare
note to myself mostly. resolvewithplus should be updated to return file urls like 'file:///path/to/script.js' and 'node:fs' to match the import.meta.resolve behaviour and to save esmock from the need to check if protocol is defined or to add the protocol |
Everything is working here and the tests are passing. A few refinements that could be made but haven't been made yet,
I don't know when these improvements will be made. This is a dull task and my energy is low atm. |
tests for these nested and conditional export definitions should be added as well :/ https://nodejs.org/api/packages.html#conditional-exports {
"exports": {
".": "./index.js",
"./feature.js": {
"node": "./feature-node.js",
"default": "./feature.js"
}
}
} https://nodejs.org/api/packages.html#conditional-exports {
"exports": {
"node": {
"import": "./feature-node.mjs",
"require": "./feature-node.cjs"
},
"default": "./feature.mjs"
}
} |
one function is now used to parse spec patterns to obtain,
it will be ready for review after tests for the patterns above are added and function names are improved. |
…ing subpath specifiers that reference dependency/package name
@tripodsan @aladdin-add this PR may be too annoying to review. It has become a huge PR. If you will review this that's great and if not it is understood why. Some function names are changed a little bit, but imo it would be easier to refine things more in a follow up PR. There is something off about linting and/or my editor that needs to be looked into and probably we should remove the "o.functioname" pattern and use something like "const functionName" or whatever. This PR completes the objective of resolving esm patterns from node.js' documentation examples |
merging this! |
adds tests and changes for subpath exports, tests the export patterns from the documentation site https://nodejs.org/api/packages.html#package-entry-points