vaderjs 1.3.3-7725642-hotfix → 1.3.3-777562-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.
- package/package.json +1 -1
- package/vader.js +45 -89
package/package.json
CHANGED
package/vader.js
CHANGED
|
@@ -482,11 +482,17 @@ function Compiler(func, file) {
|
|
|
482
482
|
|
|
483
483
|
let name = component.split("<")[1].split(">")[0].split(" ")[0].replace("/", "");
|
|
484
484
|
let componentAttributes = component.split("<")[1].split(">")[0].split(" ").join(" ").replace(name, "").trim();
|
|
485
|
-
// catchall = {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
let props = component.
|
|
485
|
+
// catchall = "" ={} =[]
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
let props = component.split("<")[1].split(">")[0]
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
const dynamicAttributesRegex = /([a-zA-Z0-9_-]+)\s*=\s*("(?:[^"\\]*(?:\\.[^"\\]*)*)"|'(?:[^'\\]*(?:\\.[^'\\]*)*)'|\{(?:[^{}]|(?:\{(?:[^{}]|(?:\{.*.*\})*)*\})*)*\}|(?:\([^)]*\)|()\s*=>\s*(?:\{.*\})?|\{[^}]*\})|\[[^\]]*\])/gs;
|
|
489
492
|
|
|
493
|
+
const attributeObject = {};
|
|
494
|
+
|
|
495
|
+
|
|
490
496
|
let filteredProps = [];
|
|
491
497
|
let isWithinComponent = false;
|
|
492
498
|
let componentName = name
|
|
@@ -494,73 +500,32 @@ function Compiler(func, file) {
|
|
|
494
500
|
|
|
495
501
|
let $_ternaryprops = []
|
|
496
502
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
} else if (isWithinComponent && prop.includes('=')) {
|
|
505
|
-
|
|
506
|
-
if (prop.includes('${')) {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
prop = prop.replace('="', ':')
|
|
510
|
-
if (prop.includes('${')) {
|
|
511
|
-
prop = prop.replace('="', ':')
|
|
512
|
-
prop = prop.replace('${', '')
|
|
513
|
-
}
|
|
514
|
-
if (prop.includes('="${{')) {
|
|
515
|
-
prop = prop.replace('${{', '{')
|
|
516
|
-
prop = prop.replace('}}', '}')
|
|
517
|
-
prop = prop.replace('="', ':')
|
|
518
|
-
prop = prop.replace('}"', '}')
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
}
|
|
522
|
-
if (prop.includes('={')) {
|
|
523
|
-
let value = prop.split('={')
|
|
524
|
-
let isObj = value[1].match(/^{.*}$/gs) ? true : false
|
|
525
|
-
if (!isObj) {
|
|
526
|
-
value[1] = value[1].replace(/}\s*$/, '')
|
|
527
|
-
}else if(!value[0].length > 0 && isObj){
|
|
528
|
-
prop = ''
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
value[1] = value[1].replace(/}\s*$/, '')
|
|
532
|
-
if (value[0] == 'style' && isObj) {
|
|
533
|
-
value[1] = `this.parseStyle(${value[1]})`
|
|
534
|
-
}
|
|
535
|
-
prop = `${value[0]}:${value[1]}`
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
if (prop.includes('function') || prop.includes('=>')) {
|
|
539
|
-
// parse 'function' to function
|
|
540
|
-
prop = prop.replace("'", '')
|
|
541
|
-
|
|
542
|
-
if (prop.endsWith("}'")) {
|
|
543
|
-
prop = prop.replace("}'", '}')
|
|
544
|
-
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
prop = prop.replace('=function', ':function')
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
filteredProps.push(prop);
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
} else if (isWithinComponent && prop.includes('}')) {
|
|
555
|
-
|
|
503
|
+
let match;
|
|
504
|
+
let propstring = ''
|
|
505
|
+
// props right now is just a string with all of them on one line and a space between each
|
|
506
|
+
while ((match = dynamicAttributesRegex.exec(props)) !== null) {
|
|
507
|
+
let str = match[0].trim().replace(/\s+/g, " ");
|
|
508
|
+
if(!str.includes('=')){
|
|
509
|
+
continue
|
|
556
510
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
511
|
+
str = str.split('=')
|
|
512
|
+
let key = str[0].trim()
|
|
513
|
+
let value = str[1].trim()
|
|
514
|
+
if(value.startsWith('"') && !value.endsWith('"') || value.startsWith("'") && !value.endsWith("'")
|
|
515
|
+
|| value.startsWith('`') && !value.endsWith('`')){
|
|
516
|
+
// wrap in respective quotes
|
|
517
|
+
value = value + value[0]
|
|
561
518
|
}
|
|
562
|
-
|
|
563
|
-
|
|
519
|
+
let isObject = value.startsWith('{{') && value.endsWith('}}')
|
|
520
|
+
if(isObject){
|
|
521
|
+
value = value.split('{{')[1].split('}}')[0].trim()
|
|
522
|
+
value = `{${value}}`
|
|
523
|
+
} else{
|
|
524
|
+
// remove starting { and ending } using regex
|
|
525
|
+
value = value.replace(/^{/, '').replace(/}$/, '')
|
|
526
|
+
}
|
|
527
|
+
propstring += `${key}:${value},`
|
|
528
|
+
}
|
|
564
529
|
component = component.replaceAll(/\s+/g, " ");
|
|
565
530
|
|
|
566
531
|
component = component.replace(componentAttributes, '')
|
|
@@ -570,8 +535,8 @@ function Compiler(func, file) {
|
|
|
570
535
|
|
|
571
536
|
let children = new RegExp(`<${name}[^>]*>([^]*)<\/${name}>`, 'gs').exec(component)?.[1] || null;
|
|
572
537
|
|
|
573
|
-
|
|
574
|
-
|
|
538
|
+
|
|
539
|
+
|
|
575
540
|
let savedname = name;
|
|
576
541
|
|
|
577
542
|
|
|
@@ -601,26 +566,17 @@ function Compiler(func, file) {
|
|
|
601
566
|
}
|
|
602
567
|
});
|
|
603
568
|
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
propstring = propstring.replace(/,$/, '')
|
|
604
572
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
props = props.replaceAll(`,${savedname}`, '').replaceAll(savedname, '')
|
|
608
|
-
if (props.startsWith(',')) {
|
|
609
|
-
props = props.replace(',', '')
|
|
610
|
-
}
|
|
611
|
-
props = props.replaceAll("='", ":'")
|
|
612
|
-
.replaceAll('=`', ':`')
|
|
613
|
-
.replaceAll('="', ':"')
|
|
614
|
-
.replaceAll('={', ':')
|
|
615
|
-
|
|
616
|
-
|
|
573
|
+
|
|
617
574
|
/**
|
|
618
575
|
* @memoize - memoize a component to be remembered on each render and replace the old jsx
|
|
619
|
-
*/
|
|
620
|
-
|
|
576
|
+
*/
|
|
621
577
|
|
|
622
578
|
let replace = "";
|
|
623
|
-
replace = `\${this.memoize(this.createComponent(${savedname}, {${
|
|
579
|
+
replace = `\${this.memoize(this.createComponent(${savedname}, {${propstring}}, [\`${myChildrens.join('')}\`]))}`;
|
|
624
580
|
|
|
625
581
|
|
|
626
582
|
body = body.replace(before, replace);
|
|
@@ -1378,7 +1334,7 @@ switch (true) {
|
|
|
1378
1334
|
globalThis.devMode = true
|
|
1379
1335
|
globalThis.isProduction = false
|
|
1380
1336
|
console.log(`
|
|
1381
|
-
Vader.js
|
|
1337
|
+
Vader.js v${fs.readFileSync(process.cwd() + '/node_modules/vaderjs/package.json', 'utf8').split('"version": "')[1].split('"')[0]}
|
|
1382
1338
|
- Watching for changes in ./pages
|
|
1383
1339
|
- Watching for changes in ./src
|
|
1384
1340
|
- Watching for changes in ./public
|
|
@@ -1418,7 +1374,7 @@ Vader.js v1.3.3
|
|
|
1418
1374
|
globalThis.isProduction = true
|
|
1419
1375
|
globalThis.routeStates = []
|
|
1420
1376
|
console.log(`
|
|
1421
|
-
Vader.js
|
|
1377
|
+
Vader.js v${fs.readFileSync(process.cwd() + '/node_modules/vaderjs/package.json', 'utf8').split('"version": "')[1].split('"')[0]}
|
|
1422
1378
|
Building to ./dist
|
|
1423
1379
|
`)
|
|
1424
1380
|
if (fs.existsSync(process.cwd() + '/dist/src/maps')) {
|
|
@@ -1432,7 +1388,7 @@ Building to ./dist
|
|
|
1432
1388
|
process.env.PORT = port
|
|
1433
1389
|
globalThis.devMode = false
|
|
1434
1390
|
console.log(`
|
|
1435
|
-
Vader.js
|
|
1391
|
+
Vader.js v${fs.readFileSync(process.cwd() + '/node_modules/vaderjs/package.json', 'utf8').split('"version": "')[1].split('"')[0]}
|
|
1436
1392
|
Serving ./dist on port ${port}
|
|
1437
1393
|
url: http://localhost:${port}
|
|
1438
1394
|
`)
|