Convert media query to js expression

@inner
@param {Array.<string>} tokens the env media query param tokens
@param {Array.<string>} allAppTypes all supported media target types
@param {string} appType current build media target app type
@return {string}
function convertMediaQueryToJSExpression(tokens, allAppTypes, appType) {
    let result = [];
    tokens.forEach(item => {
        item = item.trim();
        if (allAppTypes.includes(item)) {
            result.push(`('${item}' === '${appType}')`);
        }
        else if (item === 'and') {
            result.push('&&');
        }
        else if (item === ',' || item === 'or') {
            result.push('||');
        }
        else if (item === 'not') {
            result.push('!');
        }
        else if (item === '(' || item === ')') {
            result.push(item);
        }
    });


    let lastItem = result[result.length - 1];
    if (lastItem === '&&' || lastItem === '||') {
        result.pop();
    }

    // remove no use leading brace if has
    let braceStack = [];
    result.forEach((item, index) => {
        if (item === '(') {
            braceStack.push(index);
        }
        else if (item === ')') {
            braceStack.pop();
        }
    });
    for (let i = braceStack.length - 1; i >= 0; i--) {
        result.splice(braceStack[i], 1);
    }

    return result.join('');
}