@rws-framework/client 2.10.3 → 2.10.4
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
CHANGED
|
@@ -22,6 +22,8 @@ module.exports = async function(content) {
|
|
|
22
22
|
|
|
23
23
|
const htmlMinify = this._compiler.options.htmlMinify || true;
|
|
24
24
|
|
|
25
|
+
|
|
26
|
+
|
|
25
27
|
const RWSViewRegex = /(@RWSView\([^)]*)\)/;
|
|
26
28
|
const tsSourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
27
29
|
|
|
@@ -36,10 +38,13 @@ module.exports = async function(content) {
|
|
|
36
38
|
|
|
37
39
|
const decoratorData = tools.extractRWSViewArguments(tsSourceFile);
|
|
38
40
|
|
|
41
|
+
|
|
39
42
|
if(!decoratorData){
|
|
40
43
|
return content;
|
|
41
44
|
}
|
|
42
45
|
|
|
46
|
+
|
|
47
|
+
|
|
43
48
|
if(decoratorData.options){
|
|
44
49
|
if(decoratorData.options.template){
|
|
45
50
|
templatePath = decoratorData.options.template;
|
|
@@ -74,7 +79,7 @@ module.exports = async function(content) {
|
|
|
74
79
|
if(tagName){
|
|
75
80
|
const templateName = 'template';
|
|
76
81
|
const templatePath = path.dirname(filePath) + `/${templateName}.html`;
|
|
77
|
-
|
|
82
|
+
|
|
78
83
|
const templateExists = fs.existsSync(templatePath);
|
|
79
84
|
|
|
80
85
|
let template = 'const rwsTemplate: null = null;';
|
|
@@ -104,11 +109,12 @@ let rwsTemplate: any = T.html\`${templateContent}\`;
|
|
|
104
109
|
this.addDependency(templatePath);
|
|
105
110
|
}
|
|
106
111
|
|
|
107
|
-
const viewReg = /@RWSView\(['
|
|
112
|
+
const viewReg = /@RWSView\(["']([^"']+)["'].*\)\s*export\s+class\s+([a-zA-Z0-9_-]+)\s+extends\s+RWSViewComponent/gm
|
|
108
113
|
|
|
109
114
|
let m;
|
|
110
115
|
let className = null;
|
|
111
116
|
|
|
117
|
+
|
|
112
118
|
while ((m = viewReg.exec(processedContent)) !== null) {
|
|
113
119
|
// This is necessary to avoid infinite loops with zero-width matches
|
|
114
120
|
if (m.index === viewReg.lastIndex) {
|
|
@@ -121,7 +127,11 @@ let rwsTemplate: any = T.html\`${templateContent}\`;
|
|
|
121
127
|
className = match;
|
|
122
128
|
}
|
|
123
129
|
});
|
|
124
|
-
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if(filePath === '/app/frontend/rws/src/components/exampleRws/component.ts'){
|
|
133
|
+
console.log({className, processedContent});
|
|
134
|
+
}
|
|
125
135
|
|
|
126
136
|
if(className){
|
|
127
137
|
const replacedViewDecoratorContent = processedContent.replace(
|
|
@@ -129,7 +139,10 @@ let rwsTemplate: any = T.html\`${templateContent}\`;
|
|
|
129
139
|
`@RWSView('$1', null, { template: rwsTemplate, styles${addedParams.length? ', options: {' + (addedParams.join(', ')) + '}': ''} })\nclass $2 extends RWSViewComponent `
|
|
130
140
|
);
|
|
131
141
|
processedContent = `${template}\n${styles}\n${addedParamDefs.join('\n')}\n` + replacedViewDecoratorContent;
|
|
132
|
-
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
133
146
|
|
|
134
147
|
processedContent = `${htmlFastImports ? htmlFastImports + '\n' : ''}${processedContent}`;
|
|
135
148
|
}
|