mirror of
https://github.com/amark/gun.git
synced 2025-09-13 13:00:11 +00:00

* Thank you Murage Martin @murageyun for donating!!! * Fix opt.s3.fakes3 parsing issue (#1318) * Fix opt.s3.fakes3 parsing issue * Fix second typo within if block * Support variable number of auth retry attempts through opt.retries (#1325) Maintain default to 9 to ensure backwards compatibility * Thanks Jason Stallings @octalmage !!! * Remove unused imports (#1337) * Update README.md * yay format change * encode objects * WS ws.path fix (#1343) * Update wire.js * Update wire.js * Update wire.js * add one click deploy to readme (#1342) * update src/index (#1254) * update src/index * update * src/index fix * added src/core * is ??? this a MVP of book & rad ???? thanks to @rogowski * book & rad APIs stabilizing * RAD & Book promoted! + buggy example: test/rad/book.html * bump path * cleaned up Book results & sorting & caching * sea blobs! (#1353) * sea blobs! * and null origins * null fix * null check is last * add a way to select stats file from url (#1351) * react-native detection, and load needed shims (#1349) * react-native detection * added lib mobile * changed back to gun. for another solution * have unbuild function wrap to prevent scope leaks & allow RETURN hehehe so I can reject @bmatusiak 's lS change O:) O:) I love you you're a hero! later with @bmatusiak check sea.then for '../gun.js' vs '../' vs ... note: src/index -> core.js TODO: something about WebRTC candidates hitting ack decrement limits? * quick-fix (#1355) * Fix SEA certificate verification, allow multiple pubs (#1358) * Create SECURITY.md (#1364) * ... works (#1357) * Loading fix (#1356) * does this load better * check window.Gun too in rfs * update SECURITY.md file and change the versions to 0.2020.x (#1365) * webrtc accept getUserMedia streams as peer * Check atom exists in graph when deciding to read from disk (#1371) * fix: ERROR: Radisk needs `store.put` interface (#1374) * Update STUN servers (#1381) Commented out sipgate.net STUN server. Added Cloudflare STUN server. * universal notification system --------- Co-authored-by: ritchia1 <andrew.ritchie@estimateone.com> Co-authored-by: Anton <dev@atjn.dk> Co-authored-by: Bradley Matusiak <bmatusiak@gmail.com> Co-authored-by: Jay Byoun <jay8061@pm.me> Co-authored-by: mimiza <dev@mimiza.com> Co-authored-by: Simardeep Singh <1003simar@gmail.com> Co-authored-by: Malcolm Blaney <mblaney@gmail.com> Co-authored-by: Andreas Heissenberger <andreas@heissenberger.at> Co-authored-by: carlin978 <120719190+carlin978@users.noreply.github.com>
124 lines
2.4 KiB
JavaScript
124 lines
2.4 KiB
JavaScript
var fs = require('fs');
|
|
var nodePath = require('path');
|
|
|
|
var dir = __dirname + '/../';
|
|
|
|
var read = function(path){
|
|
return fs.readFileSync(nodePath.join(dir, path)).toString();
|
|
}
|
|
|
|
var write = function(path, data){
|
|
return fs.writeFileSync(nodePath.join(dir, path), data);
|
|
}
|
|
|
|
var rm = require('./fsrm');
|
|
|
|
var mk = function(path){
|
|
path = nodePath.join(dir, path);
|
|
if(fs.existsSync(path)){ return }
|
|
fs.mkdirSync(path);
|
|
}
|
|
|
|
var rn = function(path, newPath){
|
|
path = nodePath.join(dir, path)
|
|
newPath = nodePath.join(dir, newPath)
|
|
if(fs.existsSync(newPath)){ return }
|
|
fs.renameSync(path, newPath);
|
|
}
|
|
|
|
var between = function(text, start, end){
|
|
end = end || start;
|
|
var s = text.indexOf(start);
|
|
if(s < 0){ return ''}
|
|
s += start.length;
|
|
var e = text.indexOf(end, s);
|
|
if(e < 0){ return '' }
|
|
var code = text.slice(s, e);
|
|
return {s: s, t: code, e: e};
|
|
}
|
|
|
|
var next = function(start, end){
|
|
end = end || start;
|
|
if(!next.text){
|
|
next.text = start;
|
|
return;
|
|
}
|
|
var code = between(next.text, start, end);
|
|
next.text = next.text.slice(code.e + end.length);
|
|
return code.t;
|
|
}
|
|
|
|
var path = function(p){
|
|
var code = next(',', ')');
|
|
var path;
|
|
try{path = eval(code);
|
|
}catch(e){console.log("fail", e)};
|
|
if(!path){ return }
|
|
if('.js' !== path.slice(-3)){
|
|
path += '.js';
|
|
}
|
|
return nodePath.join('./'+(p||'src'), path);
|
|
}
|
|
|
|
var undent = function(code, n){
|
|
var regex = /\n\t\t/g;
|
|
if(1 === n){
|
|
regex = /\n\t/g;
|
|
}
|
|
return code.replace(regex, '\n');
|
|
}
|
|
|
|
;(function(){
|
|
|
|
var arg = process.argv[2] || 'gun';
|
|
|
|
var g;
|
|
if('gun' === arg){
|
|
g = 'gun';
|
|
rn('./src','./old_src');
|
|
mk('./src');
|
|
mk('./src/polyfill');
|
|
mk('./src/adapters');
|
|
} else {
|
|
g = arg;
|
|
rn('./'+arg,'./old_'+arg);
|
|
mk('./'+arg);
|
|
}
|
|
console.log("unbuild:", arg+'.js')
|
|
|
|
var f = read(arg+'.js');
|
|
var code = next(f);
|
|
|
|
|
|
code = next("/* UNBUILD */");
|
|
|
|
if('gun' === g){
|
|
write('src/polyfill/unbuild.js', undent(code, 1));
|
|
arg = '';
|
|
}
|
|
|
|
(function recurse(c){
|
|
code = next(";USE(function(module){", "})(USE");
|
|
if(!code){ return }
|
|
var file = path(arg);
|
|
if(!file){ return }
|
|
code = code.replace(/\bUSE\(/g, 'require(');
|
|
code = undent(code);
|
|
var rcode;
|
|
try{ rcode = read('old_'+file); } catch(e){}
|
|
// console.log(rcode);
|
|
if(rcode != code){
|
|
console.log("unbuild:","update",file);
|
|
}
|
|
code = ";(function(){\n"+code+"\n}());";
|
|
write(file, code);
|
|
recurse();
|
|
}());
|
|
if('gun' === g){
|
|
rm('./old_src');
|
|
}else{
|
|
rm('./old_'+g);
|
|
}
|
|
|
|
}());
|