{"_id":"remark-typescript-code-import","_rev":"7-716b494a2f291fcdc14aeef5bcdfc503","time":{"created":"2024-01-29T07:11:43.589Z","0.1.0":"2024-01-28T05:31:50.110Z","modified":"2024-03-14T14:51:49.312Z","0.1.1":"2024-01-29T07:11:43.890Z","1.0.0":"2024-03-06T09:59:57.956Z","1.0.1":"2024-03-14T14:51:48.695Z"},"name":"remark-typescript-code-import","dist-tags":{"latest":"1.0.1"},"versions":{"0.1.1":{"name":"remark-typescript-code-import","version":"0.1.1","description":"A remark plugin to import code from typescript files","license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/Rippling/remark-typescript-code-import.git"},"bugs":{"url":"https://github.com/Rippling/remark-typescript-code-import/issues"},"author":{"name":"Divyansh Kumar","email":"mr.divyanshindore@gmail.com"},"keywords":["code import","markdown","mdast","mdx","plugin","remark-plugin","remark","typescript","unified"],"engines":{"node":">=16"},"sideEffects":false,"exports":"./dist/index.js","scripts":{"build":"npm run clean && tsc","clean":"rimraf dist","format":"prettier --write .","prebuild":"npm run clean","prepublishOnly":"npm run build","release":"standard-version","test":"npm run build && vitest","watch":"npm run build -- --watch"},"dependencies":{"unist-util-visit":"^5.0.0"},"devDependencies":{"@types/node":"^20.11.5","mdast":"^3.0.0","mdast-util-directive":"^3.0.0","mdast-util-mdx-jsx":"^3.0.0","prettier":"3.2.4","remark":"^15.0.1","remark-directive":"^3.0.0","rimraf":"^5.0.5","typescript":"^5.3.3","vfile":"^6.0.1","vitest":"^1.2.2"},"gitHead":"33e7ae2949c8c6e5624b4b04e15d9cc6f742a719","homepage":"https://github.com/Rippling/remark-typescript-code-import#readme","_id":"remark-typescript-code-import@0.1.1","_nodeVersion":"18.7.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-iluTBGOMb9GFgg5+2g5hYOow96Yf6xWSKedMubaPdQ/GFzO2rXkInmKjgdkK+JI3ZMQFeuNOiSWaqazLawvsWg==","shasum":"c38da5b863a627fb1fa39107f00d8a7f60d059fd","tarball":"https://registry.npmjs.org/remark-typescript-code-import/-/remark-typescript-code-import-0.1.1.tgz","fileCount":7,"unpackedSize":25569,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIALwWFlSwSCflJCWXP4pEEhZjR1RRTs4V/9/lXc9cPnPAiBtjsaDGHnIUpVOd+Ux6PltxVJDsqi6MW0GfyrP1poAag=="}]},"_npmUser":{"name":"mrdivyansh","email":"mr.divyanshindore@gmail.com"},"directories":{},"maintainers":[{"name":"mrdivyansh","email":"mr.divyanshindore@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/remark-typescript-code-import_0.1.1_1706512303669_0.9083447961619187"},"_hasShrinkwrap":false},"1.0.0":{"name":"remark-typescript-code-import","version":"1.0.0","description":"A remark plugin to import code from typescript files","license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/Rippling/remark-typescript-code-import.git"},"bugs":{"url":"https://github.com/Rippling/remark-typescript-code-import/issues"},"author":{"name":"Divyansh Kumar","email":"mr.divyanshindore@gmail.com"},"keywords":["code import","markdown","mdast","mdx","plugin","remark-plugin","remark","typescript","unified"],"engines":{"node":">=16"},"sideEffects":false,"exports":"./dist/index.js","scripts":{"build":"npm run clean && tsc","clean":"rimraf dist","format":"prettier --write .","prebuild":"npm run clean","prepublishOnly":"npm run build","release":"standard-version","test":"npm run build && vitest","watch":"npm run build -- --watch"},"dependencies":{"mdast":"^3.0.0","typescript":"^5.3.3","unist-util-visit":"^5.0.0"},"devDependencies":{"@types/node":"^20.11.5","mdast-util-directive":"^3.0.0","mdast-util-mdx-jsx":"^3.0.0","prettier":"3.2.4","remark":"^15.0.1","remark-directive":"^3.0.0","rimraf":"^5.0.5","vfile":"^6.0.1","vitest":"^1.2.2"},"gitHead":"8a4c89219a9e4c17aae40588b0e3606f23af099a","homepage":"https://github.com/Rippling/remark-typescript-code-import#readme","_id":"remark-typescript-code-import@1.0.0","_nodeVersion":"18.7.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-s4KqjHIO6DnlhlcGTXicmL2X0EGP+cascfDPUBtjFe4Z8JFmZHcRMfyjPV/VOMXf3VQ1xY5YYcHDAk8QLoUB6A==","shasum":"08218e8da0d28a5421d162dafd2f38b06d9a89e6","tarball":"https://registry.npmjs.org/remark-typescript-code-import/-/remark-typescript-code-import-1.0.0.tgz","fileCount":7,"unpackedSize":25463,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBf2XomjodtU4Bs1Nu2FWQNvylPqqJBwXfvRuJgaXXEUAiA/u3JNHy+618cFUOOOSpfcO8WZmGvXJMbSmnaq9hunXQ=="}]},"_npmUser":{"name":"mrdivyansh","email":"mr.divyanshindore@gmail.com"},"directories":{},"maintainers":[{"name":"mrdivyansh","email":"mr.divyanshindore@gmail.com"},{"name":"divyansh_rippling","email":"divyansh@rippling.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/remark-typescript-code-import_1.0.0_1709719197755_0.7097949931019847"},"_hasShrinkwrap":false},"1.0.1":{"name":"remark-typescript-code-import","version":"1.0.1","description":"A remark plugin to import code from typescript files","license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/Rippling/remark-typescript-code-import.git"},"bugs":{"url":"https://github.com/Rippling/remark-typescript-code-import/issues"},"author":{"name":"Divyansh Kumar","email":"mr.divyanshindore@gmail.com"},"keywords":["code import","markdown","mdast","mdx","plugin","remark-plugin","remark","typescript","unified"],"engines":{"node":">=16"},"sideEffects":false,"main":"dist/index.js","type":"commonjs","scripts":{"build":"vite build","prebuild":"npm run clean && npm run lint:fix && tsc","clean":"rimraf dist","format":"prettier --write .","lint":"eslint --ext .ts .","lint:fix":"eslint --ext .ts . --fix","prepublishOnly":"npm run build","test":"npm run build && vitest"},"dependencies":{"mdast":"^3.0.0","typescript":"^5.3.3","unist-util-visit":"^5.0.0"},"devDependencies":{"@types/node":"^20.11.5","@typescript-eslint/eslint-plugin":"^7.2.0","@typescript-eslint/parser":"^7.2.0","eslint":"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3","mdast-util-directive":"^3.0.0","mdast-util-mdx-jsx":"^3.0.0","prettier":"3.2.4","remark":"^15.0.1","remark-directive":"^3.0.0","rimraf":"^5.0.5","vfile":"^6.0.1","vite":"^5.1.6","vite-plugin-dts":"^3.7.3","vitest":"^1.2.2"},"types":"./dist/index.d.ts","gitHead":"898b8b849a935ea1127490a01b800ab93965eb23","homepage":"https://github.com/Rippling/remark-typescript-code-import#readme","_id":"remark-typescript-code-import@1.0.1","_nodeVersion":"18.7.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-t0UkJhqONkFBTjdpFdqfTyHg40wy8KJGLOR4eiiJS++AGrB8xXV1YC1J1k/B+RyS4eC1sA0Y1AkT/Urf6NC0ug==","shasum":"5db67289c1addeade4e1069085e5866f7598443e","tarball":"https://registry.npmjs.org/remark-typescript-code-import/-/remark-typescript-code-import-1.0.1.tgz","fileCount":7,"unpackedSize":28916,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCZbDGknw+wcz5SVQL15x5m1Hd1877JVMiVXg34qSkm8gIgLmgjsh9kcV5wdH52zTbY1jmw/fhze++8VP+7Oa39B1k="}]},"_npmUser":{"name":"mrdivyansh","email":"mr.divyanshindore@gmail.com"},"directories":{},"maintainers":[{"name":"mrdivyansh","email":"mr.divyanshindore@gmail.com"},{"name":"divyansh_rippling","email":"divyansh@rippling.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/remark-typescript-code-import_1.0.1_1710427908550_0.8134224496322873"},"_hasShrinkwrap":false}},"maintainers":[{"name":"mrdivyansh","email":"mr.divyanshindore@gmail.com"},{"name":"divyansh_rippling","email":"divyansh@rippling.com"}],"description":"A remark plugin to import code from typescript files","homepage":"https://github.com/Rippling/remark-typescript-code-import#readme","keywords":["code import","markdown","mdast","mdx","plugin","remark-plugin","remark","typescript","unified"],"repository":{"type":"git","url":"git+https://github.com/Rippling/remark-typescript-code-import.git"},"author":{"name":"Divyansh Kumar","email":"mr.divyanshindore@gmail.com"},"bugs":{"url":"https://github.com/Rippling/remark-typescript-code-import/issues"},"license":"Apache-2.0","readme":"# `remark-typescript-code-import`\n\n📝 A remark plugin to import code from typescript files\n\n[![npm version](https://badge.fury.io/js/remark-typescript-code-import.svg)](https://badge.fury.io/js/remark-typescript-code-import)\n\n## Installation\n\n```sh\nnpm install -D remark-directive remark-typescript-code-import\n```\n\n## Setup\n\n```js\nimport remarkTypescriptCodeImport from 'remark-typescript-code-import';\n// or\n// const remarkTypescriptCodeImport = require('remark-typescript-code-import').default;\n```\n\nSee [**Using plugins**](https://github.com/remarkjs/remark/blob/master/doc/plugins.md#using-plugins) for more instructions in the official documentation.\n\n## Usage\n\nFor example, given a file named `example.mdx` with the following contents:\n\n```md\n::typescript{file=\"./Component.tsx#ComponentProps\"}\n```\n\nand `Component.tsx`\n\n```tsx\ntype ComponentProps = {\n  propA: string;\n}\n\nfunction Component(props: ComponentProps) {\n  ...\n}\n\n```\n\nThe following script:\n\n```js\nimport { remark } from 'remark';\nimport path from 'node:path';\nimport remarkDirectivePlugin from 'remark-directive';\nimport { read } from 'to-vfile';\n\nconst result = await remark()\n  .use(remarkDirectivePlugin)\n  .use(remarkTypescriptCodeImport)\n  .process(await read('example.md'));\n\nconsole.log(result.toString());\n```\n\nyields:\n\n````md\n```tsx\ntype ComponentProps = {\n  propA: string;\n};\n```\n````\n\nThe file path is relative to the markdown file path. You can use `<rootDir>` at the start of the path to import files relatively from the rootDir:\n\n```md\n::typescript{file=\"<rootDir>/Button.tsx#ButtonComponent\"}\n```\n\nIt supports multiple files and types\n\n```md\n::typescript{file=\"./Button.tsx#ButtonComponent,ButtonProps ./Chip.tsx#ChipComponent,ChipProps\"}\n```\n\n## Options\n\n- `directiveName: string`: The directive name. Defaults to `component-docs`.\n- `fileAttributeName: string`: The attribute name for file path. Defaults to `file`.\n- `rootDir: string`: Change what `<rootDir>` refers to. Defaults to `process.cwd()`.\n\n## Testing\n\nAfter installing dependencies with `npm install`, the tests can be run with: `npm test`\n\n## License\n\nRippling People Center Inc.\n[Apache 2.0](LICENSE)\n","readmeFilename":"README.md"}