UNPKG

typia

Version:

Superfast runtime validators with only one line

21 lines 1.04 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createTtscPlugin = createTtscPlugin; const node_module_1 = require("node:module"); const node_path_1 = __importDefault(require("node:path")); function createTtscPlugin(context) { // ttsc loads this descriptor as ESM, where the ambient `require` is // unavailable; anchor a CJS resolver on the consuming project to locate // typia's own package root (not the project root, which has no `native/`). const requireFrom = (0, node_module_1.createRequire)(node_path_1.default.join(context.projectRoot, "package.json")); const root = node_path_1.default.dirname(requireFrom.resolve("typia/package.json")); return { name: "typia", source: node_path_1.default.resolve(root, "native", "cmd", "ttsc-typia"), }; } exports.default = createTtscPlugin; //# sourceMappingURL=transform.js.map