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
Source handler doesn't run for a file extension if it is a file name #3985
Comments
So, you're right that there's a bug here, but the bug is that the exact filename match ever works at all. The feature is documented as:
It's pretty explicit that this is supposed to be an extension, and most of the code (eg, the code that looks for relevant files inside an app) correctly handles this. The fact that, in certain odd cases, the full filename can match, is a bug that I'll fix. Thanks! |
I think some packages may have depended on this behavior. (Unfortunately I don't recall specific examples) |
@avital Would love to know. I checked https://atmospherejs.com/mizzao/build-fetcher and it uses extension. And note that the behavior worked inconsistently here: it would work in a package, or in an app if there was a suffix of the extension also declared (as @stevezhu showed). Because the code that looks in your app for files to process does assume that extensions are extensions: var sourceInclude = _.map(
extensions,
function (isTemplate, ext) {
return new RegExp('\\.' + utils.quotemeta(ext) + '$');
}
); |
Ahh I see, thanks for that clarification and glad I unintentionally uncovered another bug. |
mquandalle:bower and numtel:publicsources both rely on this. |
* Handles this bug when used in combination with mquandalle:bower meteor/meteor#3985
@mquandalle @numtel You may way to try to address this before the next Meteor release. (I'm thinking of adding |
@Differential's Vulcanize also uses this pattern. |
@glasser Already taken care of. My packages are no longer dependent on this bug. |
https://github.com/elidoran/cosmos-browserify also depends on this, or at least the example in the README (cc @elidoran) |
Good to know, thank you @avital EDIT: revised and published. thank you. |
This is in addition to registering for extensions. Note that only the new SourceProcessor APIs allow this, not registerSourceHandler. The filename in question is the basename of the file. The file can be found in any directory in any package. If you want to be more picky, you can just ignore other ones in your processFilesForTarget. This introduces the SourceProcessorSet abstraction, which simplifies a lot of repeated code around matching filenames with processors and avoiding duplicates. Missing tests. See also #3985.
Note that a forthcoming version of Meteor (implemented on the |
When using a file name as a file extension when registering a source handler as cited in the Plugin.registerSourceHandler docs
"In some_json.json source handler" isn't logged unless you also add a source handler with just json
Note: this works fine for
api.addFiles
in packagesreproduction: https://github.com/stevezhu/meteor-source-handler-bug
using osx mavericks 10.9.5 if it's relevant
The text was updated successfully, but these errors were encountered: