Skip to content

Commit 7a49357

Browse files
committed
files. fixes #18
1 parent af5c853 commit 7a49357

File tree

12 files changed

+412
-19
lines changed

12 files changed

+412
-19
lines changed

packages/synthesis-compiler/.versions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ [email protected]
2323
2424
2525
26-
local-test:mwc:synthesis-compiler@1.1.0
26+
local-test:mwc:synthesis-compiler@1.2.0
2727
2828
2929
3030
3131
3232
3333
34-
mwc:synthesis-compiler@1.1.0
34+
mwc:synthesis-compiler@1.2.0
3535
3636
3737

packages/synthesis-compiler/package.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package.describe({
22
name: 'mwc:synthesis-compiler',
3-
version: '1.1.0',
3+
version: '1.2.0',
44
summary: 'Synthesis is meteor + polymer',
55
git: 'https://github.com/meteorwebcomponents/synthesis',
66
documentation: 'README.md',

packages/synthesis-compiler/synthesis-compiler.js

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ import path from 'path';
55
import _ from 'lodash';
66
import { Babel } from 'meteor/babel-compiler';
77
import { Synthesizer } from './synthesis-gen.js';
8-
8+
const getExtension = (fileName = '') => {
9+
var a = filename.split('.');
10+
if( a.length === 1 || ( a[0] === '' && a.length === 2 ) ) {
11+
return '';
12+
}
13+
return a.pop();
14+
}
915
export const parseHtml = (arg) => {
1016
const contents = arg.contents;
1117
const parsed = parse5.parse(contents);
@@ -139,19 +145,41 @@ class DissectHtml {
139145
return domModule;
140146
}
141147
case 'div': {
142-
const attrs = _.filter(child.attrs, o => (o.name === 'hidden' || o.name === 'by-vulcanize'));
148+
const divChild = child;
149+
const attrs = _.filter(divChild.attrs, o => (o.name === 'hidden' || o.name === 'by-vulcanize'));
143150
if (attrs.length >= 2) {
144-
const _childNodes = self.processChildNodes(child.childNodes);
151+
const _childNodes = self.processChildNodes(divChild.childNodes);
145152
pushNodes = pushNodes.concat(_childNodes);
146153
} else {
147-
return child;
154+
if (divChild.childNodes) {
155+
divChild.childNodes = self.processChildNodes(divChild.childNodes);
156+
}
157+
return divChild;
148158
}
149159
}
150160
break;
151161
case '#comment':
152162
break;
153-
default:
154-
return child;
163+
164+
default: {
165+
const defChild = child;
166+
const attrs = _.map(defChild.attrs, (o) => {
167+
// all src values without [[*]] and {{*}}
168+
if ((o.name === 'src' || o.name === 'src$') && o.value && !o.value.match(/({{|\[\[)\s*[\w\.]+\s*(}}|\]\])/g)) {
169+
const url = self.importableUrl(o.value);
170+
// console.log(defChild.nodeName, o, url);
171+
if (url) {
172+
o.value = path.resolve(path.dirname(`/${self.sourceName}`), o.value);
173+
}
174+
}
175+
return o;
176+
});
177+
defChild.attrs = attrs;
178+
if (defChild.childNodes) {
179+
defChild.childNodes = self.processChildNodes(defChild.childNodes);
180+
}
181+
return defChild;
182+
}
155183
}
156184
return null;
157185
}));

packages/synthesis-file/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Meteor Webcomponents
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)