15815213711
2024-08-26 67b8b6731811983447e053d4396b3708c14dfe3c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const node_gyp_1 = __importDefault(require("node-gyp"));
const util_1 = require("util");
process.on('message', async ({ nodeGypArgs, devDir, extraNodeGypArgs, }) => {
    const nodeGyp = (0, node_gyp_1.default)();
    nodeGyp.parseArgv(nodeGypArgs);
    nodeGyp.devDir = devDir;
    let command = nodeGyp.todo.shift();
    try {
        while (command) {
            if (command.name === 'configure') {
                command.args = command.args.filter((arg) => !extraNodeGypArgs.includes(arg));
            }
            else if (command.name === 'build' && process.platform === 'win32') {
                // This is disgusting but it prevents node-gyp from destroying our MSBuild arguments
                command.args.map = (fn) => {
                    return Array.prototype.map.call(command.args, (arg) => {
                        if (arg.startsWith('/p:'))
                            return arg;
                        return fn(arg);
                    });
                };
            }
            await (0, util_1.promisify)(nodeGyp.commands[command.name])(command.args);
            command = nodeGyp.todo.shift();
        }
        process.exit(0);
    }
    catch (err) {
        console.error(err);
        process.exit(1);
    }
});
//# sourceMappingURL=worker.js.map