@botim/mp-debug-sdk 0.7.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto.cjs +1874 -0
- package/dist/auto.d.cts +2 -0
- package/dist/auto.d.ts +2 -0
- package/dist/auto.js +1857 -0
- package/dist/index.cjs +32 -12
- package/dist/index.d.cts +21 -17
- package/dist/index.d.ts +21 -17
- package/dist/index.js +32 -13
- package/dist/vite/plugin.cjs +63 -29
- package/dist/vite/plugin.d.cts +7 -6
- package/dist/vite/plugin.d.ts +7 -6
- package/dist/vite/plugin.js +64 -30
- package/dist/vite/virtual-shim.d.ts +3 -3
- package/package.json +20 -7
- package/README.md +0 -258
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types.cjs.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/vite/plugin.cjs.map +0 -1
- package/dist/vite/plugin.js.map +0 -1
package/dist/vite/plugin.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/vite/resolve-config.ts","../../src/errors.ts","../../src/vite/plugin.ts"],"sourcesContent":["/**\n * Build-time resolver for `botim.{env}.json`.\n *\n * The real BOTIM config schema is large and platform-managed (logos, package\n * URLs, framework metadata, grayscale rollout, etc). The SDK only needs a few\n * canonical fields, so this resolver acts as a *normalizer*:\n *\n * external schema → SDK-internal `BotimConfig`\n * ─────────────── ──────────────────────────\n * mp_id → miniProgramId\n * app_id → appId (extra; preserved)\n * version → appVersion\n * app.md5 | package_url.md5 → buildSignature (deterministic per release)\n * <env from filename> → env\n *\n * Reads `botim.{env}.json` from the consumer's project root. Build-time only:\n * uses Node `fs`/`crypto`. Must NEVER be imported from device-targeted code.\n */\n\nimport { readFileSync, existsSync } from 'node:fs';\nimport { resolve, isAbsolute } from 'node:path';\nimport { createHash } from 'node:crypto';\n\nimport { BotimConfigError } from '../errors.js';\nimport type { BotimConfig, BotimEnv } from '../types.js';\n\nconst VALID_ENVS: readonly BotimEnv[] = ['dev', 'uat', 'beta', 'prod'];\n/**\n * Mini-program ids in the real config are short kebab/snake-case slugs like\n * `mbrx_p2p` — case-insensitive, allows `_` and `-`, must start with a letter.\n */\nconst ID_PATTERN = /^[a-z][a-z0-9_-]{1,63}$/i;\n\n/**\n * Inline config bag that consumers can pass to the Vite plugin (or the\n * resolver directly) instead of — or on top of — `botim.{env}.json`.\n *\n * Shape mirrors the on-disk file (`mp_id`, `app_id`, `version`, `app.md5`, …)\n * so the same normalizer pipeline runs whether the source is the filesystem\n * or a literal object. Unknown keys are forwarded as-is via the\n * `[extra: string]: unknown` index so the platform can keep adding fields\n * without breaking existing builds.\n */\nexport type InlineBotimConfigInput = {\n mp_id?: string;\n /** Legacy alias accepted for forward/back compat. */\n miniProgramId?: string;\n app_id?: string;\n version?: string;\n buildSignature?: string;\n app?: { version?: string; md5?: string; updateUrl?: string };\n package_url?: { md5?: string; version?: string };\n appName?: string;\n appVersion?: string;\n [extra: string]: unknown;\n};\n\nexport interface ResolveOptions {\n /** Map a Vite mode (e.g. \"development\", \"staging\") to a BotimEnv. */\n mapMode?: (mode: string) => BotimEnv | string;\n /**\n * Override the default `botim.{env}.json` filename pattern. Pass a string\n * for a fixed name (e.g. `\"botim_config.beta.json\"`) or a function that\n * receives the resolved env and original mode for per-env logic\n * (e.g. `(env) => `botim_config.${env}.json``).\n *\n * The result is resolved relative to the project root unless it is an\n * absolute path.\n */\n configFileName?: string | ((env: BotimEnv, mode: string) => string);\n /**\n * Inline config bag that **takes precedence** over the on-disk file.\n *\n * Merge semantics: file is loaded first (if present), then inline keys are\n * spread on top so callers can patch a single field without touching the\n * JSON (`{ mp_id: 'mbrx_p2p', version: process.env.VERSION }`).\n *\n * When no file exists at the resolved path, the resolver tolerates the\n * miss as long as `inlineConfig` carries a usable `mp_id` (or its legacy\n * `miniProgramId` alias). This is the file-less workflow — handy for\n * monorepos / native hosts that synthesize identity from env vars.\n */\n inlineConfig?: InlineBotimConfigInput;\n}\n\n/** Built-in mapping; consumers can override via `mapMode`. */\nfunction defaultMapMode(mode: string): string {\n if (mode === 'development') return 'dev';\n if (mode === 'production') return 'prod';\n return mode;\n}\n\nfunction isBotimEnv(s: string): s is BotimEnv {\n return (VALID_ENVS as readonly string[]).includes(s);\n}\n\ninterface RawBotimFile {\n /** Canonical mini-program id used by the BOTIM platform, e.g. \"mbrx_p2p\". */\n mp_id?: string;\n /** Reverse-DNS app id, e.g. \"me.botim.rd.p2p\". Different concept from mp_id. */\n app_id?: string;\n /** Release version of the mini-program package, e.g. \"0.0.127\". */\n version?: string;\n /** Optional override; otherwise we derive from version+md5. */\n buildSignature?: string;\n /** Per-package metadata; when present we use `app.md5` for the signature. */\n app?: { version?: string; md5?: string; updateUrl?: string };\n /** Older/alternate location for the same md5. */\n package_url?: { md5?: string; version?: string };\n /** Operational flags maintained by the platform. */\n disabled?: number;\n deleted?: number;\n mp_status?: number;\n /** Forward-compat for everything else (logos, framework, grayscale, ...). */\n [extra: string]: unknown;\n /** Legacy alias accepted for forward/back compat. */\n miniProgramId?: string;\n}\n\n/**\n * Resolve `botim.{env}.json` for the given Vite `mode` from `root`.\n *\n * Throws `BotimConfigError` synchronously on:\n * - unknown env after `mapMode` is applied\n * - missing or unreadable file\n * - invalid JSON\n * - missing/invalid `mp_id` (or its legacy `miniProgramId` alias)\n * - the platform marking the mini-program as deleted (`deleted: 1`)\n */\nexport function resolveBotimConfig(\n mode: string,\n root: string,\n opts: ResolveOptions = {},\n): BotimConfig {\n if (!mode) {\n throw new BotimConfigError('mode is required', { code: 'no-mode' });\n }\n\n const mapped = (opts.mapMode ?? defaultMapMode)(mode);\n if (typeof mapped !== 'string' || !isBotimEnv(mapped)) {\n throw new BotimConfigError(\n `mode \"${mode}\" mapped to \"${mapped}\" which is not a valid BotimEnv (expected one of: ${VALID_ENVS.join(', ')})`,\n { code: 'invalid-env' },\n );\n }\n const env: BotimEnv = mapped;\n\n const projectRoot = isAbsolute(root) ? root : resolve(process.cwd(), root);\n\n // Resolve the filename — either the legacy `botim.{env}.json` default, a\n // caller-provided literal (e.g. \"botim_config.beta.json\"), or a function\n // that derives one per env (e.g. monorepos that key on package name).\n const fileName = resolveFileName(opts.configFileName, env, mode);\n const filePath = isAbsolute(fileName) ? fileName : resolve(projectRoot, fileName);\n\n const inline = opts.inlineConfig;\n const inlineHasIdentity =\n typeof inline?.mp_id === 'string' && inline.mp_id.length > 0\n ? true\n : typeof inline?.miniProgramId === 'string' && inline.miniProgramId.length > 0;\n\n let raw: string | undefined;\n let parsedFromFile: RawBotimFile = {};\n\n if (existsSync(filePath)) {\n raw = readFileSync(filePath, 'utf8');\n try {\n parsedFromFile = JSON.parse(raw) as RawBotimFile;\n } catch (err) {\n const detail = err instanceof Error ? err.message : String(err);\n throw new BotimConfigError(`failed to parse JSON in ${filePath}: ${detail}`, {\n code: 'config-invalid-json',\n path: filePath,\n });\n }\n } else if (!inlineHasIdentity) {\n // No file AND no inline mp_id → we have nothing to attach to. Mention\n // both escape hatches in the error so the next reader knows the options.\n throw new BotimConfigError(\n `expected config file not found: ${filePath}\\n` +\n ` Either create ${fileName} at the project root with at least { \"mp_id\": \"...\" },\\n` +\n ` pass an explicit { configFileName } / { config: { mp_id: \"...\" } } to botimDebug(),\\n` +\n ` or supply inlineConfig with mp_id when calling resolveBotimConfig() directly.`,\n { code: 'config-missing', path: filePath },\n );\n }\n\n // Inline overrides file — last writer wins. Per-section objects (`app`,\n // `package_url`) are shallow-merged so a caller can patch only `app.md5`\n // without losing `app.version` from the file. Only materialize the merged\n // sub-object when at least one side actually defines it, otherwise we'd\n // turn an absent field into an empty `{}` and confuse the buildSignature\n // fallback heuristics below.\n const parsed: RawBotimFile = {\n ...parsedFromFile,\n ...(inline as RawBotimFile | undefined),\n };\n if (parsedFromFile.app || inline?.app) {\n parsed.app = { ...parsedFromFile.app, ...inline?.app };\n }\n if (parsedFromFile.package_url || inline?.package_url) {\n parsed.package_url = { ...parsedFromFile.package_url, ...inline?.package_url };\n }\n\n // Hard-stop on a decommissioned mini-program — refusing the build is far\n // safer than shipping a debug SDK that targets a relay slot the platform\n // has retired.\n if (parsed.deleted === 1) {\n throw new BotimConfigError(\n `${filePath} reports the mini-program as deleted (deleted: 1). Cannot ship debug SDK against a retired mini-program.`,\n { code: 'config-deleted', path: filePath },\n );\n }\n\n // Read the canonical id; fall back to the SDK-internal alias for repos that\n // hand-write a config without the platform's `mp_id` field.\n const idValue = (parsed.mp_id ?? parsed.miniProgramId) as unknown;\n if (typeof idValue !== 'string' || idValue.length === 0) {\n throw new BotimConfigError(\n `${filePath} is missing required field \"mp_id\" (must be a non-empty string)`,\n { code: 'config-missing-field', path: filePath },\n );\n }\n if (!ID_PATTERN.test(idValue)) {\n throw new BotimConfigError(\n `${filePath} field \"mp_id\" must match ${ID_PATTERN.toString()} (got: ${JSON.stringify(idValue)})`,\n { code: 'config-invalid-id', path: filePath },\n );\n }\n\n // ── Derive a stable, release-correlated buildSignature ────────────────────\n // Preference order:\n // 1. explicit buildSignature in the file (consumers may pin one)\n // 2. version + package md5 (deterministic per release; survives unrelated\n // platform-side mutations like update_time / mp_status_time)\n // 3. sha256 of the file contents (last-resort fallback)\n const md5 =\n typeof parsed.app?.md5 === 'string'\n ? parsed.app.md5\n : typeof parsed.package_url?.md5 === 'string'\n ? parsed.package_url.md5\n : undefined;\n const versionForSig =\n (typeof parsed.version === 'string' && parsed.version) ||\n (typeof parsed.app?.version === 'string' && parsed.app.version) ||\n undefined;\n\n let buildSignature: string;\n if (typeof parsed.buildSignature === 'string' && parsed.buildSignature.length > 0) {\n buildSignature = parsed.buildSignature;\n } else if (versionForSig && md5) {\n buildSignature = `v${versionForSig}+md5:${md5.slice(0, 12)}`;\n } else {\n // No file content to hash (file-less inline workflow) → hash the merged\n // canonical fields instead. Two builds with identical mp_id+env+version\n // get the same signature, which is exactly what the relay correlates on.\n const sigSource =\n raw ??\n JSON.stringify({ mp_id: idValue, env, version: versionForSig, app: parsed.app });\n buildSignature = 'sha256:' + createHash('sha256').update(sigSource).digest('hex').slice(0, 12);\n }\n\n const cfg: BotimConfig = {\n // Spread first so the canonical fields below override anything inherited.\n ...parsed,\n miniProgramId: idValue,\n env,\n buildSignature,\n appName: typeof parsed.app_id === 'string' ? parsed.app_id : (parsed.appName as string | undefined),\n appVersion:\n versionForSig ?? (typeof parsed.appVersion === 'string' ? parsed.appVersion : undefined),\n };\n\n return cfg;\n}\n\n/**\n * Resolve the on-disk filename to read for this env. Three shapes accepted:\n * - undefined → legacy default `botim.{env}.json`\n * - string → use literally (e.g. \"botim_config.beta.json\")\n * - function → called with (env, mode) and must return a string\n *\n * Throws a `BotimConfigError` rather than letting a bad function return\n * propagate as a misleading `existsSync` miss.\n */\nfunction resolveFileName(\n override: ResolveOptions['configFileName'],\n env: BotimEnv,\n mode: string,\n): string {\n if (override === undefined) return `botim.${env}.json`;\n if (typeof override === 'string') {\n if (override.length === 0) {\n throw new BotimConfigError('configFileName must be a non-empty string', {\n code: 'config-invalid-filename',\n });\n }\n return override;\n }\n if (typeof override === 'function') {\n const result = override(env, mode);\n if (typeof result !== 'string' || result.length === 0) {\n throw new BotimConfigError(\n `configFileName(${env}, ${mode}) must return a non-empty string (got ${JSON.stringify(result)})`,\n { code: 'config-invalid-filename' },\n );\n }\n return result;\n }\n throw new BotimConfigError(\n `configFileName must be a string or (env, mode) => string (got ${typeof override})`,\n { code: 'config-invalid-filename' },\n );\n}\n\nexport const __test__ = { defaultMapMode, ID_PATTERN, VALID_ENVS, resolveFileName };\n","/**\n * Errors that escape the SDK into host code.\n *\n * The SDK's no-throw invariant has exactly two carve-outs:\n * - `BotimConfigError` — thrown synchronously by `enableRemoteDebug` when the\n * resolved `BotimConfig` is missing or invalid. Prevents any I/O.\n * - `BotimConsentError` — thrown synchronously by `enableRemoteDebug` when\n * consent has not been granted in a `prod` build. Prevents any I/O.\n *\n * Both are intentionally synchronous and pre-installation: at the moment they\n * fire, no globals have been wrapped, no listeners installed, no network sent.\n */\n\nconst BRAND = '@botim/debug-sdk' as const;\n\nexport class BotimConfigError extends Error {\n readonly name = 'BotimConfigError';\n readonly code: string;\n readonly path?: string;\n\n constructor(message: string, opts: { code: string; path?: string } = { code: 'invalid-config' }) {\n super(`[${BRAND}] ${message}`);\n this.code = opts.code;\n this.path = opts.path;\n }\n}\n\nexport class BotimConsentError extends Error {\n readonly name = 'BotimConsentError';\n constructor(message: string) {\n super(`[${BRAND}] ${message}`);\n }\n}\n","/**\n * Vite plugin for `@botim/debug-sdk`.\n *\n * - Reads `botim.{mode}.json` from the consumer's project root at build time.\n * - Validates required fields; fails the build loudly if anything is wrong.\n * - Exposes the resolved config via the virtual module `virtual:botim/config`\n * as `export const botimConfig: Readonly<BotimConfig>`.\n *\n * The plugin's only Vite-specific surface is the `Plugin` type; we keep the\n * import as `type-only` so `vite` remains an *optional* peer dependency. A\n * consumer that never installs Vite will never load this file (it's only\n * reachable via the `./vite` subpath export).\n */\n\nimport type { Plugin } from 'vite';\nimport { resolveBotimConfig, type InlineBotimConfigInput } from './resolve-config.js';\nimport type { BotimConfig, BotimEnv } from '../types.js';\n\nconst VIRTUAL_ID = 'virtual:botim/config';\nconst RESOLVED_VIRTUAL_ID = '\\0' + VIRTUAL_ID;\n\nexport interface BotimDebugPluginOptions {\n /**\n * Override Vite's `mode`. Useful when the build is driven outside Vite's\n * usual `--mode` flag, or in tests. If omitted, the plugin uses the mode\n * Vite resolves from the CLI / config.\n */\n mode?: string;\n /**\n * Map Vite's mode to a BotimEnv. Defaults: `development` → `dev`,\n * `production` → `prod`, others pass through verbatim.\n */\n mapMode?: (mode: string) => BotimEnv | string;\n /**\n * Project root override. Defaults to Vite's resolved `config.root`.\n */\n root?: string;\n /**\n * Relay endpoint to bake into `virtual:botim/config` as `relayUrl`. The\n * SDK reads this at runtime so the host app can call:\n *\n * enableRemoteDebug({ endpoint: botimConfig.relayUrl, … })\n *\n * Without this option, hosts must either set up a Vite proxy\n * (`server.proxy: { '/v1': 'http://localhost:8090' }`) and pass\n * `endpoint: location.origin`, OR pass an explicit URL at the call\n * site. Passing it through the plugin centralises the wiring and makes\n * mode-specific URLs trivial: read process.env.RELAY_URL in\n * vite.config and forward it here.\n *\n * The relay must allow the page's origin via CORS (CORS_ORIGINS env on\n * @botim/debug-relay defaults to \"*\"). Trailing slash is stripped at\n * resolve time so `/v1/attach` joins cleanly.\n */\n relayUrl?: string;\n /**\n * Override the default `botim.{env}.json` filename pattern. Pass a string\n * for a fixed name (e.g. `\"botim_config.beta.json\"`) or a function for\n * per-env logic (e.g. `(env) => `botim_config.${env}.json``).\n *\n * Resolved relative to the project root unless absolute.\n */\n configFileName?: string | ((env: BotimEnv, mode: string) => string);\n /**\n * Inline config bag that **takes precedence** over the on-disk file.\n *\n * Useful when:\n * - mp_id / version come from env vars (CI builds, monorepo packages)\n * - the host wants to ship without any `botim.*.json` file at all\n * (set `mp_id` here and the resolver tolerates a missing file)\n * - a single field needs patching per build without editing JSON\n *\n * Merge semantics: the file is loaded first (if present), then these\n * keys are spread on top. Sub-objects (`app`, `package_url`) are\n * shallow-merged so patching `app.md5` keeps `app.version` from the file.\n */\n config?: InlineBotimConfigInput;\n}\n\nexport function botimDebug(options: BotimDebugPluginOptions = {}): Plugin {\n let resolved: BotimConfig | null = null;\n let resolvedFromMode: string | null = null;\n let resolvedError: Error | null = null;\n\n return {\n name: '@botim/debug-sdk:vite',\n enforce: 'pre',\n\n configResolved(viteConfig) {\n const mode = options.mode ?? viteConfig.mode;\n const root = options.root ?? viteConfig.root;\n try {\n resolved = resolveBotimConfig(mode, root, {\n mapMode: options.mapMode,\n configFileName: options.configFileName,\n inlineConfig: options.config,\n });\n // Merge the host-provided relay URL into the resolved config bag.\n // Strip trailing slash so callers don't get `/v1//attach` if they\n // pass `https://relay.example.com/`.\n if (options.relayUrl) {\n (resolved as BotimConfig & { relayUrl: string }).relayUrl =\n options.relayUrl.replace(/\\/+$/, '');\n }\n resolvedFromMode = mode;\n } catch (err) {\n // Stash the error; surface it the moment a build module imports the\n // virtual module. We don't throw from `configResolved` directly because\n // some consumers run Vite for non-build tasks (e.g. `vite-node` for\n // tooling) where the virtual module is never imported and a hard fail\n // would be a regression.\n resolved = null;\n resolvedError = err instanceof Error ? err : new Error(String(err));\n resolvedFromMode = mode;\n }\n },\n\n resolveId(id) {\n if (id === VIRTUAL_ID) return RESOLVED_VIRTUAL_ID;\n return null;\n },\n\n load(id) {\n if (id !== RESOLVED_VIRTUAL_ID) return null;\n\n if (!resolved) {\n const message =\n resolvedError?.message ??\n `[@botim/debug-sdk] virtual:botim/config requested but configResolved did not run (mode=${resolvedFromMode ?? 'unknown'})`;\n // `this.error` aborts the build with a properly attributed Vite error.\n this.error(message);\n }\n\n // Frozen so a runtime mutation can't accidentally taint the constant.\n const body =\n `// AUTO-GENERATED by @botim/debug-sdk:vite — do not edit.\\n` +\n `export const botimConfig = Object.freeze(${JSON.stringify(resolved)});\\n` +\n `export default botimConfig;\\n`;\n return { code: body, map: null };\n },\n };\n}\n\nexport { resolveBotimConfig } from './resolve-config.js';\nexport type { InlineBotimConfigInput, ResolveOptions } from './resolve-config.js';\nexport { BotimConfigError } from '../errors.js';\nexport type { BotimConfig, BotimEnv } from '../types.js';\n"],"mappings":";AAmBA,SAAS,cAAc,kBAAkB;AACzC,SAAS,SAAS,kBAAkB;AACpC,SAAS,kBAAkB;;;ACR3B,IAAM,QAAQ;AAEP,IAAM,mBAAN,cAA+B,MAAM;AAAA,EAK1C,YAAY,SAAiB,OAAwC,EAAE,MAAM,iBAAiB,GAAG;AAC/F,UAAM,IAAI,KAAK,KAAK,OAAO,EAAE;AAL/B,SAAS,OAAO;AAMd,SAAK,OAAO,KAAK;AACjB,SAAK,OAAO,KAAK;AAAA,EACnB;AACF;;;ADCA,IAAM,aAAkC,CAAC,OAAO,OAAO,QAAQ,MAAM;AAKrE,IAAM,aAAa;AAuDnB,SAAS,eAAe,MAAsB;AAC5C,MAAI,SAAS,cAAe,QAAO;AACnC,MAAI,SA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