binhend 1.4.2 → 1.4.3

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 +5 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "binhend",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "Nguyen Duc Binh",
package/src/code.js CHANGED
@@ -43,7 +43,7 @@ function getCodeOfDependencies(component, rootPath, metadata) {
43
43
  }
44
44
 
45
45
  function injectFunctionCodeContent(functionCodeString, injectionCode) {
46
- return functionCodeString.replace(/(\(.*\)\s*{|\(.*\)\s*=>\s*{)/, `$1\r\n${injectionCode}`);
46
+ return functionCodeString.replace(/(\(.*?\)\s*{|\(.*?\)\s*=>\s*{)/, `$1\r\n${injectionCode}`);
47
47
  }
48
48
 
49
49
  function getDependencyDelaration(component, rootPath) {
@@ -143,7 +143,6 @@ function getRelativeFilePath(filePath, rootPath) {
143
143
  getRelativeFilePath.cache = {};
144
144
 
145
145
  function bundle(component, rootPath) {
146
- var codeOfDependencies = getCodeOfDependencies(component, rootPath);
147
146
  var dependencyDelaration = getDependencyDelaration(component, rootPath);
148
147
  var optionCode = generateOptionCode(component, '', rootPath);
149
148
  var componentCode = component.toString();
@@ -154,11 +153,13 @@ function bundle(component, rootPath) {
154
153
 
155
154
  var codes = [];
156
155
 
157
- if (codeOfDependencies) codes.push(codeOfDependencies);
158
156
  if (componentCode) {
159
157
  codes.push(`Binh.${component.type}(${component.type})${optionCode};`);
160
- codes.push(`${componentCode}`);
158
+ codes.push(`${componentCode}\r\n`);
161
159
  }
160
+
161
+ var codeOfDependencies = getCodeOfDependencies(component, rootPath);
162
+ if (codeOfDependencies) codes.push(codeOfDependencies);
162
163
 
163
164
  return codes.join('\r\n');
164
165
  }