@soda-gql/plugin-common 0.7.0 → 0.9.0

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/index.cjs CHANGED
@@ -121,20 +121,47 @@ const setSharedBuilderService = (key, service) => {
121
121
  /**
122
122
  * Create plugin session by loading config and creating cached builder service.
123
123
  * Returns null if disabled or config load fails.
124
+ *
125
+ * @param options - Plugin options
126
+ * @param pluginName - Name of the plugin for error messages
127
+ * @throws Error if failOnError is true and config load fails
124
128
  */
125
129
  const createPluginSession = (options, pluginName) => {
126
- if (!(options.enabled ?? true)) return null;
130
+ const enabled = options.enabled ?? true;
131
+ const failOnError = options.failOnError ?? true;
132
+ if (!enabled) return null;
127
133
  const configResult = (0, __soda_gql_config.loadConfig)(options.configPath);
128
134
  if (configResult.isErr()) {
129
- console.error(`[${pluginName}] Failed to load config:`, {
135
+ const errorMsg = `[${pluginName}] Failed to load config: ${configResult.error.message}`;
136
+ console.error(errorMsg, {
130
137
  code: configResult.error.code,
131
- message: configResult.error.message,
132
138
  filePath: configResult.error.filePath,
133
139
  cause: configResult.error.cause
134
140
  });
141
+ if (failOnError) throw new Error(errorMsg);
135
142
  return null;
136
143
  }
137
144
  const config = configResult.value;
145
+ if (config.artifact?.path) {
146
+ const artifactResult = (0, __soda_gql_builder.loadArtifactSync)(config.artifact.path);
147
+ if (artifactResult.isErr()) {
148
+ const errorMsg = `[${pluginName}] Failed to load pre-built artifact: ${artifactResult.error.message}`;
149
+ console.error(errorMsg, {
150
+ code: artifactResult.error.code,
151
+ filePath: artifactResult.error.filePath
152
+ });
153
+ if (failOnError) throw new Error(errorMsg);
154
+ return null;
155
+ }
156
+ const prebuiltArtifact = artifactResult.value;
157
+ console.log(`[${pluginName}] Using pre-built artifact: ${config.artifact.path}`);
158
+ return {
159
+ config,
160
+ getArtifact: () => prebuiltArtifact,
161
+ getArtifactAsync: async () => prebuiltArtifact,
162
+ isPrebuiltMode: true
163
+ };
164
+ }
138
165
  const stateKey = getStateKey(options.configPath);
139
166
  const ensureBuilderService = () => {
140
167
  const existing = getSharedBuilderService(stateKey);
@@ -145,13 +172,16 @@ const createPluginSession = (options, pluginName) => {
145
172
  };
146
173
  /**
147
174
  * Build artifact on every invocation (like tsc-plugin).
148
- * If artifact.useBuilder is false and artifact.path is provided, load from file instead.
149
175
  * This ensures the artifact is always up-to-date with the latest source files.
176
+ *
177
+ * @throws Error if failOnError is true and build fails
150
178
  */
151
179
  const getArtifact = () => {
152
180
  const buildResult = ensureBuilderService().build();
153
181
  if (buildResult.isErr()) {
154
- console.error(`[${pluginName}] Failed to build artifact: ${buildResult.error.message}`);
182
+ const formattedError = (0, __soda_gql_builder.formatBuilderErrorForCLI)(buildResult.error);
183
+ console.error(`[${pluginName}] Build failed:\n${formattedError}`);
184
+ if (failOnError) throw new Error(`[${pluginName}] ${buildResult.error.message}`);
155
185
  return null;
156
186
  }
157
187
  return buildResult.value;
@@ -159,11 +189,15 @@ const createPluginSession = (options, pluginName) => {
159
189
  /**
160
190
  * Async version of getArtifact.
161
191
  * Supports async metadata factories and parallel element evaluation.
192
+ *
193
+ * @throws Error if failOnError is true and build fails
162
194
  */
163
195
  const getArtifactAsync = async () => {
164
196
  const buildResult = await ensureBuilderService().buildAsync();
165
197
  if (buildResult.isErr()) {
166
- console.error(`[${pluginName}] Failed to build artifact: ${buildResult.error.message}`);
198
+ const formattedError = (0, __soda_gql_builder.formatBuilderErrorForCLI)(buildResult.error);
199
+ console.error(`[${pluginName}] Build failed:\n${formattedError}`);
200
+ if (failOnError) throw new Error(`[${pluginName}] ${buildResult.error.message}`);
167
201
  return null;
168
202
  }
169
203
  return buildResult.value;
@@ -171,7 +205,8 @@ const createPluginSession = (options, pluginName) => {
171
205
  return {
172
206
  config,
173
207
  getArtifact,
174
- getArtifactAsync
208
+ getArtifactAsync,
209
+ isPrebuiltMode: false
175
210
  };
176
211
  };
177
212
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/errors.ts","../src/shared-state.ts","../src/plugin-session.ts","../src/utils/canonical-id.ts"],"sourcesContent":["/**\n * Error types and formatters for plugin-babel.\n * Simplified from plugin-shared to include only types actually used by the Babel transformer.\n */\n\nimport type { BuilderError } from \"@soda-gql/builder\";\nimport type { CanonicalId } from \"@soda-gql/common\";\n\ntype OptionsInvalidBuilderConfig = { readonly code: \"INVALID_BUILDER_CONFIG\"; readonly message: string };\ntype OptionsMissingBuilderConfig = { readonly code: \"MISSING_BUILDER_CONFIG\"; readonly message: string };\ntype OptionsConfigLoadFailed = { readonly code: \"CONFIG_LOAD_FAILED\"; readonly message: string };\n\ntype BuilderEntryNotFound = Extract<BuilderError, { code: \"ENTRY_NOT_FOUND\" }>;\ntype BuilderDocDuplicate = Extract<BuilderError, { code: \"DOC_DUPLICATE\" }>;\ntype BuilderCircularDependency = Extract<BuilderError, { code: \"GRAPH_CIRCULAR_DEPENDENCY\" }>;\ntype BuilderModuleEvaluationFailed = Extract<BuilderError, { code: \"RUNTIME_MODULE_LOAD_FAILED\" }>;\ntype BuilderWriteFailed = Extract<BuilderError, { code: \"WRITE_FAILED\" }>;\n\ntype AnalysisMetadataMissingCause = { readonly filename: string };\ntype AnalysisArtifactMissingCause = { readonly filename: string; readonly canonicalId: CanonicalId };\ntype AnalysisUnsupportedArtifactTypeCause = {\n readonly filename: string;\n readonly canonicalId: CanonicalId;\n readonly artifactType: string;\n};\n\ntype PluginErrorBase<Code extends string, Cause> = {\n readonly type: \"PluginError\";\n readonly code: Code;\n readonly message: string;\n readonly cause: Cause;\n};\n\nexport type PluginOptionsInvalidBuilderConfigError = PluginErrorBase<\n \"OPTIONS_INVALID_BUILDER_CONFIG\",\n OptionsInvalidBuilderConfig | OptionsMissingBuilderConfig | OptionsConfigLoadFailed\n> & { readonly stage: \"normalize-options\" };\n\nexport type PluginBuilderEntryNotFoundError = PluginErrorBase<\"SODA_GQL_BUILDER_ENTRY_NOT_FOUND\", BuilderEntryNotFound> & {\n readonly stage: \"builder\";\n readonly entry: string;\n};\n\nexport type PluginBuilderDocDuplicateError = PluginErrorBase<\"SODA_GQL_BUILDER_DOC_DUPLICATE\", BuilderDocDuplicate> & {\n readonly stage: \"builder\";\n readonly name: string;\n readonly sources: readonly string[];\n};\n\nexport type PluginBuilderCircularDependencyError = PluginErrorBase<\n \"SODA_GQL_BUILDER_CIRCULAR_DEPENDENCY\",\n BuilderCircularDependency\n> & { readonly stage: \"builder\"; readonly chain: readonly string[] };\n\nexport type PluginBuilderModuleEvaluationFailedError = PluginErrorBase<\n \"SODA_GQL_BUILDER_MODULE_EVALUATION_FAILED\",\n BuilderModuleEvaluationFailed\n> & { readonly stage: \"builder\"; readonly filePath: string; readonly astPath: string };\n\nexport type PluginBuilderWriteFailedError = PluginErrorBase<\"SODA_GQL_BUILDER_WRITE_FAILED\", BuilderWriteFailed> & {\n readonly stage: \"builder\";\n readonly outPath: string;\n};\n\nexport type PluginBuilderUnexpectedError = PluginErrorBase<\"SODA_GQL_BUILDER_UNEXPECTED\", unknown> & {\n readonly stage: \"builder\";\n};\n\nexport type PluginAnalysisMetadataMissingError = PluginErrorBase<\"SODA_GQL_METADATA_NOT_FOUND\", AnalysisMetadataMissingCause> & {\n readonly stage: \"analysis\";\n readonly filename: string;\n};\n\nexport type PluginAnalysisArtifactMissingError = PluginErrorBase<\n \"SODA_GQL_ANALYSIS_ARTIFACT_NOT_FOUND\",\n AnalysisArtifactMissingCause\n> & { readonly stage: \"analysis\"; readonly filename: string; readonly canonicalId: CanonicalId };\n\nexport type PluginAnalysisUnsupportedArtifactTypeError = PluginErrorBase<\n \"SODA_GQL_UNSUPPORTED_ARTIFACT_TYPE\",\n AnalysisUnsupportedArtifactTypeCause\n> & {\n readonly stage: \"analysis\";\n readonly filename: string;\n readonly canonicalId: CanonicalId;\n readonly artifactType: string;\n};\n\ntype TransformMissingBuilderArgCause = { readonly filename: string; readonly builderType: string; readonly argName: string };\ntype TransformUnsupportedValueTypeCause = { readonly valueType: string };\ntype TransformAstVisitorFailedCause = { readonly filename: string; readonly reason: string };\n\nexport type PluginTransformMissingBuilderArgError = PluginErrorBase<\n \"SODA_GQL_TRANSFORM_MISSING_BUILDER_ARG\",\n TransformMissingBuilderArgCause\n> & {\n readonly stage: \"transform\";\n readonly filename: string;\n readonly builderType: string;\n readonly argName: string;\n};\n\nexport type PluginTransformUnsupportedValueTypeError = PluginErrorBase<\n \"SODA_GQL_TRANSFORM_UNSUPPORTED_VALUE_TYPE\",\n TransformUnsupportedValueTypeCause\n> & { readonly stage: \"transform\"; readonly valueType: string };\n\nexport type PluginTransformAstVisitorFailedError = PluginErrorBase<\n \"SODA_GQL_TRANSFORM_AST_VISITOR_FAILED\",\n TransformAstVisitorFailedCause\n> & { readonly stage: \"transform\"; readonly filename: string; readonly reason: string };\n\n/**\n * Union of all plugin error types.\n */\nexport type PluginError =\n | PluginOptionsInvalidBuilderConfigError\n | PluginBuilderEntryNotFoundError\n | PluginBuilderDocDuplicateError\n | PluginBuilderCircularDependencyError\n | PluginBuilderModuleEvaluationFailedError\n | PluginBuilderWriteFailedError\n | PluginBuilderUnexpectedError\n | PluginAnalysisMetadataMissingError\n | PluginAnalysisArtifactMissingError\n | PluginAnalysisUnsupportedArtifactTypeError\n | PluginTransformMissingBuilderArgError\n | PluginTransformUnsupportedValueTypeError\n | PluginTransformAstVisitorFailedError;\n\n/**\n * Format a PluginError into a human-readable message.\n */\nexport const formatPluginError = (error: PluginError): string => {\n const codePrefix = `[${error.code}]`;\n const stageInfo = \"stage\" in error ? ` (${error.stage})` : \"\";\n return `${codePrefix}${stageInfo} ${error.message}`;\n};\n\n/**\n * Type guard for PluginError.\n */\nexport const isPluginError = (value: unknown): value is PluginError => {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"type\" in value &&\n value.type === \"PluginError\" &&\n \"code\" in value &&\n \"message\" in value\n );\n};\n\n/**\n * Assertion helper for unreachable code paths.\n * This is the ONLY acceptable throw in plugin code.\n */\nexport const assertUnreachable = (value: never, context?: string): never => {\n throw new Error(`[INTERNAL] Unreachable code path${context ? ` in ${context}` : \"\"}: received ${JSON.stringify(value)}`);\n};\n","import type { BuilderArtifact, BuilderService } from \"@soda-gql/builder\";\nimport type { PluginSession } from \"./plugin-session\";\n\n/**\n * Transformer type for code transformation.\n * - 'babel': Use Babel plugin (default, wider compatibility)\n * - 'swc': Use SWC transformer (faster, requires @soda-gql/swc-transformer)\n */\nexport type TransformerType = \"babel\" | \"swc\";\n\n/**\n * Minimal interface for SWC transformer.\n * Matches the Transformer interface from @soda-gql/swc-transformer.\n */\nexport interface SwcTransformerInterface {\n transform(input: { sourceCode: string; sourcePath: string; inputSourceMap?: string }): {\n transformed: boolean;\n sourceCode: string;\n sourceMap?: string;\n };\n}\n\n/**\n * Shared state between bundler plugins and loaders.\n * Enables efficient artifact sharing across build pipeline stages.\n */\nexport type SharedState = {\n pluginSession: PluginSession | null;\n currentArtifact: BuilderArtifact | null;\n moduleAdjacency: Map<string, Set<string>>;\n generation: number;\n swcTransformer: SwcTransformerInterface | null;\n transformerType: TransformerType | null;\n builderService: BuilderService | null;\n};\n\n// Global state for sharing between plugin and loader\nconst sharedStates = new Map<string, SharedState>();\n\n/**\n * Get shared state for a given project (identified by config path or cwd).\n */\nexport const getSharedState = (key: string): SharedState => {\n let state = sharedStates.get(key);\n if (!state) {\n state = {\n pluginSession: null,\n currentArtifact: null,\n moduleAdjacency: new Map(),\n generation: 0,\n swcTransformer: null,\n transformerType: null,\n builderService: null,\n };\n sharedStates.set(key, state);\n }\n return state;\n};\n\n/**\n * Update shared artifact.\n */\nexport const setSharedArtifact = (\n key: string,\n artifact: BuilderArtifact | null,\n moduleAdjacency?: Map<string, Set<string>>,\n): void => {\n const state = getSharedState(key);\n state.currentArtifact = artifact;\n if (moduleAdjacency) {\n state.moduleAdjacency = moduleAdjacency;\n }\n state.generation++;\n};\n\n/**\n * Get shared artifact.\n */\nexport const getSharedArtifact = (key: string): BuilderArtifact | null => {\n return getSharedState(key).currentArtifact;\n};\n\n/**\n * Get shared plugin session.\n */\nexport const getSharedPluginSession = (key: string): PluginSession | null => {\n return getSharedState(key).pluginSession;\n};\n\n/**\n * Set shared plugin session.\n */\nexport const setSharedPluginSession = (key: string, session: PluginSession | null): void => {\n getSharedState(key).pluginSession = session;\n};\n\n/**\n * Get the state key from config path or cwd.\n */\nexport const getStateKey = (configPath?: string): string => {\n return configPath ?? process.cwd();\n};\n\n/**\n * Set shared SWC transformer.\n */\nexport const setSharedSwcTransformer = (key: string, transformer: SwcTransformerInterface | null): void => {\n getSharedState(key).swcTransformer = transformer;\n};\n\n/**\n * Get shared SWC transformer.\n */\nexport const getSharedSwcTransformer = (key: string): SwcTransformerInterface | null => {\n return getSharedState(key).swcTransformer;\n};\n\n/**\n * Set shared transformer type.\n */\nexport const setSharedTransformerType = (key: string, transformerType: TransformerType | null): void => {\n getSharedState(key).transformerType = transformerType;\n};\n\n/**\n * Get shared transformer type.\n */\nexport const getSharedTransformerType = (key: string): TransformerType | null => {\n return getSharedState(key).transformerType;\n};\n\n/**\n * Get shared BuilderService.\n */\nexport const getSharedBuilderService = (key: string): BuilderService | null => {\n return getSharedState(key).builderService;\n};\n\n/**\n * Set shared BuilderService.\n */\nexport const setSharedBuilderService = (key: string, service: BuilderService | null): void => {\n getSharedState(key).builderService = service;\n};\n","/**\n * Plugin session management for all plugins.\n * Unified from plugin-babel and plugin-swc implementations.\n */\n\nimport type { BuilderArtifact, BuilderService } from \"@soda-gql/builder\";\nimport { createBuilderService } from \"@soda-gql/builder\";\nimport { loadConfig, type ResolvedSodaGqlConfig } from \"@soda-gql/config\";\nimport { getSharedBuilderService, getStateKey, setSharedBuilderService } from \"./shared-state\";\n\n/**\n * Plugin options shared across all plugins.\n */\nexport type PluginOptions = {\n readonly configPath?: string;\n readonly enabled?: boolean;\n};\n\n/**\n * Plugin session containing builder service and configuration.\n */\nexport type PluginSession = {\n readonly config: ResolvedSodaGqlConfig;\n readonly getArtifact: () => BuilderArtifact | null;\n readonly getArtifactAsync: () => Promise<BuilderArtifact | null>;\n};\n\n/**\n * Create plugin session by loading config and creating cached builder service.\n * Returns null if disabled or config load fails.\n */\nexport const createPluginSession = (options: PluginOptions, pluginName: string): PluginSession | null => {\n const enabled = options.enabled ?? true;\n if (!enabled) {\n return null;\n }\n\n const configResult = loadConfig(options.configPath);\n if (configResult.isErr()) {\n console.error(`[${pluginName}] Failed to load config:`, {\n code: configResult.error.code,\n message: configResult.error.message,\n filePath: configResult.error.filePath,\n cause: configResult.error.cause,\n });\n return null;\n }\n\n const config = configResult.value;\n const stateKey = getStateKey(options.configPath);\n\n // Use global BuilderService cache to share FileTracker state across plugin instances\n const ensureBuilderService = (): BuilderService => {\n const existing = getSharedBuilderService(stateKey);\n if (existing) {\n return existing;\n }\n\n const service = createBuilderService({ config });\n setSharedBuilderService(stateKey, service);\n return service;\n };\n\n /**\n * Build artifact on every invocation (like tsc-plugin).\n * If artifact.useBuilder is false and artifact.path is provided, load from file instead.\n * This ensures the artifact is always up-to-date with the latest source files.\n */\n const getArtifact = (): BuilderArtifact | null => {\n const builderService = ensureBuilderService();\n const buildResult = builderService.build();\n if (buildResult.isErr()) {\n console.error(`[${pluginName}] Failed to build artifact: ${buildResult.error.message}`);\n return null;\n }\n return buildResult.value;\n };\n\n /**\n * Async version of getArtifact.\n * Supports async metadata factories and parallel element evaluation.\n */\n const getArtifactAsync = async (): Promise<BuilderArtifact | null> => {\n const builderService = ensureBuilderService();\n const buildResult = await builderService.buildAsync();\n if (buildResult.isErr()) {\n console.error(`[${pluginName}] Failed to build artifact: ${buildResult.error.message}`);\n return null;\n }\n return buildResult.value;\n };\n\n return {\n config,\n getArtifact,\n getArtifactAsync,\n };\n};\n","/**\n * Utility for working with canonical IDs.\n */\n\nimport { resolve } from \"node:path\";\nimport { type CanonicalId, createCanonicalId } from \"@soda-gql/common\";\n\n/**\n * Resolve a canonical ID from a filename and AST path.\n */\nexport const resolveCanonicalId = (filename: string, astPath: string): CanonicalId =>\n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;AAGrB,QAAO;EACL;EACA;EACA;EACD;;;;;;;;;;;ACtFH,MAAa,sBAAsB,UAAkB,4EACzB,SAAS,EAAE,QAAQ"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/errors.ts","../src/shared-state.ts","../src/plugin-session.ts","../src/utils/canonical-id.ts"],"sourcesContent":["/**\n * Error types and formatters for plugin-babel.\n * Simplified from plugin-shared to include only types actually used by the Babel transformer.\n */\n\nimport type { BuilderError } from \"@soda-gql/builder\";\nimport type { CanonicalId } from \"@soda-gql/common\";\n\ntype OptionsInvalidBuilderConfig = { readonly code: \"INVALID_BUILDER_CONFIG\"; readonly message: string };\ntype OptionsMissingBuilderConfig = { readonly code: \"MISSING_BUILDER_CONFIG\"; readonly message: string };\ntype OptionsConfigLoadFailed = { readonly code: \"CONFIG_LOAD_FAILED\"; readonly message: string };\n\ntype BuilderEntryNotFound = Extract<BuilderError, { code: \"ENTRY_NOT_FOUND\" }>;\ntype BuilderDocDuplicate = Extract<BuilderError, { code: \"DOC_DUPLICATE\" }>;\ntype BuilderCircularDependency = Extract<BuilderError, { code: \"GRAPH_CIRCULAR_DEPENDENCY\" }>;\ntype BuilderModuleEvaluationFailed = Extract<BuilderError, { code: \"RUNTIME_MODULE_LOAD_FAILED\" }>;\ntype BuilderWriteFailed = Extract<BuilderError, { code: \"WRITE_FAILED\" }>;\n\ntype AnalysisMetadataMissingCause = { readonly filename: string };\ntype AnalysisArtifactMissingCause = { readonly filename: string; readonly canonicalId: CanonicalId };\ntype AnalysisUnsupportedArtifactTypeCause = {\n readonly filename: string;\n readonly canonicalId: CanonicalId;\n readonly artifactType: string;\n};\n\ntype PluginErrorBase<Code extends string, Cause> = {\n readonly type: \"PluginError\";\n readonly code: Code;\n readonly message: string;\n readonly cause: Cause;\n};\n\nexport type PluginOptionsInvalidBuilderConfigError = PluginErrorBase<\n \"OPTIONS_INVALID_BUILDER_CONFIG\",\n OptionsInvalidBuilderConfig | OptionsMissingBuilderConfig | OptionsConfigLoadFailed\n> & { readonly stage: \"normalize-options\" };\n\nexport type PluginBuilderEntryNotFoundError = PluginErrorBase<\"SODA_GQL_BUILDER_ENTRY_NOT_FOUND\", BuilderEntryNotFound> & {\n readonly stage: \"builder\";\n readonly entry: string;\n};\n\nexport type PluginBuilderDocDuplicateError = PluginErrorBase<\"SODA_GQL_BUILDER_DOC_DUPLICATE\", BuilderDocDuplicate> & {\n readonly stage: \"builder\";\n readonly name: string;\n readonly sources: readonly string[];\n};\n\nexport type PluginBuilderCircularDependencyError = PluginErrorBase<\n \"SODA_GQL_BUILDER_CIRCULAR_DEPENDENCY\",\n BuilderCircularDependency\n> & { readonly stage: \"builder\"; readonly chain: readonly string[] };\n\nexport type PluginBuilderModuleEvaluationFailedError = PluginErrorBase<\n \"SODA_GQL_BUILDER_MODULE_EVALUATION_FAILED\",\n BuilderModuleEvaluationFailed\n> & { readonly stage: \"builder\"; readonly filePath: string; readonly astPath: string };\n\nexport type PluginBuilderWriteFailedError = PluginErrorBase<\"SODA_GQL_BUILDER_WRITE_FAILED\", BuilderWriteFailed> & {\n readonly stage: \"builder\";\n readonly outPath: string;\n};\n\nexport type PluginBuilderUnexpectedError = PluginErrorBase<\"SODA_GQL_BUILDER_UNEXPECTED\", unknown> & {\n readonly stage: \"builder\";\n};\n\nexport type PluginAnalysisMetadataMissingError = PluginErrorBase<\"SODA_GQL_METADATA_NOT_FOUND\", AnalysisMetadataMissingCause> & {\n readonly stage: \"analysis\";\n readonly filename: string;\n};\n\nexport type PluginAnalysisArtifactMissingError = PluginErrorBase<\n \"SODA_GQL_ANALYSIS_ARTIFACT_NOT_FOUND\",\n AnalysisArtifactMissingCause\n> & { readonly stage: \"analysis\"; readonly filename: string; readonly canonicalId: CanonicalId };\n\nexport type PluginAnalysisUnsupportedArtifactTypeError = PluginErrorBase<\n \"SODA_GQL_UNSUPPORTED_ARTIFACT_TYPE\",\n AnalysisUnsupportedArtifactTypeCause\n> & {\n readonly stage: \"analysis\";\n readonly filename: string;\n readonly canonicalId: CanonicalId;\n readonly artifactType: string;\n};\n\ntype TransformMissingBuilderArgCause = { readonly filename: string; readonly builderType: string; readonly argName: string };\ntype TransformUnsupportedValueTypeCause = { readonly valueType: string };\ntype TransformAstVisitorFailedCause = { readonly filename: string; readonly reason: string };\n\nexport type PluginTransformMissingBuilderArgError = PluginErrorBase<\n \"SODA_GQL_TRANSFORM_MISSING_BUILDER_ARG\",\n TransformMissingBuilderArgCause\n> & {\n readonly stage: \"transform\";\n readonly filename: string;\n readonly builderType: string;\n readonly argName: string;\n};\n\nexport type PluginTransformUnsupportedValueTypeError = PluginErrorBase<\n \"SODA_GQL_TRANSFORM_UNSUPPORTED_VALUE_TYPE\",\n TransformUnsupportedValueTypeCause\n> & { readonly stage: \"transform\"; readonly valueType: string };\n\nexport type PluginTransformAstVisitorFailedError = PluginErrorBase<\n \"SODA_GQL_TRANSFORM_AST_VISITOR_FAILED\",\n TransformAstVisitorFailedCause\n> & { readonly stage: \"transform\"; readonly filename: string; readonly reason: string };\n\n/**\n * Union of all plugin error types.\n */\nexport type PluginError =\n | PluginOptionsInvalidBuilderConfigError\n | PluginBuilderEntryNotFoundError\n | PluginBuilderDocDuplicateError\n | PluginBuilderCircularDependencyError\n | PluginBuilderModuleEvaluationFailedError\n | PluginBuilderWriteFailedError\n | PluginBuilderUnexpectedError\n | PluginAnalysisMetadataMissingError\n | PluginAnalysisArtifactMissingError\n | PluginAnalysisUnsupportedArtifactTypeError\n | PluginTransformMissingBuilderArgError\n | PluginTransformUnsupportedValueTypeError\n | PluginTransformAstVisitorFailedError;\n\n/**\n * Format a PluginError into a human-readable message.\n */\nexport const formatPluginError = (error: PluginError): string => {\n const codePrefix = `[${error.code}]`;\n const stageInfo = \"stage\" in error ? ` (${error.stage})` : \"\";\n return `${codePrefix}${stageInfo} ${error.message}`;\n};\n\n/**\n * Type guard for PluginError.\n */\nexport const isPluginError = (value: unknown): value is PluginError => {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"type\" in value &&\n value.type === \"PluginError\" &&\n \"code\" in value &&\n \"message\" in value\n );\n};\n\n/**\n * Assertion helper for unreachable code paths.\n * This is the ONLY acceptable throw in plugin code.\n */\nexport const assertUnreachable = (value: never, context?: string): never => {\n throw new Error(`[INTERNAL] Unreachable code path${context ? ` in ${context}` : \"\"}: received ${JSON.stringify(value)}`);\n};\n","import type { BuilderArtifact, BuilderService } from \"@soda-gql/builder\";\nimport type { PluginSession } from \"./plugin-session\";\n\n/**\n * Transformer type for code transformation.\n * - 'babel': Use Babel plugin (default, wider compatibility)\n * - 'swc': Use SWC transformer (faster, requires @soda-gql/swc-transformer)\n */\nexport type TransformerType = \"babel\" | \"swc\";\n\n/**\n * Minimal interface for SWC transformer.\n * Matches the Transformer interface from @soda-gql/swc-transformer.\n */\nexport interface SwcTransformerInterface {\n transform(input: { sourceCode: string; sourcePath: string; inputSourceMap?: string }): {\n transformed: boolean;\n sourceCode: string;\n sourceMap?: string;\n };\n}\n\n/**\n * Shared state between bundler plugins and loaders.\n * Enables efficient artifact sharing across build pipeline stages.\n */\nexport type SharedState = {\n pluginSession: PluginSession | null;\n currentArtifact: BuilderArtifact | null;\n moduleAdjacency: Map<string, Set<string>>;\n generation: number;\n swcTransformer: SwcTransformerInterface | null;\n transformerType: TransformerType | null;\n builderService: BuilderService | null;\n};\n\n// Global state for sharing between plugin and loader\nconst sharedStates = new Map<string, SharedState>();\n\n/**\n * Get shared state for a given project (identified by config path or cwd).\n */\nexport const getSharedState = (key: string): SharedState => {\n let state = sharedStates.get(key);\n if (!state) {\n state = {\n pluginSession: null,\n currentArtifact: null,\n moduleAdjacency: new Map(),\n generation: 0,\n swcTransformer: null,\n transformerType: null,\n builderService: null,\n };\n sharedStates.set(key, state);\n }\n return state;\n};\n\n/**\n * Update shared artifact.\n */\nexport const setSharedArtifact = (\n key: string,\n artifact: BuilderArtifact | null,\n moduleAdjacency?: Map<string, Set<string>>,\n): void => {\n const state = getSharedState(key);\n state.currentArtifact = artifact;\n if (moduleAdjacency) {\n state.moduleAdjacency = moduleAdjacency;\n }\n state.generation++;\n};\n\n/**\n * Get shared artifact.\n */\nexport const getSharedArtifact = (key: string): BuilderArtifact | null => {\n return getSharedState(key).currentArtifact;\n};\n\n/**\n * Get shared plugin session.\n */\nexport const getSharedPluginSession = (key: string): PluginSession | null => {\n return getSharedState(key).pluginSession;\n};\n\n/**\n * Set shared plugin session.\n */\nexport const setSharedPluginSession = (key: string, session: PluginSession | null): void => {\n getSharedState(key).pluginSession = session;\n};\n\n/**\n * Get the state key from config path or cwd.\n */\nexport const getStateKey = (configPath?: string): string => {\n return configPath ?? process.cwd();\n};\n\n/**\n * Set shared SWC transformer.\n */\nexport const setSharedSwcTransformer = (key: string, transformer: SwcTransformerInterface | null): void => {\n getSharedState(key).swcTransformer = transformer;\n};\n\n/**\n * Get shared SWC transformer.\n */\nexport const getSharedSwcTransformer = (key: string): SwcTransformerInterface | null => {\n return getSharedState(key).swcTransformer;\n};\n\n/**\n * Set shared transformer type.\n */\nexport const setSharedTransformerType = (key: string, transformerType: TransformerType | null): void => {\n getSharedState(key).transformerType = transformerType;\n};\n\n/**\n * Get shared transformer type.\n */\nexport const getSharedTransformerType = (key: string): TransformerType | null => {\n return getSharedState(key).transformerType;\n};\n\n/**\n * Get shared BuilderService.\n */\nexport const getSharedBuilderService = (key: string): BuilderService | null => {\n return getSharedState(key).builderService;\n};\n\n/**\n * Set shared BuilderService.\n */\nexport const setSharedBuilderService = (key: string, service: BuilderService | null): void => {\n getSharedState(key).builderService = service;\n};\n","/**\n * Plugin session management for all plugins.\n * Unified from plugin-babel and plugin-swc implementations.\n */\n\nimport type { BuilderArtifact, BuilderService } from \"@soda-gql/builder\";\nimport { createBuilderService, formatBuilderErrorForCLI, loadArtifactSync } from \"@soda-gql/builder\";\nimport { loadConfig, type ResolvedSodaGqlConfig } from \"@soda-gql/config\";\nimport { getSharedBuilderService, getStateKey, setSharedBuilderService } from \"./shared-state\";\n\n/**\n * Plugin options shared across all plugins.\n */\nexport type PluginOptions = {\n readonly configPath?: string;\n readonly enabled?: boolean;\n /**\n * Whether to fail the build on error.\n * When true (default), throws an error that fails the bundler build.\n * When false, logs the error and continues (graceful degradation).\n */\n readonly failOnError?: boolean;\n};\n\n/**\n * Plugin session containing builder service and configuration.\n */\nexport type PluginSession = {\n readonly config: ResolvedSodaGqlConfig;\n readonly getArtifact: () => BuilderArtifact | null;\n readonly getArtifactAsync: () => Promise<BuilderArtifact | null>;\n /**\n * Whether the session is using a pre-built artifact.\n * When true, artifacts are loaded from a file instead of built dynamically.\n */\n readonly isPrebuiltMode: boolean;\n};\n\n/**\n * Create plugin session by loading config and creating cached builder service.\n * Returns null if disabled or config load fails.\n *\n * @param options - Plugin options\n * @param pluginName - Name of the plugin for error messages\n * @throws Error if failOnError is true and config load fails\n */\nexport const createPluginSession = (options: PluginOptions, pluginName: string): PluginSession | null => {\n const enabled = options.enabled ?? true;\n const failOnError = options.failOnError ?? true;\n\n if (!enabled) {\n return null;\n }\n\n const configResult = loadConfig(options.configPath);\n if (configResult.isErr()) {\n const errorMsg = `[${pluginName}] Failed to load config: ${configResult.error.message}`;\n console.error(errorMsg, {\n code: configResult.error.code,\n filePath: configResult.error.filePath,\n cause: configResult.error.cause,\n });\n if (failOnError) {\n throw new Error(errorMsg);\n }\n return null;\n }\n\n const config = configResult.value;\n\n // Check if pre-built artifact mode is enabled\n if (config.artifact?.path) {\n const artifactResult = loadArtifactSync(config.artifact.path);\n\n if (artifactResult.isErr()) {\n const errorMsg = `[${pluginName}] Failed to load pre-built artifact: ${artifactResult.error.message}`;\n console.error(errorMsg, {\n code: artifactResult.error.code,\n filePath: artifactResult.error.filePath,\n });\n if (failOnError) {\n throw new Error(errorMsg);\n }\n return null;\n }\n\n const prebuiltArtifact = artifactResult.value;\n console.log(`[${pluginName}] Using pre-built artifact: ${config.artifact.path}`);\n\n return {\n config,\n getArtifact: () => prebuiltArtifact,\n getArtifactAsync: async () => prebuiltArtifact,\n isPrebuiltMode: true,\n };\n }\n\n // Dynamic build mode\n const stateKey = getStateKey(options.configPath);\n\n // Use global BuilderService cache to share FileTracker state across plugin instances\n const ensureBuilderService = (): BuilderService => {\n const existing = getSharedBuilderService(stateKey);\n if (existing) {\n return existing;\n }\n\n const service = createBuilderService({ config });\n setSharedBuilderService(stateKey, service);\n return service;\n };\n\n /**\n * Build artifact on every invocation (like tsc-plugin).\n * This ensures the artifact is always up-to-date with the latest source files.\n *\n * @throws Error if failOnError is true and build fails\n */\n const getArtifact = (): BuilderArtifact | null => {\n const builderService = ensureBuilderService();\n const buildResult = builderService.build();\n if (buildResult.isErr()) {\n const formattedError = formatBuilderErrorForCLI(buildResult.error);\n console.error(`[${pluginName}] Build failed:\\n${formattedError}`);\n if (failOnError) {\n throw new Error(`[${pluginName}] ${buildResult.error.message}`);\n }\n return null;\n }\n return buildResult.value;\n };\n\n /**\n * Async version of getArtifact.\n * Supports async metadata factories and parallel element evaluation.\n *\n * @throws Error if failOnError is true and build fails\n */\n const getArtifactAsync = async (): Promise<BuilderArtifact | null> => {\n const builderService = ensureBuilderService();\n const buildResult = await builderService.buildAsync();\n if (buildResult.isErr()) {\n const formattedError = formatBuilderErrorForCLI(buildResult.error);\n console.error(`[${pluginName}] Build failed:\\n${formattedError}`);\n if (failOnError) {\n throw new Error(`[${pluginName}] ${buildResult.error.message}`);\n }\n return null;\n }\n return buildResult.value;\n };\n\n return {\n config,\n getArtifact,\n getArtifactAsync,\n isPrebuiltMode: false,\n };\n};\n","/**\n * Utility for working with canonical IDs.\n */\n\nimport { resolve } from \"node:path\";\nimport { type CanonicalId, createCanonicalId } from \"@soda-gql/common\";\n\n/**\n * Resolve a canonical ID from a filename and AST path.\n */\nexport const resolveCanonicalId = (filename: string, astPath: string): CanonicalId =>\n createCanonicalId(resolve(filename), astPath);\n"],"mappings":";;;;;;;;;AAqIA,MAAa,qBAAqB,UAA+B;AAG/D,QAAO,GAFY,IAAI,MAAM,KAAK,KAChB,WAAW,QAAQ,KAAK,M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ChD,0BAAwB,UAAU,QAAQ;AAC1C,SAAO;;;;;;;;CAST,MAAM,oBAA4C;EAEhD,MAAM,cADiB,sBAAsB,CACV,OAAO;AAC1C,MAAI,YAAY,OAAO,EAAE;GACvB,MAAM,kEAA0C,YAAY,MAAM;AAClE,WAAQ,MAAM,IAAI,WAAW,mBAAmB,iBAAiB;AACjE,OAAI,YACF,OAAM,IAAI,MAAM,IAAI,WAAW,IAAI,YAAY,MAAM,UAAU;AAEjE,UAAO;;AAET,SAAO,YAAY;;;;;;;;CASrB,MAAM,mBAAmB,YAA6C;EAEpE,MAAM,cAAc,MADG,sBAAsB,CACJ,YAAY;AACrD,MAAI,YAAY,OAAO,EAAE;GACvB,MAAM,kEAA0C,YAAY,MAAM;AAClE,WAAQ,MAAM,IAAI,WAAW,mBAAmB,iBAAiB;AACjE,OAAI,YACF,OAAM,IAAI,MAAM,IAAI,WAAW,IAAI,YAAY,MAAM,UAAU;AAEjE,UAAO;;AAET,SAAO,YAAY;;AAGrB,QAAO;EACL;EACA;EACA;EACA,gBAAgB;EACjB;;;;;;;;;;;ACnJH,MAAa,sBAAsB,UAAkB,4EACzB,SAAS,EAAE,QAAQ"}
package/dist/index.d.cts CHANGED
@@ -144,6 +144,12 @@ declare const assertUnreachable: (value: never, context?: string) => never;
144
144
  type PluginOptions = {
145
145
  readonly configPath?: string;
146
146
  readonly enabled?: boolean;
147
+ /**
148
+ * Whether to fail the build on error.
149
+ * When true (default), throws an error that fails the bundler build.
150
+ * When false, logs the error and continues (graceful degradation).
151
+ */
152
+ readonly failOnError?: boolean;
147
153
  };
148
154
  /**
149
155
  * Plugin session containing builder service and configuration.
@@ -152,10 +158,19 @@ type PluginSession = {
152
158
  readonly config: ResolvedSodaGqlConfig;
153
159
  readonly getArtifact: () => BuilderArtifact | null;
154
160
  readonly getArtifactAsync: () => Promise<BuilderArtifact | null>;
161
+ /**
162
+ * Whether the session is using a pre-built artifact.
163
+ * When true, artifacts are loaded from a file instead of built dynamically.
164
+ */
165
+ readonly isPrebuiltMode: boolean;
155
166
  };
156
167
  /**
157
168
  * Create plugin session by loading config and creating cached builder service.
158
169
  * Returns null if disabled or config load fails.
170
+ *
171
+ * @param options - Plugin options
172
+ * @param pluginName - Name of the plugin for error messages
173
+ * @throws Error if failOnError is true and config load fails
159
174
  */
160
175
  declare const createPluginSession: (options: PluginOptions, pluginName: string) => PluginSession | null;
161
176
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/errors.ts","../src/plugin-session.ts","../src/shared-state.ts","../src/types/gql-call.ts","../src/types/metadata.ts","../src/utils/canonical-id.ts"],"sourcesContent":[],"mappings":";;;;;;AAQgC,KAA3B,2BAAA,GAC2B;EAC3B,SAAA,IAAA,EAAA,wBAAuB;EAEvB,SAAA,OAAA,EAAA,MAAoB;AAAU,CAAA;AACD,KAJ7B,2BAAA,GAKyB;EACzB,SAAA,IAAA,EAAA,wBAA6B;EAC7B,SAAA,OAAA,EAAA,MAAkB;AAAU,CAAA;AAEA,KAR5B,uBAAA,GASA;EACA,SAAA,IAAA,EAAA,oBAAA;EAMA,SAAA,OAAA,EAAe,MAAA;AAOpB,CAAA;KArBK,oBAAA,GAAuB,OAuB1B,CAvBkC,YAuBlC,EAAA;EAA8B,IAAA,EAAA,iBAAA;CAA8B,CAAA;KAtBzD,mBAAA,GAAsB,OAoB0B,CApBlB,YAoBkB,EAAA;EAAe,IAAA,EAAA,eAAA;AAKpE,CAAA,CAAA;AAKA,KA7BK,yBAAA,GAA4B,OA6BS,CA7BD,YA6BsD,EAAA;EAMnF,IAAA,EAAA,2BAAA;AAKZ,CAAA,CAAA;AAKA,KA5CK,6BAAA,GAAgC,OA4CI,CA5CI,YA4CgD,EAAA;EAKjF,IAAA,EAAA,4BAA4B;AAIxC,CAAA,CAAA;AAKA,KAzDK,kBAAA,GAAqB,OAyDd,CAzDsB,YAyDY,EAAA;EAE5C,IAAA,EAAA,cAAA;CAF+C,CAAA;KAvD5C,4BAA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,cAxHd,GAAA,IAAA;AAYxC;;;AAG+B,cAgHlB,uBAhHkB,EAAA,CAAA,GAAA,EAAA,MAAA,EAAA,OAAA,EAgH+B,cAhH/B,GAAA,IAAA,EAAA,GAAA,IAAA;;;AFvBqB;AAEpB;AACA;AAG3B,UGFY,WAAA,CHEQ;EACpB,SAAA,WAAA,EGFmB,WHEW;AAAD;AACM;AACI;AACX;AAG5B,UGFY,eAAA,SAAwB,WHE8C,CAAA;EAClF,SAAA,IAAA,EAAA,UAAA;EAMA,SAAA,QAAA,EGPgB,uBHSJ;AAKjB;;;;AAAqD,UGRpC,gBAAA,SAAyB,WHQW,CAAA;EAAe,SAAA,IAAA,EAAA,WAAA;EAKxD,SAAA,QAAA,EGXS,wBHWsB;AAK3C;AAMA;AAKA;AAKA;AAKY,KG/BA,OAAA,GAAU,eH+BkB,GG/BA,gBH+BG;;;;;;;;AA1DS;AAG/C,KIFO,qBAAA,GJEoB;EAC3B,SAAA,OAAA,EAAA,MAAA;EAEA,SAAA,UAAA,EAAA,OAAoB;EACpB,SAAA,UAAA,EAAA,OAAmB;EACnB,SAAA,aAAA,CAAA,EAAA,MAAyB;AAAU,CAAA;;;;AARY;AAEpB;AAE3B,cKAQ,kBLAe,EAAA,CAAA,QAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,GKA2C,WLA3C"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/errors.ts","../src/plugin-session.ts","../src/shared-state.ts","../src/types/gql-call.ts","../src/types/metadata.ts","../src/utils/canonical-id.ts"],"sourcesContent":[],"mappings":";;;;;;AAQgC,KAA3B,2BAAA,GAC2B;EAC3B,SAAA,IAAA,EAAA,wBAAuB;EAEvB,SAAA,OAAA,EAAA,MAAoB;AAAU,CAAA;AACD,KAJ7B,2BAAA,GAKyB;EACzB,SAAA,IAAA,EAAA,wBAA6B;EAC7B,SAAA,OAAA,EAAA,MAAkB;AAAU,CAAA;AAEA,KAR5B,uBAAA,GASA;EACA,S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;AA1DS;AAG/C,KIFO,qBAAA,GJEoB;EAC3B,SAAA,OAAA,EAAA,MAAA;EAEA,SAAA,UAAA,EAAA,OAAoB;EACpB,SAAA,UAAA,EAAA,OAAmB;EACnB,SAAA,aAAA,CAAA,EAAA,MAAyB;AAAU,CAAA;;;;AARY;AAEpB;AAE3B,cKAQ,kBLAe,EAAA,CAAA,QAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,GKA2C,WLA3C"}
package/dist/index.d.mts CHANGED
@@ -144,6 +144,12 @@ declare const assertUnreachable: (value: never, context?: string) => never;
144
144
  type PluginOptions = {
145
145
  readonly configPath?: string;
146
146
  readonly enabled?: boolean;
147
+ /**
148
+ * Whether to fail the build on error.
149
+ * When true (default), throws an error that fails the bundler build.
150
+ * When false, logs the error and continues (graceful degradation).
151
+ */
152
+ readonly failOnError?: boolean;
147
153
  };
148
154
  /**
149
155
  * Plugin session containing builder service and configuration.
@@ -152,10 +158,19 @@ type PluginSession = {
152
158
  readonly config: ResolvedSodaGqlConfig;
153
159
  readonly getArtifact: () => BuilderArtifact | null;
154
160
  readonly getArtifactAsync: () => Promise<BuilderArtifact | null>;
161
+ /**
162
+ * Whether the session is using a pre-built artifact.
163
+ * When true, artifacts are loaded from a file instead of built dynamically.
164
+ */
165
+ readonly isPrebuiltMode: boolean;
155
166
  };
156
167
  /**
157
168
  * Create plugin session by loading config and creating cached builder service.
158
169
  * Returns null if disabled or config load fails.
170
+ *
171
+ * @param options - Plugin options
172
+ * @param pluginName - Name of the plugin for error messages
173
+ * @throws Error if failOnError is true and config load fails
159
174
  */
160
175
  declare const createPluginSession: (options: PluginOptions, pluginName: string) => PluginSession | null;
161
176
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/errors.ts","../src/plugin-session.ts","../src/shared-state.ts","../src/types/gql-call.ts","../src/types/metadata.ts","../src/utils/canonical-id.ts"],"sourcesContent":[],"mappings":";;;;;;AAQgC,KAA3B,2B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,SAAA,QAAA,EGXS,wBHWsB;AAK3C;AAMA;AAKA;AAKA;AAKY,KG/BA,OAAA,GAAU,eH+BkB,GG/BA,gBH+BG;;;;;;;;AA1DS;AAG/C,KIFO,qBAAA,GJEoB;EAC3B,SAAA,OAAA,EAAA,MAAA;EAEA,SAAA,UAAA,EAAA,OAAoB;EACpB,SAAA,UAAA,EAAA,OAAmB;EACnB,SAAA,aAAA,CAAA,EAAA,MAAyB;AAAU,CAAA;;;;AARY;AAEpB;AAE3B,cKAQ,kBLAe,EAAA,CAAA,QAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,GKA2C,WLA3C"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/errors.ts","../src/plugin-session.ts","../src/shared-state.ts","../src/types/gql-call.ts","../src/types/metadata.ts","../src/utils/canonical-id.ts"],"sourcesContent":[],"mappings":";;;;;;AAQgC,KAA3B,2BAAA,GAC2B;EAC3B,SAAA,IAAA,EAAA,wBAAuB;EAEvB,SAAA,OAAA,EAAA,MAAoB;AAAU,CAAA;AACD,KAJ7B,2BAAA,GAKyB;EACzB,SAAA,IAAA,EAAA,wBAA6B;EAC7B,SAAA,OAAA,EAAA,MAAkB;AAAU,CAAA;AAEA,KAR5B,uBAAA,GASA;EACA,SAAA,IAAA,EAAA,oBAAA;EAMA,SAAA,OAAA,EAAe,MAAA;AAOpB,CAAA;KArBK,oBAAA,GAAuB,OAuB1B,CAvBkC,YAuBlC,EAAA;EAA8B,IAAA,EAAA,iBAAA;CAA8B,CAAA;KAtBzD,mBAAA,GAAsB,OAoB0B,CApBlB,YAoBkB,EAAA;EAAe,IAAA,EAAA,eAAA;AAKpE,CAAA,CAAA;AAKA,KA7BK,yBAAA,GAA4B,OA6BS,CA7BD,YA6BsD,EAAA;EAMnF,IAAA,EAAA,2BAAA;AAKZ,CAAA,CAAA;AAKA,KA5CK,6BAAA,GAAgC,OA4CI,CA5CI,YA4CgD,EAAA;EAKjF,IAAA,EAAA,4BA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uBDpG7B,GAAA,IAAA;AAczB;;;AAG2C,cC0F9B,wBD1F8B,EAAA,CAAA,GAAA,EAAA,MAAA,EAAA,eAAA,EC0F4B,eD1F5B,GAAA,IAAA,EAAA,GAAA,IAAA;;;AAgB3C;cCiFa,2CAA0C;;;AAvHvD;AAMiB,cAwHJ,uBAxH2B,EAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAwHc,cAxHd,GAAA,IAAA;AAYxC;;;AAG+B,cAgHlB,uBAhHkB,EAAA,CAAA,GAAA,EAAA,MAAA,EAAA,OAAA,EAgH+B,cAhH/B,GAAA,IAAA,EAAA,GAAA,IAAA;;;AFvBqB;AAEpB;AACA;AAG3B,UGFY,WAAA,CHEQ;EACpB,SAAA,WAAA,EGFmB,WHEA;AAAU;AACM;AACI;AACX;AAG5B,UGFY,eAAA,SAAwB,WHE8C,CAAA;EAClF,SAAA,IAAA,EAAA,UAAA;EAMA,SAAA,QAAA,EGPgB,uBHSJ;AAKjB;;;;AAAqD,UGRpC,gBAAA,SAAyB,WHQW,CAAA;EAAe,SAAA,IAAA,EAAA,WAAA;EAKxD,SAAA,QAAA,EGXS,wBHWsB;AAK3C;AAMA;AAKA;AAKA;AAKY,KG/BA,OAAA,GAAU,eH+BkB,GG/BA,gBH+BG;;;;;;;;AA1DS;AAG/C,KIFO,qBAAA,GJEoB;EAC3B,SAAA,OAAA,EAAA,MAAA;EAEA,SAAA,UAAA,EAAA,OAAoB;EACpB,SAAA,UAAA,EAAA,OAAmB;EACnB,SAAA,aAAA,CAAA,EAAA,MAAyB;AAAU,CAAA;;;;AARY;AAEpB;AAE3B,cKAQ,kBLAe,EAAA,CAAA,QAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,GKA2C,WLA3C"}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createBuilderService } from "@soda-gql/builder";
1
+ import { createBuilderService, formatBuilderErrorForCLI, loadArtifactSync } from "@soda-gql/builder";
2
2
  import { loadConfig } from "@soda-gql/config";
