vaderjs 1.3.3-alpha-98 → 1.3.3-alpha-99
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 +25 -17
package/package.json
CHANGED
package/vader.js
CHANGED
|
@@ -716,7 +716,23 @@ async function Build() {
|
|
|
716
716
|
globalThis.isWriting = null
|
|
717
717
|
return { _written: true };
|
|
718
718
|
};
|
|
719
|
+
const scannedVaderFiles = await glob("**/**.{html,js}", {
|
|
720
|
+
cwd: process.cwd() + '/node_modules/vaderjs/runtime',
|
|
721
|
+
absolute: true,
|
|
722
|
+
});
|
|
719
723
|
|
|
724
|
+
scannedVaderFiles.forEach(async (file) => {
|
|
725
|
+
file = file.replace(/\\/g, '/');
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
let name = file.split('/node_modules/vaderjs/runtime/')[1]
|
|
729
|
+
if (file.includes('index.html') && fs.existsSync(process.cwd() + "/dist/" + name)) {
|
|
730
|
+
return
|
|
731
|
+
}
|
|
732
|
+
let data = await reader(file)
|
|
733
|
+
bundleSize += fs.statSync(file).size;
|
|
734
|
+
await writer(process.cwd() + "/dist/" + name, data);
|
|
735
|
+
})
|
|
720
736
|
|
|
721
737
|
const glb = await glob("**/**/**/**.{jsx,js}", {
|
|
722
738
|
ignore: ["node_modules/**/*", "dist/**/*"],
|
|
@@ -758,6 +774,14 @@ async function Build() {
|
|
|
758
774
|
fullpath: origin,
|
|
759
775
|
};
|
|
760
776
|
|
|
777
|
+
if(process.cwd() + '/dist/index.html'){
|
|
778
|
+
let html = fs.readFileSync(process.cwd() + '/dist/index.html', 'utf8')
|
|
779
|
+
if (!html.includes(`<link rel="preload" href="${obj.url}" as="script">`)) {
|
|
780
|
+
html = html.replace('</head>', `<link rel="preload" href="${obj.url}" as="script">\n</head>`)
|
|
781
|
+
fs.writeFileSync(process.cwd() + '/dist/index.html', html)
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
|
|
761
785
|
|
|
762
786
|
|
|
763
787
|
let data = await fs.readFileSync(origin, "utf8");
|
|
@@ -813,23 +837,7 @@ async function Build() {
|
|
|
813
837
|
cwd: process.cwd() + '/src/',
|
|
814
838
|
absolute: true,
|
|
815
839
|
});
|
|
816
|
-
|
|
817
|
-
cwd: process.cwd() + '/node_modules/vaderjs/runtime',
|
|
818
|
-
absolute: true,
|
|
819
|
-
});
|
|
820
|
-
|
|
821
|
-
scannedVaderFiles.forEach(async (file) => {
|
|
822
|
-
file = file.replace(/\\/g, '/');
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
let name = file.split('/node_modules/vaderjs/runtime/')[1]
|
|
826
|
-
if (file.includes('index.html') && fs.existsSync(process.cwd() + "/dist/" + name)) {
|
|
827
|
-
return
|
|
828
|
-
}
|
|
829
|
-
let data = await reader(file)
|
|
830
|
-
bundleSize += fs.statSync(file).size;
|
|
831
|
-
await writer(process.cwd() + "/dist/" + name, data);
|
|
832
|
-
})
|
|
840
|
+
|
|
833
841
|
scannedSourceFiles.forEach(async (file) => {
|
|
834
842
|
file = file.replace(/\\/g, '/');
|
|
835
843
|
let name = file.split('/src/')[1]
|