@soda-gql/babel 0.11.10 → 0.11.12

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
@@ -1,4 +1,4 @@
1
- const require_transformer = require('./transformer-C9UM_hw8.cjs');
1
+ const require_transformer = require('./transformer-uUPMOk7W.cjs');
2
2
  let __babel_core = require("@babel/core");
3
3
  let __babel_generator = require("@babel/generator");
4
4
  __babel_generator = require_transformer.__toESM(__babel_generator);
package/dist/index.d.cts CHANGED
@@ -15,11 +15,17 @@ type CollectArgs = {
15
15
  readonly programPath: NodePath<types$1.Program>;
16
16
  readonly filename: string;
17
17
  readonly createTracker?: CanonicalTrackerFactory;
18
+ /**
19
+ * Base directory for relative path computation.
20
+ * When provided, canonical IDs use paths relative to this directory.
21
+ */
22
+ readonly baseDir?: string;
18
23
  };
19
24
  declare const collectGqlDefinitionMetadata: ({
20
25
  programPath,
21
26
  filename,
22
- createTracker
27
+ createTracker,
28
+ baseDir
23
29
  }: CollectArgs) => GqlDefinitionMetadataMap;
24
30
  //#endregion
25
31
  //#region packages/babel/src/ast/analysis.d.ts
@@ -36,12 +42,18 @@ type ExtractGqlCallArgs = {
36
42
  readonly filename: string;
37
43
  readonly metadata: GqlDefinitionMetadataMap;
38
44
  readonly getArtifact: ArtifactLookup;
45
+ /**
46
+ * Base directory for relative path computation.
47
+ * When provided, canonical IDs use paths relative to this directory.
48
+ */
49
+ readonly baseDir?: string;
39
50
  };
40
51
  declare const extractGqlCall: ({
41
52
  nodePath,
42
53
  filename,
43
54
  metadata,
44
- getArtifact
55
+ getArtifact,
56
+ baseDir
45
57
  }: ExtractGqlCallArgs) => Result<BabelGqlCall, PluginError>;
46
58
  //#endregion
47
59
  //#region packages/babel/src/ast/ast.d.ts
@@ -92,6 +104,11 @@ type TransformCallExpressionArgs = {
92
104
  readonly filename: string;
93
105
  readonly metadata: GqlDefinitionMetadataMap;
94
106
  readonly getArtifact: ArtifactLookup;
107
+ /**
108
+ * Base directory for relative path computation.
109
+ * When provided, canonical IDs use paths relative to this directory.
110
+ */
111
+ readonly baseDir?: string;
95
112
  };
96
113
  type TransformCallExpressionResult = {
97
114
  readonly transformed: false;
@@ -103,7 +120,8 @@ declare const transformCallExpression: ({
103
120
  callPath,
104
121
  filename,
105
122
  metadata,
106
- getArtifact
123
+ getArtifact,
124
+ baseDir
107
125
  }: TransformCallExpressionArgs) => Result<TransformCallExpressionResult, PluginError>;
108
126
  declare const insertRuntimeCalls: (programPath: NodePath<types$1.Program>, runtimeCalls: readonly types$1.Expression[]) => void;
109
127
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/ast/metadata.ts","../src/ast/analysis.ts","../src/ast/ast.ts","../src/ast/imports.ts","../src/ast/runtime.ts","../src/ast/transformer.ts","../src/transform.ts","../src/types.ts","../src/transformer.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;KAKY,wBAAA,GAA2B,QAAQ,OAAA,CAAE,gBAAgB;KAE5D,uBAAA,UAAiC;KAEjC,WAAA;wBACmB,SAAS,OAAA,CAAE;;2BAER;;AAPf,cAaC,4BAbuB,EAAA,CAAA;EAAA,WAAA;EAAA,QAAA;EAAA;AAAA,CAAA,EAamD,WAbnD,EAAA,GAaiE,wBAbjE;;;KCWxB,cAAA,iBAA+B,gBAAgB;KAG/C,oBAAA,GAAuB;qBAAuC,SAAS,OAAA,CAAE;;ADdzE,KCeA,qBAAA,GAAwB,gBDfA,GAAA;EAAW,SAAE,QAAA,ECgB5B,QDhB4B,CCgBnB,OAAA,CAAE,cDhBiB,CAAA;CAAgB;AAA1B,KCmB3B,YAAA,GAAe,oBDnBY,GCmBW,qBDnBX;AAAO,KCqBlC,kBAAA,GDrBkC;EAEzC,SAAA,QAAA,ECoBgB,QDpBO,CCoBE,OAAA,CAAE,cDpBM,CAAA;EAEjC,SAAA,QAAW,EAAA,MAAA;EACiB,SAAE,QAAA,ECmBd,wBDnBc;E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A,CAAA;CAAX;;;;AALxB;;;AAAuC,cQgB1B,iBRhB0B,EAAA,CAAA;EAAA,WAAA;EAAA,KAAA;EAAA;CAAA,EAAA;EAAO,SAAA,WAAA,EQqBtB,QRrBsB,CQqBb,OAAA,CAAE,ORrBW,CAAA;EAEzC,SAAA,KAAA,EAAA,OQoBoB,ORpBpB;EAEA,SAAA,MAAW,EQmBG,qBRnBH;CACiB,EAAA,GAAA;EAAT,SAAA,EAAA,CAAA,OAAA,EQyEC,uBRzED,EAAA,GQyE2B,mBRzE3B;CAEG"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/ast/metadata.ts","../src/ast/analysis.ts","../src/ast/ast.ts","../src/ast/imports.ts","../src/ast/runtime.ts","../src/ast/transformer.ts","../src/transform.ts","../src/types.ts","../src/transformer.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;KAKY,wBAAA,GAA2B,QAAQ,OAAA,CAAE,gBAAgB;KAE5D,uBAAA,UAAiC;KAEjC,WAAA;wBACmB,SAAS,OAAA,CAAE;;2BAER;;AAP3B;;;EAAuC,SAAA,OAAA,CAAA,EAAA,MAAA;CAAO;AAEzC,cAgBQ,4BAhByB,EAAA,CAAA;EAAA,WAAsB;EAAA,QAAA;EAAA,aAAA;EAAA;AAAA,CAAA,EAqBzD,WArByD,EAAA,GAqB3C,wBArB2C;;;KCShD,cAAA,iBAA+B,gBAAgB;KAG/C,oBAAA,GAAuB;qBAAuC,SAAS,OAAA,CAAE;;ADdzE,KCeA,qBAAA,GAAwB,gBDfA,GAAA;EAAW,SAAE,QAAA,ECgB5B,QDhB4B,CCgBnB,OAAA,CAAE,cDhBiB,CAAA;CAAgB;AAA1B,KCmB3B,YAAA,GAAe,oBDnBY,GCmBW,qBDnBX;AAAO,KCqBlC,kBAAA,GDrBkC;EAEzC,SAAA,QAAA,ECoBgB,QDpBO,CCoBE,OAAA,CAAE,cDpBM,CAAA;EAEjC,SAAA,QAAW,EAAA,MAAA;EACiB,SAAE,QAAA,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mBAAA,GPZgB;EAEvB,SAAA,WAAW,EAAA,OAAA;EACiB,SAAE,gBAAA,CAAA,EOWL,aPXK,CAAA,OAAA,CAAA;CAAX;;;;AALxB;;;AAAuC,cQgB1B,iBRhB0B,EAAA,CAAA;EAAA,WAAA;EAAA,KAAA;EAAA;CAAA,EAAA;EAAO,SAAA,WAAA,EQqBtB,QRrBsB,CQqBb,OAAA,CAAE,ORrBW,CAAA;EAEzC,SAAA,KAAA,EAAA,OQoBoB,ORpBpB;EAEA,SAAA,MAAW,EQmBG,qBRnBH;CACiB,EAAA,GAAA;EAAT,SAAA,EAAA,CAAA,OAAA,EQyEC,uBRzED,EAAA,GQyE2B,mBRzE3B;CAEG"}
package/dist/index.d.mts CHANGED
@@ -15,11 +15,17 @@ type CollectArgs = {
15
15
  readonly programPath: NodePath<types$1.Program>;
16
16
  readonly filename: string;
17
17
  readonly createTracker?: CanonicalTrackerFactory;
18
+ /**
19
+ * Base directory for relative path computation.
20
+ * When provided, canonical IDs use paths relative to this directory.
21
+ */
22
+ readonly baseDir?: string;
18
23
  };
19
24
  declare const collectGqlDefinitionMetadata: ({
20
25
  programPath,
21
26
  filename,
22
- createTracker
27
+ createTracker,
28
+ baseDir
23
29
  }: CollectArgs) => GqlDefinitionMetadataMap;
24
30
  //#endregion
25
31
  //#region packages/babel/src/ast/analysis.d.ts
@@ -36,12 +42,18 @@ type ExtractGqlCallArgs = {
36
42
  readonly filename: string;
37
43
  readonly metadata: GqlDefinitionMetadataMap;
38
44
  readonly getArtifact: ArtifactLookup;
45
+ /**
46
+ * Base directory for relative path computation.
47
+ * When provided, canonical IDs use paths relative to this directory.
48
+ */
49
+ readonly baseDir?: string;
39
50
  };
40
51
  declare const extractGqlCall: ({
41
52
  nodePath,
42
53
  filename,
43
54
  metadata,
44
- getArtifact
55
+ getArtifact,
56
+ baseDir
45
57
  }: ExtractGqlCallArgs) => Result<BabelGqlCall, PluginError>;
46
58
  //#endregion
47
59
  //#region packages/babel/src/ast/ast.d.ts
@@ -92,6 +104,11 @@ type TransformCallExpressionArgs = {
92
104
  readonly filename: string;
93
105
  readonly metadata: GqlDefinitionMetadataMap;
94
106
  readonly getArtifact: ArtifactLookup;
107
+ /**
108
+ * Base directory for relative path computation.
109
+ * When provided, canonical IDs use paths relative to this directory.
110
+ */
111
+ readonly baseDir?: string;
95
112
  };
96
113
  type TransformCallExpressionResult = {
97
114
  readonly transformed: false;
@@ -103,7 +120,8 @@ declare const transformCallExpression: ({
103
120
  callPath,
104
121
  filename,
105
122
  metadata,
106
- getArtifact
123
+ getArtifact,
124
+ baseDir
107
125
  }: TransformCallExpressionArgs) => Result<TransformCallExpressionResult, PluginError>;
108
126
  declare const insertRuntimeCalls: (programPath: NodePath<types$1.Program>, runtimeCalls: readonly types$1.Expression[]) => void;
109
127
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/ast/metadata.ts","../src/ast/analysis.ts","../src/ast/ast.ts","../src/ast/imports.ts","../src/ast/runtime.ts","../src/ast/transformer.ts","../src/transform.ts","../src/types.ts","../src/transformer.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;KAKY,wBAAA,GAA2B,QAAQ,OAAA,CAAE,gBAAgB;KAE5D,uBAAA,UAAiC;KAEjC,WAAA;wBACmB,SAAS,OAAA,CAAE;;2BAER;;AAPf,cAaC,4BAbuB,EAAA,CAAA;EAAA,WAAA;EAAA,QAAA;EAAA;AAAA,CAAA,EAamD,WAbnD,EAAA,GAaiE,wBAbjE;;;KCWxB,cAAA,iBAA+B,gBAAgB;KAG/C,oBAAA,GAAuB;qBAAuC,SAAS,OAAA,CAAE;;ADdzE,KCeA,qBAAA,GAAwB,gBDfA,GAAA;EAAW,SAAE,QAAA,ECgB5B,QDhB4B,CCgBnB,OAAA,CAAE,cDhBiB,CAAA;CAAgB;AAA1B,KCmB3B,YAAA,GAAe,oBDnBY,GCmBW,qBDnBX;AAAO,KCqBlC,kBAAA,GDrBkC;EAEzC,SAAA,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AAA;CAAW;;;;AAE1C,KOYO,mBAAA,GPZgB;EAEvB,SAAA,WAAW,EAAA,OAAA;EACiB,SAAE,gBAAA,CAAA,EOWL,aPXK,CAAA,OAAA,CAAA;CAAX;;;;AALxB;;;AAAuC,cQgB1B,iBRhB0B,EAAA,CAAA;EAAA,WAAA;EAAA,KAAA;EAAA;CAAA,EAAA;EAAO,SAAA,WAAA,EQqBtB,QRrBsB,CQqBb,OAAA,CAAE,ORrBW,CAAA;EAEzC,SAAA,KAAA,EAAA,OQoBoB,ORpBpB;EAEA,SAAA,MAAW,EQmBG,qBRnBH;CACiB,EAAA,GAAA;EAAT,SAAA,EAAA,CAAA,OAAA,EQyEC,uBRzED,EAAA,GQyE2B,mBRzE3B;CAEG"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/ast/metadata.ts","../src/ast/analysis.ts","../src/ast/ast.ts","../src/ast/imports.ts","../src/ast/runtime.ts","../src/ast/transformer.ts","../src/transform.ts","../src/types.ts","../src/transformer.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;KAKY,wBAAA,GAA2B,QAAQ,OAAA,CAAE,gBAAgB;KAE5D,uBAAA,UAAiC;KAEjC,WAAA;wBACmB,SAAS,OAAA,CAAE;;2BAER;;AAP3B;;;EAAuC,SAAA,OAAA,CAAA,EAAA,MAAA;CAAO;AAEzC,cAgBQ,4BAhByB,EAAA,CAAA;EAAA,WAAsB;EAAA,QAAA;EAAA,aAAA;EAAA;AAAA,CAAA,EAqBzD,WArByD,EAAA,GAqB3C,wBArB2C;;;KCShD,cAAA,iBAA+B,gBAAgB;KAG/C,oBAAA,GAAuB;qBAAuC,SAAS,OAAA,CAAE;;ADdzE,KCeA,qBAAA,GAAwB,gBDfA,GAAA;EAAW,SAAE,QAAA,ECgB5B,QDhB4B,CCgBnB,OAAA,CAAE,cDhBiB,CAAA;CAAgB;AAA1B,KCmB3B,YAAA,GAAe,oBDnBY,GCmBW,qBDnBX;AAAO,KCqBlC,kBAAA,GDrB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KHlD,uBAAA;;EPNA,SAAA,cAAA,EAAA,CAAA,EAAwB,EOQJ,WPRI,EAAA,GOQY,sBPRZ,GAAA,SAAA;CAAW;;;;AAE1C,KOYO,mBAAA,GPZgB;EAEvB,SAAA,WAAW,EAAA,OAAA;EACiB,SAAE,gBAAA,CAAA,EOWL,aPXK,CAAA,OAAA,CAAA;CAAX;;;;AALxB;;;AAAuC,cQgB1B,iBRhB0B,EAAA,CAAA;EAAA,WAAA;EAAA,KAAA;EAAA;CAAA,EAAA;EAAO,SAAA,WAAA,EQqBtB,QRrBsB,CQqBb,OAAA,CAAE,ORrBW,CAAA;EAEzC,SAAA,KAAA,EAAA,OQoBoB,ORpBpB;EAEA,SAAA,MAAW,EQmBG,qBRnBH;CACiB,EAAA,GAAA;EAAT,SAAA,EAAA,CAAA,OAAA,EQyEC,uBRzED,EAAA,GQyE2B,mBRzE3B;CAEG"}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as buildOperationRuntimeComponents, c as ensureGqlRuntimeRequire, d as buildObjectExpression, f as clone, h as extractGqlCall, i as buildFragmentRuntimeCall, l as removeGraphqlSystemImports, m as stripTypeAnnotations, n as insertRuntimeCalls, o as collectGqlDefinitionMetadata, p as cloneCallExpression, r as transformCallExpression, s as ensureGqlRuntimeImport, t as createTransformer, u as buildLiteralFromValue } from "./transformer-kTdl4bE2.mjs";
1
+ import { a as buildOperationRuntimeComponents, c as ensureGqlRuntimeRequire, d as buildObjectExpression, f as clone, h as extractGqlCall, i as buildFragmentRuntimeCall, l as removeGraphqlSystemImports, m as stripTypeAnnotations, n as insertRuntimeCalls, o as collectGqlDefinitionMetadata, p as cloneCallExpression, r as transformCallExpression, s as ensureGqlRuntimeImport, t as createTransformer, u as buildLiteralFromValue } from "./transformer-DpXV_0Tu.mjs";
2
2
  import { types } from "@babel/core";
3
3
  import _generate from "@babel/generator";
4
4
  import { parse } from "@babel/parser";
package/dist/plugin.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_transformer = require('./transformer-C9UM_hw8.cjs');
2
+ const require_transformer = require('./transformer-uUPMOk7W.cjs');
3
3
  let __soda_gql_builder_plugin_support = require("@soda-gql/builder/plugin-support");
4
4
  let __babel_core = require("@babel/core");
5
5
 
package/dist/plugin.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createTransformer } from "./transformer-kTdl4bE2.mjs";
1
+ import { t as createTransformer } from "./transformer-DpXV_0Tu.mjs";
2
2
  import { createPluginSession } from "@soda-gql/builder/plugin-support";
3
3
  import { types } from "@babel/core";
4
4
 
@@ -6,11 +6,11 @@ import { createCanonicalTracker } from "@soda-gql/common";
6
6
  import { createGraphqlSystemIdentifyHelper } from "@soda-gql/builder";
7
7
 
8
8
  //#region packages/babel/src/ast/analysis.ts
