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

Pack: Automatically resolve the requirePath if provided #835

Merged
merged 2 commits into from May 10, 2013
Merged

Pack: Automatically resolve the requirePath if provided #835

merged 2 commits into from May 10, 2013

Conversation

ghost
Copy link

@ghost ghost commented May 8, 2013

Closes #834.

@@ -30,7 +30,10 @@ exports = module.exports = internals.Pack = function (options) {

options = options || {};

Utils.assert(!options || !options.requirePath || options.requirePath[0] === '/', 'Pack option \'requirePath\' must be an absolute path');
var requirePath = options.requirePath;
if (typeof requirePath === 'string') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why check if it is a string? why not just check if it is present?

Copy link
Author

Choose a reason for hiding this comment

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

I added the type check because path.resolve will throw a TypeError if a non-string argument is provided (previous versions of Node ignored invalid arguments).

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, but that's just a bad config which should throw anyway

Copy link
Author

Choose a reason for hiding this comment

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

Makes sense—thanks for cleaning it up in 14b7ce3.

hueniverse pushed a commit that referenced this pull request May 10, 2013
`Pack`: Automatically resolve the `requirePath` if provided
@hueniverse hueniverse merged commit 6d12f34 into hapijs:master May 10, 2013
@ghost ghost assigned hueniverse May 10, 2013
jmonster pushed a commit to jmonster/hapi that referenced this pull request Feb 10, 2014
`Pack`: Automatically resolve the `requirePath` if provided
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.

Pack throws an AssertionError if the requirePath is not absolute
1 participant