{"version":3,"sources":["jsdelivr-header.js","/npm/build-haxe-wrapper@1.2.0/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;ACLA,MAAM,UAAY,QAAQ,aACpB,QAAU,IAAI,UAAU,QAC9B,IAAI,MAAQ,QAAQ,WAEpB,SAAS,uBACA,MAAM,MAAM,SACb,MAAM,KAAK,qBACX,MAAM,KAAK,IAGV,MAAM,MAAM,UACb,MAAM,KAAK,yBACX,MAAM,KAAK,GAEnB,CAEA,SAAS,oBACL,IAAI,EAAa,UACb,MAAM,MAAM,SACZ,MAAM,KAAK,oBACX,EAAa,4BAEb,MAAM,KAAK,KAAM,gBACjB,MAAM,KAAK,6BACX,MAAM,KAAK,GAAG,iBAElB,MAAM,KAAK,GAAG,aAEV,MAAM,KAAK,KAAM,mBACjB,MAAM,KAAK,6CACX,MAAM,KAAK,GAAG,uCAEd,MAAM,KAAK,0BACX,MAAM,KAAK,GAEnB,CAEA,QACK,QAAQ,SACR,YAAY,uEACZ,QAAO,WACJ,uBACA,mBACJ,IAEJ,QACK,QAAQ,SACR,YAAY,6DACZ,OAAO,kBAAmB,8CAC1B,UAAU,UACV,QAAO,SAAS,EAAM,GACnB,IAAK,EAAK,SAAS,SAAU,CACzB,IAAI,EAAe,GAAG,uBACtB,MAAM,KAAK,GACX,MAAM,KAAK,EACf,CAEA,uBACI,EAAO,YACP,oBAEJ,IAAI,EAAU,OACV,MAAM,MAAM,SACZ,MAAM,KAAK,oBACX,EAAU,yBAEd,MAAM,KAAK,iBACX,IAAI,EAAe,GAAG,KAAW,IACjC,MAAM,KAAK,EACf,IAEJ,QAAQ,MAAM,QAAQ","file":"/npm/build-haxe-wrapper@1.2.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/build-haxe-wrapper@1.2.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","#!/usr/bin/env node\r\nconst commander = require('commander');\r\nconst program = new commander.Command();\r\nvar shell = require('shelljs');\r\n\r\nfunction validateDependencies() {\r\n    if (!shell.which('git')) {\r\n        shell.echo('git not installed');\r\n        shell.exit(1);\r\n    }\r\n\r\n    if (!shell.which('haxe')) {\r\n        shell.echo('haxe is not installed');\r\n        shell.exit(1);\r\n    }\r\n}\r\n\r\nfunction buildDependencies() {\r\n    let haxelibCmd = 'haxelib';\r\n    if (shell.which('npx')) {\r\n        shell.echo('npx is available');\r\n        haxelibCmd = 'npx --no-install haxelib';\r\n    }\r\n    if (shell.test('-d', './.haxelib')) {\r\n        shell.echo('removing old dependencies')\r\n        shell.exec(`${haxelibCmd} deleterepo`);\r\n    }\r\n    shell.exec(`${haxelibCmd} newrepo`);\r\n\r\n    if (shell.test('-f', './haxelib.json')) {\r\n        shell.echo('installing dependencies from haxelib.json');\r\n        shell.exec(`${haxelibCmd} install ./haxelib.json --always`);\r\n    } else {\r\n        shell.echo('haxelib.json not found');\r\n        shell.exit(1);\r\n    }\r\n}\r\n\r\nprogram\r\n    .command('setup')\r\n    .description('Cleans old dependencies and installs dependencies from haxelib.json')\r\n    .action(function() {\r\n        validateDependencies();\r\n        buildDependencies();\r\n    });\r\n\r\nprogram\r\n    .command('build')\r\n    .description('Builds the given .hxml file after setting up dependencies')\r\n    .option('--no-dependency', 'Build hxml without setting up dependencies')\r\n    .arguments('<file>')\r\n    .action(function(file, option) {\r\n        if (!file.endsWith('.hxml')) {\r\n            var errorMessage = `${file} is not a hxml file`;\r\n            shell.echo(errorMessage);\r\n            shell.exit(1);\r\n        }\r\n\r\n        validateDependencies();\r\n        if (option.dependency) {\r\n            buildDependencies();\r\n        }\r\n        let haxeCmd = 'haxe';\r\n        if (shell.which('npx')) {\r\n            shell.echo('npx is available');\r\n            haxeCmd = 'npx --no-install haxe';\r\n        }\r\n        shell.echo('Building hxml');\r\n        var buildCommand = `${haxeCmd} ${file}`;\r\n        shell.exec(buildCommand);\r\n    });\r\n\r\nprogram.parse(process.argv);"]}