binhend 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/code.js +13 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "binhend",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "Nguyen Duc Binh",
package/src/code.js CHANGED
@@ -17,7 +17,7 @@ function getCodeOfDependencies(component, rootPath, metadata) {
17
17
  var htmlTagDeclaration = getHtmlTagDeclaration(dependency);
18
18
 
19
19
  if (dependencyDelaration) {
20
- componentCode = componentCode.replace('{', `{\r\n${dependencyDelaration}\r\n`);
20
+ componentCode = componentCode.replace('{', `{\r\n${dependencyDelaration}`);
21
21
  }
22
22
 
23
23
  var blockCodes = [];
@@ -44,7 +44,7 @@ function getCodeOfDependencies(component, rootPath, metadata) {
44
44
 
45
45
  function getDependencyDelaration(component, rootPath) {
46
46
  var dependencies = getMetadataOfDependencies(component, rootPath);
47
- var codes = [], fullCode = '';
47
+ var codes = [];
48
48
 
49
49
  for (var filePath in dependencies) {
50
50
  var { name, url, type } = dependencies[filePath];
@@ -55,15 +55,16 @@ function getDependencyDelaration(component, rootPath) {
55
55
 
56
56
  var declarationCode = codes.join(',');
57
57
 
58
+ codes = [];
59
+ codes.push(`var Binh = _Binh;`);
60
+
58
61
  if (declarationCode) {
59
- fullCode = [
60
- `var Binh = _Binh;`,
61
- `var${declarationCode};`,
62
- ''
63
- ].join('\r\n');
62
+ codes.push(`var${declarationCode};`);
64
63
  }
65
64
 
66
- return fullCode;
65
+ codes.push('');
66
+
67
+ return codes.join('\r\n');
67
68
  }
68
69
 
69
70
  function getMetadataOfDependencies(component, rootPath) {
@@ -150,7 +151,10 @@ function bundle(component, rootPath) {
150
151
  var codes = [];
151
152
 
152
153
  if (codeOfDependencies) codes.push(codeOfDependencies);
153
- if (componentCode) codes.push(`Binh.${component.type}(${componentCode})${optionCode};`);
154
+ if (componentCode) {
155
+ codes.push(`Binh.${component.type}(${component.type})${optionCode};`);
156
+ codes.push(`${componentCode}`);
157
+ }
154
158
 
155
159
  return codes.join('\r\n');
156
160
  }