<commit_before>package pack;

import tannus.io.*;
import tannus.ds.*;
import tannus.sys.*;

import haxe.Json;
import js.Lib.require;

import pack.*;
import pack.Tools.*;

using StringTools;
using tannus.ds.StringUtils;
using Lambda;
using tannus.ds.ArrayTools;
using Slambda;
using pack.Tools;

class PackStandalone extends Task {
    /* Constructor Function */
    public function new(o:TaskOptions, platform:String, arch:String='x64', ?opts:Array<PackagerOptions>):Void {
        super();

        this.go = o;
        this.platform = platform;
        this.arch = arch;
        this.options = buildOptions(opts != null ? opts : []);
        this.adts = new Array();
        adts.push(new pack.adt.Common());
    }

/* === Instance Methods === */

    /**
      * execute [this] Task
      */
    override function execute(done : ?Dynamic->Void):Void {
        var rawOptions = toRaw( options );
        function packCb(error:Null<Dynamic>, appPaths:Array<String>):Void {
            if (error != null) {
                done( error );
            }
            else {
                var bundlePath = Path.fromString(appPaths[0]);
                afterBundle(bundlePath, function() {
                    done();
                });
            }
        }
        pack(rawOptions, packCb);
    }

    /**
      * called after [pack] has finished
      */
    private function afterBundle(path:Path, done:Void->Void):Void {
        done();
    }

    /**
      * called on copy of application
      */
    private function afterCopy(path:Path, electronVersion:String, platform:String, arch:String, done:Void->Void):Void {
        adts.iter.fn(_.path = path);
        adts.batch(function(?error : Dynamic) {
            if (error != null) throw error;
            done();
        });
    }

    /**
      * paths for which [ignore] returns true are ignored
      */
    private function ignore():String->Bool {
        var sglobs:Array<String> = [
            'buildscripts[/*]',
            'releases[/*]',<commit_msg>refactored packer.pack.PackStandalone to assign values to the 'path', 'ps', and 'go' fields of all AppDirTransformers before execution<commit_after>package pack;

import tannus.io.*;
import tannus.ds.*;
import tannus.sys.*;

import haxe.Json;
import js.Lib.require;

import pack.*;
import pack.Tools.*;

using StringTools;
using tannus.ds.StringUtils;
using Lambda;
using tannus.ds.ArrayTools;
using Slambda;
using pack.Tools;

class PackStandalone extends Task {
    /* Constructor Function */
    public function new(o:TaskOptions, platform:String, arch:String='x64', ?opts:Array<PackagerOptions>):Void {
        super();

        this.go = o;
        this.platform = platform;
        this.arch = arch;
        this.options = buildOptions(opts != null ? opts : []);
        this.adts = new Array();
        adts.push(new pack.adt.Common());
    }

/* === Instance Methods === */

    /**
      * execute [this] Task
      */
    override function execute(done : ?Dynamic->Void):Void {
        var rawOptions = toRaw( options );
        function packCb(error:Null<Dynamic>, appPaths:Array<String>):Void {
            if (error != null) {
                done( error );
            }
            else {
                var bundlePath = Path.fromString(appPaths[0]);
                afterBundle(bundlePath, function() {
                    done();
                });
            }
        }
        pack(rawOptions, packCb);
    }

    /**
      * called after [pack] has finished
      */
    private function afterBundle(path:Path, done:Void->Void):Void {
        done();
    }

    /**
      * called on copy of application
      */
    private function afterCopy(path:Path, electronVersion:String, platform:String, arch:String, done:Void->Void):Void {
        adts.iter(function(x) {
            x.path = path;
            x.ps = this;
            x.go = go;
        });
        adts.batch(function(?error : Dynamic) {
            if (error != null) throw error;
            done();
        });
    }

    /**
      * paths for which [ignore] returns true are ignored
      */
    private function ignore():String->Bool {
        var sglobs:Array<String> = [
            'buildscripts[/*]',
            'releases[/*]',
{'fraction_non_alphanumeric': 0.1343389111477728, 'fraction_numerical': 0.0014140938015555031, 'mean_word_length': 2.042293906810036, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1988237', 'n_tokens_mistral': 1238, 'n_tokens_neox': 1232, 'n_words': 286}