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

Modify API to be asynchronous #13

Merged
merged 11 commits into from
Mar 14, 2014
Merged

Modify API to be asynchronous #13

merged 11 commits into from
Mar 14, 2014

Conversation

totherik
Copy link
Contributor

@totherik totherik commented Mar 1, 2014

This is a non-trivial rewrite that will be released as v1.0.0. Changes include:

  • removal of resolveFileSync
  • resolve and resolveFile now have the signature function (data, errback)
  • handlers are backward compatible, so now support an optional errback: function (value, [errback])
  • all handlers resolve asynchronously regardless of whether or not they are written as such.
  • XXX: Removal of the "chaining" feature that allow clients to specify a protocol chain in a value.
  • fixes bug wherein parent handlers were not correctly being traversed
  • unuse works properly.

// require.resolve will locate a file without a known extension (e.g. txt)
// and try to load it as javascript. That won't work for this case.
var ext = path.extname(file);
return ext === '' || require.extensions.hasOwnProperty(ext);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this assumes an extensionless file should be required as though it's js, right? That strikes me as odd behavior.

Update: we chatted. Short answer: because node.

@grawk
Copy link
Member

grawk commented Mar 14, 2014

Looks good. 👍

grawk added a commit that referenced this pull request Mar 14, 2014
Modify API to be asynchronous
@grawk grawk merged commit 3bb5528 into master Mar 14, 2014
@totherik totherik deleted the async branch March 19, 2014 17:35
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 this pull request may close these issues.

3 participants