vaderjs 1.3.3-7722242-hotfix → 1.3.3-7725642-hotfix

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/vader.js +16 -18
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "vaderjs",
3
3
  "description": "A Reactive library aimed to helping you build reactive applications inspired by react.js",
4
4
  "module": "vader.js",
5
- "version": "1.3.3-7722242-hotfix",
5
+ "version": "1.3.3-7725642-hotfix",
6
6
  "bin": {
7
7
  "vader": "./vader.js"
8
8
  },
package/vader.js CHANGED
@@ -143,6 +143,9 @@ function Compiler(func, file) {
143
143
  isJSXComponent = elementTag.match(/^[A-Z]/) ? true : false;
144
144
  }
145
145
  });
146
+ if(isJSXComponent){
147
+ continue
148
+ }
146
149
  // add ; after newlines
147
150
 
148
151
 
@@ -479,9 +482,8 @@ function Compiler(func, file) {
479
482
 
480
483
  let name = component.split("<")[1].split(">")[0].split(" ")[0].replace("/", "");
481
484
  let componentAttributes = component.split("<")[1].split(">")[0].split(" ").join(" ").replace(name, "").trim();
482
- const dynamicAttributesRegex = /(\w+)(?:="([^"]*?)"|='([^']*?)'|(?:=\{([^}]*?)\})?|(?:=\{(.*?)*\})?|(?:={([^}]*?)})?|(?:{([^}]*?)})?|(?:}))?|\$=\s*\{\s*\{\s*([^]*?)\s*\}\s*\}/gs;
483
-
484
-
485
+ // catchall = {...}
486
+ const dynamicAttributesRegex = /(\w+)(?:="([^"]*?)"|='([^']*?)'|(?:=\{(.*?)\})?|(?:=\{(.*?)\})?)(?:\}|(?=\s[\w-]+=))/gs;
485
487
 
486
488
  let props = component.match(dynamicAttributesRegex)
487
489
 
@@ -492,6 +494,7 @@ function Compiler(func, file) {
492
494
 
493
495
  let $_ternaryprops = []
494
496
 
497
+ if(props){
495
498
  for (let prop of props) {
496
499
 
497
500
  if (prop === componentName) {
@@ -499,16 +502,8 @@ function Compiler(func, file) {
499
502
  isWithinComponent = true;
500
503
  filteredProps.push(prop);
501
504
  } else if (isWithinComponent && prop.includes('=')) {
502
-
503
- if (prop.startsWith('$=')) {
504
- let old = prop
505
- prop = prop.replace(/\$\s*=\s*\{\s*\{\s*([^]*?)\s*\}\s*\}/gs, '$1')
506
- component = component.replace(old, '')
507
- componentAttributes = componentAttributes.replace(prop, '')
508
- $_ternaryprops.push(prop)
509
-
510
- }
511
- else if (prop.includes('${')) {
505
+
506
+ if (prop.includes('${')) {
512
507
 
513
508
 
514
509
  prop = prop.replace('="', ':')
@@ -527,14 +522,16 @@ function Compiler(func, file) {
527
522
  if (prop.includes('={')) {
528
523
  let value = prop.split('={')
529
524
  let isObj = value[1].match(/^{.*}$/gs) ? true : false
530
- if (!isObj) {
531
- // remove trailing }
525
+ if (!isObj) {
532
526
  value[1] = value[1].replace(/}\s*$/, '')
527
+ }else if(!value[0].length > 0 && isObj){
528
+ prop = ''
533
529
  }
534
-
530
+
531
+ value[1] = value[1].replace(/}\s*$/, '')
535
532
  if (value[0] == 'style' && isObj) {
536
533
  value[1] = `this.parseStyle(${value[1]})`
537
- }
534
+ }
538
535
  prop = `${value[0]}:${value[1]}`
539
536
  }
540
537
 
@@ -563,6 +560,7 @@ function Compiler(func, file) {
563
560
  isWithinComponent = false;
564
561
  }
565
562
  }
563
+ }
566
564
  component = component.replaceAll(/\s+/g, " ");
567
565
 
568
566
  component = component.replace(componentAttributes, '')
@@ -1239,7 +1237,7 @@ async function Build() {
1239
1237
  scannedPublicFiles.forEach(async (file) => {
1240
1238
  file = file.replace(/\\/g, '/');
1241
1239
  file = file.split('/public/')[1]
1242
- let data = await reader(process.cwd() + "/public/" + file)
1240
+ let data = fs.readFileSync(process.cwd() + "/public/" + file);
1243
1241
  bundleSize += fs.statSync(process.cwd() + "/public/" + file).size;
1244
1242
  await writer(process.cwd() + "/dist/public/" + file, data);
1245
1243
  })