binhend 1.4.1 → 1.4.2
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.
- package/package.json +1 -1
- package/src/code.js +6 -2
package/package.json
CHANGED
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
|
|
20
|
+
componentCode = injectFunctionCodeContent(componentCode, dependencyDelaration);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
var blockCodes = [];
|
|
@@ -42,6 +42,10 @@ function getCodeOfDependencies(component, rootPath, metadata) {
|
|
|
42
42
|
return codes.join('\r\n');
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
function injectFunctionCodeContent(functionCodeString, injectionCode) {
|
|
46
|
+
return functionCodeString.replace(/(\(.*\)\s*{|\(.*\)\s*=>\s*{)/, `$1\r\n${injectionCode}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
45
49
|
function getDependencyDelaration(component, rootPath) {
|
|
46
50
|
var dependencies = getMetadataOfDependencies(component, rootPath);
|
|
47
51
|
var codes = [];
|
|
@@ -145,7 +149,7 @@ function bundle(component, rootPath) {
|
|
|
145
149
|
var componentCode = component.toString();
|
|
146
150
|
|
|
147
151
|
if (dependencyDelaration) {
|
|
148
|
-
componentCode = componentCode
|
|
152
|
+
componentCode = injectFunctionCodeContent(componentCode, dependencyDelaration);
|
|
149
153
|
}
|
|
150
154
|
|
|
151
155
|
var codes = [];
|