{"library":"micromark-build","title":"micromark Build Tool","description":"micromark-build is a small, specialized Command Line Interface (CLI) tool designed to optimize and build development source code for micromark extensions into production-ready output. It achieves this by applying a series of Babel transformations such as `babel-plugin-unassert`, `babel-plugin-undebug`, and `babel-plugin-inline-constants`. These plugins are responsible for removing development-specific assertions (like `assert` or `uvu/assert`), debug calls (from `debug`), and for inlining constant values from specified modules (e.g., `micromark-util-symbol`). This optimization process results in smaller and faster code for deployment in browser or Node.js environments. The current stable version is 2.0.3, with new releases typically coordinated within the broader micromark monorepo. Its primary differentiating factor is its tailored optimization focus specifically for the micromark ecosystem, making it an essential utility for developers creating micromark extensions who need to balance development-time debugging with production-ready performance and minimal bundle size.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install micromark-build"],"cli":{"name":"micromark-build","version":null}},"imports":["npm install micromark-build --save-dev\n// Then, in package.json scripts:\n\"build\": \"micromark-build\"","node --conditions development ./dev/index.js","import type { CompileContext } from 'micromark-util-types'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"{\n  \"name\": \"my-micromark-extension\",\n  \"version\": \"1.0.0\",\n  \"description\": \"My custom micromark extension.\",\n  \"type\": \"module\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"build\": \"micromark-build\"\n  },\n  \"exports\": {\n    \"development\": \"./dev/index.js\",\n    \"default\": \"./index.js\"\n  },\n  \"devDependencies\": {\n    \"micromark-build\": \"^2.0.0\",\n    \"devlop\": \"^1.0.0\",\n    \"micromark-util-symbol\": \"^2.0.0\",\n    \"uvu\": \"^0.5.0\"\n  }\n}\n\n// Example: my-micromark-extension/dev/index.js\n// (This file is processed by `micromark-build` into lib/index.js)\nimport { codes } from 'micromark-util-symbol';\nimport { assert } from 'uvu/assert';\nimport { debug } from 'devlop';\n\nconst log = debug('my-extension');\n\nexport function myExtension() {\n  assert.ok(true, 'This assertion will be removed in production!');\n  log('Debugging my extension setup.');\n\n  return { tokenizer: { 92: onBackslash } }; // ASCII 92 is '\\\\'\n}\n\nfunction onBackslash(code) {\n  log('Handling backslash character.');\n  // `codes.backslash` will be inlined in production by micromark-build.\n  return code === codes.backslash ? 1 : 0;\n}","lang":"javascript","description":"This quickstart illustrates how to configure `micromark-build` in a `package.json` for a micromark extension. It shows how to define `dev/` and production `lib/` entry points using an `exports` map, and provides example development code that `micromark-build` will optimize by removing assertions and debug logs, and inlining constants.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}