@soda-gql/tsc 0.11.5 → 0.11.6
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 +6 -0
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +4 -1
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +4 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +5 -1
- package/dist/plugin.mjs.map +1 -1
- package/package.json +6 -6
package/dist/plugin.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1
2
|
const require_transformer = require('./transformer-BE1nwZtg.cjs');
|
|
2
3
|
let __soda_gql_builder = require("@soda-gql/builder");
|
|
3
4
|
let __soda_gql_common = require("@soda-gql/common");
|
|
@@ -59,7 +60,12 @@ const createSodaGqlTransformer = (program, options = {}) => {
|
|
|
59
60
|
};
|
|
60
61
|
var plugin_default = createTscPlugin();
|
|
61
62
|
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region packages/tsc/@x-plugin.ts
|
|
65
|
+
var __x_plugin_default = plugin_default;
|
|
66
|
+
|
|
62
67
|
//#endregion
|
|
63
68
|
exports.createSodaGqlTransformer = createSodaGqlTransformer;
|
|
64
69
|
exports.createTscPlugin = createTscPlugin;
|
|
70
|
+
exports.default = __x_plugin_default;
|
|
65
71
|
//# sourceMappingURL=plugin.cjs.map
|
package/dist/plugin.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs","names":["createTransformer"],"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\nexport default createTscPlugin();\n"],"mappings":"
|
|
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"}
|
package/dist/plugin.d.cts
CHANGED
|
@@ -14,6 +14,9 @@ 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
20
|
//#endregion
|
|
18
|
-
export { PluginOptions, createSodaGqlTransformer, createTscPlugin };
|
|
21
|
+
export { PluginOptions, createSodaGqlTransformer, createTscPlugin, _default as default };
|
|
19
22
|
//# sourceMappingURL=plugin.d.cts.map
|
package/dist/plugin.d.cts.map
CHANGED
|
@@ -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,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
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","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"}
|
package/dist/plugin.d.mts
CHANGED
|
@@ -14,6 +14,9 @@ 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
20
|
//#endregion
|
|
18
|
-
export { PluginOptions, createSodaGqlTransformer, createTscPlugin };
|
|
21
|
+
export { PluginOptions, createSodaGqlTransformer, createTscPlugin, _default as default };
|
|
19
22
|
//# sourceMappingURL=plugin.d.mts.map
|
package/dist/plugin.d.mts.map
CHANGED
|
@@ -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
|
|
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"}
|
package/dist/plugin.mjs
CHANGED
|
@@ -60,5 +60,9 @@ const createSodaGqlTransformer = (program, options = {}) => {
|
|
|
60
60
|
var plugin_default = createTscPlugin();
|
|
61
61
|
|
|
62
62
|
//#endregion
|
|
63
|
-
|
|
63
|
+
//#region packages/tsc/@x-plugin.ts
|
|
64
|
+
var __x_plugin_default = plugin_default;
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
export { createSodaGqlTransformer, createTscPlugin, __x_plugin_default as default };
|
|
64
68
|
//# sourceMappingURL=plugin.mjs.map
|
package/dist/plugin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.mjs","names":[],"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\nexport default createTscPlugin();\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"}
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soda-gql/tsc",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.6",
|
|
4
4
|
"description": "TypeScript transformer and compiler plugin for soda-gql",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
"./package.json": "./package.json"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@soda-gql/builder": "0.11.
|
|
62
|
-
"@soda-gql/common": "0.11.
|
|
63
|
-
"@soda-gql/config": "0.11.
|
|
64
|
-
"@soda-gql/core": "0.11.
|
|
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
65
|
"neverthrow": "^8.1.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@soda-gql/codegen": "0.11.
|
|
68
|
+
"@soda-gql/codegen": "0.11.6",
|
|
69
69
|
"prettier": "^3.4.2"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|