@powerlines/plugin-deepkit 0.10.55 → 0.10.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!r.call(i,d)&&d!==o&&e(i,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return i},a=(t,n,r,a)=>{a&&(e(t,Symbol.toStringTag,{value:`Module`}),r&&e(r,Symbol.toStringTag,{value:`Module`})),i(t,n,`default`),r&&i(r,n,`default`)};export{a as t};
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
package/dist/index.cjs CHANGED
@@ -1,7 +1,4 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var transformer=require('@powerlines/deepkit/transformer'),f=require('@powerlines/plugin-tsc'),stormJson=require('@stryke/json/storm-json'),types=require('./types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var f__default=/*#__PURE__*/_interopDefault(f);/*****************************************
2
- *
3
- * ⚡ Built by Storm Software
4
- *
5
- *****************************************/
6
-
7
- var n=Object.defineProperty;var o=(t,i)=>n(t,"name",{value:i,configurable:true});const g=o((t={})=>({name:"deepkit",dependsOn:[f__default.default(t)],config(){return {transform:{deepkit:t??{}}}},configResolved:{order:"post",async handler(){const i=this.config.transform.deepkit.reflection||this.tsconfig.tsconfigJson.compilerOptions?.reflection||this.tsconfig.tsconfigJson.reflection||"default",e=this.config.transform.deepkit.reflectionLevel||this.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel||this.tsconfig.tsconfigJson.reflectionLevel||"minimal";(!this.tsconfig.tsconfigJson.reflection||!this.tsconfig.tsconfigJson.reflectionLevel)&&(this.tsconfig.tsconfigJson.reflection??=i,this.tsconfig.tsconfigJson.reflectionLevel??=e,await this.fs.write(this.tsconfig.tsconfigFilePath,stormJson.StormJSON.stringify(this.tsconfig.tsconfigJson))),this.config.transform.tsc??={},this.config.transform.tsc.compilerOptions={...this.config.transform.tsc.compilerOptions??{},exclude:this.config.transform.deepkit.exclude??[],reflection:i,reflectionLevel:e},this.config.transform.tsc.transformers??={before:[],after:[]},this.config.transform.tsc.transformers.before.push(transformer.createTransformer(this,this.config.transform.deepkit)),this.config.transform.tsc.transformers.after.push(transformer.createDeclarationTransformer(this,this.config.transform.deepkit));}}}),"plugin");var D=g;exports.default=D;exports.plugin=g;Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
1
+ Object.defineProperty(exports,`__esModule`,{value:!0});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(e,n,r,i)=>{i&&(t(e,Symbol.toStringTag,{value:`Module`}),r&&t(r,Symbol.toStringTag,{value:`Module`})),o(e,n,`default`),r&&o(r,n,`default`)},c=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));require(`./plugin-DHXHjv16.cjs`),require(`./types-DHkg7xmX.cjs`);let l=require(`defu`);l=c(l);let u=require(`typescript`);u=c(u);let d=require(`@stryke/json/storm-json`);var f={};s(f,require(`@deepkit/type-compiler`));let p=!1;const m=new f.Cache;function h(e,t={}){return function(n){return p||=!0,m.tick(),new f.ReflectionTransformer(n,m).withReflection((0,l.default)(t,{reflection:e.tsconfig.tsconfigJson.compilerOptions?.reflection||e.tsconfig.tsconfigJson.reflection,reflectionLevel:e.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel||e.tsconfig.tsconfigJson.reflectionLevel},{exclude:[],reflection:`default`,reflectionLevel:`minimal`}))}}function g(e,t={}){return function(n){return new f.DeclarationTransformer(n,m).withReflection((0,l.default)(t,{reflection:e.tsconfig.tsconfigJson.compilerOptions?.reflection||e.tsconfig.tsconfigJson.reflection,reflectionLevel:e.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel||e.tsconfig.tsconfigJson.reflectionLevel},{exclude:[],reflection:`default`,reflectionLevel:`minimal`}))}}async function _(e){let t=e.program.emitToMemory(),n=[];t.getDiagnostics().forEach(e=>{e.getSourceFile()?.getBaseName()?n.push(`${e.getSourceFile()?.getBaseName()} (${(e.getLineNumber()??0)+1}): ${(0,u.flattenDiagnosticMessageText)(e.getMessageText().toString(),`
2
+ `)}`):n.push((0,u.flattenDiagnosticMessageText)(e.getMessageText().toString(),`
3
+ `))});let r=n.join(`
4
+ `);if(r)throw Error(`TypeScript compilation failed: \n\n${r.length>5e3?`${r.slice(0,5e3)}...`:r}`)}const v=(e={})=>({name:`tsc`,config(){return{transform:{tsc:(0,l.default)(e??{},{typeCheck:!1})}}},async lint(){this.config.transform.tsc.typeCheck&&await _(this)},async transform(e,t){let n=u.default.transpileModule(e,{...this.config.transform.tsc,compilerOptions:{...this.tsconfig.options,...this.config.transform.tsc.compilerOptions},fileName:t});if(n.diagnostics&&n.diagnostics.length>0&&n.diagnostics?.some(e=>e.category===u.default.DiagnosticCategory.Error))throw Error(`TypeScript Compiler - TypeScript transpilation errors in file: ${t}\n${u.default.formatDiagnostics(n.diagnostics,{getCanonicalFileName:e=>u.default.sys.useCaseSensitiveFileNames?e:e.toLowerCase(),getCurrentDirectory:()=>u.default.sys.getCurrentDirectory(),getNewLine:()=>u.default.sys.newLine})}`);if(!n.outputText)throw Error(`TypeScript Compiler - No output generated for file during TypeScript transpilation: ${t}`);return{code:n.outputText,id:t}}});var y=v;const b=(e={})=>({name:`deepkit`,dependsOn:[y(e)],config(){return{transform:{deepkit:e??{}}}},configResolved:{order:`post`,async handler(){let e=this.config.transform.deepkit.reflection||this.tsconfig.tsconfigJson.compilerOptions?.reflection||this.tsconfig.tsconfigJson.reflection||`default`,t=this.config.transform.deepkit.reflectionLevel||this.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel||this.tsconfig.tsconfigJson.reflectionLevel||`minimal`;(!this.tsconfig.tsconfigJson.reflection||!this.tsconfig.tsconfigJson.reflectionLevel)&&(this.tsconfig.tsconfigJson.reflection??=e,this.tsconfig.tsconfigJson.reflectionLevel??=t,await this.fs.write(this.tsconfig.tsconfigFilePath,d.StormJSON.stringify(this.tsconfig.tsconfigJson))),this.config.transform.tsc??={},this.config.transform.tsc.compilerOptions={...this.config.transform.tsc.compilerOptions??{},exclude:this.config.transform.deepkit.exclude??[],reflection:e,reflectionLevel:t},this.config.transform.tsc.transformers??={before:[],after:[]},this.config.transform.tsc.transformers.before.push(h(this,this.config.transform.deepkit)),this.config.transform.tsc.transformers.after.push(g(this,this.config.transform.deepkit))}}});var x=b;exports.default=x,exports.plugin=b;
package/dist/index.d.cts CHANGED
@@ -1,24 +1,7 @@
1
- import { D as DeepkitPluginContext, a as DeepkitPluginOptions, P as Plugin } from './index--LP8yR-r.cjs';
2
- export { c as DeepkitPluginResolvedConfig, b as DeepkitPluginUserConfig, f as __ΩDeepkitPluginContext, _ as __ΩDeepkitPluginOptions, e as __ΩDeepkitPluginResolvedConfig, d as __ΩDeepkitPluginUserConfig } from './index--LP8yR-r.cjs';
3
- import '@deepkit/type-compiler/config';
4
- import '@storm-software/build-tools/types';
5
- import '@storm-software/config-tools/types';
6
- import '@storm-software/config/types';
7
- import '@stryke/types/base';
8
- import '@stryke/types/configuration';
9
- import '@stryke/types/file';
10
- import 'vite';
11
- import '@stryke/env/get-env-paths';
12
- import '@stryke/types/package-json';
13
- import 'jiti';
14
- import 'magic-string';
15
- import 'semver';
16
- import 'ts-morph';
17
- import 'unplugin';
18
- import '@stryke/fs/resolve';
19
- import '@stryke/types/tsconfig';
20
- import 'typescript';
21
- import '@stryke/types/array';
1
+ import { a as __ΩDeepkitPluginContext, c as __ΩDeepkitPluginUserConfig, i as DeepkitPluginUserConfig, l as Plugin, n as DeepkitPluginOptions, o as __ΩDeepkitPluginOptions, r as DeepkitPluginResolvedConfig, s as __ΩDeepkitPluginResolvedConfig, t as DeepkitPluginContext } from "./plugin-BbkLut4W.cjs";
2
+ import "./index-CEgs-Dz2.cjs";
3
+
4
+ //#region src/index.d.ts
22
5
 
