Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if ( sources[i].indexOf( "clipper.js") === -1 ) {
jshint.JSHINT( source, { evil : true, esversion: 6, loopfunc : true } );
jshint.JSHINT.errors.forEach( function( error ) {
if ( !error ) return;
var evidence=error.evidence ? " ( '" + error.evidence.substring( 0, 10 ) + " )'" : "";
console.log( sources[i] + ", line " + error.line + " char " + error.character + ": " + error.reason + evidence );
} );
}
var name;
if ( source.indexOf( "function vgMain" ) !== -1 ) name="main.js";
else name=path.basename( sources[i] );
out.sources[name]=lzString.compressToBase64( source );
}
// --- Images
out.images={};
var images=extractTokenList( lines, "images", "," );
for ( var i=0; i < images.length; ++i )
{
var image=base64Image( path.join( dir, images[i] ) );
if ( !image || !image.length ) { console.log( "Error: image file \"" + images[i] + "\" not found." ); return; }
var name=path.basename( images[i] );
out.images[name]=image;
}
// --- ImageDirs
// --- SVGDirs
var svgDirs=extractTokenList( lines, "svgDir", "," );
for ( var i=0; i < svgDirs.length; ++i )
{
var svgPath=path.join( dir, svgDirs[i] );
var files=fs.readdirSync( svgPath );
for ( var p=0; p < files.length; ++p )
{
var svgPath=path.join( dir, svgDirs[i], files[p] );
var svg=fs.readFileSync( svgPath ).toString();
if ( !svg || !svg.length ) { console.log( "Error: SVG file \"" + files[p] + "\" not found." ); return; }
var name=path.basename( files[p] );
out.svg[name]=lzString.compressToBase64( svg );
}
}
// --- Html
out.texts={};
var html=extractTokenList( lines, "html", "," );
for ( var i=0; i < html.length; ++i )
{
var source=fs.readFileSync( path.join( dir, html[i] ) ).toString();
if ( !source || !source.length ) { this.errorLog( "Error: html file \"" + html[i] + "\" not found." ); return; }
var name=path.basename( html[i], '.html' );
out.texts[name]=lzString.compressToBase64( source );
}
const compress = (string: string) =>
LZString.compressToBase64(string)
.replace(/\+/g, "-") // Convert '+' to '-'
.replace(/\//g, "_") // Convert '/' to '_'
.replace(/=+$/, ""); // Remove ending '='
function compress(object) {
return LZString.compressToBase64(JSON.stringify(object))
.replace(/\+/g, '-') // Convert '+' to '-'
.replace(/\//g, '_') // Convert '/' to '_'
.replace(/=+$/, ''); // Remove ending '='
}
function compress(input: string) {
return LZString.compressToBase64(input)
.replace(/\+/g, `-`) // Convert '+' to '-'
.replace(/\//g, `_`) // Convert '/' to '_'
.replace(/=+$/, ``); // Remove ending '='
}
var source=fs.readFileSync( path.join( dir, htmlDirs[i], files[p] ) ).toString();
if ( !source || !source.length ) { this.errorLog( "Error: html file \"" + files[p] + "\" not found." ); return; }
var name=path.basename( files[p], '.html' );
out.texts[name]=lzString.compressToBase64( source );
}
}
// --- Google Analytics
out.googleAnalytics="";
var ga=extractTokenList( lines, "googleAnalytics" );
if ( ga.length ) {
var source=fs.readFileSync( path.join( dir, ga[0] ) ).toString();
out.googleAnalytics=lzString.compressToBase64( source );
}
// --- Fav Icon
var webIcon=extractTokenList( lines, "webIcon" );
if ( webIcon.length ) {
var webIcon=fs.readFileSync( path.join( dir, webIcon[0] ) ).toString();
}
// --- Build Docs
if ( docDir && docDir.length )
buildDocs( docDir, out );
// --- Save it
outFile="VG.App=" + JSON.stringify( out );
@action('获取压缩的配置信息') getZipSettingData() {
console.log(JSON.parse(JSON.stringify(this.globalSetting)))
return LZString.compressToBase64(JSON.stringify(this.globalSetting))
}
onError: (payload, error) => {
if (error && error.message && error.message.indexOf('The play() request was'
+ ' interrupted by a call to pause()') >= 0) {
return false
}
payload.console.push({
message: lzString.compressToBase64(this.view.blockly.generatedJs),
severity: 'log',
timestamp: new Date().toISOString(),
})
payload.console.push({
message: lzString.compressToBase64(this.view.blockly.blocksXmlStr),
severity: 'log',
timestamp: new Date().toISOString(),
})
payload.console.push({
message: lzString.compressToBase64(
Blockly.Xml.domToPrettyText(Blockly.Xml.workspaceToDom(Blockly.mainWorkspace))),
severity: 'log',
timestamp: new Date().toISOString(),
})
return true
},
})
value: function getIncrementComponentsInfo() {
var _this9 = this;
var cloneComponents = JSON.parse(JSON.stringify(this.viewport.components));
Object.keys(cloneComponents).map(function (key) {
cloneComponents[key] = _this9.applicationAction.cleanComponent(cloneComponents[key]);
});
return LZString.compressToBase64(JSON.stringify(cloneComponents));
}
}, {