@soda-gql/tsc 0.11.6 → 0.11.8

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.
package/dist/plugin.cjs CHANGED
@@ -1,4 +1,3 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
2
1
  const require_transformer = require('./transformer-BE1nwZtg.cjs');
3
2
  let __soda_gql_builder = require("@soda-gql/builder");
4
3
  let __soda_gql_common = require("@soda-gql/common");
@@ -58,14 +57,18 @@ const createTscPlugin = (options = {}) => {
58
57
  const createSodaGqlTransformer = (program, options = {}) => {
59
58
  return createTscPlugin(options).before({}, program);
60
59
  };
61
- var plugin_default = createTscPlugin();
62
-
63
- //#endregion
64
- //#region packages/tsc/@x-plugin.ts
65
- var __x_plugin_default = plugin_default;
60
+ let _cachedPlugin = null;
61
+ /**
62
+ * Named export for Nest CLI compatibility.
63
+ * Nest CLI requires `before`, `after`, or `afterDeclarations` as direct exports.
64
+ */
65
+ function before(options, program) {
66
+ if (!_cachedPlugin) _cachedPlugin = createTscPlugin(options);
67
+ return _cachedPlugin.before(options, program);
68
+ }
66
69
 
67
70
  //#endregion
71
+ exports.before = before;
68
72
  exports.createSodaGqlTransformer = createSodaGqlTransformer;
69
73
  exports.createTscPlugin = createTscPlugin;
70
- exports.default = __x_plugin_default;
71
74
  //# sourceMappingURL=plugin.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs","names":["createTransformer","defaultPlugin"],"sources":["../src/plugin.ts","../@x-plugin.ts"],"sourcesContent":["/**\n * TypeScript compiler plugin entrypoint for soda-gql.\n *\n * This module provides TypeScript transformer integration for soda-gql\n * when using Nest CLI with `builder: \"tsc\"`.\n */\n\nimport { createBuilderService } from \"@soda-gql/builder\";\nimport { cachedFn } from \"@soda-gql/common\";\nimport { loadConfig } from \"@soda-gql/config\";\nimport type * as ts from \"typescript\";\nimport { createTransformer } from \"./transformer\";\n\nexport type PluginOptions = {\n readonly configPath?: string;\n readonly enabled?: boolean;\n};\n\nconst fallbackPlugin = {\n before: (_options: unknown, _program: ts.Program): ts.TransformerFactory<ts.SourceFile> => {\n return (_context: ts.TransformationContext): ts.Transformer<ts.SourceFile> => {\n return (sourceFile: ts.SourceFile) => sourceFile;\n };\n },\n};\n\nexport const createTscPlugin = (options: PluginOptions = {}) => {\n const enabled = options.enabled ?? true;\n if (!enabled) {\n return fallbackPlugin;\n }\n\n const configResult = loadConfig(options.configPath);\n if (configResult.isErr()) {\n console.error(`[@soda-gql/tsc] Failed to load config: ${configResult.error.message}`);\n return fallbackPlugin;\n }\n\n const config = configResult.value;\n const ensureBuilderService = cachedFn(() => createBuilderService({ config }));\n\n const plugin = {\n /**\n * TypeScript Compiler Plugin hook: before() transformer.\n *\n * This function is called by TypeScript Compiler Plugin with (options, program) signature.\n * It must be exported as a top-level named export for CommonJS compatibility.\n */\n before(_options: unknown, program: ts.Program): ts.TransformerFactory<ts.SourceFile> {\n const builderService = ensureBuilderService();\n const buildResult = builderService.build();\n if (buildResult.isErr()) {\n console.error(`[@soda-gql/tsc] Failed to build initial artifact: ${buildResult.error.message}`);\n return fallbackPlugin.before(_options, program);\n }\n\n const artifact = buildResult.value;\n const compilerOptions = program.getCompilerOptions();\n const transformer = createTransformer({ compilerOptions, config, artifact });\n console.log(\"[@soda-gql/tsc] Transforming program\");\n\n return (context: ts.TransformationContext) => {\n return (sourceFile: ts.SourceFile) => {\n // Skip declaration files\n if (sourceFile.isDeclarationFile) {\n return sourceFile;\n }\n\n const transformResult = transformer.transform({ sourceFile, context });\n if (!transformResult.transformed) {\n return sourceFile;\n }\n\n return transformResult.sourceFile;\n };\n };\n },\n };\n\n return plugin;\n};\n\n/**\n * Create a TypeScript transformer for testing purposes.\n * This is a helper that wraps createTscPlugin to match the signature expected by tests.\n */\nexport const createSodaGqlTransformer = (\n program: ts.Program,\n options: PluginOptions = {},\n): ts.TransformerFactory<ts.SourceFile> => {\n const plugin = createTscPlugin(options);\n return plugin.before({}, program);\n};\n\nexport default createTscPlugin();\n","export * from \"./src/plugin\";\n\nimport defaultPlugin from \"./src/plugin\";\nexport default defaultPlugin;\n"],"mappings":";;;;;;;;;;;;;AAkBA,MAAM,iBAAiB,EACrB,SAAS,UAAmB,aAA+D;AACzF,SAAQ,aAAsE;AAC5E,UAAQ,eAA8B;;GAG3C;AAED,MAAa,mBAAmB,UAAyB,EAAE,KAAK;AAE9D,KAAI,EADY,QAAQ,WAAW,MAEjC,QAAO;CAGT,MAAM,iDAA0B,QAAQ,WAAW;AACnD,KAAI,aAAa,OAAO,EAAE;AACxB,UAAQ,MAAM,0CAA0C,aAAa,MAAM,UAAU;AACrF,SAAO;;CAGT,MAAM,SAAS,aAAa;CAC5B,MAAM,0GAA2D,EAAE,QAAQ,CAAC,CAAC;AAwC7E,QAtCe,EAOb,OAAO,UAAmB,SAA2D;EAEnF,MAAM,cADiB,sBAAsB,CACV,OAAO;AAC1C,MAAI,YAAY,OAAO,EAAE;AACvB,WAAQ,MAAM,qDAAqD,YAAY,MAAM,UAAU;AAC/F,UAAO,eAAe,OAAO,UAAU,QAAQ;;EAGjD,MAAM,WAAW,YAAY;EAE7B,MAAM,cAAcA,sCAAkB;GAAE,iBADhB,QAAQ,oBAAoB;GACK;GAAQ;GAAU,CAAC;AAC5E,UAAQ,IAAI,uCAAuC;AAEnD,UAAQ,YAAsC;AAC5C,WAAQ,eAA8B;AAEpC,QAAI,WAAW,kBACb,QAAO;IAGT,MAAM,kBAAkB,YAAY,UAAU;KAAE;KAAY;KAAS,CAAC;AACtE,QAAI,CAAC,gBAAgB,YACnB,QAAO;AAGT,WAAO,gBAAgB;;;IAI9B;;;;;;AASH,MAAa,4BACX,SACA,UAAyB,EAAE,KACc;AAEzC,QADe,gBAAgB,QAAQ,CACzB,OAAO,EAAE,EAAE,QAAQ;;AAGnC,qBAAe,iBAAiB;;;;AC3FhC,yBAAeC"}
1
+ {"version":3,"file":"plugin.cjs","names":["createTransformer","_cachedPlugin: ReturnType<typeof createTscPlugin> | null"],"sources":["../src/plugin.ts"],"sourcesContent":["/**\n * TypeScript compiler plugin entrypoint for soda-gql.\n *\n * This module provides TypeScript transformer integration for soda-gql\n * when using Nest CLI with `builder: \"tsc\"`.\n */\n\nimport { createBuilderService } from \"@soda-gql/builder\";\nimport { cachedFn } from \"@soda-gql/common\";\nimport { loadConfig } from \"@soda-gql/config\";\nimport type * as ts from \"typescript\";\nimport { createTransformer } from \"./transformer\";\n\nexport type PluginOptions = {\n readonly configPath?: string;\n readonly enabled?: boolean;\n};\n\nconst fallbackPlugin = {\n before: (_options: unknown, _program: ts.Program): ts.TransformerFactory<ts.SourceFile> => {\n return (_context: ts.TransformationContext): ts.Transformer<ts.SourceFile> => {\n return (sourceFile: ts.SourceFile) => sourceFile;\n };\n },\n};\n\nexport const createTscPlugin = (options: PluginOptions = {}) => {\n const enabled = options.enabled ?? true;\n if (!enabled) {\n return fallbackPlugin;\n }\n\n const configResult = loadConfig(options.configPath);\n if (configResult.isErr()) {\n console.error(`[@soda-gql/tsc] Failed to load config: ${configResult.error.message}`);\n return fallbackPlugin;\n }\n\n const config = configResult.value;\n const ensureBuilderService = cachedFn(() => createBuilderService({ config }));\n\n const plugin = {\n /**\n * TypeScript Compiler Plugin hook: before() transformer.\n *\n * This function is called by TypeScript Compiler Plugin with (options, program) signature.\n * It must be exported as a top-level named export for CommonJS compatibility.\n */\n before(_options: unknown, program: ts.Program): ts.TransformerFactory<ts.SourceFile> {\n const builderService = ensureBuilderService();\n const buildResult = builderService.build();\n if (buildResult.isErr()) {\n console.error(`[@soda-gql/tsc] Failed to build initial artifact: ${buildResult.error.message}`);\n return fallbackPlugin.before(_options, program);\n }\n\n const artifact = buildResult.value;\n const compilerOptions = program.getCompilerOptions();\n const transformer = createTransformer({ compilerOptions, config, artifact });\n console.log(\"[@soda-gql/tsc] Transforming program\");\n\n return (context: ts.TransformationContext) => {\n return (sourceFile: ts.SourceFile) => {\n // Skip declaration files\n if (sourceFile.isDeclarationFile) {\n return sourceFile;\n }\n\n const transformResult = transformer.transform({ sourceFile, context });\n if (!transformResult.transformed) {\n return sourceFile;\n }\n\n return transformResult.sourceFile;\n };\n };\n },\n };\n\n return plugin;\n};\n\n/**\n * Create a TypeScript transformer for testing purposes.\n * This is a helper that wraps createTscPlugin to match the signature expected by tests.\n */\nexport const createSodaGqlTransformer = (\n program: ts.Program,\n options: PluginOptions = {},\n): ts.TransformerFactory<ts.SourceFile> => {\n const plugin = createTscPlugin(options);\n return plugin.before({}, program);\n};\n\nlet _cachedPlugin: ReturnType<typeof createTscPlugin> | null = null;\n\n/**\n * Named export for Nest CLI compatibility.\n * Nest CLI requires `before`, `after`, or `afterDeclarations` as direct exports.\n */\nexport function before(options: PluginOptions, program: ts.Program): ts.TransformerFactory<ts.SourceFile> {\n if (!_cachedPlugin) {\n _cachedPlugin = createTscPlugin(options);\n }\n return _cachedPlugin.before(options, program);\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAM,iBAAiB,EACrB,SAAS,UAAmB,aAA+D;AACzF,SAAQ,aAAsE;AAC5E,UAAQ,eAA8B;;GAG3C;AAED,MAAa,mBAAmB,UAAyB,EAAE,KAAK;AAE9D,KAAI,EADY,QAAQ,WAAW,MAEjC,QAAO;CAGT,MAAM,iDAA0B,QAAQ,WAAW;AACnD,KAAI,aAAa,OAAO,EAAE;AACxB,UAAQ,MAAM,0CAA0C,aAAa,MAAM,UAAU;AACrF,SAAO;;CAGT,MAAM,SAAS,aAAa;CAC5B,MAAM,0GAA2D,EAAE,QAAQ,CAAC,CAAC;AAwC7E,QAtCe,EAOb,OAAO,UAAmB,SAA2D;EAEnF,MAAM,cADiB,sBAAsB,CACV,OAAO;AAC1C,MAAI,YAAY,OAAO,EAAE;AACvB,WAAQ,MAAM,qDAAqD,YAAY,MAAM,UAAU;AAC/F,UAAO,eAAe,OAAO,UAAU,QAAQ;;EAGjD,MAAM,WAAW,YAAY;EAE7B,MAAM,cAAcA,sCAAkB;GAAE,iBADhB,QAAQ,oBAAoB;GACK;GAAQ;GAAU,CAAC;AAC5E,UAAQ,IAAI,uCAAuC;AAEnD,UAAQ,YAAsC;AAC5C,WAAQ,eAA8B;AAEpC,QAAI,WAAW,kBACb,QAAO;IAGT,MAAM,kBAAkB,YAAY,UAAU;KAAE;KAAY;KAAS,CAAC;AACtE,QAAI,CAAC,gBAAgB,YACnB,QAAO;AAGT,WAAO,gBAAgB;;;IAI9B;;;;;;AASH,MAAa,4BACX,SACA,UAAyB,EAAE,KACc;AAEzC,QADe,gBAAgB,QAAQ,CACzB,OAAO,EAAE,EAAE,QAAQ;;AAGnC,IAAIC,gBAA2D;;;;;AAM/D,SAAgB,OAAO,SAAwB,SAA2D;AACxG,KAAI,CAAC,cACH,iBAAgB,gBAAgB,QAAQ;AAE1C,QAAO,cAAc,OAAO,SAAS,QAAQ"}
package/dist/plugin.d.cts CHANGED
@@ -14,9 +14,11 @@ declare const createTscPlugin: (options?: PluginOptions) => {
14
14
  * This is a helper that wraps createTscPlugin to match the signature expected by tests.
15
15
  */
16
16
  declare const createSodaGqlTransformer: (program: ts$1.Program, options?: PluginOptions) => ts$1.TransformerFactory<ts$1.SourceFile>;
17
- declare const _default: {
18
- before: (_options: unknown, _program: ts$1.Program) => ts$1.TransformerFactory<ts$1.SourceFile>;
19
- };
17
+ /**
18
+ * Named export for Nest CLI compatibility.
19
+ * Nest CLI requires `before`, `after`, or `afterDeclarations` as direct exports.
20
+ */
21
+ declare function before(options: PluginOptions, program: ts$1.Program): ts$1.TransformerFactory<ts$1.SourceFile>;
20
22
  //#endregion
21
- export { PluginOptions, createSodaGqlTransformer, createTscPlugin, _default as default };
23
+ export { PluginOptions, before, createSodaGqlTransformer, createTscPlugin };
22
24
  //# sourceMappingURL=plugin.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.ts"],"sourcesContent":[],"mappings":";;;;AAmB8E,KANlE,aAAA,GAMkE;EAAzB,SAAG,UAAA,CAAA,EAAA,MAA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;;;;iBAA3C,MAAA,UAAgB,wBAAwB,IAAA,CAAG,UAAU,IAAA,CAAG,mBAAmB,IAAA,CAAG"}
package/dist/plugin.d.mts CHANGED
@@ -14,9 +14,11 @@ declare const createTscPlugin: (options?: PluginOptions) => {
14
14
  * This is a helper that wraps createTscPlugin to match the signature expected by tests.
15
15
  */
16
16
  declare const createSodaGqlTransformer: (program: ts$1.Program, options?: PluginOptions) => ts$1.TransformerFactory<ts$1.SourceFile>;
17
- declare const _default: {
18
- before: (_options: unknown, _program: ts$1.Program) => ts$1.TransformerFactory<ts$1.SourceFile>;
19
- };
17
+ /**
18
+ * Named export for Nest CLI compatibility.
19
+ * Nest CLI requires `before`, `after`, or `afterDeclarations` as direct exports.
20
+ */
21
+ declare function before(options: PluginOptions, program: ts$1.Program): ts$1.TransformerFactory<ts$1.SourceFile>;
20
22
  //#endregion
21
- export { PluginOptions, createSodaGqlTransformer, createTscPlugin, _default as default };
23
+ export { PluginOptions, before, createSodaGqlTransformer, createTscPlugin };
22
24
  //# sourceMappingURL=plugin.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"sourcesContent":[],"mappings":";;;;AAmB8E,KANlE,aAAA,GAMkE;EAAzB,SAAG,UAAA,CAAA,EAAA,MAAA;EAAkB,SAAA,OAAA,CAAA,EAAA,OAAA;AAmE1E,CAAA;AACc,cA7DD,eA6DC,EAAA,CAAA,OAAA,CAAA,EA7D2B,aA6D3B,EAAA,GAAA;EACH,MAAA,EAAA,CAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EArE6B,IAAA,CAAG,OAqEhC,EAAA,GArE0C,IAAA,CAAG,kBAqE7C,CArEgE,IAAA,CAAG,UAqEnE,CAAA;CACc;;;AAGvB;;AAzE4E,cAmEjE,wBAnEiE,EAAA,CAAA,OAAA,EAoEnE,IAAA,CAAG,OApEgE,EAAA,OAAA,CAAA,EAqEnE,aArEmE,EAAA,GAsE3E,IAAA,CAAG,kBAtEwE,CAsErD,IAAA,CAAG,UAtEkD,CAAA;cAyE5E,QAzEsD,EAAA;EAAkB,MAAA,EAAA,CAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAlC,IAAA,CAAG,OAA+B,EAAA,GAArB,IAAA,CAAG,kBAAkB,CAAC,IAAA,CAAG,UAAJ,CAAA"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"sourcesContent":[],"mappings":";;;;AAmB8E,KANlE,aAAA,GAMkE;EAAzB,SAAG,UAAA,CAAA,EAAA,MAAA;EAAkB,SAAA,OAAA,CAAA,EAAA,OAAA;AAmE1E,CAAA;AACc,cA7DD,eA6DC,EAAA,CAAA,OAAA,CAAA,EA7D2B,aA6D3B,EAAA,GAAA;EACH,MAAA,EAAA,CAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EArE6B,IAAA,CAAG,OAqEhC,EAAA,GArE0C,IAAA,CAAG,kBAqE7C,CArEgE,IAAA,CAAG,UAqEnE,CAAA;CACc;;;AAWzB;;AAA2D,cAd9C,wBAc8C,EAAA,CAAA,OAAA,EAbhD,IAAA,CAAG,OAa6C,EAAA,OAAA,CAAA,EAZhD,aAYgD,EAAA,GAXxD,IAAA,CAAG,kBAWqD,CAXlC,IAAA,CAAG,UAW+B,CAAA;;;;;iBAA3C,MAAA,UAAgB,wBAAwB,IAAA,CAAG,UAAU,IAAA,CAAG,mBAAmB,IAAA,CAAG"}
package/dist/plugin.mjs CHANGED
@@ -57,12 +57,16 @@ const createTscPlugin = (options = {}) => {
57
57
  const createSodaGqlTransformer = (program, options = {}) => {
58
58
  return createTscPlugin(options).before({}, program);
59
59
  };
60
- var plugin_default = createTscPlugin();
61
-
62
- //#endregion
63
- //#region packages/tsc/@x-plugin.ts
64
- var __x_plugin_default = plugin_default;
60
+ let _cachedPlugin = null;
61
+ /**
62
+ * Named export for Nest CLI compatibility.
63
+ * Nest CLI requires `before`, `after`, or `afterDeclarations` as direct exports.
64
+ */
65
+ function before(options, program) {
66
+ if (!_cachedPlugin) _cachedPlugin = createTscPlugin(options);
67
+ return _cachedPlugin.before(options, program);
68
+ }
65
69
 
66
70
  //#endregion
67
- export { createSodaGqlTransformer, createTscPlugin, __x_plugin_default as default };
71
+ export { before, createSodaGqlTransformer, createTscPlugin };
68
72
  //# sourceMappingURL=plugin.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.mjs","names":["defaultPlugin"],"sources":["../src/plugin.ts","../@x-plugin.ts"],"sourcesContent":["/**\n * TypeScript compiler plugin entrypoint for soda-gql.\n *\n * This module provides TypeScript transformer integration for soda-gql\n * when using Nest CLI with `builder: \"tsc\"`.\n */\n\nimport { createBuilderService } from \"@soda-gql/builder\";\nimport { cachedFn } from \"@soda-gql/common\";\nimport { loadConfig } from \"@soda-gql/config\";\nimport type * as ts from \"typescript\";\nimport { createTransformer } from \"./transformer\";\n\nexport type PluginOptions = {\n readonly configPath?: string;\n readonly enabled?: boolean;\n};\n\nconst fallbackPlugin = {\n before: (_options: unknown, _program: ts.Program): ts.TransformerFactory<ts.SourceFile> => {\n return (_context: ts.TransformationContext): ts.Transformer<ts.SourceFile> => {\n return (sourceFile: ts.SourceFile) => sourceFile;\n };\n },\n};\n\nexport const createTscPlugin = (options: PluginOptions = {}) => {\n const enabled = options.enabled ?? true;\n if (!enabled) {\n return fallbackPlugin;\n }\n\n const configResult = loadConfig(options.configPath);\n if (configResult.isErr()) {\n console.error(`[@soda-gql/tsc] Failed to load config: ${configResult.error.message}`);\n return fallbackPlugin;\n }\n\n const config = configResult.value;\n const ensureBuilderService = cachedFn(() => createBuilderService({ config }));\n\n const plugin = {\n /**\n * TypeScript Compiler Plugin hook: before() transformer.\n *\n * This function is called by TypeScript Compiler Plugin with (options, program) signature.\n * It must be exported as a top-level named export for CommonJS compatibility.\n */\n before(_options: unknown, program: ts.Program): ts.TransformerFactory<ts.SourceFile> {\n const builderService = ensureBuilderService();\n const buildResult = builderService.build();\n if (buildResult.isErr()) {\n console.error(`[@soda-gql/tsc] Failed to build initial artifact: ${buildResult.error.message}`);\n return fallbackPlugin.before(_options, program);\n }\n\n const artifact = buildResult.value;\n const compilerOptions = program.getCompilerOptions();\n const transformer = createTransformer({ compilerOptions, config, artifact });\n console.log(\"[@soda-gql/tsc] Transforming program\");\n\n return (context: ts.TransformationContext) => {\n return (sourceFile: ts.SourceFile) => {\n // Skip declaration files\n if (sourceFile.isDeclarationFile) {\n return sourceFile;\n }\n\n const transformResult = transformer.transform({ sourceFile, context });\n if (!transformResult.transformed) {\n return sourceFile;\n }\n\n return transformResult.sourceFile;\n };\n };\n },\n };\n\n return plugin;\n};\n\n/**\n * Create a TypeScript transformer for testing purposes.\n * This is a helper that wraps createTscPlugin to match the signature expected by tests.\n */\nexport const createSodaGqlTransformer = (\n program: ts.Program,\n options: PluginOptions = {},\n): ts.TransformerFactory<ts.SourceFile> => {\n const plugin = createTscPlugin(options);\n return plugin.before({}, program);\n};\n\nexport default createTscPlugin();\n","export * from \"./src/plugin\";\n\nimport defaultPlugin from \"./src/plugin\";\nexport default defaultPlugin;\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAM,iBAAiB,EACrB,SAAS,UAAmB,aAA+D;AACzF,SAAQ,aAAsE;AAC5E,UAAQ,eAA8B;;GAG3C;AAED,MAAa,mBAAmB,UAAyB,EAAE,KAAK;AAE9D,KAAI,EADY,QAAQ,WAAW,MAEjC,QAAO;CAGT,MAAM,eAAe,WAAW,QAAQ,WAAW;AACnD,KAAI,aAAa,OAAO,EAAE;AACxB,UAAQ,MAAM,0CAA0C,aAAa,MAAM,UAAU;AACrF,SAAO;;CAGT,MAAM,SAAS,aAAa;CAC5B,MAAM,uBAAuB,eAAe,qBAAqB,EAAE,QAAQ,CAAC,CAAC;AAwC7E,QAtCe,EAOb,OAAO,UAAmB,SAA2D;EAEnF,MAAM,cADiB,sBAAsB,CACV,OAAO;AAC1C,MAAI,YAAY,OAAO,EAAE;AACvB,WAAQ,MAAM,qDAAqD,YAAY,MAAM,UAAU;AAC/F,UAAO,eAAe,OAAO,UAAU,QAAQ;;EAGjD,MAAM,WAAW,YAAY;EAE7B,MAAM,cAAc,kBAAkB;GAAE,iBADhB,QAAQ,oBAAoB;GACK;GAAQ;GAAU,CAAC;AAC5E,UAAQ,IAAI,uCAAuC;AAEnD,UAAQ,YAAsC;AAC5C,WAAQ,eAA8B;AAEpC,QAAI,WAAW,kBACb,QAAO;IAGT,MAAM,kBAAkB,YAAY,UAAU;KAAE;KAAY;KAAS,CAAC;AACtE,QAAI,CAAC,gBAAgB,YACnB,QAAO;AAGT,WAAO,gBAAgB;;;IAI9B;;;;;;AASH,MAAa,4BACX,SACA,UAAyB,EAAE,KACc;AAEzC,QADe,gBAAgB,QAAQ,CACzB,OAAO,EAAE,EAAE,QAAQ;;AAGnC,qBAAe,iBAAiB;;;;AC3FhC,yBAAeA"}
1
+ {"version":3,"file":"plugin.mjs","names":["_cachedPlugin: ReturnType<typeof createTscPlugin> | null"],"sources":["../src/plugin.ts"],"sourcesContent":["/**\n * TypeScript compiler plugin entrypoint for soda-gql.\n *\n * This module provides TypeScript transformer integration for soda-gql\n * when using Nest CLI with `builder: \"tsc\"`.\n */\n\nimport { createBuilderService } from \"@soda-gql/builder\";\nimport { cachedFn } from \"@soda-gql/common\";\nimport { loadConfig } from \"@soda-gql/config\";\nimport type * as ts from \"typescript\";\nimport { createTransformer } from \"./transformer\";\n\nexport type PluginOptions = {\n readonly configPath?: string;\n readonly enabled?: boolean;\n};\n\nconst fallbackPlugin = {\n before: (_options: unknown, _program: ts.Program): ts.TransformerFactory<ts.SourceFile> => {\n return (_context: ts.TransformationContext): ts.Transformer<ts.SourceFile> => {\n return (sourceFile: ts.SourceFile) => sourceFile;\n };\n },\n};\n\nexport const createTscPlugin = (options: PluginOptions = {}) => {\n const enabled = options.enabled ?? true;\n if (!enabled) {\n return fallbackPlugin;\n }\n\n const configResult = loadConfig(options.configPath);\n if (configResult.isErr()) {\n console.error(`[@soda-gql/tsc] Failed to load config: ${configResult.error.message}`);\n return fallbackPlugin;\n }\n\n const config = configResult.value;\n const ensureBuilderService = cachedFn(() => createBuilderService({ config }));\n\n const plugin = {\n /**\n * TypeScript Compiler Plugin hook: before() transformer.\n *\n * This function is called by TypeScript Compiler Plugin with (options, program) signature.\n * It must be exported as a top-level named export for CommonJS compatibility.\n */\n before(_options: unknown, program: ts.Program): ts.TransformerFactory<ts.SourceFile> {\n const builderService = ensureBuilderService();\n const buildResult = builderService.build();\n if (buildResult.isErr()) {\n console.error(`[@soda-gql/tsc] Failed to build initial artifact: ${buildResult.error.message}`);\n return fallbackPlugin.before(_options, program);\n }\n\n const artifact = buildResult.value;\n const compilerOptions = program.getCompilerOptions();\n const transformer = createTransformer({ compilerOptions, config, artifact });\n console.log(\"[@soda-gql/tsc] Transforming program\");\n\n return (context: ts.TransformationContext) => {\n return (sourceFile: ts.SourceFile) => {\n // Skip declaration files\n if (sourceFile.isDeclarationFile) {\n return sourceFile;\n }\n\n const transformResult = transformer.transform({ sourceFile, context });\n if (!transformResult.transformed) {\n return sourceFile;\n }\n\n return transformResult.sourceFile;\n };\n };\n },\n };\n\n return plugin;\n};\n\n/**\n * Create a TypeScript transformer for testing purposes.\n * This is a helper that wraps createTscPlugin to match the signature expected by tests.\n */\nexport const createSodaGqlTransformer = (\n program: ts.Program,\n options: PluginOptions = {},\n): ts.TransformerFactory<ts.SourceFile> => {\n const plugin = createTscPlugin(options);\n return plugin.before({}, program);\n};\n\nlet _cachedPlugin: ReturnType<typeof createTscPlugin> | null = null;\n\n/**\n * Named export for Nest CLI compatibility.\n * Nest CLI requires `before`, `after`, or `afterDeclarations` as direct exports.\n */\nexport function before(options: PluginOptions, program: ts.Program): ts.TransformerFactory<ts.SourceFile> {\n if (!_cachedPlugin) {\n _cachedPlugin = createTscPlugin(options);\n }\n return _cachedPlugin.before(options, program);\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAM,iBAAiB,EACrB,SAAS,UAAmB,aAA+D;AACzF,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0 +1,2 @@
1
+ export * from "./dist/index.mjs";
2
+ export { default } from "./dist/index.mjs";
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@soda-gql/tsc",
3
- "version": "0.11.6",
3
+ "version": "0.11.8",
4
4
  "description": "TypeScript transformer and compiler plugin for soda-gql",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "license": "MIT",
8
8
  "files": [
9
- "dist"
9
+ "dist",
10
+ "index.d.ts",
11
+ "index.js",
12
+ "plugin.d.ts",
13
+ "plugin.js"
10
14
  ],
11
15
  "author": {
12
16
  "name": "Shota Hatada",
@@ -58,14 +62,14 @@
58
62
  "./package.json": "./package.json"
59
63
  },
60
64
  "dependencies": {
61
- "@soda-gql/builder": "0.11.6",
62
- "@soda-gql/common": "0.11.6",
63
- "@soda-gql/config": "0.11.6",
64
- "@soda-gql/core": "0.11.6",
65
+ "@soda-gql/builder": "0.11.8",
66
+ "@soda-gql/common": "0.11.8",
67
+ "@soda-gql/config": "0.11.8",
68
+ "@soda-gql/core": "0.11.8",
65
69
  "neverthrow": "^8.1.1"
66
70
  },
67
71
  "devDependencies": {
68
- "@soda-gql/codegen": "0.11.6",
72
+ "@soda-gql/codegen": "0.11.8",
69
73
  "prettier": "^3.4.2"
70
74
  },
71
75
  "peerDependencies": {
package/plugin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./dist/plugin.d.mts";
2
+ export { default } from "./dist/plugin.d.mts";
package/plugin.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./dist/plugin.mjs";
2
+ export { default } from "./dist/plugin.mjs";