(node)
| 4 | export const transformers = [ |
| 5 | { |
| 6 | code(node) { |
| 7 | if (node.tagName === "code") { |
| 8 | const raw = this.source; |
| 9 | node.properties.__raw__ = raw; |
| 10 | |
| 11 | if (raw.startsWith("npm install")) { |
| 12 | node.properties.__npm__ = raw; |
| 13 | node.properties.__yarn__ = raw.replace("npm install", "yarn add"); |
| 14 | node.properties.__pnpm__ = raw.replace("npm install", "pnpm add"); |
| 15 | node.properties.__bun__ = raw.replace("npm install", "bun add"); |
| 16 | } |
| 17 | |
| 18 | if (raw.startsWith("npx create-")) { |
| 19 | node.properties.__npm__ = raw; |
| 20 | node.properties.__yarn__ = raw.replace("npx create-", "yarn create "); |
| 21 | node.properties.__pnpm__ = raw.replace("npx create-", "pnpm create "); |
| 22 | node.properties.__bun__ = raw.replace("npx", "bunx --bun"); |
| 23 | } |
| 24 | |
| 25 | // npm create. |
| 26 | if (raw.startsWith("npm create")) { |
| 27 | node.properties.__npm__ = raw; |
| 28 | node.properties.__yarn__ = raw.replace("npm create", "yarn create"); |
| 29 | node.properties.__pnpm__ = raw.replace("npm create", "pnpm create"); |
| 30 | node.properties.__bun__ = raw.replace("npm create", "bun create"); |
| 31 | } |
| 32 | |
| 33 | // npx. |
| 34 | if (raw.startsWith("npx")) { |
| 35 | node.properties.__npm__ = raw; |
| 36 | node.properties.__yarn__ = raw.replace("npx", "yarn"); |
| 37 | node.properties.__pnpm__ = raw.replace("npx", "pnpm dlx"); |
| 38 | node.properties.__bun__ = raw.replace("npx", "bunx --bun"); |
| 39 | } |
| 40 | |
| 41 | // npm run. |
| 42 | if (raw.startsWith("npm run")) { |
| 43 | node.properties.__npm__ = raw; |
| 44 | node.properties.__yarn__ = raw.replace("npm run", "yarn"); |
| 45 | node.properties.__pnpm__ = raw.replace("npm run", "pnpm"); |
| 46 | node.properties.__bun__ = raw.replace("npm run", "bun"); |
| 47 | } |
| 48 | } |
| 49 | }, |
| 50 | }, |
| 51 | ] as ShikiTransformer[]; |
| 52 |
nothing calls this directly
no outgoing calls
no test coverage detected