{"record":{"id":"d48235444a5a4bf2","repo":"oven-sh/bun","slug":"this-script-is-not-meant-to-be-run-directly","errorCode":null,"errorMessage":"This script is not meant to be run directly","messagePattern":"This script is not meant to be run directly","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/codegen/bundle-functions.ts","lineNumber":58,"sourceCode":"// The output is intended to be similar to what WebCore does, but they use a\n// python script, and they write all the `@` syntax by hand. When generating,\n// we concatenate all the sources into one big string, which then creates a\n// single JSC::SourceProvider. Passing start/end positions to each function's\n// JSC::SourceCode. JSC does this, but WebCore does not seem to as of writing.\nimport assert from \"assert\";\nimport { readdirSync, rmSync } from \"fs\";\nimport path from \"path\";\nimport { sliceSourceCode } from \"./builtin-parser\";\nimport { createAssertClientJS, createLogClientJS } from \"./client-js\";\nimport { getJS2NativeDTS } from \"./generate-js2native\";\nimport { cap, checkAscii, low, writeIfNotChanged } from \"./helpers\";\nimport { applyGlobalReplacements, define } from \"./replacements\";\n\nconst PARALLEL = false;\nconst KEEP_TMP = true;\n\nif (import.meta.main) {\n  throw new Error(\"This script is not meant to be run directly\");\n}\n\nconst CMAKE_BUILD_ROOT = globalThis.CMAKE_BUILD_ROOT;\nif (!CMAKE_BUILD_ROOT) {\n  throw new Error(\"CMAKE_BUILD_ROOT is not defined\");\n}\n\nconst SRC_DIR = path.join(import.meta.dir, \"../js/builtins\");\nconst CODEGEN_DIR = path.join(CMAKE_BUILD_ROOT, \"./codegen\");\nconst TMP_DIR = path.join(CMAKE_BUILD_ROOT, \"./tmp_functions\");\n\ninterface ParsedBuiltin {\n  name: string;\n  params: string[];\n  directives: Record<string, any>;\n  source: string;\n  async: boolean;\n  enums: string[];","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/codegen/bundle-functions.ts#L40-L76","documentation":"Error \"This script is not meant to be run directly\" thrown in oven-sh/bun.","triggerScenarios":"Thrown at src/codegen/bundle-functions.ts:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}