Merge pull request #716 from marko-js/issue-688

fixes #688 - add reference to browser.json in meta dependencies
This commit is contained in:
Patrick Steele-Idem 2017-06-08 14:17:20 -06:00 committed by GitHub
commit b9f6624093
5 changed files with 28 additions and 1 deletions

View File

@ -17,13 +17,15 @@ function getComponentFiles(filename) {
var styleMatch = new RegExp('^'+fileMatch+'style\\.\\w+$');
var componentMatch = new RegExp('^'+fileMatch+'component\\.\\w+$');
var splitComponentMatch = new RegExp('^'+fileMatch+'component-browser\\.\\w+$');
var packageMatch = new RegExp('^'+fileMatch+'browser\\.\\json$');
var dirname = path.dirname(filename);
var foundFiles = {
styles: [],
file: null,
browserFile: null
browserFile: null,
package: null
};
var dirFiles = fs.readdirSync(dirname);
@ -38,6 +40,8 @@ function getComponentFiles(filename) {
foundFiles.browserFile = file;
} else if (componentMatch.test(file)) {
foundFiles.file = file;
} else if (packageMatch.test(file)) {
foundFiles.package = file;
}
}

View File

@ -160,6 +160,10 @@ module.exports = function handleRootNodes() {
context.addDependency('./' + styleFile);
});
if (componentFiles.package) {
context.addDependency('package: ./' + componentFiles.package);
}
if (componentFiles.file) {
let file = componentFiles.file;

View File

@ -0,0 +1,17 @@
"use strict";
var marko_template = module.exports = require("marko/src/html").t(__filename);
function render(input, out) {
var data = input;
out.w("YOLO");
}
marko_template._ = render;
marko_template.meta = {
deps: [
"package: ./browser.json"
]
};