23
6
  /**
24
7
  * Deepkit plugin for Powerlines.
@@ -27,5 +10,6 @@ import '@stryke/types/array';
27
10
  * @returns A Powerlines plugin that integrates Deepkit transformations.
28
11
  */
29
12
  declare const plugin: <TContext extends DeepkitPluginContext = DeepkitPluginContext>(options?: DeepkitPluginOptions) => Plugin<TContext>;
30
-
31
- export { DeepkitPluginContext, DeepkitPluginOptions, plugin as default, plugin };
13
+ //#endregion
14
+ export { DeepkitPluginContext, DeepkitPluginOptions, DeepkitPluginResolvedConfig, DeepkitPluginUserConfig, __ΩDeepkitPluginContext, __ΩDeepkitPluginOptions, __ΩDeepkitPluginResolvedConfig, __ΩDeepkitPluginUserConfig, plugin as default, plugin };
15
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;AAwCA;;;;;AAIG,cAJU,MAIV,EAAA,CAAA,iBAHgB,oBAGhB,GAHuC,oBAGvC,CAAA,CAAA,OAAA,CAAA,EADQ,oBACR,EAAA,GAAA,MAAA,CAAO,QAAP,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { a as __ΩDeepkitPluginContext, c as __ΩDeepkitPluginUserConfig, i as DeepkitPluginUserConfig, l as Plugin, n as DeepkitPluginOptions, o as __ΩDeepkitPluginOptions, r as DeepkitPluginResolvedConfig, s as __ΩDeepkitPluginResolvedConfig, t as DeepkitPluginContext } from "./plugin-DShiRg8h.mjs";
2
+ import "./index-D9zIjQH9.mjs";
3
+
4
+ //#region src/index.d.ts
5
+
6
+ /**
7
+ * Deepkit plugin for Powerlines.
8
+ *
9
+ * @param options - The Deepkit plugin user configuration options.
10
+ * @returns A Powerlines plugin that integrates Deepkit transformations.
11
+ */
12
+ declare const plugin: <TContext extends DeepkitPluginContext = DeepkitPluginContext>(options?: DeepkitPluginOptions) => Plugin<TContext>;
13
+ //#endregion
14
+ export { DeepkitPluginContext, DeepkitPluginOptions, DeepkitPluginResolvedConfig, DeepkitPluginUserConfig, __ΩDeepkitPluginContext, __ΩDeepkitPluginOptions, __ΩDeepkitPluginResolvedConfig, __ΩDeepkitPluginUserConfig, plugin as default, plugin };
15
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;AAwCA;;;;;AAIG,cAJU,MAIV,EAAA,CAAA,iBAHgB,oBAGhB,GAHuC,oBAGvC,CAAA,CAAA,OAAA,CAAA,EADQ,oBACR,EAAA,GAAA,MAAA,CAAO,QAAP,CAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,5 @@
1
+ import{t as e}from"./chunk-X42XA8SV.mjs";import"./plugin-DzeYlbKJ.mjs";import"./types-BKeuN6sy.mjs";import t from"defu";import n,{flattenDiagnosticMessageText as r}from"typescript";import{StormJSON as i}from"@stryke/json/storm-json";var a={};import*as o from"@deepkit/type-compiler";e(a,o);let s=!1;const c=new a.Cache;function l(e,n={}){return function(r){return s||=!0,c.tick(),new a.ReflectionTransformer(r,c).withReflection(t(n,{reflection:e.tsconfig.tsconfigJson.compilerOptions?.reflection||e.tsconfig.tsconfigJson.reflection,reflectionLevel:e.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel||e.tsconfig.tsconfigJson.reflectionLevel},{exclude:[],reflection:`default`,reflectionLevel:`minimal`}))}}function u(e,n={}){return function(r){return new a.DeclarationTransformer(r,c).withReflection(t(n,{reflection:e.tsconfig.tsconfigJson.compilerOptions?.reflection||e.tsconfig.tsconfigJson.reflection,reflectionLevel:e.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel||e.tsconfig.tsconfigJson.reflectionLevel},{exclude:[],reflection:`default`,reflectionLevel:`minimal`}))}}async function d(e){let t=e.program.emitToMemory(),n=[];t.getDiagnostics().forEach(e=>{e.getSourceFile()?.getBaseName()?n.push(`${e.getSourceFile()?.getBaseName()} (${(e.getLineNumber()??0)+1}): ${r(e.getMessageText().toString(),`
2
+ `)}`):n.push(r(e.getMessageText().toString(),`
3
+ `))});let i=n.join(`
4
+ `);if(i)throw Error(`TypeScript compilation failed: \n\n${i.length>5e3?`${i.slice(0,5e3)}...`:i}`)}var f=(e={})=>({name:`tsc`,config(){return{transform:{tsc:t(e??{},{typeCheck:!1})}}},async lint(){this.config.transform.tsc.typeCheck&&await d(this)},async transform(e,t){let r=n.transpileModule(e,{...this.config.transform.tsc,compilerOptions:{...this.tsconfig.options,...this.config.transform.tsc.compilerOptions},fileName:t});if(r.diagnostics&&r.diagnostics.length>0&&r.diagnostics?.some(e=>e.category===n.DiagnosticCategory.Error))throw Error(`TypeScript Compiler - TypeScript transpilation errors in file: ${t}\n${n.formatDiagnostics(r.diagnostics,{getCanonicalFileName:e=>n.sys.useCaseSensitiveFileNames?e:e.toLowerCase(),getCurrentDirectory:()=>n.sys.getCurrentDirectory(),getNewLine:()=>n.sys.newLine})}`);if(!r.outputText)throw Error(`TypeScript Compiler - No output generated for file during TypeScript transpilation: ${t}`);return{code:r.outputText,id:t}}});const p=(e={})=>({name:`deepkit`,dependsOn:[f(e)],config(){return{transform:{deepkit:e??{}}}},configResolved:{order:`post`,async handler(){let e=this.config.transform.deepkit.reflection||this.tsconfig.tsconfigJson.compilerOptions?.reflection||this.tsconfig.tsconfigJson.reflection||`default`,t=this.config.transform.deepkit.reflectionLevel||this.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel||this.tsconfig.tsconfigJson.reflectionLevel||`minimal`;(!this.tsconfig.tsconfigJson.reflection||!this.tsconfig.tsconfigJson.reflectionLevel)&&(this.tsconfig.tsconfigJson.reflection??=e,this.tsconfig.tsconfigJson.reflectionLevel??=t,await this.fs.write(this.tsconfig.tsconfigFilePath,i.stringify(this.tsconfig.tsconfigJson))),this.config.transform.tsc??={},this.config.transform.tsc.compilerOptions={...this.config.transform.tsc.compilerOptions??{},exclude:this.config.transform.deepkit.exclude??[],reflection:e,reflectionLevel:t},this.config.transform.tsc.transformers??={before:[],after:[]},this.config.transform.tsc.transformers.before.push(l(this,this.config.transform.deepkit)),this.config.transform.tsc.transformers.after.push(u(this,this.config.transform.deepkit))}}});var m=p;export{m as default,p as plugin};
5
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["Cache","ReflectionTransformer","DeclarationTransformer","diagnosticMessages: string[]","plugin","tsc"],"sources":["../../deepkit/src/vendor/type-compiler/index.ts","../../deepkit/src/transformer.ts","../../plugin-tsc/src/helpers/type-check.ts","../../plugin-tsc/src/index.ts","../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\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/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n// Re-exported Deepkit - Type Compiler module\n\nexport * from \"@deepkit/type-compiler\";\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\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/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\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 \"@powerlines/deepkit/vendor/type-compiler\";\nimport { ReflectionConfig } from \"@powerlines/deepkit/vendor/type-compiler/config\";\nimport defu from \"defu\";\nimport { Context } from \"powerlines/types/context\";\nimport ts from \"typescript\";\n\nlet loaded = false;\nconst cache = new Cache();\n\n/**\n * Creates a Deepkit TypeScript transformer.\n *\n * @param context - The Powerlines plugin context.\n * @param options - The transformation options.\n * @returns A Deepkit TypeScript custom transformer factory.\n */\nexport function createTransformer(\n context: Context,\n options: Partial<ReflectionConfig> = {}\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 defu(\n options,\n {\n reflection:\n context.tsconfig.tsconfigJson.compilerOptions?.reflection ||\n context.tsconfig.tsconfigJson.reflection,\n reflectionLevel:\n context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel ||\n context.tsconfig.tsconfigJson.reflectionLevel\n },\n {\n exclude: [],\n reflection: \"default\",\n reflectionLevel: \"minimal\"\n }\n ) as ReflectionConfig\n );\n };\n}\n\n/**\n * Creates a Deepkit TypeScript declaration transformer.\n *\n * @param context - The Powerlines plugin context.\n * @param options - The transformation options.\n * @returns A Deepkit TypeScript custom declaration transformer factory.\n */\nexport function createDeclarationTransformer(\n context: Context,\n options: Partial<ReflectionConfig> = {}\n): ts.CustomTransformerFactory {\n return function declarationTransformer(ctx: ts.TransformationContext) {\n return new DeclarationTransformer(ctx, cache).withReflection(\n defu(\n options,\n {\n reflection:\n context.tsconfig.tsconfigJson.compilerOptions?.reflection ||\n context.tsconfig.tsconfigJson.reflection,\n reflectionLevel:\n context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel ||\n context.tsconfig.tsconfigJson.reflectionLevel\n },\n {\n exclude: [],\n reflection: \"default\",\n reflectionLevel: \"minimal\"\n }\n ) as ReflectionConfig\n );\n };\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\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/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Context } from \"powerlines/types/context\";\nimport { flattenDiagnosticMessageText } from \"typescript\";\n\n/**\n * Perform type checks on the provided sources using TypeScript's compiler API.\n *\n * @param context - The build context containing information about the current build.\n */\nexport async function typeCheck(context: Context): Promise<void> {\n const result = context.program.emitToMemory();\n\n const diagnosticMessages: string[] = [];\n result.getDiagnostics().forEach(diagnostic => {\n if (diagnostic.getSourceFile()?.getBaseName()) {\n diagnosticMessages.push(\n `${diagnostic.getSourceFile()?.getBaseName()} (${\n (diagnostic.getLineNumber() ?? 0) + 1\n }): ${flattenDiagnosticMessageText(\n diagnostic.getMessageText().toString(),\n \"\\n\"\n )}`\n );\n } else {\n diagnosticMessages.push(\n flattenDiagnosticMessageText(\n diagnostic.getMessageText().toString(),\n \"\\n\"\n )\n );\n }\n });\n\n const diagnosticMessage = diagnosticMessages.join(\"\\n\");\n if (diagnosticMessage) {\n throw new Error(\n `TypeScript compilation failed: \\n\\n${\n diagnosticMessage.length > 5000\n ? `${diagnosticMessage.slice(0, 5000)}...`\n : diagnosticMessage\n }`\n );\n }\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\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/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport defu from \"defu\";\nimport { ConfigResult, Plugin } from \"powerlines/types/plugin\";\nimport ts from \"typescript\";\nimport { typeCheck } from \"./helpers/type-check\";\nimport {\n TypeScriptCompilerPluginContext,\n TypeScriptCompilerPluginOptions\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\n/**\n * TypeScript Compiler plugin for Powerlines.\n *\n * @param options - The TypeScript Compiler plugin user configuration options.\n * @returns A Powerlines plugin that integrates TypeScript Compiler transformations.\n */\nexport const plugin = <\n TContext extends\n TypeScriptCompilerPluginContext = TypeScriptCompilerPluginContext\n>(\n options: TypeScriptCompilerPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"tsc\",\n config() {\n return {\n transform: {\n tsc: defu(options ?? {}, {\n typeCheck: false\n })\n }\n } as ConfigResult<TContext>;\n },\n async lint() {\n if (this.config.transform.tsc.typeCheck) {\n await typeCheck(this);\n }\n },\n async transform(code: string, id: string) {\n const result = ts.transpileModule(code, {\n ...this.config.transform.tsc,\n compilerOptions: {\n ...this.tsconfig.options,\n ...this.config.transform.tsc.compilerOptions\n },\n fileName: id\n });\n if (\n result.diagnostics &&\n result.diagnostics.length > 0 &&\n result.diagnostics?.some(\n diagnostic => diagnostic.category === ts.DiagnosticCategory.Error\n )\n ) {\n throw new Error(\n `TypeScript Compiler - TypeScript transpilation errors in file: ${id}\\n${ts.formatDiagnostics(\n result.diagnostics,\n {\n getCanonicalFileName: fileName =>\n ts.sys.useCaseSensitiveFileNames\n ? fileName\n : fileName.toLowerCase(),\n getCurrentDirectory: () => ts.sys.getCurrentDirectory(),\n getNewLine: () => ts.sys.newLine\n }\n )}`\n );\n }\n\n if (!result.outputText) {\n throw new Error(\n `TypeScript Compiler - No output generated for file during TypeScript transpilation: ${id}`\n );\n }\n\n return { code: result.outputText, id };\n }\n } as Plugin<TContext>;\n};\n\nexport default plugin;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\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/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n createDeclarationTransformer,\n createTransformer\n} from \"@powerlines/deepkit/transformer\";\nimport tsc from \"@powerlines/plugin-tsc\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { Plugin } from \"powerlines/types/plugin\";\nimport { ReflectionLevel } from \"powerlines/types/tsconfig\";\nimport {\n DeepkitPluginContext,\n DeepkitPluginOptions,\n DeepkitPluginUserConfig\n} from \"./types/plugin\";\n\nexport * from \"./types\";\n\n/**\n * Deepkit plugin for Powerlines.\n *\n * @param options - The Deepkit plugin user configuration options.\n * @returns A Powerlines plugin that integrates Deepkit transformations.\n */\nexport const plugin = <\n TContext extends DeepkitPluginContext = DeepkitPluginContext\n>(\n options: DeepkitPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"deepkit\",\n dependsOn: [tsc(options)],\n config() {\n return {\n transform: {\n deepkit: options ?? {}\n }\n } as Partial<DeepkitPluginUserConfig>;\n },\n configResolved: {\n order: \"post\",\n async handler() {\n const reflection =\n this.config.transform.deepkit.reflection ||\n this.tsconfig.tsconfigJson.compilerOptions?.reflection ||\n this.tsconfig.tsconfigJson.reflection ||\n \"default\";\n const reflectionLevel =\n this.config.transform.deepkit.reflectionLevel ||\n this.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel ||\n this.tsconfig.tsconfigJson.reflectionLevel ||\n \"minimal\";\n\n if (\n !this.tsconfig.tsconfigJson.reflection ||\n !this.tsconfig.tsconfigJson.reflectionLevel\n ) {\n this.tsconfig.tsconfigJson.reflection ??= reflection;\n this.tsconfig.tsconfigJson.reflectionLevel ??=\n reflectionLevel as ReflectionLevel;\n\n await this.fs.write(\n this.tsconfig.tsconfigFilePath,\n StormJSON.stringify(this.tsconfig.tsconfigJson)\n );\n }\n\n this.config.transform.tsc ??=\n {} as TContext[\"config\"][\"transform\"][\"tsc\"];\n this.config.transform.tsc.compilerOptions = {\n ...(this.config.transform.tsc.compilerOptions ?? {}),\n exclude: this.config.transform.deepkit.exclude ?? [],\n reflection,\n reflectionLevel\n };\n\n this.config.transform.tsc.transformers ??= {\n before: [],\n after: []\n };\n\n this.config.transform.tsc.transformers.before!.push(\n createTransformer(this, this.config.transform.deepkit)\n );\n this.config.transform.tsc.transformers.after!.push(\n createDeclarationTransformer(this, this.config.transform.deepkit)\n );\n }\n }\n } as Plugin<TContext>;\n};\n\nexport default plugin;\n"],"mappings":"kSC4BA,IAAI,EAAS,GACb,MAAM,EAAQ,IAAIA,EAAAA,MASlB,SAAgB,EACd,EACA,EAAqC,EAAE,CACV,CAC7B,OAAO,SAAqB,EAA+B,CAMzD,MALA,CACE,IAAS,GAGX,EAAM,MAAM,CACL,IAAIC,EAAAA,sBAAsB,EAAK,EAAM,CAAC,eAC3C,EACE,EACA,CACE,WACE,EAAQ,SAAS,aAAa,iBAAiB,YAC/C,EAAQ,SAAS,aAAa,WAChC,gBACE,EAAQ,SAAS,aAAa,iBAAiB,iBAC/C,EAAQ,SAAS,aAAa,gBACjC,CACD,CACE,QAAS,EAAE,CACX,WAAY,UACZ,gBAAiB,UAClB,CACF,CACF,EAWL,SAAgB,EACd,EACA,E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