vaderjs 1.3.3-alpha-24 → 1.3.3-alpha-25
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/runtime/vader.js +6 -3
- package/vader.js +10 -3
package/package.json
CHANGED
package/runtime/vader.js
CHANGED
|
@@ -360,7 +360,7 @@ export class Component {
|
|
|
360
360
|
} else {
|
|
361
361
|
const targetElement = document.querySelector(`[key="${this.key}"]`);
|
|
362
362
|
if (targetElement) {
|
|
363
|
-
targetElement.
|
|
363
|
+
targetElement.outerHTML = this.render();
|
|
364
364
|
} else {
|
|
365
365
|
console.error('Target element not found.');
|
|
366
366
|
}
|
|
@@ -659,6 +659,7 @@ export const require = async (path, noresolve = false) => {
|
|
|
659
659
|
let file = ''
|
|
660
660
|
try {
|
|
661
661
|
file = await fetch(path).then((res) => res.text());
|
|
662
|
+
cache
|
|
662
663
|
} catch (error) {
|
|
663
664
|
console.error(error)
|
|
664
665
|
}
|
|
@@ -683,9 +684,11 @@ export const require = async (path, noresolve = false) => {
|
|
|
683
684
|
file = file.replaceAll(exports, "");
|
|
684
685
|
}
|
|
685
686
|
|
|
686
|
-
|
|
687
|
+
cache[path] = new Function(`return (async () => { ${file} })()`)();
|
|
688
|
+
return cache[path]
|
|
687
689
|
case filetype === "jsx":
|
|
688
|
-
|
|
690
|
+
cache[path] = new Function(`return (async () => { ${file} })()`)();
|
|
691
|
+
return cache[path]
|
|
689
692
|
|
|
690
693
|
}
|
|
691
694
|
};
|
package/vader.js
CHANGED
|
@@ -335,7 +335,7 @@ function Compiler(func) {
|
|
|
335
335
|
if (value && value.includes("={")) {
|
|
336
336
|
value = value.replace("=", "");
|
|
337
337
|
value == "undefined" ? (value = '"') : (value = value);
|
|
338
|
-
|
|
338
|
+
|
|
339
339
|
key == 'style' ? value = `{this.parseStyle({${value.split('{{')[1].split('}}')[0]}})}` : null
|
|
340
340
|
|
|
341
341
|
|
|
@@ -655,11 +655,12 @@ async function Build() {
|
|
|
655
655
|
let obj = {
|
|
656
656
|
url: isBasePath ? '/' : aburl,
|
|
657
657
|
pathname: `/pages/${origin.split('pages/')[1].split('.jsx')[0].replace('.jsx', '')}.jsx`,
|
|
658
|
+
fullpath: origin,
|
|
658
659
|
};
|
|
659
660
|
|
|
660
661
|
// Read and compile file content
|
|
661
662
|
let data = await fs.readFileSync(origin, "utf8");
|
|
662
|
-
data = Compiler(data)
|
|
663
|
+
data = Compiler(data)
|
|
663
664
|
|
|
664
665
|
await writer(process.cwd() + "/dist/pages/" + fileName, data);
|
|
665
666
|
|
|
@@ -677,6 +678,12 @@ async function Build() {
|
|
|
677
678
|
if (!before.includes(`//@desc ${obj.pathname}`)) {
|
|
678
679
|
await writer(process.cwd() + "/dist/app.js", newfile);
|
|
679
680
|
}
|
|
681
|
+
|
|
682
|
+
let beforeHTML = fs.existsSync(process.cwd() + "/dist/index.html") ? await reader(process.cwd() + "/dist/index.html") : '';
|
|
683
|
+
if(!beforeHTML.includes(`<link rel="prefetch" href="/pages/${origin.split('pages/')[1] }" as="fetch">`)){
|
|
684
|
+
let newHTML = beforeHTML + `\n<link rel="prefetch" href="/pages/${origin.split('pages/')[1] }" as="fetch">`
|
|
685
|
+
await writer(process.cwd() + "/dist/index.html", newHTML);
|
|
686
|
+
}
|
|
680
687
|
}
|
|
681
688
|
|
|
682
689
|
|
|
@@ -709,7 +716,7 @@ async function Build() {
|
|
|
709
716
|
|
|
710
717
|
let data = await reader(process.cwd() + "/src/" + name)
|
|
711
718
|
if (name.includes('.jsx')) {
|
|
712
|
-
data = Compiler(data)
|
|
719
|
+
data = Compiler(data)
|
|
713
720
|
}
|
|
714
721
|
bundleSize += fs.statSync(process.cwd() + "/src/" + name).size;
|
|
715
722
|
await writer(process.cwd() + "/dist/src/" + name, data);
|