3
3
  import { resolve } from "node:path";
4
4
  import { createCanonicalId } from "@soda-gql/common";
@@ -121,20 +121,47 @@ const setSharedBuilderService = (key, service) => {
121
121
  /**
122
122
  * Create plugin session by loading config and creating cached builder service.
123
123
  * Returns null if disabled or config load fails.
124
+ *
125
+ * @param options - Plugin options
126
+ * @param pluginName - Name of the plugin for error messages
127
+ * @throws Error if failOnError is true and config load fails
124
128
  */
125
129
  const createPluginSession = (options, pluginName) => {
126
- if (!(options.enabled ?? true)) return null;
130
+ const enabled = options.enabled ?? true;
131
+ const failOnError = options.failOnError ?? true;
132
+ if (!enabled) return null;
127
133
  const configResult = loadConfig(options.configPath);
128
134
  if (configResult.isErr()) {
129
- console.error(`[${pluginName}] Failed to load config:`, {
135
+ const errorMsg = `[${pluginName}] Failed to load config: ${configResult.error.message}`;
136
+ console.error(errorMsg, {
130
137
  code: configResult.error.code,
131
- message: configResult.error.message,
132
138
  filePath: configResult.error.filePath,
133
139
  cause: configResult.error.cause
134
140
  });
141
+ if (failOnError) throw new Error(errorMsg);
135
142
  return null;
136
143
  }
137
144
  const config = configResult.value;
145
+ if (config.artifact?.path) {
146
+ const artifactResult = loadArtifactSync(config.artifact.path);
147
+ if (artifactResult.isErr()) {
148
+ const errorMsg = `[${pluginName}] Failed to load pre-built artifact: ${artifactResult.error.message}`;
149
+ console.error(errorMsg, {
150
+ code: artifactResult.error.code,
151
+ filePath: artifactResult.error.filePath
152
+ });
153
+ if (failOnError) throw new Error(errorMsg);
154
+ return null;
155
+ }
156
+ const prebuiltArtifact = artifactResult.value;
157
+ console.log(`[${pluginName}] Using pre-built artifact: ${config.artifact.path}`);
158
+ return {
159
+ config,
160
+ getArtifact: () => prebuiltArtifact,
161
+ getArtifactAsync: async () => prebuiltArtifact,
162
+ isPrebuiltMode: true
163
+ };
164
+ }
138
165
  const stateKey = getStateKey(options.configPath);
139
166
  const ensureBuilderService = () => {
140
167
  const existing = getSharedBuilderService(stateKey);
@@ -145,13 +172,16 @@ const createPluginSession = (options, pluginName) => {
145
172
  };
146
173
  /**
147
174
  * Build artifact on every invocation (like tsc-plugin).
148
- * If artifact.useBuilder is false and artifact.path is provided, load from file instead.
149
175
  * This ensures the artifact is always up-to-date with the latest source files.
176
+ *
177
+ * @throws Error if failOnError is true and build fails
150
178
  */
151
179
  const getArtifact = () => {
152
180
  const buildResult = ensureBuilderService().build();
153
181
  if (buildResult.isErr()) {
154
- console.error(`[${pluginName}] Failed to build artifact: ${buildResult.error.message}`);
182
+ const formattedError = formatBuilderErrorForCLI(buildResult.error);
183
+ console.error(`[${pluginName}] Build failed:\n${formattedError}`);
184
+ if (failOnError) throw new Error(`[${pluginName}] ${buildResult.error.message}`);
155
185
  return null;
156
186
  }
157
187
  return buildResult.value;
@@ -159,11 +189,15 @@ const createPluginSession = (options, pluginName) => {
159
189
  /**
160
190
  * Async version of getArtifact.
161
191
  * Supports async metadata factories and parallel element evaluation.
192
+ *
193
+ * @throws Error if failOnError is true and build fails
162
194
  */
163
195
  const getArtifactAsync = async () => {
164
196
  const buildResult = await ensureBuilderService().buildAsync();
165
197
  if (buildResult.isErr()) {
166
- console.error(`[${pluginName}] Failed to build artifact: ${buildResult.error.message}`);
198
+ const formattedError = formatBuilderErrorForCLI(buildResult.error);
199
+ console.error(`[${pluginName}] Build failed:\n${formattedError}`);
200
+ if (failOnError) throw new Error(`[${pluginName}] ${buildResult.error.message}`);
167
201
  return null;
168
202
  }
169
203
  return buildResult.value;
@@ -171,7 +205,8 @@ const createPluginSession = (options, pluginName) => {
171
205
  return {
172
206
  config,
173
207
  getArtifact,
174
- getArtifactAsync
208
+ getArtifactAsync,
209
+ isPrebuiltMode: false
175
210
  };
176
211
  };
177
212
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/errors.ts","../src/shared-state.ts","../src/plugin-session.ts","../src/utils/canonical-id.ts"],"sourcesContent":["/**\n * Error types and formatters for plugin-babel.\n * Simplified from plugin-shared to include only types actually used by the Babel transformer.\n */\n\nimport type { BuilderError } from \"@soda-gql/builder\";\nimport type { CanonicalId } from \"@soda-gql/common\";\n\ntype OptionsInvalidBuilderConfig = { readonly code: \"INVALID_BUILDER_CONFIG\"; readonly message: string };\ntype OptionsMissingBuilderConfig = { readonly code: \"MISSING_BUILDER_CONFIG\"; readonly message: string };\ntype OptionsConfigLoadFailed = { readonly code: \"CONFIG_LOAD_FAILED\"; readonly message: string };\n\ntype BuilderEntryNotFound = Extract<BuilderError, { code: \"ENTRY_NOT_FOUND\" }>;\ntype BuilderDocDuplicate = Extract<BuilderError, { code: \"DOC_DUPLICATE\" }>;\ntype BuilderCircularDependency = Extract<BuilderError, { code: \"GRAPH_CIRCULAR_DEPENDENCY\" }>;\ntype BuilderModuleEvaluationFailed = Extract<BuilderError, { code: \"RUNTIME_MODULE_LOAD_FAILED\" }>;\ntype BuilderWriteFailed = Extract<BuilderError, { code: \"WRITE_FAILED\" }>;\n\ntype AnalysisMetadataMissingCause = { readonly filename: string };\ntype AnalysisArtifactMissingCause = { readonly filename: string; readonly canonicalId: CanonicalId };\ntype AnalysisUnsupportedArtifactTypeCause = {\n readonly filename: string;\n readonly canonicalId: CanonicalId;\n readonly artifactType: string;\n};\n\ntype PluginErrorBase<Code extends string, Cause> = {\n readonly type: \"PluginError\";\n readonly code: Code;\n readonly message: string;\n readonly cause: Cause;\n};\n\nexport type PluginOptionsInvalidBuilderConfigError = PluginErrorBase<\n \"OPTIONS_INVALID_BUILDER_CONFIG\",\n OptionsInvalidBuilderConfig | OptionsMissingBuilderConfig | OptionsConfigLoadFailed\n> & { readonly stage: \"normalize-options\" };\n\nexport type PluginBuilderEntryNotFoundError = PluginErrorBase<\"SODA_GQL_BUILDER_ENTRY_NOT_FOUND\", BuilderEntryNotFound> & {\n readonly stage: \"builder\";\n readonly entry: string;\n};\n\nexport type PluginBuilderDocDuplicateError = PluginErrorBase<\"SODA_GQL_BUILDER_DOC_DUPLICATE\", BuilderDocDuplicate> & {\n readonly stage: \"builder\";\n readonly name: string;\n readonly sources: readonly string[];\n};\n\nexport type PluginBuilderCircularDependencyError = PluginErrorBase<\n \"SODA_GQL_BUILDER_CIRCULAR_DEPENDENCY\",\n BuilderCircularDependency\n> & { readonly stage: \"builder\"; readonly chain: readonly string[] };\n\nexport type PluginBuilderModuleEvaluationFailedError = PluginErrorBase<\n \"SODA_GQL_BUILDER_MODULE_EVALUATION_FAILED\",\n BuilderModuleEvaluationFailed\n> & { readonly stage: \"builder\"; readonly filePath: string; readonly astPath: string };\n\nexport type PluginBuilderWriteFailedError = PluginErrorBase<\"SODA_GQL_BUILDER_WRITE_FAILED\", BuilderWriteFailed> & {\n readonly stage: \"builder\";\n readonly outPath: string;\n};\n\nexport type PluginBuilderUnexpectedError = PluginErrorBase<\"SODA_GQL_BUILDER_UNEXPECTED\", unknown> & {\n readonly stage: \"builder\";\n};\n\nexport type PluginAnalysisMetadataMissingError = PluginErrorBase<\"SODA_GQL_METADATA_NOT_FOUND\", AnalysisMetadataMissingCause> & {\n readonly stage: \"analysis\";\n readonly filename: string;\n};\n\nexport type PluginAnalysisArtifactMissingError = PluginErrorBase<\n \"SODA_GQL_ANALYSIS_ARTIFACT_NOT_FOUND\",\n AnalysisArtifactMissingCause\n> & { readonly stage: \"analysis\"; readonly filename: string; readonly canonicalId: CanonicalId };\n\nexport type PluginAnalysisUnsupportedArtifactTypeError = PluginErrorBase<\n \"SODA_GQL_UNSUPPORTED_ARTIFACT_TYPE\",\n AnalysisUnsupportedArtifactTypeCause\n> & {\n readonly stage: \"analysis\";\n readonly filename: string;\n readonly canonicalId: CanonicalId;\n readonly artifactType: string;\n};\n\ntype TransformMissingBuilderArgCause = { readonly filename: string; readonly builderType: string; readonly argName: string };\ntype TransformUnsupportedValueTypeCause = { readonly valueType: string };\ntype TransformAstVisitorFailedCause = { readonly filename: string; readonly reason: string };\n\nexport type PluginTransformMissingBuilderArgError = PluginErrorBase<\n \"SODA_GQL_TRANSFORM_MISSING_BUILDER_ARG\",\n TransformMissingBuilderArgCause\n> & {\n readonly stage: \"transform\";\n readonly filename: string;\n readonly builderType: string;\n readonly argName: string;\n};\n\nexport type PluginTransformUnsupportedValueTypeError = PluginErrorBase<\n \"SODA_GQL_TRANSFORM_UNSUPPORTED_VALUE_TYPE\",\n TransformUnsupportedValueTypeCause\n> & { readonly stage: \"transform\"; readonly valueType: string };\n\nexport type PluginTransformAstVisitorFailedError = PluginErrorBase<\n \"SODA_GQL_TRANSFORM_AST_VISITOR_FAILED\",\n TransformAstVisitorFailedCause\n> & { readonly stage: \"transform\"; readonly filename: string; readonly reason: string };\n\n/**\n * Union of all plugin error types.\n */\nexport type PluginError =\n | PluginOptionsInvalidBuilderConfigError\n | PluginBuilderEntryNotFoundError\n | PluginBuilderDocDuplicateError\n | PluginBuilderCircularDependencyError\n | PluginBuilderModuleEvaluationFailedError\n | PluginBuilderWriteFailedError\n | PluginBuilderUnexpectedError\n | PluginAnalysisMetadataMissingError\n | PluginAnalysisArtifactMissingError\n | PluginAnalysisUnsupportedArtifactTypeError\n | PluginTransformMissingBuilderArgError\n | PluginTransformUnsupportedValueTypeError\n | PluginTransformAstVisitorFailedError;\n\n/**\n * Format a PluginError into a human-readable message.\n */\nexport const formatPluginError = (error: PluginError): string => {\n const codePrefix = `[${error.code}]`;\n const stageInfo = \"stage\" in error ? ` (${error.stage})` : \"\";\n return `${codePrefix}${stageInfo} ${error.message}`;\n};\n\n/**\n * Type guard for PluginError.\n */\nexport const isPluginError = (value: unknown): value is PluginError => {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"type\" in value &&\n value.type === \"PluginError\" &&\n \"code\" in value &&\n \"message\" in value\n );\n};\n\n/**\n * Assertion helper for unreachable code paths.\n * This is the ONLY acceptable throw in plugin code.\n */\nexport const assertUnreachable = (value: never, context?: string): never => {\n throw new Error(`[INTERNAL] Unreachable code path${context ? ` in ${context}` : \"\"}: received ${JSON.stringify(value)}`);\n};\n","import type { BuilderArtifact, BuilderService } from \"@soda-gql/builder\";\nimport type { PluginSession } from \"./plugin-session\";\n\n/**\n * Transformer type for code transformation.\n * - 'babel': Use Babel plugin (default, wider compatibility)\n * - 'swc': Use SWC transformer (faster, requires @soda-gql/swc-transformer)\n */\nexport type TransformerType = \"babel\" | \"swc\";\n\n/**\n * Minimal interface for SWC transformer.\n * Matches the Transformer interface from @soda-gql/swc-transformer.\n */\nexport interface SwcTransformerInterface {\n transform(input: { sourceCode: string; sourcePath: string; inputSourceMap?: string }): {\n transformed: boolean;\n sourceCode: string;\n sourceMap?: string;\n };\n}\n\n/**\n * Shared state between bundler plugins and loaders.\n * Enables efficient artifact sharing across build pipeline stages.\n */\nexport type SharedState = {\n pluginSession: PluginSession | null;\n currentArtifact: BuilderArtifact | null;\n moduleAdjacency: Map<string, Set<string>>;\n generation: number;\n swcTransformer: SwcTransformerInterface | null;\n transformerType: TransformerType | null;\n builderService: BuilderService | null;\n};\n\n// Global state for sharing between plugin and loader\nconst sharedStates = new Map<string, SharedState>();\n\n/**\n * Get shared state for a given project (identified by config path or cwd).\n */\nexport const getSharedState = (key: string): SharedState => {\n let state = sharedStates.get(key);\n if (!state) {\n state = {\n pluginSession: null,\n currentArtifact: null,\n moduleAdjacency: new Map(),\n generation: 0,\n swcTransformer: null,\n transformerType: null,\n builderService: null,\n };\n sharedStates.set(key, state);\n }\n return state;\n};\n\n/**\n * Update shared artifact.\n */\nexport const setSharedArtifact = (\n key: string,\n artifact: BuilderArtifact | null,\n moduleAdjacency?: Map<string, Set<string>>,\n): void => {\n const state = getSharedState(key);\n state.currentArtifact = artifact;\n if (moduleAdjacency) {\n state.moduleAdjacency = moduleAdjacency;\n }\n state.generation++;\n};\n\n/**\n * Get shared artifact.\n */\nexport const getSharedArtifact = (key: string): BuilderArtifact | null => {\n return getSharedState(key).currentArtifact;\n};\n\n/**\n * Get shared plugin session.\n */\nexport const getSharedPluginSession = (key: string): PluginSession | null => {\n return getSharedState(key).pluginSession;\n};\n\n/**\n * Set shared plugin session.\n */\nexport const setSharedPluginSession = (key: string, session: PluginSession | null): void => {\n getSharedState(key).pluginSession = session;\n};\n\n/**\n * Get the state key from config path or cwd.\n */\nexport const getStateKey = (configPath?: string): string => {\n return configPath ?? process.cwd();\n};\n\n/**\n * Set shared SWC transformer.\n */\nexport const setSharedSwcTransformer = (key: string, transformer: SwcTransformerInterface | null): void => {\n getSharedState(key).swcTransformer = transformer;\n};\n\n/**\n * Get shared SWC transformer.\n */\nexport const getSharedSwcTransformer = (key: string): SwcTransformerInterface | null => {\n return getSharedState(key).swcTransformer;\n};\n\n/**\n * Set shared transformer type.\n */\nexport const setSharedTransformerType = (key: string, transformerType: TransformerType | null): void => {\n getSharedState(key).transformerType = transformerType;\n};\n\n/**\n * Get shared transformer type.\n */\nexport const getSharedTransformerType = (key: string): TransformerType | null => {\n return getSharedState(key).transformerType;\n};\n\n/**\n * Get shared BuilderService.\n */\nexport const getSharedBuilderService = (key: string): BuilderService | null => {\n return getSharedState(key).builderService;\n};\n\n/**\n * Set shared BuilderService.\n */\nexport const setSharedBuilderService = (key: string, service: BuilderService | null): void => {\n getSharedState(key).builderService = service;\n};\n","/**\n * Plugin session management for all plugins.\n * Unified from plugin-babel and plugin-swc implementations.\n */\n\nimport type { BuilderArtifact, BuilderService } from \"@soda-gql/builder\";\nimport { createBuilderService } from \"@soda-gql/builder\";\nimport { loadConfig, type ResolvedSodaGqlConfig } from \"@soda-gql/config\";\nimport { getSharedBuilderService, getStateKey, setSharedBuilderService } from \"./shared-state\";\n\n/**\n * Plugin options shared across all plugins.\n */\nexport type PluginOptions = {\n readonly configPath?: string;\n readonly enabled?: boolean;\n};\n\n/**\n * Plugin session containing builder service and configuration.\n */\nexport type PluginSession = {\n readonly config: ResolvedSodaGqlConfig;\n readonly getArtifact: () => BuilderArtifact | null;\n readonly getArtifactAsync: () => Promise<BuilderArtifact | null>;\n};\n\n/**\n * Create plugin session by loading config and creating cached builder service.\n * Returns null if disabled or config load fails.\n */\nexport const createPluginSession = (options: PluginOptions, pluginName: string): PluginSession | null => {\n const enabled = options.enabled ?? true;\n if (!enabled) {\n return null;\n }\n\n const configResult = loadConfig(options.configPath);\n if (configResult.isErr()) {\n console.error(`[${pluginName}] Failed to load config:`, {\n code: configResult.error.code,\n message: configResult.error.message,\n filePath: configResult.error.filePath,\n cause: configResult.error.cause,\n });\n return null;\n }\n\n const config = configResult.value;\n const stateKey = getStateKey(options.configPath);\n\n // Use global BuilderService cache to share FileTracker state across plugin instances\n const ensureBuilderService = (): BuilderService => {\n const existing = getSharedBuilderService(stateKey);\n if (existing) {\n return existing;\n }\n\n const service = createBuilderService({ config });\n setSharedBuilderService(stateKey, service);\n return service;\n };\n\n /**\n * Build artifact on every invocation (like tsc-plugin).\n * If artifact.useBuilder is false and artifact.path is provided, load from file instead.\n * This ensures the artifact is always up-to-date with the latest source files.\n */\n const getArtifact = (): BuilderArtifact | null => {\n const builderService = ensureBuilderService();\n const buildResult = builderService.build();\n if (buildResult.isErr()) {\n console.error(`[${pluginName}] Failed to build artifact: ${buildResult.error.message}`);\n return null;\n }\n return buildResult.value;\n };\n\n /**\n * Async version of getArtifact.\n * Supports async metadata factories and parallel element evaluation.\n */\n const getArtifactAsync = async (): Promise<BuilderArtifact | null> => {\n const builderService = ensureBuilderService();\n const buildResult = await builderService.buildAsync();\n if (buildResult.isErr()) {\n console.error(`[${pluginName}] Failed to build artifact: ${buildResult.error.message}`);\n return null;\n }\n return buildResult.value;\n };\n\n return {\n config,\n getArtifact,\n getArtifactAsync,\n };\n};\n","/**\n * Utility for working with canonical IDs.\n */\n\nimport { resolve } from \"node:path\";\nimport { type CanonicalId, createCanonicalId } from \"@soda-gql/common\";\n\n/**\n * Resolve a canonical ID from a filename and AST path.\n */\nexport const resolveCanonicalId = (filename: string, astPath: string): CanonicalId =>\n createCanonicalId(resolve(filename), astPath);\n"],"mappings":";;;;;;;;;AAqIA,MAAa,qBAAqB,UAA+B;AAG/D,QAAO,GAFY,IAAI,MAAM,KAAK,KAChB,WAAW,QAAQ,KA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{"version":3,"file":"index.mjs","names":[],"sources":["../src/errors.ts","../src/shared-state.ts","../src/plugin-session.ts","../src/utils/canonical-id.ts"],"sourcesContent":["/**\n * Error types and formatters for plugin-babel.\n * Simplified from plugin-shared to include only types actually used by the Babel transformer.\n */\n\nimport type { BuilderError } from \"@soda-gql/builder\";\nimport type { CanonicalId } from \"@soda-gql/common\";\n\ntype OptionsInvalidBuilderConfig = { readonly code: \"INVALID_BUILDER_CONFIG\"; readonly message: string };\ntype OptionsMissingBuilderConfig = { readonly code: \"MISSING_BUILDER_CONFIG\"; readonly message: string };\ntype OptionsConfigLoadFailed = { readonly code: \"CONFIG_LOAD_FAILED\"; readonly message: string };\n\ntype BuilderEntryNotFound = Extract<BuilderError, { code: \"ENTRY_NOT_FOUND\" }>;\ntype BuilderDocDuplicate = Extract<BuilderError, { code: \"DOC_DUPLICATE\" }>;\ntype BuilderCircularDependency = Extract<BuilderError, { code: \"GRAPH_CIRCULAR_DEPENDENCY\" }>;\ntype BuilderModuleEvaluationFailed = Extract<BuilderError, { code: \"RUNTIME_MODULE_LOAD_FAILED\" }>;\ntype BuilderWriteFailed = Extract<BuilderError, { code: \"WRITE_FAILED\" }>;\n\ntype AnalysisMetadataMissingCause = { readonly filename: string };\ntype AnalysisArtifactMissingCause = { readonly filename: string; readonly canonicalId: CanonicalId };\ntype AnalysisUnsupportedArtifactTypeCause = {\n readonly filename: string;\n readonly canonicalId: CanonicalId;\n readonly artifactType: string;\n};\n\ntype PluginErrorBase<Code extends string, Cause> = {\n readonly type: \"PluginError\";\n readonly code: Code;\n readonly message: string;\n readonly cause: Cause;\n};\n\nexport type PluginOptionsInvalidBuilderConfigError = PluginErrorBase<\n \"OPTIONS_INVALID_BUILDER_CONFIG\",\n OptionsInvalidBuilderConfig | OptionsMissingBuilderConfig | OptionsConfigLoadFailed\n> & { readonly stage: \"normalize-options\" };\n\nexport type PluginBuilderEntryNotFoundError = PluginErrorBase<\"SODA_GQL_BUILDER_ENTRY_NOT_FOUND\", BuilderEntryNotFound> & {\n readonly stage: \"builder\";\n readonly entry: string;\n};\n\nexport type PluginBuilderDocDuplicateError = PluginErrorBase<\"SODA_GQL_BUILDER_DOC_DUPLICATE\", BuilderDocDuplicate> & {\n readonly stage: \"builder\";\n readonly name: string;\n readonly sources: readonly string[];\n};\n\nexport type PluginBuilderCircularDependencyError = PluginErrorBase<\n \"SODA_GQL_BUILDER_CIRCULAR_DEPENDENCY\",\n BuilderCircularDependency\n> & { readonly stage: \"builder\"; readonly chain: readonly string[] };\n\nexport type PluginBuilderModuleEvaluationFailedError = PluginErrorBase<\n \"SODA_GQL_BUILDER_MODULE_EVALUATION_FAILED\",\n BuilderModuleEvaluationFailed\n> & { readonly stage: \"builder\"; readonly filePath: string; readonly astPath: string };\n\nexport type PluginBuilderWriteFailedError = PluginErrorBase<\"SODA_GQL_BUILDER_WRITE_FAILED\", BuilderWriteFailed> & {\n readonly stage: \"builder\";\n readonly outPath: string;\n};\n\nexport type PluginBuilderUnexpectedError = PluginErrorBase<\"SODA_GQL_BUILDER_UNEXPECTED\", unknown> & {\n readonly stage: \"builder\";\n};\n\nexport type PluginAnalysisMetadataMissingError = PluginErrorBase<\"SODA_GQL_METADATA_NOT_FOUND\", AnalysisMetadataMissingCause> & {\n readonly stage: \"analysis\";\n readonly filename: string;\n};\n\nexport type PluginAnalysisArtifactMissingError = PluginErrorBase<\n \"SODA_GQL_ANALYSIS_ARTIFACT_NOT_FOUND\",\n AnalysisArtifactMissingCause\n> & { readonly stage: \"analysis\"; readonly filename: string; readonly canonicalId: CanonicalId };\n\nexport type PluginAnalysisUnsupportedArtifactTypeError = PluginErrorBase<\n \"SODA_GQL_UNSUPPORTED_ARTIFACT_TYPE\",\n AnalysisUnsupportedArtifactTypeCause\n> & {\n readonly stage: \"analysis\";\n readonly filename: string;\n readonly canonicalId: CanonicalId;\n readonly artifactType: string;\n};\n\ntype TransformMissingBuilderArgCause = { readonly filename: string; readonly builderType: string; readonly argName: string };\ntype TransformUnsupportedValueTypeCause = { readonly valueType: string };\ntype TransformAstVisitorFailedCause = { readonly filename: string; readonly reason: string };\n\nexport type PluginTransformMissingBuilderArgError = PluginErrorBase<\n \"SODA_GQL_TRANSFORM_MISSING_BUILDER_ARG\",\n TransformMissingBuilderArgCause\n> & {\n readonly stage: \"transform\";\n readonly filename: string;\n readonly builderType: string;\n readonly argName: string;\n};\n\nexport type PluginTransformUnsupportedValueTypeError = PluginErrorBase<\n \"SODA_GQL_TRANSFORM_UNSUPPORTED_VALUE_TYPE\",\n TransformUnsupportedValueTypeCause\n> & { readonly stage: \"transform\"; readonly valueType: string };\n\nexport type PluginTransformAstVisitorFailedError = PluginErrorBase<\n \"SODA_GQL_TRANSFORM_AST_VISITOR_FAILED\",\n TransformAstVisitorFailedCause\n> & { readonly stage: \"transform\"; readonly filename: string; readonly reason: string };\n\n/**\n * Union of all plugin error types.\n */\nexport type PluginError =\n | PluginOptionsInvalidBuilderConfigError\n | PluginBuilderEntryNotFoundError\n | PluginBuilderDocDuplicateError\n | PluginBuilderCircularDependencyError\n | PluginBuilderModuleEvaluationFailedError\n | PluginBuilderWriteFailedError\n | PluginBuilderUnexpectedError\n | PluginAnalysisMetadataMissingError\n | PluginAnalysisArtifactMissingError\n | PluginAnalysisUnsupportedArtifactTypeError\n | PluginTransformMissingBuilderArgError\n | PluginTransformUnsupportedValueTypeError\n | PluginTransformAstVisitorFailedError;\n\n/**\n * Format a PluginError into a human-readable message.\n */\nexport const formatPluginError = (error: PluginError): string => {\n const codePrefix = `[${error.code}]`;\n const stageInfo = \"stage\" in error ? ` (${error.stage})` : \"\";\n return `${codePrefix}${stageInfo} ${error.message}`;\n};\n\n/**\n * Type guard for PluginError.\n */\nexport const isPluginError = (value: unknown): value is PluginError => {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"type\" in value &&\n value.type === \"PluginError\" &&\n \"code\" in value &&\n \"message\" in value\n );\n};\n\n/**\n * Assertion helper for unreachable code paths.\n * This is the ONLY acceptable throw in plugin code.\n */\nexport const assertUnreachable = (value: never, context?: string): never => {\n throw new Error(`[INTERNAL] Unreachable code path${context ? ` in ${context}` : \"\"}: received ${JSON.stringify(value)}`);\n};\n","import type { BuilderArtifact, BuilderService } from \"@soda-gql/builder\";\nimport type { PluginSession } from \"./plugin-session\";\n\n/**\n * Transformer type for code transformation.\n * - 'babel': Use Babel plugin (default, wider compatibility)\n * - 'swc': Use SWC transformer (faster, requires @soda-gql/swc-transformer)\n */\nexport type TransformerType = \"babel\" | \"swc\";\n\n/**\n * Minimal interface for SWC transformer.\n * Matches the Transformer interface from @soda-gql/swc-transformer.\n */\nexport interface SwcTransformerInterface {\n transform(input: { sourceCode: string; sourcePath: string; inputSourceMap?: string }): {\n transformed: boolean;\n sourceCode: string;\n sourceMap?: string;\n };\n}\n\n/**\n * Shared state between bundler plugins and loaders.\n * Enables efficient artifact sharing across build pipeline stages.\n */\nexport type SharedState = {\n pluginSession: PluginSession | null;\n currentArtifact: BuilderArtifact | null;\n moduleAdjacency: Map<string, Set<string>>;\n generation: number;\n swcTransformer: SwcTransformerInterface | null;\n transformerType: TransformerType | null;\n builderService: BuilderService | null;\n};\n\n// Global state for sharing between plugin and loader\nconst sharedStates = new Map<string, SharedState>();\n\n/**\n * Get shared state for a given project (identified by config path or cwd).\n */\nexport const getSharedState = (key: string): SharedState => {\n let state = sharedStates.get(key);\n if (!state) {\n state = {\n pluginSession: null,\n currentArtifact: null,\n moduleAdjacency: new Map(),\n generation: 0,\n swcTransformer: null,\n transformerType: null,\n builderService: null,\n };\n sharedStates.set(key, state);\n }\n return state;\n};\n\n/**\n * Update shared artifact.\n */\nexport const setSharedArtifact = (\n key: string,\n artifact: BuilderArtifact | null,\n moduleAdjacency?: Map<string, Set<string>>,\n): void => {\n const state = getSharedState(key);\n state.currentArtifact = artifact;\n if (moduleAdjacency) {\n state.moduleAdjacency = moduleAdjacency;\n }\n state.generation++;\n};\n\n/**\n * Get shared artifact.\n */\nexport const getSharedArtifact = (key: string): BuilderArtifact | null => {\n return getSharedState(key).currentArtifact;\n};\n\n/**\n * Get shared plugin session.\n */\nexport const getSharedPluginSession = (key: string): PluginSession | null => {\n return getSharedState(key).pluginSession;\n};\n\n/**\n * Set shared plugin session.\n */\nexport const setSharedPluginSession = (key: string, session: PluginSession | null): void => {\n getSharedState(key).pluginSession = session;\n};\n\n/**\n * Get the state key from config path or cwd.\n */\nexport const getStateKey = (configPath?: string): string => {\n return configPath ?? process.cwd();\n};\n\n/**\n * Set shared SWC transformer.\n */\nexport const setSharedSwcTransformer = (key: string, transformer: SwcTransformerInterface | null): void => {\n getSharedState(key).swcTransformer = transformer;\n};\n\n/**\n * Get shared SWC transformer.\n */\nexport const getSharedSwcTransformer = (key: string): SwcTransformerInterface | null => {\n return getSharedState(key).swcTransformer;\n};\n\n/**\n * Set shared transformer type.\n */\nexport const setSharedTransformerType = (key: string, transformerType: TransformerType | null): void => {\n getSharedState(key).transformerType = transformerType;\n};\n\n/**\n * Get shared transformer type.\n */\nexport const getSharedTransformerType = (key: string): TransformerType | null => {\n return getSharedState(key).transformerType;\n};\n\n/**\n * Get shared BuilderService.\n */\nexport const getSharedBuilderService = (key: string): BuilderService | null => {\n return getSharedState(key).builderService;\n};\n\n/**\n * Set shared BuilderService.\n */\nexport const setSharedBuilderService = (key: string, service: BuilderService | null): void => {\n getSharedState(key).builderService = service;\n};\n","/**\n * Plugin session management for all plugins.\n * Unified from plugin-babel and plugin-swc implementations.\n */\n\nimport type { BuilderArtifact, BuilderService } from \"@soda-gql/builder\";\nimport { createBuilderService, formatBuilderErrorForCLI, loadArtifactSync } from \"@soda-gql/builder\";\nimport { loadConfig, type ResolvedSodaGqlConfig } from \"@soda-gql/config\";\nimport { getSharedBuilderService, getStateKey, setSharedBuilderService } from \"./shared-state\";\n\n/**\n * Plugin options shared across all plugins.\n */\nexport type PluginOptions = {\n readonly configPath?: string;\n readonly enabled?: boolean;\n /**\n * Whether to fail the build on error.\n * When true (default), throws an error that fails the bundler build.\n * When false, logs the error and continues (graceful degradation).\n */\n readonly failOnError?: boolean;\n};\n\n/**\n * Plugin session containing builder service and configuration.\n */\nexport type PluginSession = {\n readonly config: ResolvedSodaGqlConfig;\n readonly getArtifact: () => BuilderArtifact | null;\n readonly getArtifactAsync: () => Promise<BuilderArtifact | null>;\n /**\n * Whether the session is using a pre-built artifact.\n * When true, artifacts are loaded from a file instead of built dynamically.\n */\n readonly isPrebuiltMode: boolean;\n};\n\n/**\n * Create plugin session by loading config and creating cached builder service.\n * Returns null if disabled or config load fails.\n *\n * @param options - Plugin options\n * @param pluginName - Name of the plugin for error messages\n * @throws Error if failOnError is true and config load fails\n */\nexport const createPluginSession = (options: PluginOptions, pluginName: string): PluginSession | null => {\n const enabled = options.enabled ?? true;\n const failOnError = options.failOnError ?? true;\n\n if (!enabled) {\n return null;\n }\n\n const configResult = loadConfig(options.configPath);\n if (configResult.isErr()) {\n const errorMsg = `[${pluginName}] Failed to load config: ${configResult.error.message}`;\n console.error(errorMsg, {\n code: configResult.error.code,\n filePath: configResult.error.filePath,\n cause: configResult.error.cause,\n });\n if (failOnError) {\n throw new Error(errorMsg);\n }\n return null;\n }\n\n const config = configResult.value;\n\n // Check if pre-built artifact mode is enabled\n if (config.artifact?.path) {\n const artifactResult = loadArtifactSync(config.artifact.path);\n\n if (artifactResult.isErr()) {\n const errorMsg = `[${pluginName}] Failed to load pre-built artifact: ${artifactResult.error.message}`;\n console.error(errorMsg, {\n code: artifactResult.error.code,\n filePath: artifactResult.error.filePath,\n });\n if (failOnError) {\n throw new Error(errorMsg);\n }\n return null;\n }\n\n const prebuiltArtifact = artifactResult.value;\n console.log(`[${pluginName}] Using pre-built artifact: ${config.artifact.path}`);\n\n return {\n config,\n getArtifact: () => prebuiltArtifact,\n getArtifactAsync: async () => prebuiltArtifact,\n isPrebuiltMode: true,\n };\n }\n\n // Dynamic build mode\n const stateKey = getStateKey(options.configPath);\n\n // Use global BuilderService cache to share FileTracker state across plugin instances\n const ensureBuilderService = (): BuilderService => {\n const existing = getSharedBuilderService(stateKey);\n if (existing) {\n return existing;\n }\n\n const service = createBuilderService({ config });\n setSharedBuilderService(stateKey, service);\n return service;\n };\n\n /**\n * Build artifact on every invocation (like tsc-plugin).\n * This ensures the artifact is always up-to-date with the latest source files.\n *\n * @throws Error if failOnError is true and build fails\n */\n const getArtifact = (): BuilderArtifact | null => {\n const builderService = ensureBuilderService();\n const buildResult = builderService.build();\n if (buildResult.isErr()) {\n const formattedError = formatBuilderErrorForCLI(buildResult.error);\n console.error(`[${pluginName}] Build failed:\\n${formattedError}`);\n if (failOnError) {\n throw new Error(`[${pluginName}] ${buildResult.error.message}`);\n }\n return null;\n }\n return buildResult.value;\n };\n\n /**\n * Async version of getArtifact.\n * Supports async metadata factories and parallel element evaluation.\n *\n * @throws Error if failOnError is true and build fails\n */\n const getArtifactAsync = async (): Promise<BuilderArtifact | null> => {\n const builderService = ensureBuilderService();\n const buildResult = await builderService.buildAsync();\n if (buildResult.isErr()) {\n const formattedError = formatBuilderErrorForCLI(buildResult.error);\n console.error(`[${pluginName}] Build failed:\\n${formattedError}`);\n if (failOnError) {\n throw new Error(`[${pluginName}] ${buildResult.error.message}`);\n }\n return null;\n }\n return buildResult.value;\n };\n\n return {\n config,\n getArtifact,\n getArtifactAsync,\n isPrebuiltMode: false,\n };\n};\n","/**\n * Utility for working with canonical IDs.\n */\n\nimport { resolve } from \"node:path\";\nimport { type CanonicalId, createCanonicalId } from \"@soda-gql/common\";\n\n/**\n * Resolve a canonical ID from a filename and AST path.\n */\nexport const resolveCanonicalId = (filename: string, astPath: string): CanonicalId =>\n createCanonicalId(resolve(filename), astPath);\n"],"mappings":";;;;;;;;;AAqIA,MAAa,qBAAqB,UAA+B;AAG/D,QAAO,GAFY,IAAI,MAAM,KAAK,KAChB,WAAW,QAAQ,KAAK,MAAM,MAAM,KAAK,GAC1B,GAAG,MAAM;;;;;AAM5C,MAAa,iBAAiB,UAAyC;AACrE,QACE,OAAO,UAAU,YACjB,UAAU,QACV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sB,CACV,OAAO;AAC1C,MAAI,YAAY,OAAO,EAAE;GACvB,MAAM,iBAAiB,yBAAyB,YAAY,MAAM;AAClE,WAAQ,MAAM,IAAI,WAAW,mBAAmB,iBAAiB;AACjE,OAAI,YACF,OAAM,IAAI,MAAM,IAAI,WAAW,IAAI,YAAY,MAAM,UAAU;AAEjE,UAAO;;AAET,SAAO,YAAY;;;;;;;;CASrB,MAAM,mBAAmB,YAA6C;EAEpE,MAAM,cAAc,MADG,sBAAsB,CACJ,YAAY;AACrD,MAAI,YAAY,OAAO,EAAE;GACvB,MAAM,iBAAiB,yBAAyB,YAAY,MAAM;AAClE,WAAQ,MAAM,IAAI,WAAW,mBAAmB,iBAAiB;AACjE,OAAI,YACF,OAAM,IAAI,MAAM,IAAI,WAAW,IAAI,YAAY,MAAM,UAAU;AAEjE,UAAO;;AAET,SAAO,YAAY;;AAGrB,QAAO;EACL;EACA;EACA;EACA,gBAAgB;EACjB;;;;;;;;;;;ACnJH,MAAa,sBAAsB,UAAkB,YACnD,kBAAkB,QAAQ,SAAS,EAAE,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soda-gql/plugin-common",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Shared utilities for soda-gql build plugins",
5
5
  "type": "module",
6
6
  "private": false,
@@ -46,9 +46,9 @@
46
46
  "./package.json": "./package.json"
47
47
  },
48
48
  "dependencies": {
49
- "@soda-gql/builder": "~0.7.0",
50
- "@soda-gql/common": "~0.7.0",
51
- "@soda-gql/config": "~0.7.0",
49
+ "@soda-gql/builder": "~0.9.0",
50
+ "@soda-gql/common": "~0.9.0",
51
+ "@soda-gql/config": "~0.9.0",
52
52
  "neverthrow": "^8.1.1"
53
53
  },
54
54
  "devDependencies": {},