bin/appcache-manifest.js
function generate(globs, options, callback) {
    if (generationQueue.size > 0) {
        // There is a process not started.
        return
    }
    if (typeof options.delay === "number") {
        generationQueue.push(next => setTimeout(next, options.delay))
    }
    generationQueue.push(next => {
        //eslint-disable-next-line require-jsdoc
        function done(err) {
            if (err != null) {
                process.exitCode = 1
                console.error(`  ERROR: ${err.message}`)
            }
            if (options.verbose && err == null) {
                console.log("  Done.")
            }

            next()

            if (callback != null) {
                callback(err)
            }
        }

        const appcacheStream = createAppcacheStream(globs, options)
        if (options.verbose) {
            console.log(`Generate: ${options.output}`)
            appcacheStream
                .on("addpath", (e) => console.log(`  Add: ${e.path}`))
                .on("addhash", (e) => console.log(`  Add fingerprint: ${e.digest}`))
        }

        // Pipe to output.
        if (options.output) {
            const dir = path.dirname(path.resolve(options.output))
            mkdir(dir, (err) => {
                if (err != null) {
                    done(err)
                }
                else {
                    appcacheStream
                        .pipe(fs.createWriteStream(options.output))
                        .on("finish", done)
                        .on("error", done)
                }
            })
        }
        else {
            appcacheStream
                .on("end", done)
                .pipe(process.stdout)
        }
    })
}
function generate(globs, options, callback) {
    if (generationQueue.size > 0) {
        // There is a process not started.
        return
    }
    if (typeof options.delay === "number") {
        generationQueue.push(next => setTimeout(next, options.delay))
    }
    generationQueue.push(next => {
        //eslint-disable-next-line require-jsdoc
        function done(err) {
            if (err != null) {
                process.exitCode = 1
                console.error(`  ERROR: ${err.message}`)
            }
            if (options.verbose && err == null) {
                console.log("  Done.")
            }

            next()

            if (callback != null) {
                callback(err)
            }
        }

        const appcacheStream = createAppcacheStream(globs, options)
        if (options.verbose) {
            console.log(`Generate: ${options.output}`)
            appcacheStream
                .on("addpath", (e) => console.log(`  Add: ${e.path}`))
                .on("addhash", (e) => console.log(`  Add fingerprint: ${e.digest}`))
        }

        // Pipe to output.
        if (options.output) {
            const dir = path.dirname(path.resolve(options.output))
            mkdir(dir, (err) => {
                if (err != null) {
                    done(err)
                }
                else {
                    appcacheStream
                        .pipe(fs.createWriteStream(options.output))
                        .on("finish", done)
                        .on("error", done)
                }
            })
        }
        else {
            appcacheStream
                .on("end", done)
                .pipe(process.stdout)
        }
    })
}
function generate ( globs , options , callback ) { if ( generationQueue . size > 0 ) { // There is a process not started. return } if ( typeof options . delay === "number" ) { generationQueue . push ( next => setTimeout ( next , options . delay ) ) } generationQueue . push ( next => { //eslint-disable-next-line require-jsdoc function done ( err ) { if ( err != null ) { process . exitCode = 1 console . error ( ` ${ err . message } ` ) } if ( options . verbose && err == null ) { console . log ( "  Done." ) } next ( ) if ( callback != null ) { callback ( err ) } } const appcacheStream = createAppcacheStream ( globs , options ) if ( options . verbose ) { console . log ( ` ${ options . output } ` ) appcacheStream . on ( "addpath" , ( e ) => console . log ( ` ${ e . path } ` ) ) . on ( "addhash" , ( e ) => console . log ( ` ${ e . digest } ` ) ) } // Pipe to output. if ( options . output ) { const dir = path . dirname ( path . resolve ( options . output ) ) mkdir ( dir , ( err ) => { if ( err != null ) { done ( err ) } else { appcacheStream . pipe ( fs . createWriteStream ( options . output ) ) . on ( "finish" , done ) . on ( "error" , done ) } } ) } else { appcacheStream . on ( "end" , done ) . pipe ( process . stdout ) } } ) }
Generate appcache manifest.

@param {string[]} globs - The globs which specifies the target files.
@param {object} options - The option object.
@param {function} callback - The callback function.
@returns {void}
@private
Generate appcache manifest .