-
Notifications
You must be signed in to change notification settings - Fork 231
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
Removing some magic to make naming conventions more sane #218
Closed
mikegrassotti
wants to merge
1
commit into
stefanpenner:master
from
mikegrassotti:no-dashed-filenames-ever
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,22 +47,6 @@ define("resolver", | |
}; | ||
} | ||
|
||
function chooseModuleName(seen, moduleName) { | ||
var underscoredModuleName = Ember.String.underscore(moduleName); | ||
|
||
if (moduleName !== underscoredModuleName && seen[moduleName] && seen[underscoredModuleName]) { | ||
throw new TypeError("Ambigous module names: `" + moduleName + "` and `" + underscoredModuleName + "`"); | ||
} | ||
|
||
if (seen[moduleName]) { | ||
return moduleName; | ||
} else if (seen[underscoredModuleName]) { | ||
return underscoredModuleName; | ||
} else { | ||
return moduleName; | ||
} | ||
} | ||
|
||
function resolveOther(parsedName) { | ||
var prefix = this.namespace.modulePrefix; | ||
Ember.assert('module prefix must be defined', prefix); | ||
|
@@ -74,31 +58,33 @@ define("resolver", | |
|
||
// allow treat all dashed and all underscored as the same thing | ||
// supports components with dashes and other stuff with underscores. | ||
var normalizedModuleName = chooseModuleName(requirejs._eak_seen, moduleName); | ||
var normalizedModuleName = Ember.String.underscore(moduleName); | ||
|
||
if (parsedName.fullName === 'router:main') { | ||
// for now, lets keep the router at app/router.js | ||
return require(prefix + '/router'); | ||
} | ||
|
||
if (requirejs._eak_seen[normalizedModuleName]) { | ||
try { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be nice if require supported |
||
var module = require(normalizedModuleName, null, null, true /* force sync */); | ||
|
||
if (module === undefined) { | ||
throw new Error(" Expected to find: '" + parsedName.fullName + "' within '" + normalizedModuleName + "' but got 'undefined'. Did you forget to `export default` within '" + normalizedModuleName + "'?"); | ||
} | ||
|
||
if (Ember.ENV.LOG_MODULE_RESOLVER) { | ||
Ember.Logger.info('hit', moduleName); | ||
} | ||
|
||
return module; | ||
} else { | ||
} catch (error) { | ||
if (Ember.ENV.LOG_MODULE_RESOLVER) { | ||
Ember.Logger.info('miss', moduleName); | ||
} | ||
return this._super(parsedName); | ||
} | ||
|
||
if (module === undefined) { | ||
throw new Error(" Expected to find: '" + parsedName.fullName + "' within '" + normalizedModuleName + "' but got 'undefined'. Did you forget to `export default` within '" + normalizedModuleName + "'?"); | ||
} | ||
|
||
if (Ember.ENV.LOG_MODULE_RESOLVER) { | ||
Ember.Logger.info('hit', moduleName); | ||
} | ||
|
||
return module; | ||
|
||
|
||
} | ||
// Ember.DefaultResolver docs: | ||
// https://github.com/emberjs/ember.js/blob/master/packages/ember-application/lib/system/resolver.js | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 line also seems to indicate that you are moving to underscored names instead of dasherized names
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.
on disk underscored, in ember dasherized.