conditional-compilation

Uni-App X conditional compilation.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/dcloudio/uni-ai-x/conditional-compilation
Clone the repo
git clone --depth 1 https://github.com/dcloudio/uni-ai-x

Made for: Cursor.

Per session 888 This file is loaded in full into every session.
When invoked 888 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin unknown No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00888 $0.00888
Opus 5 $0.00444 $0.00444
Sonnet 5 $0.00178 $0.00178
Haiku 4.5 $0.00089 $0.00089

Measured today against content hash cca7fe47948b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

conditional-compilation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/conditional-compilation.mdc · 78 lines

How it starts

The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.

core syntax

// Platform basic judgment
#ifdef APP-PLUS
  //Mini programs/APP common code
#elifdef APP-ANDROID
  // Android-specific logic
#elifdef APP-IOS
  // IOS-specific logic
#endif

// Environmental judgment
#ifdef DEBUG
  console.log('Debugging information')
#endif

Multi-terminal UI adaptation

<template>
  <view #ifdef="APP-IOS">
    <uni-swipe-cell :rightWidth="120"></uni-swipe-cell>
  </view>
  <view #ifndef="APP-HARMONY">
    <div class="custom-cell">123</div>
  </view>
</template>

Core Platform Identifier

VUE3 uni-app js engine version is used to distinguish between vue2 and 3, see HBuilderX 3.2.0 for details VUE2 uni-app js engine version is used to distinguish between vue2 and 3, see more UNI-APP-X is used to distinguish whether it is a uni-app x project Details HBuilderX 3.9.0 uniVersion is used to distinguish the version of the compiler Details HBuilderX 3.9.0 APP App When the APP-PLUS uni-app js engine version is compiled to an app APP-PLUS-NVUE or APP-NVUE App nvue page APP-ANDROID App Android Platform Details APP-IOS App iOS Platform Details APP-HARMONY App HarmonyOS Next platform H5 H5 (WEB recommended) WEB web (same as H5) HBuilderX 3.6.3 MP-WEIXIN WeChat Mini Program MP-ALIPAY APPLET MP-BAIDU BAIDU MINI PROGRAM MP-TUTIAO TIKTOK MINI PROGRAM MP-LARK Feishu Mini Program MP-QQ QQ applet MP-KUAISHOU Kuaishou Mini Program MP-JD JD Mini Program MP-360 360 applet MP-HARMONY Harmony Yuan Service HBuilderX 4.34 MP-XHS Xiaohongshu Mini Program MP WeChat Mini Program/Alipay Mini Program/Baidu Mini Program/Douyin Mini Program/Feishu Mini Program/QQ Mini Program/360 Mini Program/Hongmeng Yuan Service QUICKAPP-WEBVIEW (INCLUDING ALLIANCE AND HUAWEI) QUICKAPP-WEBVIEW-UNION QUICKAPP-WEBVIEW-HUAWEI 快訂計

  • Compiler versioning UNI-APP-X: Distinguish uni-app x items (requires HBuilderX 3.9) uniVersion: supports version comparison (e.g. #ifdef uniVersion > 3.9)

Advanced

  • COMBINATORIAL LOGIC: SUPPORT AND/OR LOGIC OPERATIONS (E.G. APP-PLUS AND (ANDROID OR IOS))
  • Dynamic Identity: Add a custom compilation identity via plus.define({IS_LOGIN: true}).

Read the full file on GitHub · 78 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 78 lines · 888 tokens per session scan A cca7fe47948b

Subscribe to this mod's changes

conditional-compilation is a cursor rule published in the GitHub repository dcloudio/uni-ai-x (85 stars, last pushed today), licensed Apache-2.0. It adds 888 tokens to every session, about $0.0044 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-01.