typia
Version:
Superfast runtime validators with only one line
1 lines • 1.12 kB
Source Map (JSON)
{"version":3,"file":"transform.mjs","names":[],"sources":["../src/transform.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type { ITtscPlugin, ITtscPluginFactoryContext } from \"ttsc\";\n\nexport function createTtscPlugin(\n context: ITtscPluginFactoryContext,\n): ITtscPlugin {\n // ttsc loads this descriptor as ESM, where the ambient `require` is\n // unavailable; anchor a CJS resolver on the consuming project to locate\n // typia's own package root (not the project root, which has no `native/`).\n const requireFrom = createRequire(\n path.join(context.projectRoot, \"package.json\"),\n );\n const root: string = path.dirname(requireFrom.resolve(\"typia/package.json\"));\n return {\n name: \"typia\",\n source: path.resolve(root, \"native\", \"cmd\", \"ttsc-typia\"),\n };\n}\n\nexport default createTtscPlugin;\n"],"mappings":";;;AAIA,SAAgB,iBACd,SACa;CAIb,MAAM,cAAc,cAClB,KAAK,KAAK,QAAQ,aAAa,cAAc,CAC/C;CACA,MAAM,OAAe,KAAK,QAAQ,YAAY,QAAQ,oBAAoB,CAAC;CAC3E,OAAO;EACL,MAAM;EACN,QAAQ,KAAK,QAAQ,MAAM,UAAU,OAAO,YAAY;CAC1D;AACF"}