Download build/raw-text-plugin.mjs from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 714 Bytes
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/build/raw-text-plugin.mjs
- Command line
-
hf download hf://SaylorTwift/kimi-code/build/raw-text-plugin.mjs
-
curl -L -o raw-text-plugin.mjs https://huggingface.co/SaylorTwift/kimi-code/resolve/main/build/raw-text-plugin.mjs
714 Bytes
| import { readFileSync } from 'node:fs'; | |
| /** | |
| * Bundler plugin that lets files be imported as raw strings: | |
| * | |
| * import description from './grep.md?raw'; | |
| * | |
| * The file content is inlined into the bundle at build time, so prompt | |
| * source files never ship separately in `dist`. Vitest handles the same | |
| * `?raw` imports through Vite's built-in asset loader. | |
| */ | |
| export function rawTextPlugin() { | |
| return { | |
| name: 'raw-text', | |
| enforce: 'pre', | |
| load(id) { | |
| const [path, query = ''] = id.split('?', 2); | |
| if (!query.split('&').includes('raw')) return null; | |
| const text = readFileSync(path, 'utf-8'); | |
| return { code: `export default ${JSON.stringify(text)};`, map: null }; | |
| }, | |
| }; | |
| } | |