add sourcecode to bundle

This commit is contained in:
Milan Hauth 2020-09-26 15:16:25 +02:00
parent 7c25e8846d
commit 287d9de49d
2 changed files with 34 additions and 7 deletions

View file

@ -9,13 +9,13 @@
"inline": "inliner http://0.0.0.0:5000/alchi-maps.html >alchi-maps.inlined.html"
},
"devDependencies": {
"@babel/cli": "^7.10.5",
"@babel/core": "^7.11.4",
"@babel/cli": "^7.11.5",
"@babel/core": "^7.11.5",
"@rollup/plugin-commonjs": "^15.0.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"inliner": "^1.13.1",
"mime-types": "^2.1.27",
"rollup": "^2.26.7",
"rollup": "^2.26.9",
"rollup-plugin-livereload": "^2.0.0",
"rollup-plugin-serve": "^1.0.4",
"rollup-plugin-svelte": "^6.0.0",
@ -24,8 +24,9 @@
"sirv-cli": "^1.0.6",
"svelte": "^3.24.1",
"svelte-preval": "github:milahu/svelte-preval",
"tosource": "^2.0.0-alpha.2",
"sync-promise": "^1.1.0",
"sync-rpc": "^1.3.6",
"terser": "^5.3.0",
"sync-rpc": "^1.3.6"
"tosource": "^2.0.0-alpha.2"
}
}

View file

@ -1550,7 +1550,7 @@
// opposite of bodyPosStatic array
let posInFromOut = preval(() => Array.from(Array(4).keys())
.map((x) => Array.from(Array(4).keys())
.map((y) => [x, y])))
.map((y) => [x, y])));
@ -4356,7 +4356,33 @@ console.log(`flipBodies: doAnimateMoves is`, doAnimateMoves);
});
window.sourceCode = preval(
({baseDir}) => {
const sourceFileĹist = [
'src/AlchiMaps.svelte',
'src/main.js',
'src/alchi.js',
'src/colorTable.cjs',
'rollup.config.js',
'package.json',
'README.md',
'LICENSE',
'public/alchi-maps.html',
'public/index.html',
];
const fs = require('fs');
return sourceFileĹist.reduce(
(acc, sourceFile) => {
acc[sourceFile] = fs.readFileSync(
baseDir+'/'+sourceFile, {
encoding: 'utf-8',
});
return acc;
},
{}
);
}
);
</script>