9
- const extractGqlCall = ({ nodePath, filename, metadata, getArtifact }) => {
9
+ const extractGqlCall = ({ nodePath, filename, metadata, getArtifact, baseDir }) => {
10
10
  const callExpression = nodePath.node;
11
11
  const meta = metadata.get(callExpression);
12
12
  if (!meta) return err(createMetadataMissingError({ filename }));
13
- const canonicalId = resolveCanonicalId(filename, meta.astPath);
13
+ const canonicalId = resolveCanonicalId(filename, meta.astPath, { baseDir });
14
14
  const artifact = getArtifact(canonicalId);
15
15
  if (!artifact) return err(createArtifactMissingError({
16
16
  filename,
@@ -203,10 +203,11 @@ const extractRequireTargetSpecifier = (expr) => {
203
203
 
204
204
  //#endregion
205
205
  //#region packages/babel/src/ast/metadata.ts
206
- const collectGqlDefinitionMetadata = ({ programPath, filename, createTracker }) => {
206
+ const collectGqlDefinitionMetadata = ({ programPath, filename, createTracker, baseDir }) => {
207
207
  const exportBindings = collectExportBindings(programPath.node);
208
208
  const tracker = (createTracker ?? createCanonicalTracker)({
209
209
  filePath: filename,
210
+ baseDir,
210
211
  getExportName: (localName) => exportBindings.get(localName)
211
212
  });
212
213
  const getAnonymousName = createAnonymousNameFactory();
@@ -395,13 +396,14 @@ const buildOperationRuntimeComponents = ({ artifact }) => {
395
396
 
396
397
  //#endregion
397
398
  //#region packages/babel/src/ast/transformer.ts
398
- const transformCallExpression = ({ callPath, filename, metadata, getArtifact }) => {
399
+ const transformCallExpression = ({ callPath, filename, metadata, getArtifact, baseDir }) => {
399
400
  if (!metadata.has(callPath.node)) return ok({ transformed: false });
400
401
  const gqlCallResult = extractGqlCall({
401
402
  nodePath: callPath,
402
403
  filename,
403
404
  metadata,
404
- getArtifact
405
+ getArtifact,
406
+ baseDir
405
407
  });
406
408
  if (gqlCallResult.isErr()) return err(gqlCallResult.error);
407
409
  const gqlCall = gqlCallResult.value;
@@ -483,7 +485,8 @@ const createTransformer = ({ programPath, types: types$1, config }) => {
483
485
  return { transform: (context) => {
484
486
  const metadata = collectGqlDefinitionMetadata({
485
487
  programPath,
486
- filename: context.filename
488
+ filename: context.filename,
489
+ baseDir: config.baseDir
487
490
  });
488
491
  const runtimeCalls = [];
489
492
  let transformed = false;
@@ -492,7 +495,8 @@ const createTransformer = ({ programPath, types: types$1, config }) => {
492
495
  callPath,
493
496
  filename: context.filename,
494
497
  metadata,
495
- getArtifact: context.artifactLookup
498
+ getArtifact: context.artifactLookup,
499
+ baseDir: config.baseDir
496
500
  });
497
501
  if (result.isErr()) {
498
502
  console.error(`[@soda-gql/babel] ${formatPluginError(result.error)}`);
@@ -526,4 +530,4 @@ const createTransformer = ({ programPath, types: types$1, config }) => {
526
530
 
527
531
  //#endregion
528
532
  export { buildOperationRuntimeComponents as a, ensureGqlRuntimeRequire as c, buildObjectExpression as d, clone as f, extractGqlCall as h, buildFragmentRuntimeCall as i, removeGraphqlSystemImports as l, stripTypeAnnotations as m, insertRuntimeCalls as n, collectGqlDefinitionMetadata as o, cloneCallExpression as p, transformCallExpression as r, ensureGqlRuntimeImport as s, createTransformer as t, buildLiteralFromValue as u };
529
- //# sourceMappingURL=transformer-kTdl4bE2.mjs.map
533
+ //# sourceMappingURL=transformer-DpXV_0Tu.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformer-DpXV_0Tu.mjs","names":["elements: Expression[]","properties: t.ObjectProperty[]","t","toRemove: NodePath[]","bindings: ExportBindingMap","t","prebuildProps: Record<string, t.Expression>","t","types","lastLoader: NodePath<t.Statement> | null","runtimeCalls: t.Expression[]"],"sources":["../src/ast/analysis.ts","../src/ast/ast.ts","../src/ast/imports.ts","../src/ast/metadata.ts","../src/ast/runtime.ts","../src/ast/transformer.ts","../src/transformer.ts"],"sourcesContent":["import type { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { BuilderArtifactElement } from \"@soda-gql/builder\";\nimport type {\n GqlCallFragment,\n GqlCallOperation,\n PluginAnalysisArtifactMissingError,\n PluginAnalysisMetadataMissingError,\n PluginAnalysisUnsupportedArtifactTypeError,\n PluginError,\n} from \"@soda-gql/builder/plugin-support\";\nimport { resolveCanonicalId } from \"@soda-gql/builder/plugin-support\";\nimport type { CanonicalId } from \"@soda-gql/common\";\nimport { err, ok, type Result } from \"neverthrow\";\nimport type { GqlDefinitionMetadataMap } from \"./metadata\";\n\nexport type ArtifactLookup = (canonicalId: CanonicalId) => BuilderArtifactElement | undefined;\n\n// Babel-specific GqlCall types\nexport type BabelGqlCallFragment = GqlCallFragment & { readonly nodePath: NodePath<t.CallExpression> };\nexport type BabelGqlCallOperation = GqlCallOperation & {\n readonly nodePath: NodePath<t.CallExpression>;\n};\n\nexport type BabelGqlCall = BabelGqlCallFragment | BabelGqlCallOperation;\n\nexport type ExtractGqlCallArgs = {\n readonly nodePath: NodePath<t.CallExpression>;\n readonly filename: string;\n readonly metadata: GqlDefinitionMetadataMap;\n readonly getArtifact: ArtifactLookup;\n /**\n * Base directory for relative path computation.\n * When provided, canonical IDs use paths relative to this directory.\n */\n readonly baseDir?: string;\n};\n\nexport const extractGqlCall = ({\n nodePath,\n filename,\n metadata,\n getArtifact,\n baseDir,\n}: ExtractGqlCallArgs): Result<BabelGqlCall, PluginError> => {\n const callExpression = nodePath.node;\n\n const meta = metadata.get(callExpression);\n if (!meta) {\n return err(createMetadataMissingError({ filename }));\n }\n\n const canonicalId = resolveCanonicalId(filename, meta.astPath, { baseDir });\n const artifact = getArtifact(canonicalId);\n\n if (!artifact) {\n return err(createArtifactMissingError({ filename, canonicalId }));\n }\n\n if (artifact.type === \"fragment\") {\n return ok({ nodePath, canonicalId, type: \"fragment\", artifact });\n }\n\n if (artifact.type === \"operation\") {\n return ok({ nodePath, canonicalId, type: \"operation\", artifact });\n }\n\n return err(\n createUnsupportedArtifactTypeError({\n filename,\n canonicalId,\n artifactType: (artifact as { type: string }).type,\n }),\n );\n};\n\ntype MetadataErrorInput = { readonly filename: string };\ntype ArtifactMissingErrorInput = { readonly filename: string; readonly canonicalId: CanonicalId };\ntype UnsupportedArtifactTypeInput = {\n readonly filename: string;\n readonly canonicalId: CanonicalId;\n readonly artifactType: string;\n};\n\nconst createMetadataMissingError = ({ filename }: MetadataErrorInput): PluginAnalysisMetadataMissingError => ({\n type: \"PluginError\",\n stage: \"analysis\",\n code: \"SODA_GQL_METADATA_NOT_FOUND\",\n message: `No GraphQL metadata found for ${filename}`,\n cause: { filename },\n filename,\n});\n\nconst createArtifactMissingError = ({\n filename,\n canonicalId,\n}: ArtifactMissingErrorInput): PluginAnalysisArtifactMissingError => ({\n type: \"PluginError\",\n stage: \"analysis\",\n code: \"SODA_GQL_ANALYSIS_ARTIFACT_NOT_FOUND\",\n message: `No builder artifact found for canonical ID ${canonicalId}`,\n cause: { filename, canonicalId },\n filename,\n canonicalId,\n});\n\nconst createUnsupportedArtifactTypeError = ({\n filename,\n canonicalId,\n artifactType,\n}: UnsupportedArtifactTypeInput): PluginAnalysisUnsupportedArtifactTypeError => ({\n type: \"PluginError\",\n stage: \"analysis\",\n code: \"SODA_GQL_UNSUPPORTED_ARTIFACT_TYPE\",\n message: `Unsupported builder artifact type \"${artifactType}\" for canonical ID ${canonicalId}`,\n cause: { filename, canonicalId, artifactType },\n filename,\n canonicalId,\n artifactType,\n});\n","import type { Expression } from \"@babel/types\";\nimport * as t from \"@babel/types\";\nimport type { PluginError, PluginTransformUnsupportedValueTypeError } from \"@soda-gql/builder/plugin-support\";\nimport { err, ok, type Result } from \"neverthrow\";\n\nconst createUnsupportedValueTypeError = (valueType: string): PluginTransformUnsupportedValueTypeError => ({\n type: \"PluginError\",\n stage: \"transform\",\n code: \"SODA_GQL_TRANSFORM_UNSUPPORTED_VALUE_TYPE\",\n message: `Unsupported value type: ${valueType}`,\n cause: { valueType },\n valueType,\n});\n\nexport const buildLiteralFromValue = (value: unknown): Result<Expression, PluginError> => {\n if (value === null) {\n return ok(t.nullLiteral());\n }\n if (typeof value === \"string\") {\n return ok(t.stringLiteral(value));\n }\n if (typeof value === \"number\") {\n return ok(t.numericLiteral(value));\n }\n if (typeof value === \"boolean\") {\n return ok(t.booleanLiteral(value));\n }\n if (Array.isArray(value)) {\n const elements: Expression[] = [];\n for (const item of value) {\n const result = buildLiteralFromValue(item);\n if (result.isErr()) {\n return result;\n }\n elements.push(result.value);\n }\n return ok(t.arrayExpression(elements));\n }\n if (typeof value === \"object\") {\n const properties: t.ObjectProperty[] = [];\n for (const [key, val] of Object.entries(value)) {\n const result = buildLiteralFromValue(val);\n if (result.isErr()) {\n return result;\n }\n properties.push(t.objectProperty(t.identifier(key), result.value));\n }\n return ok(t.objectExpression(properties));\n }\n return err(createUnsupportedValueTypeError(typeof value));\n};\n\nexport const clone = <T extends t.Node>(node: T): T => t.cloneNode(node, true) as T;\n\nexport const cloneCallExpression = (node: t.CallExpression): t.CallExpression =>\n t.callExpression(clone(node.callee), node.arguments.map(clone));\n\nexport const stripTypeAnnotations = (node: t.Node): void => {\n if (\"typeParameters\" in node) {\n delete node.typeParameters;\n }\n if (\"typeAnnotation\" in node) {\n delete node.typeAnnotation;\n }\n if (\"returnType\" in node) {\n delete node.returnType;\n }\n};\n\nexport const buildObjectExpression = <K extends string>(\n properties: Record<K, t.Expression | t.PatternLike>,\n): t.ObjectExpression =>\n t.objectExpression(\n Object.entries<t.Expression | t.PatternLike>(properties).map(([key, value]) => t.objectProperty(t.identifier(key), value)),\n );\n","import { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { GraphqlSystemIdentifyHelper } from \"@soda-gql/builder\";\n\nconst RUNTIME_MODULE = \"@soda-gql/runtime\";\n\n/**\n * Ensure that the gqlRuntime require exists in the program for CJS output.\n * Injects: const __soda_gql_runtime = require(\"@soda-gql/runtime\");\n */\nexport const ensureGqlRuntimeRequire = (programPath: NodePath<t.Program>) => {\n // Check if the require already exists\n const existing = programPath.node.body.find(\n (statement): statement is t.VariableDeclaration =>\n t.isVariableDeclaration(statement) &&\n statement.declarations.some((decl) => {\n if (!t.isIdentifier(decl.id) || decl.id.name !== \"__soda_gql_runtime\") {\n return false;\n }\n if (!decl.init || !t.isCallExpression(decl.init)) {\n return false;\n }\n const callExpr = decl.init;\n if (!t.isIdentifier(callExpr.callee) || callExpr.callee.name !== \"require\") {\n return false;\n }\n const arg = callExpr.arguments[0];\n return arg && t.isStringLiteral(arg) && arg.value === RUNTIME_MODULE;\n }),\n );\n\n if (existing) {\n return;\n }\n\n // Create: const __soda_gql_runtime = require(\"@soda-gql/runtime\");\n const requireCall = t.callExpression(t.identifier(\"require\"), [t.stringLiteral(RUNTIME_MODULE)]);\n\n const variableDeclaration = t.variableDeclaration(\"const\", [\n t.variableDeclarator(t.identifier(\"__soda_gql_runtime\"), requireCall),\n ]);\n\n // Insert at the beginning of the file\n programPath.node.body.unshift(variableDeclaration);\n};\n\n/**\n * Ensure that the gqlRuntime import exists in the program.\n * gqlRuntime is always imported from @soda-gql/runtime.\n */\nexport const ensureGqlRuntimeImport = (programPath: NodePath<t.Program>) => {\n const existing = programPath.node.body.find(\n (statement) => statement.type === \"ImportDeclaration\" && statement.source.value === RUNTIME_MODULE,\n );\n\n if (existing && t.isImportDeclaration(existing)) {\n const hasSpecifier = existing.specifiers.some(\n (specifier) =>\n specifier.type === \"ImportSpecifier\" &&\n specifier.imported.type === \"Identifier\" &&\n specifier.imported.name === \"gqlRuntime\",\n );\n\n if (!hasSpecifier) {\n existing.specifiers = [...existing.specifiers, t.importSpecifier(t.identifier(\"gqlRuntime\"), t.identifier(\"gqlRuntime\"))];\n }\n\n return;\n }\n\n programPath.node.body.unshift(\n t.importDeclaration(\n [t.importSpecifier(t.identifier(\"gqlRuntime\"), t.identifier(\"gqlRuntime\"))],\n t.stringLiteral(RUNTIME_MODULE),\n ),\n );\n};\n\n/**\n * Remove the graphql-system import (runtimeModule) and gql-related exports from the program.\n * After transformation, gqlRuntime is imported from @soda-gql/runtime instead,\n * so the original graphql-system import should be completely removed.\n *\n * This handles both ESM imports and CommonJS require() statements.\n */\nexport const removeGraphqlSystemImports = (\n programPath: NodePath<t.Program>,\n graphqlSystemIdentifyHelper: GraphqlSystemIdentifyHelper,\n filename: string,\n) => {\n // After transformation, all gql usage should be replaced with gqlRuntime\n // So we can safely remove the graphql-system import\n const toRemove: NodePath[] = [];\n\n programPath.traverse({\n // Remove ESM import declarations for the graphql-system\n ImportDeclaration(path) {\n if (t.isStringLiteral(path.node.source)) {\n const isGraphqlSystem = graphqlSystemIdentifyHelper.isGraphqlSystemImportSpecifier({\n filePath: filename,\n specifier: path.node.source.value,\n });\n if (isGraphqlSystem) {\n toRemove.push(path);\n }\n }\n },\n // Remove CommonJS require() statements for the graphql-system\n // - const graphql_system_1 = require(\"../../graphql-system\");\n // - const { gql } = require(\"@/graphql-system\");\n VariableDeclaration(path) {\n const shouldRemove = path.node.declarations.every((decl) => {\n const specifier = extractRequireTargetSpecifier(decl.init);\n if (!specifier) {\n return false;\n }\n\n return graphqlSystemIdentifyHelper.isGraphqlSystemImportSpecifier({\n filePath: filename,\n specifier: specifier,\n });\n });\n\n if (shouldRemove) {\n toRemove.push(path);\n }\n },\n });\n\n for (const path of toRemove) {\n path.remove();\n }\n};\n\n/**\n * Check if an expression is a require() call and extract its target specifier.\n * Handles multiple patterns:\n * - require(\"@/graphql-system\")\n * - Object(require(\"@/graphql-system\")) (interop helper pattern)\n */\nconst extractRequireTargetSpecifier = (expr: t.Node | null | undefined): string | undefined => {\n if (!expr) {\n return undefined;\n }\n\n // Direct require(\"@/graphql-system\")\n if (t.isCallExpression(expr)) {\n if (t.isIdentifier(expr.callee) && expr.callee.name === \"require\") {\n const arg = expr.arguments[0];\n if (arg && t.isStringLiteral(arg)) {\n return arg.value;\n }\n }\n\n // Object(require(\"@/graphql-system\")) or similar interop helpers\n if (t.isIdentifier(expr.callee) && (expr.callee.name === \"Object\" || expr.callee.name.startsWith(\"__import\"))) {\n const arg = expr.arguments[0];\n if (arg && t.isCallExpression(arg)) {\n if (t.isIdentifier(arg.callee) && arg.callee.name === \"require\") {\n const requireArg = arg.arguments[0];\n if (requireArg && t.isStringLiteral(requireArg)) {\n return requireArg.value;\n }\n }\n }\n }\n }\n\n return undefined;\n};\n","import { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { GqlDefinitionMetadata } from \"@soda-gql/builder/plugin-support\";\nimport { type CanonicalPathTracker, createCanonicalTracker } from \"@soda-gql/common\";\n\nexport type GqlDefinitionMetadataMap = WeakMap<t.CallExpression, GqlDefinitionMetadata>;\n\ntype CanonicalTrackerFactory = typeof createCanonicalTracker;\n\ntype CollectArgs = {\n readonly programPath: NodePath<t.Program>;\n readonly filename: string;\n readonly createTracker?: CanonicalTrackerFactory;\n /**\n * Base directory for relative path computation.\n * When provided, canonical IDs use paths relative to this directory.\n */\n readonly baseDir?: string;\n};\n\ntype ScopeHandle = ReturnType<CanonicalPathTracker[\"enterScope\"]>;\ntype ExportBindingMap = Map<string, string>;\n\nexport const collectGqlDefinitionMetadata = ({\n programPath,\n filename,\n createTracker,\n baseDir,\n}: CollectArgs): GqlDefinitionMetadataMap => {\n const exportBindings = collectExportBindings(programPath.node);\n const trackerFactory = createTracker ?? createCanonicalTracker;\n const tracker = trackerFactory({\n filePath: filename,\n baseDir,\n getExportName: (localName) => exportBindings.get(localName),\n });\n\n const getAnonymousName = createAnonymousNameFactory();\n const scopeHandles = new WeakMap<NodePath<t.Node>, ScopeHandle>();\n const metadata = new WeakMap<t.CallExpression, GqlDefinitionMetadata>();\n\n programPath.traverse({\n enter(path) {\n if (path.isCallExpression() && isGqlDefinitionCall(path.node)) {\n const depthBeforeRegister = tracker.currentDepth();\n const { astPath } = tracker.registerDefinition();\n const isTopLevel = depthBeforeRegister <= 1;\n const exportInfo = isTopLevel ? resolveTopLevelExport(path, exportBindings) : null;\n\n metadata.set(path.node, {\n astPath,\n isTopLevel,\n isExported: exportInfo?.isExported ?? false,\n exportBinding: exportInfo?.exportBinding,\n });\n\n path.skip();\n return;\n }\n\n const handle = maybeEnterScope(path, tracker, getAnonymousName);\n if (handle) {\n scopeHandles.set(path, handle);\n }\n },\n exit(path) {\n const handle = scopeHandles.get(path);\n if (handle) {\n tracker.exitScope(handle);\n scopeHandles.delete(path);\n }\n },\n });\n\n return metadata;\n};\n\nconst collectExportBindings = (program: t.Program): ExportBindingMap => {\n const bindings: ExportBindingMap = new Map();\n\n for (const statement of program.body) {\n // ESM exports: export const foo = ...\n if (t.isExportNamedDeclaration(statement) && statement.declaration) {\n const { declaration } = statement;\n if (t.isVariableDeclaration(declaration)) {\n for (const declarator of declaration.declarations) {\n if (t.isIdentifier(declarator.id)) {\n bindings.set(declarator.id.name, declarator.id.name);\n }\n }\n continue;\n }\n\n if ((t.isFunctionDeclaration(declaration) || t.isClassDeclaration(declaration)) && declaration.id) {\n bindings.set(declaration.id.name, declaration.id.name);\n }\n continue;\n }\n\n // CommonJS exports: exports.foo = ... or module.exports.foo = ...\n if (t.isExpressionStatement(statement) && t.isAssignmentExpression(statement.expression)) {\n const exportName = getCommonJsExportName(statement.expression.left);\n if (exportName) {\n bindings.set(exportName, exportName);\n }\n }\n }\n\n return bindings;\n};\n\nconst getCommonJsExportName = (node: t.LVal | t.OptionalMemberExpression): string | null => {\n if (!t.isMemberExpression(node) || node.computed) {\n return null;\n }\n\n // Check if it's exports.foo or module.exports.foo\n const isExports = t.isIdentifier(node.object, { name: \"exports\" });\n const isModuleExports =\n t.isMemberExpression(node.object) &&\n t.isIdentifier(node.object.object, { name: \"module\" }) &&\n t.isIdentifier(node.object.property, { name: \"exports\" });\n\n if (!isExports && !isModuleExports) {\n return null;\n }\n\n // Extract property name\n if (t.isIdentifier(node.property)) {\n return node.property.name;\n }\n if (t.isStringLiteral(node.property)) {\n return node.property.value;\n }\n\n return null;\n};\n\nconst createAnonymousNameFactory = (): ((kind: string) => string) => {\n const counters = new Map<string, number>();\n return (kind) => {\n const count = counters.get(kind) ?? 0;\n counters.set(kind, count + 1);\n return `${kind}#${count}`;\n };\n};\n\nconst isGqlDefinitionCall = (node: t.Node): node is t.CallExpression =>\n t.isCallExpression(node) &&\n t.isMemberExpression(node.callee) &&\n isGqlReference(node.callee.object) &&\n node.arguments.length > 0 &&\n t.isArrowFunctionExpression(node.arguments[0]);\n\nconst isGqlReference = (expr: t.Expression | t.Super): boolean => {\n if (t.isIdentifier(expr, { name: \"gql\" })) {\n return true;\n }\n if (!t.isMemberExpression(expr) || expr.computed) {\n return false;\n }\n if (\n (t.isIdentifier(expr.property) && expr.property.name === \"gql\") ||\n (t.isStringLiteral(expr.property) && expr.property.value === \"gql\")\n ) {\n return true;\n }\n return isGqlReference(expr.object);\n};\n\nconst resolveTopLevelExport = (\n callPath: NodePath<t.CallExpression>,\n exportBindings: ExportBindingMap,\n): { readonly isExported: true; readonly exportBinding: string } | null => {\n // ESM: const foo = gql.default(...); export { foo };\n const declarator = callPath.parentPath;\n if (declarator?.isVariableDeclarator()) {\n const { id } = declarator.node;\n if (t.isIdentifier(id)) {\n const exportBinding = exportBindings.get(id.name);\n if (exportBinding) {\n return { isExported: true, exportBinding };\n }\n }\n }\n\n // CommonJS: exports.foo = gql.default(...);\n const assignment = callPath.parentPath;\n if (assignment?.isAssignmentExpression()) {\n const exportName = getCommonJsExportName(assignment.node.left);\n if (exportName && exportBindings.has(exportName)) {\n return { isExported: true, exportBinding: exportName };\n }\n }\n\n return null;\n};\n\nconst maybeEnterScope = (\n path: NodePath<t.Node>,\n tracker: CanonicalPathTracker,\n getAnonymousName: (kind: string) => string,\n): ScopeHandle | null => {\n // CommonJS exports: exports.foo = ... or module.exports.foo = ...\n if (path.isAssignmentExpression()) {\n const exportName = getCommonJsExportName(path.node.left);\n if (exportName) {\n return tracker.enterScope({ segment: exportName, kind: \"variable\", stableKey: `var:${exportName}` });\n }\n }\n\n if (path.isVariableDeclarator() && t.isIdentifier(path.node.id)) {\n const name = path.node.id.name;\n return tracker.enterScope({ segment: name, kind: \"variable\", stableKey: `var:${name}` });\n }\n\n if (path.isArrowFunctionExpression()) {\n const name = getAnonymousName(\"arrow\");\n return tracker.enterScope({ segment: name, kind: \"function\", stableKey: \"arrow\" });\n }\n\n if (path.isFunctionDeclaration() || path.isFunctionExpression()) {\n const explicitName = path.node.id?.name;\n const name = explicitName ?? getAnonymousName(\"function\");\n return tracker.enterScope({ segment: name, kind: \"function\", stableKey: `func:${name}` });\n }\n\n if (path.isClassDeclaration()) {\n const explicitName = path.node.id?.name;\n const name = explicitName ?? getAnonymousName(\"class\");\n return tracker.enterScope({ segment: name, kind: \"class\", stableKey: `class:${name}` });\n }\n\n if (path.isClassMethod() && t.isIdentifier(path.node.key)) {\n const name = path.node.key.name;\n return tracker.enterScope({ segment: name, kind: \"method\", stableKey: `member:${name}` });\n }\n\n if (path.isClassProperty() && t.isIdentifier(path.node.key)) {\n const name = path.node.key.name;\n return tracker.enterScope({ segment: name, kind: \"property\", stableKey: `member:${name}` });\n }\n\n if (path.isObjectProperty()) {\n const key = path.node.key;\n const name = t.isIdentifier(key) ? key.name : t.isStringLiteral(key) ? key.value : null;\n if (name) {\n return tracker.enterScope({ segment: name, kind: \"property\", stableKey: `prop:${name}` });\n }\n }\n\n return null;\n};\n","import { types as t } from \"@babel/core\";\nimport type { PluginError } from \"@soda-gql/builder/plugin-support\";\nimport { ok, type Result } from \"neverthrow\";\nimport type { BabelGqlCallFragment, BabelGqlCallOperation } from \"./analysis\";\nimport { buildObjectExpression } from \"./ast\";\n\nexport const buildFragmentRuntimeCall = ({\n artifact,\n}: BabelGqlCallFragment & { filename: string }): Result<t.Expression, PluginError> => {\n const prebuildProps: Record<string, t.Expression> = {\n typename: t.stringLiteral(artifact.prebuild.typename),\n };\n if (artifact.prebuild.key !== undefined) {\n prebuildProps.key = t.stringLiteral(artifact.prebuild.key);\n }\n\n return ok(\n t.callExpression(t.memberExpression(t.identifier(\"gqlRuntime\"), t.identifier(\"fragment\")), [\n buildObjectExpression({\n prebuild: buildObjectExpression(prebuildProps),\n }),\n ]),\n );\n};\n\nexport const buildOperationRuntimeComponents = ({\n artifact,\n}: BabelGqlCallOperation & { filename: string }): Result<\n { referenceCall: t.Expression; runtimeCall: t.Expression },\n PluginError\n> => {\n const runtimeCall = t.callExpression(t.memberExpression(t.identifier(\"gqlRuntime\"), t.identifier(\"operation\")), [\n buildObjectExpression({\n prebuild: t.callExpression(t.memberExpression(t.identifier(\"JSON\"), t.identifier(\"parse\")), [\n t.stringLiteral(JSON.stringify(artifact.prebuild)),\n ]),\n runtime: buildObjectExpression({}),\n }),\n ]);\n\n const referenceCall = t.callExpression(t.memberExpression(t.identifier(\"gqlRuntime\"), t.identifier(\"getOperation\")), [\n t.stringLiteral(artifact.prebuild.operationName),\n ]);\n\n return ok({\n referenceCall,\n runtimeCall,\n });\n};\n","import type { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { PluginError } from \"@soda-gql/builder/plugin-support\";\nimport { err, ok, type Result } from \"neverthrow\";\nimport type { ArtifactLookup, BabelGqlCall } from \"./analysis\";\nimport { extractGqlCall } from \"./analysis\";\nimport type { GqlDefinitionMetadataMap } from \"./metadata\";\nimport { buildFragmentRuntimeCall, buildOperationRuntimeComponents } from \"./runtime\";\n\ntype TransformCallExpressionArgs = {\n readonly callPath: NodePath<t.CallExpression>;\n readonly filename: string;\n readonly metadata: GqlDefinitionMetadataMap;\n readonly getArtifact: ArtifactLookup;\n /**\n * Base directory for relative path computation.\n * When provided, canonical IDs use paths relative to this directory.\n */\n readonly baseDir?: string;\n};\n\ntype TransformCallExpressionResult =\n | { readonly transformed: false }\n | { readonly transformed: true; readonly runtimeCall?: t.Expression };\n\nexport const transformCallExpression = ({\n callPath,\n filename,\n metadata,\n getArtifact,\n baseDir,\n}: TransformCallExpressionArgs): Result<TransformCallExpressionResult, PluginError> => {\n // Skip if this call doesn't have GQL metadata\n if (!metadata.has(callPath.node)) {\n return ok({ transformed: false });\n }\n\n const gqlCallResult = extractGqlCall({\n nodePath: callPath,\n filename,\n metadata,\n getArtifact,\n baseDir,\n });\n\n if (gqlCallResult.isErr()) {\n return err(gqlCallResult.error);\n }\n\n const gqlCall = gqlCallResult.value;\n\n return replaceWithRuntimeCall(callPath, gqlCall, filename);\n};\n\nconst replaceWithRuntimeCall = (\n callPath: NodePath<t.CallExpression>,\n gqlCall: BabelGqlCall,\n filename: string,\n): Result<TransformCallExpressionResult, PluginError> => {\n if (gqlCall.type === \"fragment\") {\n const result = buildFragmentRuntimeCall({ ...gqlCall, filename });\n if (result.isErr()) {\n return err(result.error);\n }\n callPath.replaceWith(result.value);\n return ok({ transformed: true });\n }\n\n if (gqlCall.type === \"operation\") {\n const result = buildOperationRuntimeComponents({ ...gqlCall, filename });\n if (result.isErr()) {\n return err(result.error);\n }\n const { referenceCall, runtimeCall } = result.value;\n callPath.replaceWith(referenceCall);\n return ok({ transformed: true, runtimeCall });\n }\n\n return ok({ transformed: false });\n};\n\nexport const insertRuntimeCalls = (programPath: NodePath<t.Program>, runtimeCalls: readonly t.Expression[]): void => {\n if (runtimeCalls.length === 0) {\n return;\n }\n\n programPath.traverse({\n ImportDeclaration(importDeclPath) {\n if (importDeclPath.node.source.value === \"@soda-gql/runtime\") {\n importDeclPath.insertAfter([...runtimeCalls]);\n }\n },\n });\n};\n","/**\n * Babel implementation of the TransformAdapter interface.\n *\n * This adapter wraps the existing Babel-specific transformation logic\n * for soda-gql zero-runtime transformations.\n */\n\nimport type { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport { createGraphqlSystemIdentifyHelper } from \"@soda-gql/builder\";\nimport { formatPluginError } from \"@soda-gql/builder/plugin-support\";\nimport type { ResolvedSodaGqlConfig } from \"@soda-gql/config\";\nimport { ensureGqlRuntimeImport, removeGraphqlSystemImports } from \"./ast/imports\";\nimport { collectGqlDefinitionMetadata } from \"./ast/metadata\";\nimport { transformCallExpression } from \"./ast/transformer\";\nimport type { TransformPassResult, TransformProgramContext } from \"./types\";\n\n/**\n * Creates a Babel transformer with a single transform() method.\n * This matches the pattern used in the TypeScript plugin.\n */\nexport const createTransformer = ({\n programPath,\n types,\n config,\n}: {\n readonly programPath: NodePath<t.Program>;\n readonly types: typeof t;\n readonly config: ResolvedSodaGqlConfig;\n}) => {\n // Create graphql system identify helper using builder's implementation\n const graphqlSystemIdentifyHelper = createGraphqlSystemIdentifyHelper(config);\n\n /**\n * Check if a node is a require() or __webpack_require__() call.\n */\n const isRequireCall = (node: t.Node): boolean => {\n if (!types.isCallExpression(node)) {\n return false;\n }\n\n const callee = node.callee;\n return types.isIdentifier(callee) && (callee.name === \"require\" || callee.name === \"__webpack_require__\");\n };\n\n /**\n * Find the last statement that loads a module (import or require).\n * Handles both ESM imports and CommonJS require() calls.\n */\n const findLastModuleLoader = (): NodePath<t.Statement> | null => {\n const bodyPaths = programPath.get(\"body\");\n let lastLoader: NodePath<t.Statement> | null = null;\n\n for (const path of bodyPaths) {\n // ESM: import declaration\n if (path.isImportDeclaration()) {\n lastLoader = path;\n continue;\n }\n\n // CommonJS: const foo = require(\"bar\") or const foo = __webpack_require__(123)\n if (path.isVariableDeclaration()) {\n for (const declarator of path.node.declarations) {\n if (declarator.init && isRequireCall(declarator.init)) {\n lastLoader = path;\n break;\n }\n }\n continue;\n }\n\n // CommonJS: require(\"bar\") or __webpack_require__(123) as standalone expression\n if (path.isExpressionStatement()) {\n if (isRequireCall(path.node.expression)) {\n lastLoader = path;\n }\n }\n }\n\n return lastLoader;\n };\n\n return {\n transform: (context: TransformProgramContext): TransformPassResult => {\n const metadata = collectGqlDefinitionMetadata({\n programPath,\n filename: context.filename,\n baseDir: config.baseDir,\n });\n\n const runtimeCalls: t.Expression[] = [];\n let transformed = false;\n\n // Transform all gql call expressions\n programPath.traverse({\n CallExpression: (callPath) => {\n const result = transformCallExpression({\n callPath,\n filename: context.filename,\n metadata,\n getArtifact: context.artifactLookup,\n baseDir: config.baseDir,\n });\n\n if (result.isErr()) {\n // Log error and continue - don't fail the entire build for a single error\n console.error(`[@soda-gql/babel] ${formatPluginError(result.error)}`);\n return;\n }\n\n const transformResult = result.value;\n if (transformResult.transformed) {\n transformed = true;\n\n if (transformResult.runtimeCall) {\n runtimeCalls.push(transformResult.runtimeCall);\n }\n }\n },\n });\n\n if (!transformed) {\n return { transformed: false, runtimeArtifacts: undefined };\n }\n\n // Ensure runtime import\n ensureGqlRuntimeImport(programPath);\n\n // Insert runtime side effects immediately if any\n if (runtimeCalls.length > 0) {\n const statements = runtimeCalls.map((expr) => types.expressionStatement(expr));\n const lastLoaderPath = findLastModuleLoader();\n\n if (lastLoaderPath) {\n lastLoaderPath.insertAfter(statements);\n } else {\n programPath.unshiftContainer(\"body\", statements);\n }\n }\n\n // Clean up: remove graphql system imports and recrawl scope\n programPath.scope.crawl();\n removeGraphqlSystemImports(programPath, graphqlSystemIdentifyHelper, context.filename);\n\n return {\n transformed: true,\n runtimeArtifacts: undefined,\n };\n },\n };\n};\n"],"mappings":";;;;;;;;AAsCA,MAAa,kBAAkB,EAC7B,UACA,UACA,UACA,aACA,cAC2D;CAC3D,MAAM,iBAAiB,SAAS;CAEhC,MAAM,OAAO,SAAS,IAAI,eAAe;AACzC,KAAI,CAAC,KACH,QAAO,IAAI,2BAA2B,EAAE,UAAU,CAAC,CAAC;CAGtD,MAAM,cAAc,mBAAmB,UAAU,KAAK,S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AI,cAAc;AAGlB,cAAY,SAAS,EACnB,iBAAiB,aAAa;GAC5B,MAAM,SAAS,wBAAwB;IACrC;IACA,UAAU,QAAQ;IAClB;IACA,aAAa,QAAQ;IACrB,SAAS,OAAO;IACjB,CAAC;AAEF,OAAI,OAAO,OAAO,EAAE;AAElB,YAAQ,MAAM,qBAAqB,kBAAkB,OAAO,MAAM,GAAG;AACrE;;GAGF,MAAM,kBAAkB,OAAO;AAC/B,OAAI,gBAAgB,aAAa;AAC/B,kBAAc;AAEd,QAAI,gBAAgB,YAClB,cAAa,KAAK,gBAAgB,YAAY;;KAIrD,CAAC;AAEF,MAAI,CAAC,YACH,QAAO;GAAE,aAAa;GAAO,kBAAkB;GAAW;AAI5D,yBAAuB,YAAY;AAGnC,MAAI,aAAa,SAAS,GAAG;GAC3B,MAAM,aAAa,aAAa,KAAK,SAASF,QAAM,oBAAoB,KAAK,CAAC;GAC9E,MAAM,iBAAiB,sBAAsB;AAE7C,OAAI,eACF,gBAAe,YAAY,WAAW;OAEtC,aAAY,iBAAiB,QAAQ,WAAW;;AAKpD,cAAY,MAAM,OAAO;AACzB,6BAA2B,aAAa,6BAA6B,QAAQ,SAAS;AAEtF,SAAO;GACL,aAAa;GACb,kBAAkB;GACnB;IAEJ"}
@@ -34,11 +34,11 @@ let __soda_gql_common = require("@soda-gql/common");
34
34
  let __soda_gql_builder = require("@soda-gql/builder");
35
35
 
36
36
  //#region packages/babel/src/ast/analysis.ts
37
- const extractGqlCall = ({ nodePath, filename, metadata, getArtifact }) => {
37
+ const extractGqlCall = ({ nodePath, filename, metadata, getArtifact, baseDir }) => {
38
38
  const callExpression = nodePath.node;
39
39
  const meta = metadata.get(callExpression);
40
40
  if (!meta) return (0, neverthrow.err)(createMetadataMissingError({ filename }));
41
- const canonicalId = (0, __soda_gql_builder_plugin_support.resolveCanonicalId)(filename, meta.astPath);
41
+ const canonicalId = (0, __soda_gql_builder_plugin_support.resolveCanonicalId)(filename, meta.astPath, { baseDir });
42
42
  const artifact = getArtifact(canonicalId);
43
43
  if (!artifact) return (0, neverthrow.err)(createArtifactMissingError({
44
44
  filename,
@@ -231,10 +231,11 @@ const extractRequireTargetSpecifier = (expr) => {
231
231
 
232
232
  //#endregion
233
233
  //#region packages/babel/src/ast/metadata.ts
234
- const collectGqlDefinitionMetadata = ({ programPath, filename, createTracker }) => {
234
+ const collectGqlDefinitionMetadata = ({ programPath, filename, createTracker, baseDir }) => {
235
235
  const exportBindings = collectExportBindings(programPath.node);
236
236
  const tracker = (createTracker ?? __soda_gql_common.createCanonicalTracker)({
237
237
  filePath: filename,
238
+ baseDir,
238
239
  getExportName: (localName) => exportBindings.get(localName)
239
240
  });
240
241
  const getAnonymousName = createAnonymousNameFactory();
@@ -423,13 +424,14 @@ const buildOperationRuntimeComponents = ({ artifact }) => {
423
424
 
424
425
  //#endregion
425
426
  //#region packages/babel/src/ast/transformer.ts
426
- const transformCallExpression = ({ callPath, filename, metadata, getArtifact }) => {
427
+ const transformCallExpression = ({ callPath, filename, metadata, getArtifact, baseDir }) => {
427
428
  if (!metadata.has(callPath.node)) return (0, neverthrow.ok)({ transformed: false });
428
429
  const gqlCallResult = extractGqlCall({
429
430
  nodePath: callPath,
430
431
  filename,
431
432
  metadata,
432
- getArtifact
433
+ getArtifact,
434
+ baseDir
433
435
  });
434
436
  if (gqlCallResult.isErr()) return (0, neverthrow.err)(gqlCallResult.error);
435
437
  const gqlCall = gqlCallResult.value;
@@ -511,7 +513,8 @@ const createTransformer = ({ programPath, types, config }) => {
511
513
  return { transform: (context) => {
512
514
  const metadata = collectGqlDefinitionMetadata({
513
515
  programPath,
514
- filename: context.filename
516
+ filename: context.filename,
517
+ baseDir: config.baseDir
515
518
  });
516
519
  const runtimeCalls = [];
517
520
  let transformed = false;
@@ -520,7 +523,8 @@ const createTransformer = ({ programPath, types, config }) => {
520
523
  callPath,
521
524
  filename: context.filename,
522
525
  metadata,
523
- getArtifact: context.artifactLookup
526
+ getArtifact: context.artifactLookup,
527
+ baseDir: config.baseDir
524
528
  });
525
529
  if (result.isErr()) {
526
530
  console.error(`[@soda-gql/babel] ${(0, __soda_gql_builder_plugin_support.formatPluginError)(result.error)}`);
@@ -649,4 +653,4 @@ Object.defineProperty(exports, 'transformCallExpression', {
649
653
  return transformCallExpression;
650
654
  }
651
655
  });
652
- //# sourceMappingURL=transformer-C9UM_hw8.cjs.map
656
+ //# sourceMappingURL=transformer-uUPMOk7W.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformer-uUPMOk7W.cjs","names":["t","elements: Expression[]","properties: t.ObjectProperty[]","t","toRemove: NodePath[]","createCanonicalTracker","bindings: ExportBindingMap","t","prebuildProps: Record<string, t.Expression>","t","lastLoader: NodePath<t.Statement> | null","runtimeCalls: t.Expression[]"],"sources":["../src/ast/analysis.ts","../src/ast/ast.ts","../src/ast/imports.ts","../src/ast/metadata.ts","../src/ast/runtime.ts","../src/ast/transformer.ts","../src/transformer.ts"],"sourcesContent":["import type { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { BuilderArtifactElement } from \"@soda-gql/builder\";\nimport type {\n GqlCallFragment,\n GqlCallOperation,\n PluginAnalysisArtifactMissingError,\n PluginAnalysisMetadataMissingError,\n PluginAnalysisUnsupportedArtifactTypeError,\n PluginError,\n} from \"@soda-gql/builder/plugin-support\";\nimport { resolveCanonicalId } from \"@soda-gql/builder/plugin-support\";\nimport type { CanonicalId } from \"@soda-gql/common\";\nimport { err, ok, type Result } from \"neverthrow\";\nimport type { GqlDefinitionMetadataMap } from \"./metadata\";\n\nexport type ArtifactLookup = (canonicalId: CanonicalId) => BuilderArtifactElement | undefined;\n\n// Babel-specific GqlCall types\nexport type BabelGqlCallFragment = GqlCallFragment & { readonly nodePath: NodePath<t.CallExpression> };\nexport type BabelGqlCallOperation = GqlCallOperation & {\n readonly nodePath: NodePath<t.CallExpression>;\n};\n\nexport type BabelGqlCall = BabelGqlCallFragment | BabelGqlCallOperation;\n\nexport type ExtractGqlCallArgs = {\n readonly nodePath: NodePath<t.CallExpression>;\n readonly filename: string;\n readonly metadata: GqlDefinitionMetadataMap;\n readonly getArtifact: ArtifactLookup;\n /**\n * Base directory for relative path computation.\n * When provided, canonical IDs use paths relative to this directory.\n */\n readonly baseDir?: string;\n};\n\nexport const extractGqlCall = ({\n nodePath,\n filename,\n metadata,\n getArtifact,\n baseDir,\n}: ExtractGqlCallArgs): Result<BabelGqlCall, PluginError> => {\n const callExpression = nodePath.node;\n\n const meta = metadata.get(callExpression);\n if (!meta) {\n return err(createMetadataMissingError({ filename }));\n }\n\n const canonicalId = resolveCanonicalId(filename, meta.astPath, { baseDir });\n const artifact = getArtifact(canonicalId);\n\n if (!artifact) {\n return err(createArtifactMissingError({ filename, canonicalId }));\n }\n\n if (artifact.type === \"fragment\") {\n return ok({ nodePath, canonicalId, type: \"fragment\", artifact });\n }\n\n if (artifact.type === \"operation\") {\n return ok({ nodePath, canonicalId, type: \"operation\", artifact });\n }\n\n return err(\n createUnsupportedArtifactTypeError({\n filename,\n canonicalId,\n artifactType: (artifact as { type: string }).type,\n }),\n );\n};\n\ntype MetadataErrorInput = { readonly filename: string };\ntype ArtifactMissingErrorInput = { readonly filename: string; readonly canonicalId: CanonicalId };\ntype UnsupportedArtifactTypeInput = {\n readonly filename: string;\n readonly canonicalId: CanonicalId;\n readonly artifactType: string;\n};\n\nconst createMetadataMissingError = ({ filename }: MetadataErrorInput): PluginAnalysisMetadataMissingError => ({\n type: \"PluginError\",\n stage: \"analysis\",\n code: \"SODA_GQL_METADATA_NOT_FOUND\",\n message: `No GraphQL metadata found for ${filename}`,\n cause: { filename },\n filename,\n});\n\nconst createArtifactMissingError = ({\n filename,\n canonicalId,\n}: ArtifactMissingErrorInput): PluginAnalysisArtifactMissingError => ({\n type: \"PluginError\",\n stage: \"analysis\",\n code: \"SODA_GQL_ANALYSIS_ARTIFACT_NOT_FOUND\",\n message: `No builder artifact found for canonical ID ${canonicalId}`,\n cause: { filename, canonicalId },\n filename,\n canonicalId,\n});\n\nconst createUnsupportedArtifactTypeError = ({\n filename,\n canonicalId,\n artifactType,\n}: UnsupportedArtifactTypeInput): PluginAnalysisUnsupportedArtifactTypeError => ({\n type: \"PluginError\",\n stage: \"analysis\",\n code: \"SODA_GQL_UNSUPPORTED_ARTIFACT_TYPE\",\n message: `Unsupported builder artifact type \"${artifactType}\" for canonical ID ${canonicalId}`,\n cause: { filename, canonicalId, artifactType },\n filename,\n canonicalId,\n artifactType,\n});\n","import type { Expression } from \"@babel/types\";\nimport * as t from \"@babel/types\";\nimport type { PluginError, PluginTransformUnsupportedValueTypeError } from \"@soda-gql/builder/plugin-support\";\nimport { err, ok, type Result } from \"neverthrow\";\n\nconst createUnsupportedValueTypeError = (valueType: string): PluginTransformUnsupportedValueTypeError => ({\n type: \"PluginError\",\n stage: \"transform\",\n code: \"SODA_GQL_TRANSFORM_UNSUPPORTED_VALUE_TYPE\",\n message: `Unsupported value type: ${valueType}`,\n cause: { valueType },\n valueType,\n});\n\nexport const buildLiteralFromValue = (value: unknown): Result<Expression, PluginError> => {\n if (value === null) {\n return ok(t.nullLiteral());\n }\n if (typeof value === \"string\") {\n return ok(t.stringLiteral(value));\n }\n if (typeof value === \"number\") {\n return ok(t.numericLiteral(value));\n }\n if (typeof value === \"boolean\") {\n return ok(t.booleanLiteral(value));\n }\n if (Array.isArray(value)) {\n const elements: Expression[] = [];\n for (const item of value) {\n const result = buildLiteralFromValue(item);\n if (result.isErr()) {\n return result;\n }\n elements.push(result.value);\n }\n return ok(t.arrayExpression(elements));\n }\n if (typeof value === \"object\") {\n const properties: t.ObjectProperty[] = [];\n for (const [key, val] of Object.entries(value)) {\n const result = buildLiteralFromValue(val);\n if (result.isErr()) {\n return result;\n }\n properties.push(t.objectProperty(t.identifier(key), result.value));\n }\n return ok(t.objectExpression(properties));\n }\n return err(createUnsupportedValueTypeError(typeof value));\n};\n\nexport const clone = <T extends t.Node>(node: T): T => t.cloneNode(node, true) as T;\n\nexport const cloneCallExpression = (node: t.CallExpression): t.CallExpression =>\n t.callExpression(clone(node.callee), node.arguments.map(clone));\n\nexport const stripTypeAnnotations = (node: t.Node): void => {\n if (\"typeParameters\" in node) {\n delete node.typeParameters;\n }\n if (\"typeAnnotation\" in node) {\n delete node.typeAnnotation;\n }\n if (\"returnType\" in node) {\n delete node.returnType;\n }\n};\n\nexport const buildObjectExpression = <K extends string>(\n properties: Record<K, t.Expression | t.PatternLike>,\n): t.ObjectExpression =>\n t.objectExpression(\n Object.entries<t.Expression | t.PatternLike>(properties).map(([key, value]) => t.objectProperty(t.identifier(key), value)),\n );\n","import { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { GraphqlSystemIdentifyHelper } from \"@soda-gql/builder\";\n\nconst RUNTIME_MODULE = \"@soda-gql/runtime\";\n\n/**\n * Ensure that the gqlRuntime require exists in the program for CJS output.\n * Injects: const __soda_gql_runtime = require(\"@soda-gql/runtime\");\n */\nexport const ensureGqlRuntimeRequire = (programPath: NodePath<t.Program>) => {\n // Check if the require already exists\n const existing = programPath.node.body.find(\n (statement): statement is t.VariableDeclaration =>\n t.isVariableDeclaration(statement) &&\n statement.declarations.some((decl) => {\n if (!t.isIdentifier(decl.id) || decl.id.name !== \"__soda_gql_runtime\") {\n return false;\n }\n if (!decl.init || !t.isCallExpression(decl.init)) {\n return false;\n }\n const callExpr = decl.init;\n if (!t.isIdentifier(callExpr.callee) || callExpr.callee.name !== \"require\") {\n return false;\n }\n const arg = callExpr.arguments[0];\n return arg && t.isStringLiteral(arg) && arg.value === RUNTIME_MODULE;\n }),\n );\n\n if (existing) {\n return;\n }\n\n // Create: const __soda_gql_runtime = require(\"@soda-gql/runtime\");\n const requireCall = t.callExpression(t.identifier(\"require\"), [t.stringLiteral(RUNTIME_MODULE)]);\n\n const variableDeclaration = t.variableDeclaration(\"const\", [\n t.variableDeclarator(t.identifier(\"__soda_gql_runtime\"), requireCall),\n ]);\n\n // Insert at the beginning of the file\n programPath.node.body.unshift(variableDeclaration);\n};\n\n/**\n * Ensure that the gqlRuntime import exists in the program.\n * gqlRuntime is always imported from @soda-gql/runtime.\n */\nexport const ensureGqlRuntimeImport = (programPath: NodePath<t.Program>) => {\n const existing = programPath.node.body.find(\n (statement) => statement.type === \"ImportDeclaration\" && statement.source.value === RUNTIME_MODULE,\n );\n\n if (existing && t.isImportDeclaration(existing)) {\n const hasSpecifier = existing.specifiers.some(\n (specifier) =>\n specifier.type === \"ImportSpecifier\" &&\n specifier.imported.type === \"Identifier\" &&\n specifier.imported.name === \"gqlRuntime\",\n );\n\n if (!hasSpecifier) {\n existing.specifiers = [...existing.specifiers, t.importSpecifier(t.identifier(\"gqlRuntime\"), t.identifier(\"gqlRuntime\"))];\n }\n\n return;\n }\n\n programPath.node.body.unshift(\n t.importDeclaration(\n [t.importSpecifier(t.identifier(\"gqlRuntime\"), t.identifier(\"gqlRuntime\"))],\n t.stringLiteral(RUNTIME_MODULE),\n ),\n );\n};\n\n/**\n * Remove the graphql-system import (runtimeModule) and gql-related exports from the program.\n * After transformation, gqlRuntime is imported from @soda-gql/runtime instead,\n * so the original graphql-system import should be completely removed.\n *\n * This handles both ESM imports and CommonJS require() statements.\n */\nexport const removeGraphqlSystemImports = (\n programPath: NodePath<t.Program>,\n graphqlSystemIdentifyHelper: GraphqlSystemIdentifyHelper,\n filename: string,\n) => {\n // After transformation, all gql usage should be replaced with gqlRuntime\n // So we can safely remove the graphql-system import\n const toRemove: NodePath[] = [];\n\n programPath.traverse({\n // Remove ESM import declarations for the graphql-system\n ImportDeclaration(path) {\n if (t.isStringLiteral(path.node.source)) {\n const isGraphqlSystem = graphqlSystemIdentifyHelper.isGraphqlSystemImportSpecifier({\n filePath: filename,\n specifier: path.node.source.value,\n });\n if (isGraphqlSystem) {\n toRemove.push(path);\n }\n }\n },\n // Remove CommonJS require() statements for the graphql-system\n // - const graphql_system_1 = require(\"../../graphql-system\");\n // - const { gql } = require(\"@/graphql-system\");\n VariableDeclaration(path) {\n const shouldRemove = path.node.declarations.every((decl) => {\n const specifier = extractRequireTargetSpecifier(decl.init);\n if (!specifier) {\n return false;\n }\n\n return graphqlSystemIdentifyHelper.isGraphqlSystemImportSpecifier({\n filePath: filename,\n specifier: specifier,\n });\n });\n\n if (shouldRemove) {\n toRemove.push(path);\n }\n },\n });\n\n for (const path of toRemove) {\n path.remove();\n }\n};\n\n/**\n * Check if an expression is a require() call and extract its target specifier.\n * Handles multiple patterns:\n * - require(\"@/graphql-system\")\n * - Object(require(\"@/graphql-system\")) (interop helper pattern)\n */\nconst extractRequireTargetSpecifier = (expr: t.Node | null | undefined): string | undefined => {\n if (!expr) {\n return undefined;\n }\n\n // Direct require(\"@/graphql-system\")\n if (t.isCallExpression(expr)) {\n if (t.isIdentifier(expr.callee) && expr.callee.name === \"require\") {\n const arg = expr.arguments[0];\n if (arg && t.isStringLiteral(arg)) {\n return arg.value;\n }\n }\n\n // Object(require(\"@/graphql-system\")) or similar interop helpers\n if (t.isIdentifier(expr.callee) && (expr.callee.name === \"Object\" || expr.callee.name.startsWith(\"__import\"))) {\n const arg = expr.arguments[0];\n if (arg && t.isCallExpression(arg)) {\n if (t.isIdentifier(arg.callee) && arg.callee.name === \"require\") {\n const requireArg = arg.arguments[0];\n if (requireArg && t.isStringLiteral(requireArg)) {\n return requireArg.value;\n }\n }\n }\n }\n }\n\n return undefined;\n};\n","import { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { GqlDefinitionMetadata } from \"@soda-gql/builder/plugin-support\";\nimport { type CanonicalPathTracker, createCanonicalTracker } from \"@soda-gql/common\";\n\nexport type GqlDefinitionMetadataMap = WeakMap<t.CallExpression, GqlDefinitionMetadata>;\n\ntype CanonicalTrackerFactory = typeof createCanonicalTracker;\n\ntype CollectArgs = {\n readonly programPath: NodePath<t.Program>;\n readonly filename: string;\n readonly createTracker?: CanonicalTrackerFactory;\n /**\n * Base directory for relative path computation.\n * When provided, canonical IDs use paths relative to this directory.\n */\n readonly baseDir?: string;\n};\n\ntype ScopeHandle = ReturnType<CanonicalPathTracker[\"enterScope\"]>;\ntype ExportBindingMap = Map<string, string>;\n\nexport const collectGqlDefinitionMetadata = ({\n programPath,\n filename,\n createTracker,\n baseDir,\n}: CollectArgs): GqlDefinitionMetadataMap => {\n const exportBindings = collectExportBindings(programPath.node);\n const trackerFactory = createTracker ?? createCanonicalTracker;\n const tracker = trackerFactory({\n filePath: filename,\n baseDir,\n getExportName: (localName) => exportBindings.get(localName),\n });\n\n const getAnonymousName = createAnonymousNameFactory();\n const scopeHandles = new WeakMap<NodePath<t.Node>, ScopeHandle>();\n const metadata = new WeakMap<t.CallExpression, GqlDefinitionMetadata>();\n\n programPath.traverse({\n enter(path) {\n if (path.isCallExpression() && isGqlDefinitionCall(path.node)) {\n const depthBeforeRegister = tracker.currentDepth();\n const { astPath } = tracker.registerDefinition();\n const isTopLevel = depthBeforeRegister <= 1;\n const exportInfo = isTopLevel ? resolveTopLevelExport(path, exportBindings) : null;\n\n metadata.set(path.node, {\n astPath,\n isTopLevel,\n isExported: exportInfo?.isExported ?? false,\n exportBinding: exportInfo?.exportBinding,\n });\n\n path.skip();\n return;\n }\n\n const handle = maybeEnterScope(path, tracker, getAnonymousName);\n if (handle) {\n scopeHandles.set(path, handle);\n }\n },\n exit(path) {\n const handle = scopeHandles.get(path);\n if (handle) {\n tracker.exitScope(handle);\n scopeHandles.delete(path);\n }\n },\n });\n\n return metadata;\n};\n\nconst collectExportBindings = (program: t.Program): ExportBindingMap => {\n const bindings: ExportBindingMap = new Map();\n\n for (const statement of program.body) {\n // ESM exports: export const foo = ...\n if (t.isExportNamedDeclaration(statement) && statement.declaration) {\n const { declaration } = statement;\n if (t.isVariableDeclaration(declaration)) {\n for (const declarator of declaration.declarations) {\n if (t.isIdentifier(declarator.id)) {\n bindings.set(declarator.id.name, declarator.id.name);\n }\n }\n continue;\n }\n\n if ((t.isFunctionDeclaration(declaration) || t.isClassDeclaration(declaration)) && declaration.id) {\n bindings.set(declaration.id.name, declaration.id.name);\n }\n continue;\n }\n\n // CommonJS exports: exports.foo = ... or module.exports.foo = ...\n if (t.isExpressionStatement(statement) && t.isAssignmentExpression(statement.expression)) {\n const exportName = getCommonJsExportName(statement.expression.left);\n if (exportName) {\n bindings.set(exportName, exportName);\n }\n }\n }\n\n return bindings;\n};\n\nconst getCommonJsExportName = (node: t.LVal | t.OptionalMemberExpression): string | null => {\n if (!t.isMemberExpression(node) || node.computed) {\n return null;\n }\n\n // Check if it's exports.foo or module.exports.foo\n const isExports = t.isIdentifier(node.object, { name: \"exports\" });\n const isModuleExports =\n t.isMemberExpression(node.object) &&\n t.isIdentifier(node.object.object, { name: \"module\" }) &&\n t.isIdentifier(node.object.property, { name: \"exports\" });\n\n if (!isExports && !isModuleExports) {\n return null;\n }\n\n // Extract property name\n if (t.isIdentifier(node.property)) {\n return node.property.name;\n }\n if (t.isStringLiteral(node.property)) {\n return node.property.value;\n }\n\n return null;\n};\n\nconst createAnonymousNameFactory = (): ((kind: string) => string) => {\n const counters = new Map<string, number>();\n return (kind) => {\n const count = counters.get(kind) ?? 0;\n counters.set(kind, count + 1);\n return `${kind}#${count}`;\n };\n};\n\nconst isGqlDefinitionCall = (node: t.Node): node is t.CallExpression =>\n t.isCallExpression(node) &&\n t.isMemberExpression(node.callee) &&\n isGqlReference(node.callee.object) &&\n node.arguments.length > 0 &&\n t.isArrowFunctionExpression(node.arguments[0]);\n\nconst isGqlReference = (expr: t.Expression | t.Super): boolean => {\n if (t.isIdentifier(expr, { name: \"gql\" })) {\n return true;\n }\n if (!t.isMemberExpression(expr) || expr.computed) {\n return false;\n }\n if (\n (t.isIdentifier(expr.property) && expr.property.name === \"gql\") ||\n (t.isStringLiteral(expr.property) && expr.property.value === \"gql\")\n ) {\n return true;\n }\n return isGqlReference(expr.object);\n};\n\nconst resolveTopLevelExport = (\n callPath: NodePath<t.CallExpression>,\n exportBindings: ExportBindingMap,\n): { readonly isExported: true; readonly exportBinding: string } | null => {\n // ESM: const foo = gql.default(...); export { foo };\n const declarator = callPath.parentPath;\n if (declarator?.isVariableDeclarator()) {\n const { id } = declarator.node;\n if (t.isIdentifier(id)) {\n const exportBinding = exportBindings.get(id.name);\n if (exportBinding) {\n return { isExported: true, exportBinding };\n }\n }\n }\n\n // CommonJS: exports.foo = gql.default(...);\n const assignment = callPath.parentPath;\n if (assignment?.isAssignmentExpression()) {\n const exportName = getCommonJsExportName(assignment.node.left);\n if (exportName && exportBindings.has(exportName)) {\n return { isExported: true, exportBinding: exportName };\n }\n }\n\n return null;\n};\n\nconst maybeEnterScope = (\n path: NodePath<t.Node>,\n tracker: CanonicalPathTracker,\n getAnonymousName: (kind: string) => string,\n): ScopeHandle | null => {\n // CommonJS exports: exports.foo = ... or module.exports.foo = ...\n if (path.isAssignmentExpression()) {\n const exportName = getCommonJsExportName(path.node.left);\n if (exportName) {\n return tracker.enterScope({ segment: exportName, kind: \"variable\", stableKey: `var:${exportName}` });\n }\n }\n\n if (path.isVariableDeclarator() && t.isIdentifier(path.node.id)) {\n const name = path.node.id.name;\n return tracker.enterScope({ segment: name, kind: \"variable\", stableKey: `var:${name}` });\n }\n\n if (path.isArrowFunctionExpression()) {\n const name = getAnonymousName(\"arrow\");\n return tracker.enterScope({ segment: name, kind: \"function\", stableKey: \"arrow\" });\n }\n\n if (path.isFunctionDeclaration() || path.isFunctionExpression()) {\n const explicitName = path.node.id?.name;\n const name = explicitName ?? getAnonymousName(\"function\");\n return tracker.enterScope({ segment: name, kind: \"function\", stableKey: `func:${name}` });\n }\n\n if (path.isClassDeclaration()) {\n const explicitName = path.node.id?.name;\n const name = explicitName ?? getAnonymousName(\"class\");\n return tracker.enterScope({ segment: name, kind: \"class\", stableKey: `class:${name}` });\n }\n\n if (path.isClassMethod() && t.isIdentifier(path.node.key)) {\n const name = path.node.key.name;\n return tracker.enterScope({ segment: name, kind: \"method\", stableKey: `member:${name}` });\n }\n\n if (path.isClassProperty() && t.isIdentifier(path.node.key)) {\n const name = path.node.key.name;\n return tracker.enterScope({ segment: name, kind: \"property\", stableKey: `member:${name}` });\n }\n\n if (path.isObjectProperty()) {\n const key = path.node.key;\n const name = t.isIdentifier(key) ? key.name : t.isStringLiteral(key) ? key.value : null;\n if (name) {\n return tracker.enterScope({ segment: name, kind: \"property\", stableKey: `prop:${name}` });\n }\n }\n\n return null;\n};\n","import { types as t } from \"@babel/core\";\nimport type { PluginError } from \"@soda-gql/builder/plugin-support\";\nimport { ok, type Result } from \"neverthrow\";\nimport type { BabelGqlCallFragment, BabelGqlCallOperation } from \"./analysis\";\nimport { buildObjectExpression } from \"./ast\";\n\nexport const buildFragmentRuntimeCall = ({\n artifact,\n}: BabelGqlCallFragment & { filename: string }): Result<t.Expression, PluginError> => {\n const prebuildProps: Record<string, t.Expression> = {\n typename: t.stringLiteral(artifact.prebuild.typename),\n };\n if (artifact.prebuild.key !== undefined) {\n prebuildProps.key = t.stringLiteral(artifact.prebuild.key);\n }\n\n return ok(\n t.callExpression(t.memberExpression(t.identifier(\"gqlRuntime\"), t.identifier(\"fragment\")), [\n buildObjectExpression({\n prebuild: buildObjectExpression(prebuildProps),\n }),\n ]),\n );\n};\n\nexport const buildOperationRuntimeComponents = ({\n artifact,\n}: BabelGqlCallOperation & { filename: string }): Result<\n { referenceCall: t.Expression; runtimeCall: t.Expression },\n PluginError\n> => {\n const runtimeCall = t.callExpression(t.memberExpression(t.identifier(\"gqlRuntime\"), t.identifier(\"operation\")), [\n buildObjectExpression({\n prebuild: t.callExpression(t.memberExpression(t.identifier(\"JSON\"), t.identifier(\"parse\")), [\n t.stringLiteral(JSON.stringify(artifact.prebuild)),\n ]),\n runtime: buildObjectExpression({}),\n }),\n ]);\n\n const referenceCall = t.callExpression(t.memberExpression(t.identifier(\"gqlRuntime\"), t.identifier(\"getOperation\")), [\n t.stringLiteral(artifact.prebuild.operationName),\n ]);\n\n return ok({\n referenceCall,\n runtimeCall,\n });\n};\n","import type { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { PluginError } from \"@soda-gql/builder/plugin-support\";\nimport { err, ok, type Result } from \"neverthrow\";\nimport type { ArtifactLookup, BabelGqlCall } from \"./analysis\";\nimport { extractGqlCall } from \"./analysis\";\nimport type { GqlDefinitionMetadataMap } from \"./metadata\";\nimport { buildFragmentRuntimeCall, buildOperationRuntimeComponents } from \"./runtime\";\n\ntype TransformCallExpressionArgs = {\n readonly callPath: NodePath<t.CallExpression>;\n readonly filename: string;\n readonly metadata: GqlDefinitionMetadataMap;\n readonly getArtifact: ArtifactLookup;\n /**\n * Base directory for relative path computation.\n * When provided, canonical IDs use paths relative to this directory.\n */\n readonly baseDir?: string;\n};\n\ntype TransformCallExpressionResult =\n | { readonly transformed: false }\n | { readonly transformed: true; readonly runtimeCall?: t.Expression };\n\nexport const transformCallExpression = ({\n callPath,\n filename,\n metadata,\n getArtifact,\n baseDir,\n}: TransformCallExpressionArgs): Result<TransformCallExpressionResult, PluginError> => {\n // Skip if this call doesn't have GQL metadata\n if (!metadata.has(callPath.node)) {\n return ok({ transformed: false });\n }\n\n const gqlCallResult = extractGqlCall({\n nodePath: callPath,\n filename,\n metadata,\n getArtifact,\n baseDir,\n });\n\n if (gqlCallResult.isErr()) {\n return err(gqlCallResult.error);\n }\n\n const gqlCall = gqlCallResult.value;\n\n return replaceWithRuntimeCall(callPath, gqlCall, filename);\n};\n\nconst replaceWithRuntimeCall = (\n callPath: NodePath<t.CallExpression>,\n gqlCall: BabelGqlCall,\n filename: string,\n): Result<TransformCallExpressionResult, PluginError> => {\n if (gqlCall.type === \"fragment\") {\n const result = buildFragmentRuntimeCall({ ...gqlCall, filename });\n if (result.isErr()) {\n return err(result.error);\n }\n callPath.replaceWith(result.value);\n return ok({ transformed: true });\n }\n\n if (gqlCall.type === \"operation\") {\n const result = buildOperationRuntimeComponents({ ...gqlCall, filename });\n if (result.isErr()) {\n return err(result.error);\n }\n const { referenceCall, runtimeCall } = result.value;\n callPath.replaceWith(referenceCall);\n return ok({ transformed: true, runtimeCall });\n }\n\n return ok({ transformed: false });\n};\n\nexport const insertRuntimeCalls = (programPath: NodePath<t.Program>, runtimeCalls: readonly t.Expression[]): void => {\n if (runtimeCalls.length === 0) {\n return;\n }\n\n programPath.traverse({\n ImportDeclaration(importDeclPath) {\n if (importDeclPath.node.source.value === \"@soda-gql/runtime\") {\n importDeclPath.insertAfter([...runtimeCalls]);\n }\n },\n });\n};\n","/**\n * Babel implementation of the TransformAdapter interface.\n *\n * This adapter wraps the existing Babel-specific transformation logic\n * for soda-gql zero-runtime transformations.\n */\n\nimport type { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport { createGraphqlSystemIdentifyHelper } from \"@soda-gql/builder\";\nimport { formatPluginError } from \"@soda-gql/builder/plugin-support\";\nimport type { ResolvedSodaGqlConfig } from \"@soda-gql/config\";\nimport { ensureGqlRuntimeImport, removeGraphqlSystemImports } from \"./ast/imports\";\nimport { collectGqlDefinitionMetadata } from \"./ast/metadata\";\nimport { transformCallExpression } from \"./ast/transformer\";\nimport type { TransformPassResult, TransformProgramContext } from \"./types\";\n\n/**\n * Creates a Babel transformer with a single transform() method.\n * This matches the pattern used in the TypeScript plugin.\n */\nexport const createTransformer = ({\n programPath,\n types,\n config,\n}: {\n readonly programPath: NodePath<t.Program>;\n readonly types: typeof t;\n readonly config: ResolvedSodaGqlConfig;\n}) => {\n // Create graphql system identify helper using builder's implementation\n const graphqlSystemIdentifyHelper = createGraphqlSystemIdentifyHelper(config);\n\n /**\n * Check if a node is a require() or __webpack_require__() call.\n */\n const isRequireCall = (node: t.Node): boolean => {\n if (!types.isCallExpression(node)) {\n return false;\n }\n\n const callee = node.callee;\n return types.isIdentifier(callee) && (callee.name === \"require\" || callee.name === \"__webpack_require__\");\n };\n\n /**\n * Find the last statement that loads a module (import or require).\n * Handles both ESM imports and CommonJS require() calls.\n */\n const findLastModuleLoader = (): NodePath<t.Statement> | null => {\n const bodyPaths = programPath.get(\"body\");\n let lastLoader: NodePath<t.Statement> | null = null;\n\n for (const path of bodyPaths) {\n // ESM: import declaration\n if (path.isImportDeclaration()) {\n lastLoader = path;\n continue;\n }\n\n // CommonJS: const foo = require(\"bar\") or const foo = __webpack_require__(123)\n if (path.isVariableDeclaration()) {\n for (const declarator of path.node.declarations) {\n if (declarator.init && isRequireCall(declarator.init)) {\n lastLoader = path;\n break;\n }\n }\n continue;\n }\n\n // CommonJS: require(\"bar\") or __webpack_require__(123) as standalone expression\n if (path.isExpressionStatement()) {\n if (isRequireCall(path.node.expression)) {\n lastLoader = path;\n }\n }\n }\n\n return lastLoader;\n };\n\n return {\n transform: (context: TransformProgramContext): TransformPassResult => {\n const metadata = collectGqlDefinitionMetadata({\n programPath,\n filename: context.filename,\n baseDir: config.baseDir,\n });\n\n const runtimeCalls: t.Expression[] = [];\n let transformed = false;\n\n // Transform all gql call expressions\n programPath.traverse({\n CallExpression: (callPath) => {\n const result = transformCallExpression({\n callPath,\n filename: context.filename,\n metadata,\n getArtifact: context.artifactLookup,\n baseDir: config.baseDir,\n });\n\n if (result.isErr()) {\n // Log error and continue - don't fail the entire build for a single error\n console.error(`[@soda-gql/babel] ${formatPluginError(result.error)}`);\n return;\n }\n\n const transformResult = result.value;\n if (transformResult.transformed) {\n transformed = true;\n\n if (transformResult.runtimeCall) {\n runtimeCalls.push(transformResult.runtimeCall);\n }\n }\n },\n });\n\n if (!transformed) {\n return { transformed: false, runtimeArtifacts: undefined };\n }\n\n // Ensure runtime import\n ensureGqlRuntimeImport(programPath);\n\n // Insert runtime side effects immediately if any\n if (runtimeCalls.length > 0) {\n const statements = runtimeCalls.map((expr) => types.expressionStatement(expr));\n const lastLoaderPath = findLastModuleLoader();\n\n if (lastLoaderPath) {\n lastLoaderPath.insertAfter(statements);\n } else {\n programPath.unshiftContainer(\"body\", statements);\n }\n }\n\n // Clean up: remove graphql system imports and recrawl scope\n programPath.scope.crawl();\n removeGraphqlSystemImports(programPath, graphqlSystemIdentifyHelper, context.filename);\n\n return {\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jC,KAAI,WAAW,QAAQ,cAAc,WAAW,KAAK,EAAE;AACrD,kBAAa;AACb;;AAGJ;;AAIF,OAAI,KAAK,uBAAuB,EAC9B;QAAI,cAAc,KAAK,KAAK,WAAW,CACrC,cAAa;;;AAKnB,SAAO;;AAGT,QAAO,EACL,YAAY,YAA0D;EACpE,MAAM,WAAW,6BAA6B;GAC5C;GACA,UAAU,QAAQ;GAClB,SAAS,OAAO;GACjB,CAAC;EAEF,MAAMC,eAA+B,EAAE;EACvC,IAAI,cAAc;AAGlB,cAAY,SAAS,EACnB,iBAAiB,aAAa;GAC5B,MAAM,SAAS,wBAAwB;IACrC;IACA,UAAU,QAAQ;IAClB;IACA,aAAa,QAAQ;IACrB,SAAS,OAAO;IACjB,CAAC;AAEF,OAAI,OAAO,OAAO,EAAE;AAElB,YAAQ,MAAM,8EAAuC,OAAO,MAAM,GAAG;AACrE;;GAGF,MAAM,kBAAkB,OAAO;AAC/B,OAAI,gBAAgB,aAAa;AAC/B,kBAAc;AAEd,QAAI,gBAAgB,YAClB,cAAa,KAAK,gBAAgB,YAAY;;KAIrD,CAAC;AAEF,MAAI,CAAC,YACH,QAAO;GAAE,aAAa;GAAO,kBAAkB;GAAW;AAI5D,yBAAuB,YAAY;AAGnC,MAAI,aAAa,SAAS,GAAG;GAC3B,MAAM,aAAa,aAAa,KAAK,SAAS,MAAM,oBAAoB,KAAK,CAAC;GAC9E,MAAM,iBAAiB,sBAAsB;AAE7C,OAAI,eACF,gBAAe,YAAY,WAAW;OAEtC,aAAY,iBAAiB,QAAQ,WAAW;;AAKpD,cAAY,MAAM,OAAO;AACzB,6BAA2B,aAAa,6BAA6B,QAAQ,SAAS;AAEtF,SAAO;GACL,aAAa;GACb,kBAAkB;GACnB;IAEJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soda-gql/babel",
3
- "version": "0.11.10",
3
+ "version": "0.11.12",
4
4
  "description": "Babel transformer and plugin for soda-gql",
5
5
  "type": "module",
6
6
  "private": false,
@@ -60,10 +60,10 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "@ampproject/remapping": "^2.3.0",
63
- "@soda-gql/builder": "0.11.10",
64
- "@soda-gql/common": "0.11.10",
65
- "@soda-gql/config": "0.11.10",
66
- "@soda-gql/core": "0.11.10",
63
+ "@soda-gql/builder": "0.11.12",
64
+ "@soda-gql/common": "0.11.12",
65
+ "@soda-gql/config": "0.11.12",
66
+ "@soda-gql/core": "0.11.12",
67
67
  "@babel/core": "^7.24.0",
68
68
  "@babel/generator": "^7.24.0",
69
69
  "@babel/parser": "^7.24.0",
@@ -72,7 +72,7 @@
72
72
  "neverthrow": "^8.1.1"
73
73
  },
74
74
  "devDependencies": {
75
- "@soda-gql/tsc": "0.11.10",
75
+ "@soda-gql/tsc": "0.11.12",
76
76
  "@types/babel__generator": "^7.27.0"
77
77
  },
78
78
  "peerDependencies": {},
@@ -1 +0,0 @@
1
- {"version":3,"file":"transformer-C9UM_hw8.cjs","names":["t","elements: Expression[]","properties: t.ObjectProperty[]","t","toRemove: NodePath[]","createCanonicalTracker","bindings: ExportBindingMap","t","prebuildProps: Record<string, t.Expression>","t","lastLoader: NodePath<t.Statement> | null","runtimeCalls: t.Expression[]"],"sources":["../src/ast/analysis.ts","../src/ast/ast.ts","../src/ast/imports.ts","../src/ast/metadata.ts","../src/ast/runtime.ts","../src/ast/transformer.ts","../src/transformer.ts"],"sourcesContent":["import type { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { BuilderArtifactElement } from \"@soda-gql/builder\";\nimport type {\n GqlCallFragment,\n GqlCallOperation,\n PluginAnalysisArtifactMissingError,\n PluginAnalysisMetadataMissingError,\n PluginAnalysisUnsupportedArtifactTypeError,\n PluginError,\n} from \"@soda-gql/builder/plugin-support\";\nimport { resolveCanonicalId } from \"@soda-gql/builder/plugin-support\";\nimport type { CanonicalId } from \"@soda-gql/common\";\nimport { err, ok, type Result } from \"neverthrow\";\nimport type { GqlDefinitionMetadataMap } from \"./metadata\";\n\nexport type ArtifactLookup = (canonicalId: CanonicalId) => BuilderArtifactElement | undefined;\n\n// Babel-specific GqlCall types\nexport type BabelGqlCallFragment = GqlCallFragment & { readonly nodePath: NodePath<t.CallExpression> };\nexport type BabelGqlCallOperation = GqlCallOperation & {\n readonly nodePath: NodePath<t.CallExpression>;\n};\n\nexport type BabelGqlCall = BabelGqlCallFragment | BabelGqlCallOperation;\n\nexport type ExtractGqlCallArgs = {\n readonly nodePath: NodePath<t.CallExpression>;\n readonly filename: string;\n readonly metadata: GqlDefinitionMetadataMap;\n readonly getArtifact: ArtifactLookup;\n};\n\nexport const extractGqlCall = ({\n nodePath,\n filename,\n metadata,\n getArtifact,\n}: ExtractGqlCallArgs): Result<BabelGqlCall, PluginError> => {\n const callExpression = nodePath.node;\n\n const meta = metadata.get(callExpression);\n if (!meta) {\n return err(createMetadataMissingError({ filename }));\n }\n\n const canonicalId = resolveCanonicalId(filename, meta.astPath);\n const artifact = getArtifact(canonicalId);\n\n if (!artifact) {\n return err(createArtifactMissingError({ filename, canonicalId }));\n }\n\n if (artifact.type === \"fragment\") {\n return ok({ nodePath, canonicalId, type: \"fragment\", artifact });\n }\n\n if (artifact.type === \"operation\") {\n return ok({ nodePath, canonicalId, type: \"operation\", artifact });\n }\n\n return err(\n createUnsupportedArtifactTypeError({\n filename,\n canonicalId,\n artifactType: (artifact as { type: string }).type,\n }),\n );\n};\n\ntype MetadataErrorInput = { readonly filename: string };\ntype ArtifactMissingErrorInput = { readonly filename: string; readonly canonicalId: CanonicalId };\ntype UnsupportedArtifactTypeInput = {\n readonly filename: string;\n readonly canonicalId: CanonicalId;\n readonly artifactType: string;\n};\n\nconst createMetadataMissingError = ({ filename }: MetadataErrorInput): PluginAnalysisMetadataMissingError => ({\n type: \"PluginError\",\n stage: \"analysis\",\n code: \"SODA_GQL_METADATA_NOT_FOUND\",\n message: `No GraphQL metadata found for ${filename}`,\n cause: { filename },\n filename,\n});\n\nconst createArtifactMissingError = ({\n filename,\n canonicalId,\n}: ArtifactMissingErrorInput): PluginAnalysisArtifactMissingError => ({\n type: \"PluginError\",\n stage: \"analysis\",\n code: \"SODA_GQL_ANALYSIS_ARTIFACT_NOT_FOUND\",\n message: `No builder artifact found for canonical ID ${canonicalId}`,\n cause: { filename, canonicalId },\n filename,\n canonicalId,\n});\n\nconst createUnsupportedArtifactTypeError = ({\n filename,\n canonicalId,\n artifactType,\n}: UnsupportedArtifactTypeInput): PluginAnalysisUnsupportedArtifactTypeError => ({\n type: \"PluginError\",\n stage: \"analysis\",\n code: \"SODA_GQL_UNSUPPORTED_ARTIFACT_TYPE\",\n message: `Unsupported builder artifact type \"${artifactType}\" for canonical ID ${canonicalId}`,\n cause: { filename, canonicalId, artifactType },\n filename,\n canonicalId,\n artifactType,\n});\n","import type { Expression } from \"@babel/types\";\nimport * as t from \"@babel/types\";\nimport type { PluginError, PluginTransformUnsupportedValueTypeError } from \"@soda-gql/builder/plugin-support\";\nimport { err, ok, type Result } from \"neverthrow\";\n\nconst createUnsupportedValueTypeError = (valueType: string): PluginTransformUnsupportedValueTypeError => ({\n type: \"PluginError\",\n stage: \"transform\",\n code: \"SODA_GQL_TRANSFORM_UNSUPPORTED_VALUE_TYPE\",\n message: `Unsupported value type: ${valueType}`,\n cause: { valueType },\n valueType,\n});\n\nexport const buildLiteralFromValue = (value: unknown): Result<Expression, PluginError> => {\n if (value === null) {\n return ok(t.nullLiteral());\n }\n if (typeof value === \"string\") {\n return ok(t.stringLiteral(value));\n }\n if (typeof value === \"number\") {\n return ok(t.numericLiteral(value));\n }\n if (typeof value === \"boolean\") {\n return ok(t.booleanLiteral(value));\n }\n if (Array.isArray(value)) {\n const elements: Expression[] = [];\n for (const item of value) {\n const result = buildLiteralFromValue(item);\n if (result.isErr()) {\n return result;\n }\n elements.push(result.value);\n }\n return ok(t.arrayExpression(elements));\n }\n if (typeof value === \"object\") {\n const properties: t.ObjectProperty[] = [];\n for (const [key, val] of Object.entries(value)) {\n const result = buildLiteralFromValue(val);\n if (result.isErr()) {\n return result;\n }\n properties.push(t.objectProperty(t.identifier(key), result.value));\n }\n return ok(t.objectExpression(properties));\n }\n return err(createUnsupportedValueTypeError(typeof value));\n};\n\nexport const clone = <T extends t.Node>(node: T): T => t.cloneNode(node, true) as T;\n\nexport const cloneCallExpression = (node: t.CallExpression): t.CallExpression =>\n t.callExpression(clone(node.callee), node.arguments.map(clone));\n\nexport const stripTypeAnnotations = (node: t.Node): void => {\n if (\"typeParameters\" in node) {\n delete node.typeParameters;\n }\n if (\"typeAnnotation\" in node) {\n delete node.typeAnnotation;\n }\n if (\"returnType\" in node) {\n delete node.returnType;\n }\n};\n\nexport const buildObjectExpression = <K extends string>(\n properties: Record<K, t.Expression | t.PatternLike>,\n): t.ObjectExpression =>\n t.objectExpression(\n Object.entries<t.Expression | t.PatternLike>(properties).map(([key, value]) => t.objectProperty(t.identifier(key), value)),\n );\n","import { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { GraphqlSystemIdentifyHelper } from \"@soda-gql/builder\";\n\nconst RUNTIME_MODULE = \"@soda-gql/runtime\";\n\n/**\n * Ensure that the gqlRuntime require exists in the program for CJS output.\n * Injects: const __soda_gql_runtime = require(\"@soda-gql/runtime\");\n */\nexport const ensureGqlRuntimeRequire = (programPath: NodePath<t.Program>) => {\n // Check if the require already exists\n const existing = programPath.node.body.find(\n (statement): statement is t.VariableDeclaration =>\n t.isVariableDeclaration(statement) &&\n statement.declarations.some((decl) => {\n if (!t.isIdentifier(decl.id) || decl.id.name !== \"__soda_gql_runtime\") {\n return false;\n }\n if (!decl.init || !t.isCallExpression(decl.init)) {\n return false;\n }\n const callExpr = decl.init;\n if (!t.isIdentifier(callExpr.callee) || callExpr.callee.name !== \"require\") {\n return false;\n }\n const arg = callExpr.arguments[0];\n return arg && t.isStringLiteral(arg) && arg.value === RUNTIME_MODULE;\n }),\n );\n\n if (existing) {\n return;\n }\n\n // Create: const __soda_gql_runtime = require(\"@soda-gql/runtime\");\n const requireCall = t.callExpression(t.identifier(\"require\"), [t.stringLiteral(RUNTIME_MODULE)]);\n\n const variableDeclaration = t.variableDeclaration(\"const\", [\n t.variableDeclarator(t.identifier(\"__soda_gql_runtime\"), requireCall),\n ]);\n\n // Insert at the beginning of the file\n programPath.node.body.unshift(variableDeclaration);\n};\n\n/**\n * Ensure that the gqlRuntime import exists in the program.\n * gqlRuntime is always imported from @soda-gql/runtime.\n */\nexport const ensureGqlRuntimeImport = (programPath: NodePath<t.Program>) => {\n const existing = programPath.node.body.find(\n (statement) => statement.type === \"ImportDeclaration\" && statement.source.value === RUNTIME_MODULE,\n );\n\n if (existing && t.isImportDeclaration(existing)) {\n const hasSpecifier = existing.specifiers.some(\n (specifier) =>\n specifier.type === \"ImportSpecifier\" &&\n specifier.imported.type === \"Identifier\" &&\n specifier.imported.name === \"gqlRuntime\",\n );\n\n if (!hasSpecifier) {\n existing.specifiers = [...existing.specifiers, t.importSpecifier(t.identifier(\"gqlRuntime\"), t.identifier(\"gqlRuntime\"))];\n }\n\n return;\n }\n\n programPath.node.body.unshift(\n t.importDeclaration(\n [t.importSpecifier(t.identifier(\"gqlRuntime\"), t.identifier(\"gqlRuntime\"))],\n t.stringLiteral(RUNTIME_MODULE),\n ),\n );\n};\n\n/**\n * Remove the graphql-system import (runtimeModule) and gql-related exports from the program.\n * After transformation, gqlRuntime is imported from @soda-gql/runtime instead,\n * so the original graphql-system import should be completely removed.\n *\n * This handles both ESM imports and CommonJS require() statements.\n */\nexport const removeGraphqlSystemImports = (\n programPath: NodePath<t.Program>,\n graphqlSystemIdentifyHelper: GraphqlSystemIdentifyHelper,\n filename: string,\n) => {\n // After transformation, all gql usage should be replaced with gqlRuntime\n // So we can safely remove the graphql-system import\n const toRemove: NodePath[] = [];\n\n programPath.traverse({\n // Remove ESM import declarations for the graphql-system\n ImportDeclaration(path) {\n if (t.isStringLiteral(path.node.source)) {\n const isGraphqlSystem = graphqlSystemIdentifyHelper.isGraphqlSystemImportSpecifier({\n filePath: filename,\n specifier: path.node.source.value,\n });\n if (isGraphqlSystem) {\n toRemove.push(path);\n }\n }\n },\n // Remove CommonJS require() statements for the graphql-system\n // - const graphql_system_1 = require(\"../../graphql-system\");\n // - const { gql } = require(\"@/graphql-system\");\n VariableDeclaration(path) {\n const shouldRemove = path.node.declarations.every((decl) => {\n const specifier = extractRequireTargetSpecifier(decl.init);\n if (!specifier) {\n return false;\n }\n\n return graphqlSystemIdentifyHelper.isGraphqlSystemImportSpecifier({\n filePath: filename,\n specifier: specifier,\n });\n });\n\n if (shouldRemove) {\n toRemove.push(path);\n }\n },\n });\n\n for (const path of toRemove) {\n path.remove();\n }\n};\n\n/**\n * Check if an expression is a require() call and extract its target specifier.\n * Handles multiple patterns:\n * - require(\"@/graphql-system\")\n * - Object(require(\"@/graphql-system\")) (interop helper pattern)\n */\nconst extractRequireTargetSpecifier = (expr: t.Node | null | undefined): string | undefined => {\n if (!expr) {\n return undefined;\n }\n\n // Direct require(\"@/graphql-system\")\n if (t.isCallExpression(expr)) {\n if (t.isIdentifier(expr.callee) && expr.callee.name === \"require\") {\n const arg = expr.arguments[0];\n if (arg && t.isStringLiteral(arg)) {\n return arg.value;\n }\n }\n\n // Object(require(\"@/graphql-system\")) or similar interop helpers\n if (t.isIdentifier(expr.callee) && (expr.callee.name === \"Object\" || expr.callee.name.startsWith(\"__import\"))) {\n const arg = expr.arguments[0];\n if (arg && t.isCallExpression(arg)) {\n if (t.isIdentifier(arg.callee) && arg.callee.name === \"require\") {\n const requireArg = arg.arguments[0];\n if (requireArg && t.isStringLiteral(requireArg)) {\n return requireArg.value;\n }\n }\n }\n }\n }\n\n return undefined;\n};\n","import { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { GqlDefinitionMetadata } from \"@soda-gql/builder/plugin-support\";\nimport { type CanonicalPathTracker, createCanonicalTracker } from \"@soda-gql/common\";\n\nexport type GqlDefinitionMetadataMap = WeakMap<t.CallExpression, GqlDefinitionMetadata>;\n\ntype CanonicalTrackerFactory = typeof createCanonicalTracker;\n\ntype CollectArgs = {\n readonly programPath: NodePath<t.Program>;\n readonly filename: string;\n readonly createTracker?: CanonicalTrackerFactory;\n};\n\ntype ScopeHandle = ReturnType<CanonicalPathTracker[\"enterScope\"]>;\ntype ExportBindingMap = Map<string, string>;\n\nexport const collectGqlDefinitionMetadata = ({ programPath, filename, createTracker }: CollectArgs): GqlDefinitionMetadataMap => {\n const exportBindings = collectExportBindings(programPath.node);\n const trackerFactory = createTracker ?? createCanonicalTracker;\n const tracker = trackerFactory({\n filePath: filename,\n getExportName: (localName) => exportBindings.get(localName),\n });\n\n const getAnonymousName = createAnonymousNameFactory();\n const scopeHandles = new WeakMap<NodePath<t.Node>, ScopeHandle>();\n const metadata = new WeakMap<t.CallExpression, GqlDefinitionMetadata>();\n\n programPath.traverse({\n enter(path) {\n if (path.isCallExpression() && isGqlDefinitionCall(path.node)) {\n const depthBeforeRegister = tracker.currentDepth();\n const { astPath } = tracker.registerDefinition();\n const isTopLevel = depthBeforeRegister <= 1;\n const exportInfo = isTopLevel ? resolveTopLevelExport(path, exportBindings) : null;\n\n metadata.set(path.node, {\n astPath,\n isTopLevel,\n isExported: exportInfo?.isExported ?? false,\n exportBinding: exportInfo?.exportBinding,\n });\n\n path.skip();\n return;\n }\n\n const handle = maybeEnterScope(path, tracker, getAnonymousName);\n if (handle) {\n scopeHandles.set(path, handle);\n }\n },\n exit(path) {\n const handle = scopeHandles.get(path);\n if (handle) {\n tracker.exitScope(handle);\n scopeHandles.delete(path);\n }\n },\n });\n\n return metadata;\n};\n\nconst collectExportBindings = (program: t.Program): ExportBindingMap => {\n const bindings: ExportBindingMap = new Map();\n\n for (const statement of program.body) {\n // ESM exports: export const foo = ...\n if (t.isExportNamedDeclaration(statement) && statement.declaration) {\n const { declaration } = statement;\n if (t.isVariableDeclaration(declaration)) {\n for (const declarator of declaration.declarations) {\n if (t.isIdentifier(declarator.id)) {\n bindings.set(declarator.id.name, declarator.id.name);\n }\n }\n continue;\n }\n\n if ((t.isFunctionDeclaration(declaration) || t.isClassDeclaration(declaration)) && declaration.id) {\n bindings.set(declaration.id.name, declaration.id.name);\n }\n continue;\n }\n\n // CommonJS exports: exports.foo = ... or module.exports.foo = ...\n if (t.isExpressionStatement(statement) && t.isAssignmentExpression(statement.expression)) {\n const exportName = getCommonJsExportName(statement.expression.left);\n if (exportName) {\n bindings.set(exportName, exportName);\n }\n }\n }\n\n return bindings;\n};\n\nconst getCommonJsExportName = (node: t.LVal | t.OptionalMemberExpression): string | null => {\n if (!t.isMemberExpression(node) || node.computed) {\n return null;\n }\n\n // Check if it's exports.foo or module.exports.foo\n const isExports = t.isIdentifier(node.object, { name: \"exports\" });\n const isModuleExports =\n t.isMemberExpression(node.object) &&\n t.isIdentifier(node.object.object, { name: \"module\" }) &&\n t.isIdentifier(node.object.property, { name: \"exports\" });\n\n if (!isExports && !isModuleExports) {\n return null;\n }\n\n // Extract property name\n if (t.isIdentifier(node.property)) {\n return node.property.name;\n }\n if (t.isStringLiteral(node.property)) {\n return node.property.value;\n }\n\n return null;\n};\n\nconst createAnonymousNameFactory = (): ((kind: string) => string) => {\n const counters = new Map<string, number>();\n return (kind) => {\n const count = counters.get(kind) ?? 0;\n counters.set(kind, count + 1);\n return `${kind}#${count}`;\n };\n};\n\nconst isGqlDefinitionCall = (node: t.Node): node is t.CallExpression =>\n t.isCallExpression(node) &&\n t.isMemberExpression(node.callee) &&\n isGqlReference(node.callee.object) &&\n node.arguments.length > 0 &&\n t.isArrowFunctionExpression(node.arguments[0]);\n\nconst isGqlReference = (expr: t.Expression | t.Super): boolean => {\n if (t.isIdentifier(expr, { name: \"gql\" })) {\n return true;\n }\n if (!t.isMemberExpression(expr) || expr.computed) {\n return false;\n }\n if (\n (t.isIdentifier(expr.property) && expr.property.name === \"gql\") ||\n (t.isStringLiteral(expr.property) && expr.property.value === \"gql\")\n ) {\n return true;\n }\n return isGqlReference(expr.object);\n};\n\nconst resolveTopLevelExport = (\n callPath: NodePath<t.CallExpression>,\n exportBindings: ExportBindingMap,\n): { readonly isExported: true; readonly exportBinding: string } | null => {\n // ESM: const foo = gql.default(...); export { foo };\n const declarator = callPath.parentPath;\n if (declarator?.isVariableDeclarator()) {\n const { id } = declarator.node;\n if (t.isIdentifier(id)) {\n const exportBinding = exportBindings.get(id.name);\n if (exportBinding) {\n return { isExported: true, exportBinding };\n }\n }\n }\n\n // CommonJS: exports.foo = gql.default(...);\n const assignment = callPath.parentPath;\n if (assignment?.isAssignmentExpression()) {\n const exportName = getCommonJsExportName(assignment.node.left);\n if (exportName && exportBindings.has(exportName)) {\n return { isExported: true, exportBinding: exportName };\n }\n }\n\n return null;\n};\n\nconst maybeEnterScope = (\n path: NodePath<t.Node>,\n tracker: CanonicalPathTracker,\n getAnonymousName: (kind: string) => string,\n): ScopeHandle | null => {\n // CommonJS exports: exports.foo = ... or module.exports.foo = ...\n if (path.isAssignmentExpression()) {\n const exportName = getCommonJsExportName(path.node.left);\n if (exportName) {\n return tracker.enterScope({ segment: exportName, kind: \"variable\", stableKey: `var:${exportName}` });\n }\n }\n\n if (path.isVariableDeclarator() && t.isIdentifier(path.node.id)) {\n const name = path.node.id.name;\n return tracker.enterScope({ segment: name, kind: \"variable\", stableKey: `var:${name}` });\n }\n\n if (path.isArrowFunctionExpression()) {\n const name = getAnonymousName(\"arrow\");\n return tracker.enterScope({ segment: name, kind: \"function\", stableKey: \"arrow\" });\n }\n\n if (path.isFunctionDeclaration() || path.isFunctionExpression()) {\n const explicitName = path.node.id?.name;\n const name = explicitName ?? getAnonymousName(\"function\");\n return tracker.enterScope({ segment: name, kind: \"function\", stableKey: `func:${name}` });\n }\n\n if (path.isClassDeclaration()) {\n const explicitName = path.node.id?.name;\n const name = explicitName ?? getAnonymousName(\"class\");\n return tracker.enterScope({ segment: name, kind: \"class\", stableKey: `class:${name}` });\n }\n\n if (path.isClassMethod() && t.isIdentifier(path.node.key)) {\n const name = path.node.key.name;\n return tracker.enterScope({ segment: name, kind: \"method\", stableKey: `member:${name}` });\n }\n\n if (path.isClassProperty() && t.isIdentifier(path.node.key)) {\n const name = path.node.key.name;\n return tracker.enterScope({ segment: name, kind: \"property\", stableKey: `member:${name}` });\n }\n\n if (path.isObjectProperty()) {\n const key = path.node.key;\n const name = t.isIdentifier(key) ? key.name : t.isStringLiteral(key) ? key.value : null;\n if (name) {\n return tracker.enterScope({ segment: name, kind: \"property\", stableKey: `prop:${name}` });\n }\n }\n\n return null;\n};\n","import { types as t } from \"@babel/core\";\nimport type { PluginError } from \"@soda-gql/builder/plugin-support\";\nimport { ok, type Result } from \"neverthrow\";\nimport type { BabelGqlCallFragment, BabelGqlCallOperation } from \"./analysis\";\nimport { buildObjectExpression } from \"./ast\";\n\nexport const buildFragmentRuntimeCall = ({\n artifact,\n}: BabelGqlCallFragment & { filename: string }): Result<t.Expression, PluginError> => {\n const prebuildProps: Record<string, t.Expression> = {\n typename: t.stringLiteral(artifact.prebuild.typename),\n };\n if (artifact.prebuild.key !== undefined) {\n prebuildProps.key = t.stringLiteral(artifact.prebuild.key);\n }\n\n return ok(\n t.callExpression(t.memberExpression(t.identifier(\"gqlRuntime\"), t.identifier(\"fragment\")), [\n buildObjectExpression({\n prebuild: buildObjectExpression(prebuildProps),\n }),\n ]),\n );\n};\n\nexport const buildOperationRuntimeComponents = ({\n artifact,\n}: BabelGqlCallOperation & { filename: string }): Result<\n { referenceCall: t.Expression; runtimeCall: t.Expression },\n PluginError\n> => {\n const runtimeCall = t.callExpression(t.memberExpression(t.identifier(\"gqlRuntime\"), t.identifier(\"operation\")), [\n buildObjectExpression({\n prebuild: t.callExpression(t.memberExpression(t.identifier(\"JSON\"), t.identifier(\"parse\")), [\n t.stringLiteral(JSON.stringify(artifact.prebuild)),\n ]),\n runtime: buildObjectExpression({}),\n }),\n ]);\n\n const referenceCall = t.callExpression(t.memberExpression(t.identifier(\"gqlRuntime\"), t.identifier(\"getOperation\")), [\n t.stringLiteral(artifact.prebuild.operationName),\n ]);\n\n return ok({\n referenceCall,\n runtimeCall,\n });\n};\n","import type { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { PluginError } from \"@soda-gql/builder/plugin-support\";\nimport { err, ok, type Result } from \"neverthrow\";\nimport type { ArtifactLookup, BabelGqlCall } from \"./analysis\";\nimport { extractGqlCall } from \"./analysis\";\nimport type { GqlDefinitionMetadataMap } from \"./metadata\";\nimport { buildFragmentRuntimeCall, buildOperationRuntimeComponents } from \"./runtime\";\n\ntype TransformCallExpressionArgs = {\n readonly callPath: NodePath<t.CallExpression>;\n readonly filename: string;\n readonly metadata: GqlDefinitionMetadataMap;\n readonly getArtifact: ArtifactLookup;\n};\n\ntype TransformCallExpressionResult =\n | { readonly transformed: false }\n | { readonly transformed: true; readonly runtimeCall?: t.Expression };\n\nexport const transformCallExpression = ({\n callPath,\n filename,\n metadata,\n getArtifact,\n}: TransformCallExpressionArgs): Result<TransformCallExpressionResult, PluginError> => {\n // Skip if this call doesn't have GQL metadata\n if (!metadata.has(callPath.node)) {\n return ok({ transformed: false });\n }\n\n const gqlCallResult = extractGqlCall({\n nodePath: callPath,\n filename,\n metadata,\n getArtifact,\n });\n\n if (gqlCallResult.isErr()) {\n return err(gqlCallResult.error);\n }\n\n const gqlCall = gqlCallResult.value;\n\n return replaceWithRuntimeCall(callPath, gqlCall, filename);\n};\n\nconst replaceWithRuntimeCall = (\n callPath: NodePath<t.CallExpression>,\n gqlCall: BabelGqlCall,\n filename: string,\n): Result<TransformCallExpressionResult, PluginError> => {\n if (gqlCall.type === \"fragment\") {\n const result = buildFragmentRuntimeCall({ ...gqlCall, filename });\n if (result.isErr()) {\n return err(result.error);\n }\n callPath.replaceWith(result.value);\n return ok({ transformed: true });\n }\n\n if (gqlCall.type === \"operation\") {\n const result = buildOperationRuntimeComponents({ ...gqlCall, filename });\n if (result.isErr()) {\n return err(result.error);\n }\n const { referenceCall, runtimeCall } = result.value;\n callPath.replaceWith(referenceCall);\n return ok({ transformed: true, runtimeCall });\n }\n\n return ok({ transformed: false });\n};\n\nexport const insertRuntimeCalls = (programPath: NodePath<t.Program>, runtimeCalls: readonly t.Expression[]): void => {\n if (runtimeCalls.length === 0) {\n return;\n }\n\n programPath.traverse({\n ImportDeclaration(importDeclPath) {\n if (importDeclPath.node.source.value === \"@soda-gql/runtime\") {\n importDeclPath.insertAfter([...runtimeCalls]);\n }\n },\n });\n};\n","/**\n * Babel implementation of the TransformAdapter interface.\n *\n * This adapter wraps the existing Babel-specific transformation logic\n * for soda-gql zero-runtime transformations.\n */\n\nimport type { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport { createGraphqlSystemIdentifyHelper } from \"@soda-gql/builder\";\nimport { formatPluginError } from \"@soda-gql/builder/plugin-support\";\nimport type { ResolvedSodaGqlConfig } from \"@soda-gql/config\";\nimport { ensureGqlRuntimeImport, removeGraphqlSystemImports } from \"./ast/imports\";\nimport { collectGqlDefinitionMetadata } from \"./ast/metadata\";\nimport { transformCallExpression } from \"./ast/transformer\";\nimport type { TransformPassResult, TransformProgramContext } from \"./types\";\n\n/**\n * Creates a Babel transformer with a single transform() method.\n * This matches the pattern used in the TypeScript plugin.\n */\nexport const createTransformer = ({\n programPath,\n types,\n config,\n}: {\n readonly programPath: NodePath<t.Program>;\n readonly types: typeof t;\n readonly config: ResolvedSodaGqlConfig;\n}) => {\n // Create graphql system identify helper using builder's implementation\n const graphqlSystemIdentifyHelper = createGraphqlSystemIdentifyHelper(config);\n\n /**\n * Check if a node is a require() or __webpack_require__() call.\n */\n const isRequireCall = (node: t.Node): boolean => {\n if (!types.isCallExpression(node)) {\n return false;\n }\n\n const callee = node.callee;\n return types.isIdentifier(callee) && (callee.name === \"require\" || callee.name === \"__webpack_require__\");\n };\n\n /**\n * Find the last statement that loads a module (import or require).\n * Handles both ESM imports and CommonJS require() calls.\n */\n const findLastModuleLoader = (): NodePath<t.Statement> | null => {\n const bodyPaths = programPath.get(\"body\");\n let lastLoader: NodePath<t.Statement> | null = null;\n\n for (const path of bodyPaths) {\n // ESM: import declaration\n if (path.isImportDeclaration()) {\n lastLoader = path;\n continue;\n }\n\n // CommonJS: const foo = require(\"bar\") or const foo = __webpack_require__(123)\n if (path.isVariableDeclaration()) {\n for (const declarator of path.node.declarations) {\n if (declarator.init && isRequireCall(declarator.init)) {\n lastLoader = path;\n break;\n }\n }\n continue;\n }\n\n // CommonJS: require(\"bar\") or __webpack_require__(123) as standalone expression\n if (path.isExpressionStatement()) {\n if (isRequireCall(path.node.expression)) {\n lastLoader = path;\n }\n }\n }\n\n return lastLoader;\n };\n\n return {\n transform: (context: TransformProgramContext): TransformPassResult => {\n const metadata = collectGqlDefinitionMetadata({\n programPath,\n filename: context.filename,\n });\n\n const runtimeCalls: t.Expression[] = [];\n let transformed = false;\n\n // Transform all gql call expressions\n programPath.traverse({\n CallExpression: (callPath) => {\n const result = transformCallExpression({\n callPath,\n filename: context.filename,\n metadata,\n getArtifact: context.artifactLookup,\n });\n\n if (result.isErr()) {\n // Log error and continue - don't fail the entire build for a single error\n console.error(`[@soda-gql/babel] ${formatPluginError(result.error)}`);\n return;\n }\n\n const transformResult = result.value;\n if (transformResult.transformed) {\n transformed = true;\n\n if (transformResult.runtimeCall) {\n runtimeCalls.push(transformResult.runtimeCall);\n }\n }\n },\n });\n\n if (!transformed) {\n return { transformed: false, runtimeArtifacts: undefined };\n }\n\n // Ensure runtime import\n ensureGqlRuntimeImport(programPath);\n\n // Insert runtime side effects immediately if any\n if (runtimeCalls.length > 0) {\n const statements = runtimeCalls.map((expr) => types.expressionStatement(expr));\n const lastLoaderPath = findLastModuleLoader();\n\n if (lastLoaderPath) {\n lastLoaderPath.insertAfter(statements);\n } else {\n programPath.unshiftContainer(\"body\", statements);\n }\n }\n\n // Clean up: remove graphql system imports and recrawl scope\n programPath.scope.crawl();\n removeGraphqlSystemImports(programPath, graphqlSystemIdentifyHelper, context.filename);\n\n return {\n transformed: true,\n runt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rD,kBAAa;AACb;;AAGJ;;AAIF,OAAI,KAAK,uBAAuB,EAC9B;QAAI,cAAc,KAAK,KAAK,WAAW,CACrC,cAAa;;;AAKnB,SAAO;;AAGT,QAAO,EACL,YAAY,YAA0D;EACpE,MAAM,WAAW,6BAA6B;GAC5C;GACA,UAAU,QAAQ;GACnB,CAAC;EAEF,MAAMC,eAA+B,EAAE;EACvC,IAAI,cAAc;AAGlB,cAAY,SAAS,EACnB,iBAAiB,aAAa;GAC5B,MAAM,SAAS,wBAAwB;IACrC;IACA,UAAU,QAAQ;IAClB;IACA,aAAa,QAAQ;IACtB,CAAC;AAEF,OAAI,OAAO,OAAO,EAAE;AAElB,YAAQ,MAAM,8EAAuC,OAAO,MAAM,GAAG;AACrE;;GAGF,MAAM,kBAAkB,OAAO;AAC/B,OAAI,gBAAgB,aAAa;AAC/B,kBAAc;AAEd,QAAI,gBAAgB,YAClB,cAAa,KAAK,gBAAgB,YAAY;;KAIrD,CAAC;AAEF,MAAI,CAAC,YACH,QAAO;GAAE,aAAa;GAAO,kBAAkB;GAAW;AAI5D,yBAAuB,YAAY;AAGnC,MAAI,aAAa,SAAS,GAAG;GAC3B,MAAM,aAAa,aAAa,KAAK,SAAS,MAAM,oBAAoB,KAAK,CAAC;GAC9E,MAAM,iBAAiB,sBAAsB;AAE7C,OAAI,eACF,gBAAe,YAAY,WAAW;OAEtC,aAAY,iBAAiB,QAAQ,WAAW;;AAKpD,cAAY,MAAM,OAAO;AACzB,6BAA2B,aAAa,6BAA6B,QAAQ,SAAS;AAEtF,SAAO;GACL,aAAa;GACb,kBAAkB;GACnB;IAEJ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"transformer-kTdl4bE2.mjs","names":["elements: Expression[]","properties: t.ObjectProperty[]","t","toRemove: NodePath[]","bindings: ExportBindingMap","t","prebuildProps: Record<string, t.Expression>","t","types","lastLoader: NodePath<t.Statement> | null","runtimeCalls: t.Expression[]"],"sources":["../src/ast/analysis.ts","../src/ast/ast.ts","../src/ast/imports.ts","../src/ast/metadata.ts","../src/ast/runtime.ts","../src/ast/transformer.ts","../src/transformer.ts"],"sourcesContent":["import type { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { BuilderArtifactElement } from \"@soda-gql/builder\";\nimport type {\n GqlCallFragment,\n GqlCallOperation,\n PluginAnalysisArtifactMissingError,\n PluginAnalysisMetadataMissingError,\n PluginAnalysisUnsupportedArtifactTypeError,\n PluginError,\n} from \"@soda-gql/builder/plugin-support\";\nimport { resolveCanonicalId } from \"@soda-gql/builder/plugin-support\";\nimport type { CanonicalId } from \"@soda-gql/common\";\nimport { err, ok, type Result } from \"neverthrow\";\nimport type { GqlDefinitionMetadataMap } from \"./metadata\";\n\nexport type ArtifactLookup = (canonicalId: CanonicalId) => BuilderArtifactElement | undefined;\n\n// Babel-specific GqlCall types\nexport type BabelGqlCallFragment = GqlCallFragment & { readonly nodePath: NodePath<t.CallExpression> };\nexport type BabelGqlCallOperation = GqlCallOperation & {\n readonly nodePath: NodePath<t.CallExpression>;\n};\n\nexport type BabelGqlCall = BabelGqlCallFragment | BabelGqlCallOperation;\n\nexport type ExtractGqlCallArgs = {\n readonly nodePath: NodePath<t.CallExpression>;\n readonly filename: string;\n readonly metadata: GqlDefinitionMetadataMap;\n readonly getArtifact: ArtifactLookup;\n};\n\nexport const extractGqlCall = ({\n nodePath,\n filename,\n metadata,\n getArtifact,\n}: ExtractGqlCallArgs): Result<BabelGqlCall, PluginError> => {\n const callExpression = nodePath.node;\n\n const meta = metadata.get(callExpression);\n if (!meta) {\n return err(createMetadataMissingError({ filename }));\n }\n\n const canonicalId = resolveCanonicalId(filename, meta.astPath);\n const artifact = getArtifact(canonicalId);\n\n if (!artifact) {\n return err(createArtifactMissingError({ filename, canonicalId }));\n }\n\n if (artifact.type === \"fragment\") {\n return ok({ nodePath, canonicalId, type: \"fragment\", artifact });\n }\n\n if (artifact.type === \"operation\") {\n return ok({ nodePath, canonicalId, type: \"operation\", artifact });\n }\n\n return err(\n createUnsupportedArtifactTypeError({\n filename,\n canonicalId,\n artifactType: (artifact as { type: string }).type,\n }),\n );\n};\n\ntype MetadataErrorInput = { readonly filename: string };\ntype ArtifactMissingErrorInput = { readonly filename: string; readonly canonicalId: CanonicalId };\ntype UnsupportedArtifactTypeInput = {\n readonly filename: string;\n readonly canonicalId: CanonicalId;\n readonly artifactType: string;\n};\n\nconst createMetadataMissingError = ({ filename }: MetadataErrorInput): PluginAnalysisMetadataMissingError => ({\n type: \"PluginError\",\n stage: \"analysis\",\n code: \"SODA_GQL_METADATA_NOT_FOUND\",\n message: `No GraphQL metadata found for ${filename}`,\n cause: { filename },\n filename,\n});\n\nconst createArtifactMissingError = ({\n filename,\n canonicalId,\n}: ArtifactMissingErrorInput): PluginAnalysisArtifactMissingError => ({\n type: \"PluginError\",\n stage: \"analysis\",\n code: \"SODA_GQL_ANALYSIS_ARTIFACT_NOT_FOUND\",\n message: `No builder artifact found for canonical ID ${canonicalId}`,\n cause: { filename, canonicalId },\n filename,\n canonicalId,\n});\n\nconst createUnsupportedArtifactTypeError = ({\n filename,\n canonicalId,\n artifactType,\n}: UnsupportedArtifactTypeInput): PluginAnalysisUnsupportedArtifactTypeError => ({\n type: \"PluginError\",\n stage: \"analysis\",\n code: \"SODA_GQL_UNSUPPORTED_ARTIFACT_TYPE\",\n message: `Unsupported builder artifact type \"${artifactType}\" for canonical ID ${canonicalId}`,\n cause: { filename, canonicalId, artifactType },\n filename,\n canonicalId,\n artifactType,\n});\n","import type { Expression } from \"@babel/types\";\nimport * as t from \"@babel/types\";\nimport type { PluginError, PluginTransformUnsupportedValueTypeError } from \"@soda-gql/builder/plugin-support\";\nimport { err, ok, type Result } from \"neverthrow\";\n\nconst createUnsupportedValueTypeError = (valueType: string): PluginTransformUnsupportedValueTypeError => ({\n type: \"PluginError\",\n stage: \"transform\",\n code: \"SODA_GQL_TRANSFORM_UNSUPPORTED_VALUE_TYPE\",\n message: `Unsupported value type: ${valueType}`,\n cause: { valueType },\n valueType,\n});\n\nexport const buildLiteralFromValue = (value: unknown): Result<Expression, PluginError> => {\n if (value === null) {\n return ok(t.nullLiteral());\n }\n if (typeof value === \"string\") {\n return ok(t.stringLiteral(value));\n }\n if (typeof value === \"number\") {\n return ok(t.numericLiteral(value));\n }\n if (typeof value === \"boolean\") {\n return ok(t.booleanLiteral(value));\n }\n if (Array.isArray(value)) {\n const elements: Expression[] = [];\n for (const item of value) {\n const result = buildLiteralFromValue(item);\n if (result.isErr()) {\n return result;\n }\n elements.push(result.value);\n }\n return ok(t.arrayExpression(elements));\n }\n if (typeof value === \"object\") {\n const properties: t.ObjectProperty[] = [];\n for (const [key, val] of Object.entries(value)) {\n const result = buildLiteralFromValue(val);\n if (result.isErr()) {\n return result;\n }\n properties.push(t.objectProperty(t.identifier(key), result.value));\n }\n return ok(t.objectExpression(properties));\n }\n return err(createUnsupportedValueTypeError(typeof value));\n};\n\nexport const clone = <T extends t.Node>(node: T): T => t.cloneNode(node, true) as T;\n\nexport const cloneCallExpression = (node: t.CallExpression): t.CallExpression =>\n t.callExpression(clone(node.callee), node.arguments.map(clone));\n\nexport const stripTypeAnnotations = (node: t.Node): void => {\n if (\"typeParameters\" in node) {\n delete node.typeParameters;\n }\n if (\"typeAnnotation\" in node) {\n delete node.typeAnnotation;\n }\n if (\"returnType\" in node) {\n delete node.returnType;\n }\n};\n\nexport const buildObjectExpression = <K extends string>(\n properties: Record<K, t.Expression | t.PatternLike>,\n): t.ObjectExpression =>\n t.objectExpression(\n Object.entries<t.Expression | t.PatternLike>(properties).map(([key, value]) => t.objectProperty(t.identifier(key), value)),\n );\n","import { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { GraphqlSystemIdentifyHelper } from \"@soda-gql/builder\";\n\nconst RUNTIME_MODULE = \"@soda-gql/runtime\";\n\n/**\n * Ensure that the gqlRuntime require exists in the program for CJS output.\n * Injects: const __soda_gql_runtime = require(\"@soda-gql/runtime\");\n */\nexport const ensureGqlRuntimeRequire = (programPath: NodePath<t.Program>) => {\n // Check if the require already exists\n const existing = programPath.node.body.find(\n (statement): statement is t.VariableDeclaration =>\n t.isVariableDeclaration(statement) &&\n statement.declarations.some((decl) => {\n if (!t.isIdentifier(decl.id) || decl.id.name !== \"__soda_gql_runtime\") {\n return false;\n }\n if (!decl.init || !t.isCallExpression(decl.init)) {\n return false;\n }\n const callExpr = decl.init;\n if (!t.isIdentifier(callExpr.callee) || callExpr.callee.name !== \"require\") {\n return false;\n }\n const arg = callExpr.arguments[0];\n return arg && t.isStringLiteral(arg) && arg.value === RUNTIME_MODULE;\n }),\n );\n\n if (existing) {\n return;\n }\n\n // Create: const __soda_gql_runtime = require(\"@soda-gql/runtime\");\n const requireCall = t.callExpression(t.identifier(\"require\"), [t.stringLiteral(RUNTIME_MODULE)]);\n\n const variableDeclaration = t.variableDeclaration(\"const\", [\n t.variableDeclarator(t.identifier(\"__soda_gql_runtime\"), requireCall),\n ]);\n\n // Insert at the beginning of the file\n programPath.node.body.unshift(variableDeclaration);\n};\n\n/**\n * Ensure that the gqlRuntime import exists in the program.\n * gqlRuntime is always imported from @soda-gql/runtime.\n */\nexport const ensureGqlRuntimeImport = (programPath: NodePath<t.Program>) => {\n const existing = programPath.node.body.find(\n (statement) => statement.type === \"ImportDeclaration\" && statement.source.value === RUNTIME_MODULE,\n );\n\n if (existing && t.isImportDeclaration(existing)) {\n const hasSpecifier = existing.specifiers.some(\n (specifier) =>\n specifier.type === \"ImportSpecifier\" &&\n specifier.imported.type === \"Identifier\" &&\n specifier.imported.name === \"gqlRuntime\",\n );\n\n if (!hasSpecifier) {\n existing.specifiers = [...existing.specifiers, t.importSpecifier(t.identifier(\"gqlRuntime\"), t.identifier(\"gqlRuntime\"))];\n }\n\n return;\n }\n\n programPath.node.body.unshift(\n t.importDeclaration(\n [t.importSpecifier(t.identifier(\"gqlRuntime\"), t.identifier(\"gqlRuntime\"))],\n t.stringLiteral(RUNTIME_MODULE),\n ),\n );\n};\n\n/**\n * Remove the graphql-system import (runtimeModule) and gql-related exports from the program.\n * After transformation, gqlRuntime is imported from @soda-gql/runtime instead,\n * so the original graphql-system import should be completely removed.\n *\n * This handles both ESM imports and CommonJS require() statements.\n */\nexport const removeGraphqlSystemImports = (\n programPath: NodePath<t.Program>,\n graphqlSystemIdentifyHelper: GraphqlSystemIdentifyHelper,\n filename: string,\n) => {\n // After transformation, all gql usage should be replaced with gqlRuntime\n // So we can safely remove the graphql-system import\n const toRemove: NodePath[] = [];\n\n programPath.traverse({\n // Remove ESM import declarations for the graphql-system\n ImportDeclaration(path) {\n if (t.isStringLiteral(path.node.source)) {\n const isGraphqlSystem = graphqlSystemIdentifyHelper.isGraphqlSystemImportSpecifier({\n filePath: filename,\n specifier: path.node.source.value,\n });\n if (isGraphqlSystem) {\n toRemove.push(path);\n }\n }\n },\n // Remove CommonJS require() statements for the graphql-system\n // - const graphql_system_1 = require(\"../../graphql-system\");\n // - const { gql } = require(\"@/graphql-system\");\n VariableDeclaration(path) {\n const shouldRemove = path.node.declarations.every((decl) => {\n const specifier = extractRequireTargetSpecifier(decl.init);\n if (!specifier) {\n return false;\n }\n\n return graphqlSystemIdentifyHelper.isGraphqlSystemImportSpecifier({\n filePath: filename,\n specifier: specifier,\n });\n });\n\n if (shouldRemove) {\n toRemove.push(path);\n }\n },\n });\n\n for (const path of toRemove) {\n path.remove();\n }\n};\n\n/**\n * Check if an expression is a require() call and extract its target specifier.\n * Handles multiple patterns:\n * - require(\"@/graphql-system\")\n * - Object(require(\"@/graphql-system\")) (interop helper pattern)\n */\nconst extractRequireTargetSpecifier = (expr: t.Node | null | undefined): string | undefined => {\n if (!expr) {\n return undefined;\n }\n\n // Direct require(\"@/graphql-system\")\n if (t.isCallExpression(expr)) {\n if (t.isIdentifier(expr.callee) && expr.callee.name === \"require\") {\n const arg = expr.arguments[0];\n if (arg && t.isStringLiteral(arg)) {\n return arg.value;\n }\n }\n\n // Object(require(\"@/graphql-system\")) or similar interop helpers\n if (t.isIdentifier(expr.callee) && (expr.callee.name === \"Object\" || expr.callee.name.startsWith(\"__import\"))) {\n const arg = expr.arguments[0];\n if (arg && t.isCallExpression(arg)) {\n if (t.isIdentifier(arg.callee) && arg.callee.name === \"require\") {\n const requireArg = arg.arguments[0];\n if (requireArg && t.isStringLiteral(requireArg)) {\n return requireArg.value;\n }\n }\n }\n }\n }\n\n return undefined;\n};\n","import { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { GqlDefinitionMetadata } from \"@soda-gql/builder/plugin-support\";\nimport { type CanonicalPathTracker, createCanonicalTracker } from \"@soda-gql/common\";\n\nexport type GqlDefinitionMetadataMap = WeakMap<t.CallExpression, GqlDefinitionMetadata>;\n\ntype CanonicalTrackerFactory = typeof createCanonicalTracker;\n\ntype CollectArgs = {\n readonly programPath: NodePath<t.Program>;\n readonly filename: string;\n readonly createTracker?: CanonicalTrackerFactory;\n};\n\ntype ScopeHandle = ReturnType<CanonicalPathTracker[\"enterScope\"]>;\ntype ExportBindingMap = Map<string, string>;\n\nexport const collectGqlDefinitionMetadata = ({ programPath, filename, createTracker }: CollectArgs): GqlDefinitionMetadataMap => {\n const exportBindings = collectExportBindings(programPath.node);\n const trackerFactory = createTracker ?? createCanonicalTracker;\n const tracker = trackerFactory({\n filePath: filename,\n getExportName: (localName) => exportBindings.get(localName),\n });\n\n const getAnonymousName = createAnonymousNameFactory();\n const scopeHandles = new WeakMap<NodePath<t.Node>, ScopeHandle>();\n const metadata = new WeakMap<t.CallExpression, GqlDefinitionMetadata>();\n\n programPath.traverse({\n enter(path) {\n if (path.isCallExpression() && isGqlDefinitionCall(path.node)) {\n const depthBeforeRegister = tracker.currentDepth();\n const { astPath } = tracker.registerDefinition();\n const isTopLevel = depthBeforeRegister <= 1;\n const exportInfo = isTopLevel ? resolveTopLevelExport(path, exportBindings) : null;\n\n metadata.set(path.node, {\n astPath,\n isTopLevel,\n isExported: exportInfo?.isExported ?? false,\n exportBinding: exportInfo?.exportBinding,\n });\n\n path.skip();\n return;\n }\n\n const handle = maybeEnterScope(path, tracker, getAnonymousName);\n if (handle) {\n scopeHandles.set(path, handle);\n }\n },\n exit(path) {\n const handle = scopeHandles.get(path);\n if (handle) {\n tracker.exitScope(handle);\n scopeHandles.delete(path);\n }\n },\n });\n\n return metadata;\n};\n\nconst collectExportBindings = (program: t.Program): ExportBindingMap => {\n const bindings: ExportBindingMap = new Map();\n\n for (const statement of program.body) {\n // ESM exports: export const foo = ...\n if (t.isExportNamedDeclaration(statement) && statement.declaration) {\n const { declaration } = statement;\n if (t.isVariableDeclaration(declaration)) {\n for (const declarator of declaration.declarations) {\n if (t.isIdentifier(declarator.id)) {\n bindings.set(declarator.id.name, declarator.id.name);\n }\n }\n continue;\n }\n\n if ((t.isFunctionDeclaration(declaration) || t.isClassDeclaration(declaration)) && declaration.id) {\n bindings.set(declaration.id.name, declaration.id.name);\n }\n continue;\n }\n\n // CommonJS exports: exports.foo = ... or module.exports.foo = ...\n if (t.isExpressionStatement(statement) && t.isAssignmentExpression(statement.expression)) {\n const exportName = getCommonJsExportName(statement.expression.left);\n if (exportName) {\n bindings.set(exportName, exportName);\n }\n }\n }\n\n return bindings;\n};\n\nconst getCommonJsExportName = (node: t.LVal | t.OptionalMemberExpression): string | null => {\n if (!t.isMemberExpression(node) || node.computed) {\n return null;\n }\n\n // Check if it's exports.foo or module.exports.foo\n const isExports = t.isIdentifier(node.object, { name: \"exports\" });\n const isModuleExports =\n t.isMemberExpression(node.object) &&\n t.isIdentifier(node.object.object, { name: \"module\" }) &&\n t.isIdentifier(node.object.property, { name: \"exports\" });\n\n if (!isExports && !isModuleExports) {\n return null;\n }\n\n // Extract property name\n if (t.isIdentifier(node.property)) {\n return node.property.name;\n }\n if (t.isStringLiteral(node.property)) {\n return node.property.value;\n }\n\n return null;\n};\n\nconst createAnonymousNameFactory = (): ((kind: string) => string) => {\n const counters = new Map<string, number>();\n return (kind) => {\n const count = counters.get(kind) ?? 0;\n counters.set(kind, count + 1);\n return `${kind}#${count}`;\n };\n};\n\nconst isGqlDefinitionCall = (node: t.Node): node is t.CallExpression =>\n t.isCallExpression(node) &&\n t.isMemberExpression(node.callee) &&\n isGqlReference(node.callee.object) &&\n node.arguments.length > 0 &&\n t.isArrowFunctionExpression(node.arguments[0]);\n\nconst isGqlReference = (expr: t.Expression | t.Super): boolean => {\n if (t.isIdentifier(expr, { name: \"gql\" })) {\n return true;\n }\n if (!t.isMemberExpression(expr) || expr.computed) {\n return false;\n }\n if (\n (t.isIdentifier(expr.property) && expr.property.name === \"gql\") ||\n (t.isStringLiteral(expr.property) && expr.property.value === \"gql\")\n ) {\n return true;\n }\n return isGqlReference(expr.object);\n};\n\nconst resolveTopLevelExport = (\n callPath: NodePath<t.CallExpression>,\n exportBindings: ExportBindingMap,\n): { readonly isExported: true; readonly exportBinding: string } | null => {\n // ESM: const foo = gql.default(...); export { foo };\n const declarator = callPath.parentPath;\n if (declarator?.isVariableDeclarator()) {\n const { id } = declarator.node;\n if (t.isIdentifier(id)) {\n const exportBinding = exportBindings.get(id.name);\n if (exportBinding) {\n return { isExported: true, exportBinding };\n }\n }\n }\n\n // CommonJS: exports.foo = gql.default(...);\n const assignment = callPath.parentPath;\n if (assignment?.isAssignmentExpression()) {\n const exportName = getCommonJsExportName(assignment.node.left);\n if (exportName && exportBindings.has(exportName)) {\n return { isExported: true, exportBinding: exportName };\n }\n }\n\n return null;\n};\n\nconst maybeEnterScope = (\n path: NodePath<t.Node>,\n tracker: CanonicalPathTracker,\n getAnonymousName: (kind: string) => string,\n): ScopeHandle | null => {\n // CommonJS exports: exports.foo = ... or module.exports.foo = ...\n if (path.isAssignmentExpression()) {\n const exportName = getCommonJsExportName(path.node.left);\n if (exportName) {\n return tracker.enterScope({ segment: exportName, kind: \"variable\", stableKey: `var:${exportName}` });\n }\n }\n\n if (path.isVariableDeclarator() && t.isIdentifier(path.node.id)) {\n const name = path.node.id.name;\n return tracker.enterScope({ segment: name, kind: \"variable\", stableKey: `var:${name}` });\n }\n\n if (path.isArrowFunctionExpression()) {\n const name = getAnonymousName(\"arrow\");\n return tracker.enterScope({ segment: name, kind: \"function\", stableKey: \"arrow\" });\n }\n\n if (path.isFunctionDeclaration() || path.isFunctionExpression()) {\n const explicitName = path.node.id?.name;\n const name = explicitName ?? getAnonymousName(\"function\");\n return tracker.enterScope({ segment: name, kind: \"function\", stableKey: `func:${name}` });\n }\n\n if (path.isClassDeclaration()) {\n const explicitName = path.node.id?.name;\n const name = explicitName ?? getAnonymousName(\"class\");\n return tracker.enterScope({ segment: name, kind: \"class\", stableKey: `class:${name}` });\n }\n\n if (path.isClassMethod() && t.isIdentifier(path.node.key)) {\n const name = path.node.key.name;\n return tracker.enterScope({ segment: name, kind: \"method\", stableKey: `member:${name}` });\n }\n\n if (path.isClassProperty() && t.isIdentifier(path.node.key)) {\n const name = path.node.key.name;\n return tracker.enterScope({ segment: name, kind: \"property\", stableKey: `member:${name}` });\n }\n\n if (path.isObjectProperty()) {\n const key = path.node.key;\n const name = t.isIdentifier(key) ? key.name : t.isStringLiteral(key) ? key.value : null;\n if (name) {\n return tracker.enterScope({ segment: name, kind: \"property\", stableKey: `prop:${name}` });\n }\n }\n\n return null;\n};\n","import { types as t } from \"@babel/core\";\nimport type { PluginError } from \"@soda-gql/builder/plugin-support\";\nimport { ok, type Result } from \"neverthrow\";\nimport type { BabelGqlCallFragment, BabelGqlCallOperation } from \"./analysis\";\nimport { buildObjectExpression } from \"./ast\";\n\nexport const buildFragmentRuntimeCall = ({\n artifact,\n}: BabelGqlCallFragment & { filename: string }): Result<t.Expression, PluginError> => {\n const prebuildProps: Record<string, t.Expression> = {\n typename: t.stringLiteral(artifact.prebuild.typename),\n };\n if (artifact.prebuild.key !== undefined) {\n prebuildProps.key = t.stringLiteral(artifact.prebuild.key);\n }\n\n return ok(\n t.callExpression(t.memberExpression(t.identifier(\"gqlRuntime\"), t.identifier(\"fragment\")), [\n buildObjectExpression({\n prebuild: buildObjectExpression(prebuildProps),\n }),\n ]),\n );\n};\n\nexport const buildOperationRuntimeComponents = ({\n artifact,\n}: BabelGqlCallOperation & { filename: string }): Result<\n { referenceCall: t.Expression; runtimeCall: t.Expression },\n PluginError\n> => {\n const runtimeCall = t.callExpression(t.memberExpression(t.identifier(\"gqlRuntime\"), t.identifier(\"operation\")), [\n buildObjectExpression({\n prebuild: t.callExpression(t.memberExpression(t.identifier(\"JSON\"), t.identifier(\"parse\")), [\n t.stringLiteral(JSON.stringify(artifact.prebuild)),\n ]),\n runtime: buildObjectExpression({}),\n }),\n ]);\n\n const referenceCall = t.callExpression(t.memberExpression(t.identifier(\"gqlRuntime\"), t.identifier(\"getOperation\")), [\n t.stringLiteral(artifact.prebuild.operationName),\n ]);\n\n return ok({\n referenceCall,\n runtimeCall,\n });\n};\n","import type { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { PluginError } from \"@soda-gql/builder/plugin-support\";\nimport { err, ok, type Result } from \"neverthrow\";\nimport type { ArtifactLookup, BabelGqlCall } from \"./analysis\";\nimport { extractGqlCall } from \"./analysis\";\nimport type { GqlDefinitionMetadataMap } from \"./metadata\";\nimport { buildFragmentRuntimeCall, buildOperationRuntimeComponents } from \"./runtime\";\n\ntype TransformCallExpressionArgs = {\n readonly callPath: NodePath<t.CallExpression>;\n readonly filename: string;\n readonly metadata: GqlDefinitionMetadataMap;\n readonly getArtifact: ArtifactLookup;\n};\n\ntype TransformCallExpressionResult =\n | { readonly transformed: false }\n | { readonly transformed: true; readonly runtimeCall?: t.Expression };\n\nexport const transformCallExpression = ({\n callPath,\n filename,\n metadata,\n getArtifact,\n}: TransformCallExpressionArgs): Result<TransformCallExpressionResult, PluginError> => {\n // Skip if this call doesn't have GQL metadata\n if (!metadata.has(callPath.node)) {\n return ok({ transformed: false });\n }\n\n const gqlCallResult = extractGqlCall({\n nodePath: callPath,\n filename,\n metadata,\n getArtifact,\n });\n\n if (gqlCallResult.isErr()) {\n return err(gqlCallResult.error);\n }\n\n const gqlCall = gqlCallResult.value;\n\n return replaceWithRuntimeCall(callPath, gqlCall, filename);\n};\n\nconst replaceWithRuntimeCall = (\n callPath: NodePath<t.CallExpression>,\n gqlCall: BabelGqlCall,\n filename: string,\n): Result<TransformCallExpressionResult, PluginError> => {\n if (gqlCall.type === \"fragment\") {\n const result = buildFragmentRuntimeCall({ ...gqlCall, filename });\n if (result.isErr()) {\n return err(result.error);\n }\n callPath.replaceWith(result.value);\n return ok({ transformed: true });\n }\n\n if (gqlCall.type === \"operation\") {\n const result = buildOperationRuntimeComponents({ ...gqlCall, filename });\n if (result.isErr()) {\n return err(result.error);\n }\n const { referenceCall, runtimeCall } = result.value;\n callPath.replaceWith(referenceCall);\n return ok({ transformed: true, runtimeCall });\n }\n\n return ok({ transformed: false });\n};\n\nexport const insertRuntimeCalls = (programPath: NodePath<t.Program>, runtimeCalls: readonly t.Expression[]): void => {\n if (runtimeCalls.length === 0) {\n return;\n }\n\n programPath.traverse({\n ImportDeclaration(importDeclPath) {\n if (importDeclPath.node.source.value === \"@soda-gql/runtime\") {\n importDeclPath.insertAfter([...runtimeCalls]);\n }\n },\n });\n};\n","/**\n * Babel implementation of the TransformAdapter interface.\n *\n * This adapter wraps the existing Babel-specific transformation logic\n * for soda-gql zero-runtime transformations.\n */\n\nimport type { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport { createGraphqlSystemIdentifyHelper } from \"@soda-gql/builder\";\nimport { formatPluginError } from \"@soda-gql/builder/plugin-support\";\nimport type { ResolvedSodaGqlConfig } from \"@soda-gql/config\";\nimport { ensureGqlRuntimeImport, removeGraphqlSystemImports } from \"./ast/imports\";\nimport { collectGqlDefinitionMetadata } from \"./ast/metadata\";\nimport { transformCallExpression } from \"./ast/transformer\";\nimport type { TransformPassResult, TransformProgramContext } from \"./types\";\n\n/**\n * Creates a Babel transformer with a single transform() method.\n * This matches the pattern used in the TypeScript plugin.\n */\nexport const createTransformer = ({\n programPath,\n types,\n config,\n}: {\n readonly programPath: NodePath<t.Program>;\n readonly types: typeof t;\n readonly config: ResolvedSodaGqlConfig;\n}) => {\n // Create graphql system identify helper using builder's implementation\n const graphqlSystemIdentifyHelper = createGraphqlSystemIdentifyHelper(config);\n\n /**\n * Check if a node is a require() or __webpack_require__() call.\n */\n const isRequireCall = (node: t.Node): boolean => {\n if (!types.isCallExpression(node)) {\n return false;\n }\n\n const callee = node.callee;\n return types.isIdentifier(callee) && (callee.name === \"require\" || callee.name === \"__webpack_require__\");\n };\n\n /**\n * Find the last statement that loads a module (import or require).\n * Handles both ESM imports and CommonJS require() calls.\n */\n const findLastModuleLoader = (): NodePath<t.Statement> | null => {\n const bodyPaths = programPath.get(\"body\");\n let lastLoader: NodePath<t.Statement> | null = null;\n\n for (const path of bodyPaths) {\n // ESM: import declaration\n if (path.isImportDeclaration()) {\n lastLoader = path;\n continue;\n }\n\n // CommonJS: const foo = require(\"bar\") or const foo = __webpack_require__(123)\n if (path.isVariableDeclaration()) {\n for (const declarator of path.node.declarations) {\n if (declarator.init && isRequireCall(declarator.init)) {\n lastLoader = path;\n break;\n }\n }\n continue;\n }\n\n // CommonJS: require(\"bar\") or __webpack_require__(123) as standalone expression\n if (path.isExpressionStatement()) {\n if (isRequireCall(path.node.expression)) {\n lastLoader = path;\n }\n }\n }\n\n return lastLoader;\n };\n\n return {\n transform: (context: TransformProgramContext): TransformPassResult => {\n const metadata = collectGqlDefinitionMetadata({\n programPath,\n filename: context.filename,\n });\n\n const runtimeCalls: t.Expression[] = [];\n let transformed = false;\n\n // Transform all gql call expressions\n programPath.traverse({\n CallExpression: (callPath) => {\n const result = transformCallExpression({\n callPath,\n filename: context.filename,\n metadata,\n getArtifact: context.artifactLookup,\n });\n\n if (result.isErr()) {\n // Log error and continue - don't fail the entire build for a single error\n console.error(`[@soda-gql/babel] ${formatPluginError(result.error)}`);\n return;\n }\n\n const transformResult = result.value;\n if (transformResult.transformed) {\n transformed = true;\n\n if (transformResult.runtimeCall) {\n runtimeCalls.push(transformResult.runtimeCall);\n }\n }\n },\n });\n\n if (!transformed) {\n return { transformed: false, runtimeArtifacts: undefined };\n }\n\n // Ensure runtime import\n ensureGqlRuntimeImport(programPath);\n\n // Insert runtime side effects immediately if any\n if (runtimeCalls.length > 0) {\n const statements = runtimeCalls.map((expr) => types.expressionStatement(expr));\n const lastLoaderPath = findLastModuleLoader();\n\n if (lastLoaderPath) {\n lastLoaderPath.insertAfter(statements);\n } else {\n programPath.unshiftContainer(\"body\", statements);\n }\n }\n\n // Clean up: remove graphql system imports and recrawl scope\n programPath.scope.crawl();\n removeGraphqlSystemImports(programPath, graphqlSystemIdentifyHelper, context.filename);\n\n return {\n transformed: true,\n runtimeArtifacts: undefined,\n };\n },\n };\n};\n"],"mappings":";;;;;;;;AAiCA,MAAa,kBAAkB,EAC7B,UACA,UACA,UACA,kBAC2D;CAC3D,MAAM,iBAAiB,SAAS;CAEhC,MAAM,OAAO,SAAS,IAAI,eAAe;AACzC,KAAI,CAAC,KACH,QAAO,IAAI,2BAA2B,EAAE,UAAU,CAAC,CAAC;CAGtD,MAAM,cAAc,mBAAmB,UAAU,KAAK,QAAQ;CAC9D,MAAM,WAAW,YAAY,YAAY;AAEzC,KAAI,CAAC,SACH,QAAO,IAAI,2BAA2B;EAAE;EAAU;EAAa,CAAC,CAAC;AAGnE,KAAI,SAAS,SAAS,WACpB,QAAO,GAAG;EAAE;EAAU;EAAa,MAAM;EAAY;EAAU,CAAC;AAGlE,KAAI,SAAS,SAAS,YACpB,QAAO,GAAG;EAAE;EAAU;EAAa,MAAM;EAAa;EAAU,CAAC;AAGnE,QAAO,IACL,mCAAmC;EACjC;EACA;EACA,cAAe,SAA8B;EAC9C,CAAC,CACH;;AAWH,MAAM,8BAA8B,EAAE,gBAAwE;CAC5G,MAAM;CACN,OAAO;CACP,MAAM;CACN,SAAS,iCAAiC;CAC1C,OAAO,EAAE,UAAU;CACnB;CACD;AAED,MAAM,8BAA8B,EAClC,UACA,mBACoE;CACpE,M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