@soda-gql/tsc 0.11.5 → 0.11.7
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 +10 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +6 -1
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +6 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +10 -2
- package/dist/plugin.mjs.map +1 -1
- package/package.json +6 -6
package/dist/plugin.cjs
CHANGED
|
@@ -57,9 +57,18 @@ const createTscPlugin = (options = {}) => {
|
|
|
57
57
|
const createSodaGqlTransformer = (program, options = {}) => {
|
|
58
58
|
return createTscPlugin(options).before({}, program);
|
|
59
59
|
};
|
|
60
|
-
|
|
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
|
+
}
|
|
61
69
|
|
|
62
70
|
//#endregion
|
|
71
|
+
exports.before = before;
|
|
63
72
|
exports.createSodaGqlTransformer = createSodaGqlTransformer;
|
|
64
73
|
exports.createTscPlugin = createTscPlugin;
|
|
65
74
|
//# 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
|
|
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,6 +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
|
+
/**
|
|
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>;
|
|
17
22
|
//#endregion
|
|
18
|
-
export { PluginOptions, createSodaGqlTransformer, createTscPlugin };
|
|
23
|
+
export { PluginOptions, before, createSodaGqlTransformer, createTscPlugin };
|
|
19
24
|
//# 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;;;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.d.mts
CHANGED
|
@@ -14,6 +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
|
+
/**
|
|
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>;
|
|
17
22
|
//#endregion
|
|
18
|
-
export { PluginOptions, createSodaGqlTransformer, createTscPlugin };
|
|
23
|
+
export { PluginOptions, before, createSodaGqlTransformer, createTscPlugin };
|
|
19
24
|
//# 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;;;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,8 +57,16 @@ const createTscPlugin = (options = {}) => {
|
|
|
57
57
|
const createSodaGqlTransformer = (program, options = {}) => {
|
|
58
58
|
return createTscPlugin(options).before({}, program);
|
|
59
59
|
};
|
|
60
|
-
|
|
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
|
+
}
|
|
61
69
|
|
|
62
70
|
//#endregion
|
|
63
|
-
export { createSodaGqlTransformer, createTscPlugin };
|
|
71
|
+
export { before, createSodaGqlTransformer, createTscPlugin };
|
|
64
72
|
//# 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
|
|
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,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,IAAIA,gBAA2D;;;;;AAM/D,SAAgB,OAAO,SAAwB,SAA2D;AACxG,KAAI,CAAC,cACH,iBAAgB,gBAAgB,QAAQ;AAE1C,QAAO,cAAc,OAAO,SAAS,QAAQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soda-gql/tsc",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.7",
|
|
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.7",
|
|
62
|
+
"@soda-gql/common": "0.11.7",
|
|
63
|
+
"@soda-gql/config": "0.11.7",
|
|
64
|
+
"@soda-gql/core": "0.11.7",
|
|
65
65
|
"neverthrow": "^8.1.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@soda-gql/codegen": "0.11.
|
|
68
|
+
"@soda-gql/codegen": "0.11.7",
|
|
69
69
|
"prettier": "^3.4.2"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|