{"version":3,"file":"jest.mjs","sources":["../src/jest.ts"],"sourcesContent":["import type { Config as SwcConfig } from \"@swc/core\";\nimport { applyTransformers, type SwcConfigTransformer } from \"./applyTransformers.ts\";\n\nexport interface DefineJestConfigOptions {\n    baseUrl?: NonNullable<SwcConfig[\"jsc\"]>[\"baseUrl\"];\n    parser?: \"ecmascript\" | \"typescript\";\n    paths?: NonNullable<SwcConfig[\"jsc\"]>[\"paths\"];\n    react?: boolean;\n    transformers?: SwcConfigTransformer[];\n}\n\nexport function defineJestConfig(options: DefineJestConfigOptions = {}) {\n    const {\n        baseUrl,\n        parser = \"typescript\",\n        paths,\n        react = false,\n        transformers = []\n    } = options;\n\n    const config: SwcConfig = {\n        jsc: {\n            baseUrl,\n            paths,\n            parser: parser === \"ecmascript\"\n                ? {\n                    syntax: \"ecmascript\",\n                    jsx: react\n                }\n                : {\n                    syntax: \"typescript\",\n                    tsx: react\n                },\n            // The output environment that the code will be compiled for.\n            target: \"esnext\",\n            transform: react\n                ? {\n                    react: {\n                        // Use \"react/jsx-runtime\".\n                        runtime: \"automatic\",\n                        // Use the native \"Object.assign()\" instead of \"_extends\".\n                        useBuiltins: true\n                    }\n                }\n                : undefined\n        },\n        module: {\n            // The output module resolution system that the code will be compiled for.\n            type: \"es6\"\n        }\n    };\n\n    const transformedConfig = applyTransformers(config, transformers, {\n        environment: \"jest\"\n    });\n\n    return transformedConfig;\n}\n"],"names":["applyTransformers","defineJestConfig","options","baseUrl","parser","paths","react","transformers","config","undefined","transformedConfig"],"mappings":";;;AACsF;AAU/E,SAASC,gBAAgBA,CAACC,UAAmC,CAAC,CAAC;IAClE,MAAM,EACFC,OAAO,EACPC,SAAS,YAAY,EACrBC,KAAK,EACLC,QAAQ,KAAK,EACbC,eAAe,EAAE,EACpB,GAAGL;IAEJ,MAAMM,SAAoB;QACtB,KAAK;YACDL;YACAE;YACA,QAAQD,WAAW,eACb;gBACE,QAAQ;gBACR,KAAKE;YACT,IACE;gBACE,QAAQ;gBACR,KAAKA;YACT;YACJ,6DAA6D;YAC7D,QAAQ;YACR,WAAWA,QACL;gBACE,OAAO;oBACH,2BAA2B;oBAC3B,SAAS;oBACT,0DAA0D;oBAC1D,aAAa;gBACjB;YACJ,IACEG;QACV;QACA,QAAQ;YACJ,0EAA0E;YAC1E,MAAM;QACV;IACJ;IAEA,MAAMC,oBAAoBV,iBAAiBA,CAACQ,QAAQD,cAAc;QAC9D,aAAa;IACjB;IAEA,OAAOG;AACX"}