@storm-stack/core
Version:
A build toolkit and runtime used by Storm Software in TypeScript applications
1 lines • 3.76 kB
Source Map (JSON)
{"version":3,"sources":["../../src/lib/deepkit/transformer.ts"],"names":["cache","Cache","createTransformer","context","options","__name","transformer","ctx","tick","ReflectionTransformer","withReflection","reflection","reflectionMode","reflectionLevel","tsconfig","tsconfigJson","compilerOptions","createDeclarationTransformer","declarationTransformer","DeclarationTransformer"],"mappings":";;;;AA4BA,IAAMA,KAAAA,GAAQ,KAAIC,MAAAA,GAAAA;AAEX,SAASC,iBAAAA,CACdC,OAAAA,EACAC,OAAAA,GAA6B,EAAC,EAAC;AAE/B,EAAA,uBAAOC,wBAAA,CAAA,SAASC,YAAYC,GAAAA,EAA6B;AAKvDP,IAAAA,KAAAA,CAAMQ,IAAAA,EAAI;AACV,IAAA,OAAO,KAAIC,MAAAA,EAAsBF,GAAAA,EAAKP,KAAAA,EAAOU,cAAAA,CAAe;AAC1DC,MAAAA,UAAAA,EAAYP,QAAQQ,cAAAA,IAAkB,SAAA;MACtCC,eAAAA,EACET,OAAAA,CAAQS,eAAAA,IACRV,OAAAA,CAAQW,QAAAA,CAASC,YAAAA,CAAaC,iBAAiBH,eAAAA,IAC/CV,OAAAA,CAAQW,QAAAA,CAASC,YAAAA,CAAaF,eAAAA,IAC9B;KACJ,CAAA;EACF,CAAA,EAdO,aAAA,CAAA;AAeT;AAnBgBX,wBAAAA,CAAAA,iBAAAA,EAAAA,mBAAAA,CAAAA;AAqBT,SAASe,4BAAAA,CACdd,OAAAA,EACAC,OAAAA,GAA6B,EAAC,EAAC;AAE/B,EAAA,uBAAOC,wBAAA,CAAA,SAASa,uBAAuBX,GAAAA,EAA6B;AAClE,IAAA,OAAO,KAAIY,MAAAA,EAAuBZ,GAAAA,EAAKP,KAAAA,EAAOU,cAAAA,CAAe;AAC3DC,MAAAA,UAAAA,EAAYP,QAAQQ,cAAAA,IAAkB,SAAA;MACtCC,eAAAA,EACET,OAAAA,CAAQS,eAAAA,IACRV,OAAAA,CAAQW,QAAAA,CAASC,YAAAA,CAAaC,iBAAiBH,eAAAA,IAC/CV,OAAAA,CAAQW,QAAAA,CAASC,YAAAA,CAAaF,eAAAA,IAC9B;KACJ,CAAA;EACF,CAAA,EATO,wBAAA,CAAA;AAUT;AAdgBI,wBAAAA,CAAAA,4BAAAA,EAAAA,8BAAAA,CAAAA","file":"chunk-FER6BFVC.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/storm-stack.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-stack\n Documentation: https://docs.stormsoftware.com/projects/storm-stack\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Cache,\n DeclarationTransformer,\n ReflectionTransformer\n} from \"@deepkit/type-compiler\";\nimport ts from \"typescript\";\nimport { TranspilerOptions } from \"../../types/compiler\";\nimport { Context } from \"../../types/context\";\n\nlet loaded = false;\nconst cache = new Cache();\n\nexport function createTransformer(\n context: Context,\n options: TranspilerOptions = {}\n): ts.CustomTransformerFactory {\n return function transformer(ctx: ts.TransformationContext) {\n if (!loaded) {\n loaded = true;\n }\n\n cache.tick();\n return new ReflectionTransformer(ctx, cache).withReflection({\n reflection: options.reflectionMode || \"default\",\n reflectionLevel:\n options.reflectionLevel ||\n context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel ||\n context.tsconfig.tsconfigJson.reflectionLevel ||\n \"minimal\"\n });\n };\n}\n\nexport function createDeclarationTransformer(\n context: Context,\n options: TranspilerOptions = {}\n): ts.CustomTransformerFactory {\n return function declarationTransformer(ctx: ts.TransformationContext) {\n return new DeclarationTransformer(ctx, cache).withReflection({\n reflection: options.reflectionMode || \"default\",\n reflectionLevel:\n options.reflectionLevel ||\n context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel ||\n context.tsconfig.tsconfigJson.reflectionLevel ||\n \"minimal\"\n });\n };\n}\n"]}