@litsx/babel-preset-litsx 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,9 @@
1
1
  import { createRuntimeHooksTransform } from "@litsx/babel-plugin-shared-hooks";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import traverse from "@babel/traverse";
5
+ import parser from "@litsx/babel-parser";
6
+ import { ensureTypescriptModule } from "./transform-litsx-properties.js";
2
7
 
3
8
  const RUNTIME_MODULE = "@litsx/core";
4
9
  const IMPORT_SOURCES = [RUNTIME_MODULE];
@@ -28,11 +33,646 @@ const RUNTIME_HELPERS = [
28
33
  "useStyle",
29
34
  "useRef",
30
35
  "useCallbackRef",
36
+ "useStableId",
31
37
  ];
32
38
 
33
- export default createRuntimeHooksTransform({
34
- pluginName: "transform-litsx-hooks",
35
- runtimeModule: RUNTIME_MODULE,
36
- importSources: IMPORT_SOURCES,
37
- helperNames: RUNTIME_HELPERS,
38
- });
39
+ const SOURCE_EXTENSIONS = [
40
+ "",
41
+ ".litsx",
42
+ ".tsx",
43
+ ".ts",
44
+ ".jsx",
45
+ ".js",
46
+ ".mjs",
47
+ ".cjs",
48
+ ];
49
+ const DEFAULT_MODULE_RESOLUTION_OPTIONS = {
50
+ moduleResolution: 100,
51
+ allowJs: true,
52
+ checkJs: false,
53
+ jsx: 1,
54
+ target: 99,
55
+ module: 99,
56
+ esModuleInterop: true,
57
+ allowSyntheticDefaultImports: true,
58
+ };
59
+
60
+ function normalizeFilePath(value) {
61
+ return normalizePath(value);
62
+ }
63
+
64
+ function getTraverse() {
65
+ return traverse.default || traverse;
66
+ }
67
+
68
+ function normalizeInMemoryFiles(files) {
69
+ const normalized = new Map();
70
+ if (!files || typeof files !== "object") {
71
+ return normalized;
72
+ }
73
+ for (const [filename, source] of Object.entries(files)) {
74
+ if (typeof source !== "string") continue;
75
+ normalized.set(normalizeFilePath(filename), source);
76
+ }
77
+ return normalized;
78
+ }
79
+
80
+ function createStructuralHookResolver(options = {}) {
81
+ const inMemoryFiles = normalizeInMemoryFiles(options.inMemoryFiles);
82
+ const moduleCache = new Map();
83
+ const resolvedImportCache = new Map();
84
+ const providedTypescriptSession =
85
+ options?.typescriptSession?.projectSession || options?.typescriptSession || null;
86
+ const compilerOptionsCache = new Map();
87
+ const moduleResolutionHostCache = new Map();
88
+
89
+ function getProgramForFile(filename) {
90
+ if (!providedTypescriptSession?.getProgram || !filename) {
91
+ return null;
92
+ }
93
+
94
+ try {
95
+ if (providedTypescriptSession.kind === "project") {
96
+ return providedTypescriptSession.getProgram();
97
+ }
98
+ if (providedTypescriptSession.kind === "standalone") {
99
+ return providedTypescriptSession.getProgram(normalizeFilePath(filename));
100
+ }
101
+ } catch {
102
+ return null;
103
+ }
104
+
105
+ return null;
106
+ }
107
+
108
+ function getCompilerOptions(filename) {
109
+ const cacheKey = normalizeFilePath(filename);
110
+ if (compilerOptionsCache.has(cacheKey)) {
111
+ return compilerOptionsCache.get(cacheKey);
112
+ }
113
+ const program = getProgramForFile(filename);
114
+ const compilerOptions =
115
+ program?.getCompilerOptions?.() ||
116
+ options.compilerOptions ||
117
+ DEFAULT_MODULE_RESOLUTION_OPTIONS;
118
+ compilerOptionsCache.set(cacheKey, compilerOptions);
119
+ return compilerOptions;
120
+ }
121
+
122
+ function getModuleResolutionHost(filename) {
123
+ const cacheKey = normalizeFilePath(filename);
124
+ if (moduleResolutionHostCache.has(cacheKey)) {
125
+ return moduleResolutionHostCache.get(cacheKey);
126
+ }
127
+ const ts = ensureTypescriptModule();
128
+ const host = providedTypescriptSession?.host || ts.sys;
129
+ moduleResolutionHostCache.set(cacheKey, host);
130
+ return host;
131
+ }
132
+
133
+ function fileExists(filename) {
134
+ const normalized = normalizeFilePath(filename);
135
+ return inMemoryFiles.has(normalized) || fs.existsSync(normalized);
136
+ }
137
+
138
+ function readFile(filename) {
139
+ const normalized = normalizeFilePath(filename);
140
+ if (inMemoryFiles.has(normalized)) {
141
+ return inMemoryFiles.get(normalized);
142
+ }
143
+ try {
144
+ return fs.readFileSync(normalized, "utf8");
145
+ } catch {
146
+ return null;
147
+ }
148
+ }
149
+
150
+ function resolveWithExtensions(base) {
151
+ const normalizedBase = normalizeFilePath(base);
152
+ for (const ext of SOURCE_EXTENSIONS) {
153
+ const candidate = `${normalizedBase}${ext}`;
154
+ if (fileExists(candidate)) {
155
+ return normalizeFilePath(candidate);
156
+ }
157
+ }
158
+ for (const ext of SOURCE_EXTENSIONS.filter(Boolean)) {
159
+ const candidate = normalizeFilePath(path.join(base, `index${ext}`));
160
+ if (fileExists(candidate)) {
161
+ return candidate;
162
+ }
163
+ }
164
+ return null;
165
+ }
166
+
167
+ function resolvePathAlias(containingFile, source) {
168
+ const compilerOptions = getCompilerOptions(containingFile) || {};
169
+ const baseUrl = compilerOptions.baseUrl
170
+ ? normalizeFilePath(
171
+ path.isAbsolute(compilerOptions.baseUrl)
172
+ ? compilerOptions.baseUrl
173
+ : path.resolve(path.dirname(containingFile), compilerOptions.baseUrl)
174
+ )
175
+ : normalizeFilePath(path.dirname(containingFile));
176
+ const pathMappings = compilerOptions.paths || {};
177
+
178
+ for (const [pattern, substitutions] of Object.entries(pathMappings)) {
179
+ const starIndex = pattern.indexOf("*");
180
+ const isStarPattern = starIndex !== -1;
181
+ const prefix = isStarPattern ? pattern.slice(0, starIndex) : pattern;
182
+ const suffix = isStarPattern ? pattern.slice(starIndex + 1) : "";
183
+
184
+ if (isStarPattern) {
185
+ if (!source.startsWith(prefix) || !source.endsWith(suffix)) {
186
+ continue;
187
+ }
188
+ } else if (source !== pattern) {
189
+ continue;
190
+ }
191
+
192
+ const wildcardValue = isStarPattern
193
+ ? source.slice(prefix.length, source.length - suffix.length)
194
+ : "";
195
+
196
+ for (const substitution of substitutions || []) {
197
+ const substituted = isStarPattern
198
+ ? substitution.replace("*", wildcardValue)
199
+ : substitution;
200
+ const candidateBase = path.isAbsolute(substituted)
201
+ ? substituted
202
+ : path.join(baseUrl, substituted);
203
+ const resolved = resolveWithExtensions(candidateBase);
204
+ if (resolved) {
205
+ return resolved;
206
+ }
207
+ }
208
+ }
209
+
210
+ return null;
211
+ }
212
+
213
+ function resolveImport(containingFile, source) {
214
+ if (typeof source !== "string" || !containingFile) {
215
+ return null;
216
+ }
217
+ const cacheKey = `${normalizeFilePath(containingFile)}::${source}`;
218
+ if (resolvedImportCache.has(cacheKey)) {
219
+ return resolvedImportCache.get(cacheKey);
220
+ }
221
+
222
+ const baseDir = path.dirname(containingFile);
223
+ let resolved = source.startsWith(".") || source.startsWith("/")
224
+ ? resolveWithExtensions(path.resolve(baseDir, source))
225
+ : resolvePathAlias(containingFile, source);
226
+
227
+ if (!resolved) {
228
+ const ts = ensureTypescriptModule();
229
+ try {
230
+ const resolution = ts.resolveModuleName(
231
+ source,
232
+ normalizeFilePath(containingFile),
233
+ getCompilerOptions(containingFile),
234
+ getModuleResolutionHost(containingFile)
235
+ );
236
+ const resolvedFileName = resolution?.resolvedModule?.resolvedFileName;
237
+ if (resolvedFileName) {
238
+ resolved = resolveWithExtensions(resolvedFileName) || normalizeFilePath(resolvedFileName);
239
+ }
240
+ } catch {
241
+ resolved = null;
242
+ }
243
+ }
244
+
245
+ resolvedImportCache.set(cacheKey, resolved);
246
+ return resolved;
247
+ }
248
+
249
+ function getParserPluginsForModule(filename, source) {
250
+ if (/\.(?:[cm]?ts|tsx|litsx)$/i.test(filename)) {
251
+ return ["typescript"];
252
+ }
253
+ if (/\b(?:as|satisfies)\s+[^;,)]+/.test(source)) {
254
+ return ["typescript"];
255
+ }
256
+ return [];
257
+ }
258
+
259
+ function getImportedName(specifier) {
260
+ if (specifier.type === "ImportDefaultSpecifier") return "default";
261
+ if (specifier.type === "ImportNamespaceSpecifier") return "*";
262
+ return specifier.imported?.name ?? specifier.imported?.value ?? null;
263
+ }
264
+
265
+ function isDefineHookCallee(node, analysis) {
266
+ if (!node) return false;
267
+ if (node.type === "Identifier") {
268
+ return analysis.defineHookLocals.has(node.name);
269
+ }
270
+ if (
271
+ node.type === "MemberExpression" &&
272
+ !node.computed &&
273
+ node.property?.type === "Identifier" &&
274
+ node.property.name === "defineHook" &&
275
+ node.object?.type === "Identifier"
276
+ ) {
277
+ return analysis.runtimeNamespaceLocals.has(node.object.name);
278
+ }
279
+ return false;
280
+ }
281
+
282
+ function addExportBinding(analysis, exportedName, info) {
283
+ if (exportedName) {
284
+ analysis.exportBindings.set(exportedName, info);
285
+ }
286
+ }
287
+
288
+ function getDefineHookPhaseInfo(init) {
289
+ const definition = init?.arguments?.[0];
290
+ if (!definition || definition.type !== "ObjectExpression") {
291
+ return {
292
+ hasStaticPhase: false,
293
+ hasInstancePhase: true,
294
+ };
295
+ }
296
+ const hasProperty = (name) => definition.properties.some((property) => {
297
+ if (property.type !== "ObjectProperty" && property.type !== "ObjectMethod") {
298
+ return false;
299
+ }
300
+ const key = property.key;
301
+ return (
302
+ (key.type === "Identifier" && key.name === name) ||
303
+ (key.type === "StringLiteral" && key.value === name)
304
+ );
305
+ });
306
+ return {
307
+ hasStaticPhase: hasProperty("static"),
308
+ hasInstancePhase: hasProperty("setup") || hasProperty("createState") || hasProperty("middlewares"),
309
+ };
310
+ }
311
+
312
+ function analyzeModule(filename) {
313
+ const normalizedFilename = normalizeFilePath(filename);
314
+ if (!normalizedFilename) return null;
315
+ if (moduleCache.has(normalizedFilename)) {
316
+ return moduleCache.get(normalizedFilename);
317
+ }
318
+
319
+ const source = readFile(normalizedFilename);
320
+ if (typeof source !== "string") {
321
+ moduleCache.set(normalizedFilename, null);
322
+ return null;
323
+ }
324
+
325
+ const analysis = {
326
+ filename: normalizedFilename,
327
+ importBindings: new Map(),
328
+ exportBindings: new Map(),
329
+ defineHookLocals: new Set(),
330
+ runtimeNamespaceLocals: new Set(),
331
+ structuralLocals: new Set(),
332
+ structuralLocalInfo: new Map(),
333
+ customHookPaths: new Map(),
334
+ customHookUsageCache: new Map(),
335
+ };
336
+ moduleCache.set(normalizedFilename, analysis);
337
+
338
+ let ast;
339
+ try {
340
+ ast = parser.parse(source, {
341
+ sourceType: "module",
342
+ plugins: getParserPluginsForModule(normalizedFilename, source),
343
+ });
344
+ } catch {
345
+ moduleCache.set(normalizedFilename, null);
346
+ return null;
347
+ }
348
+
349
+ getTraverse()(ast, {
350
+ Program(programPath) {
351
+ for (const statementPath of programPath.get("body")) {
352
+ const node = statementPath.node;
353
+
354
+ if (statementPath.isImportDeclaration()) {
355
+ const sourceValue = node.source.value;
356
+ const resolvedSource = resolveImport(normalizedFilename, sourceValue);
357
+ for (const specifier of node.specifiers) {
358
+ const localName = specifier.local?.name;
359
+ if (!localName) continue;
360
+ const importedName = getImportedName(specifier);
361
+ analysis.importBindings.set(localName, {
362
+ importedName,
363
+ source: sourceValue,
364
+ resolvedSource,
365
+ });
366
+ if (sourceValue === RUNTIME_MODULE && importedName === "defineHook") {
367
+ analysis.defineHookLocals.add(localName);
368
+ }
369
+ if (
370
+ sourceValue === RUNTIME_MODULE &&
371
+ (specifier.type === "ImportNamespaceSpecifier" ||
372
+ specifier.type === "ImportDefaultSpecifier")
373
+ ) {
374
+ analysis.runtimeNamespaceLocals.add(localName);
375
+ }
376
+ }
377
+ continue;
378
+ }
379
+
380
+ const declarationPath = statementPath.isExportNamedDeclaration()
381
+ ? statementPath.get("declaration")
382
+ : statementPath;
383
+
384
+ if (declarationPath?.isFunctionDeclaration?.()) {
385
+ const localName = declarationPath.node.id?.name;
386
+ if (localName && /^use[A-Z0-9]/.test(localName)) {
387
+ analysis.customHookPaths.set(localName, declarationPath);
388
+ }
389
+ }
390
+
391
+ if (declarationPath?.isVariableDeclaration?.()) {
392
+ for (const declaratorPath of declarationPath.get("declarations")) {
393
+ const id = declaratorPath.node.id;
394
+ if (id?.type !== "Identifier") continue;
395
+ const init = declaratorPath.node.init;
396
+ if (init?.type === "CallExpression" && isDefineHookCallee(init.callee, analysis)) {
397
+ analysis.structuralLocals.add(id.name);
398
+ analysis.structuralLocalInfo.set(id.name, getDefineHookPhaseInfo(init));
399
+ } else if (
400
+ /^use[A-Z0-9]/.test(id.name) &&
401
+ (
402
+ init?.type === "FunctionExpression" ||
403
+ init?.type === "ArrowFunctionExpression"
404
+ )
405
+ ) {
406
+ analysis.customHookPaths.set(id.name, declaratorPath.get("init"));
407
+ }
408
+ }
409
+ }
410
+
411
+ if (statementPath.isExportNamedDeclaration()) {
412
+ const exportNode = statementPath.node;
413
+ const declaration = exportNode.declaration;
414
+ if (declaration?.type === "VariableDeclaration") {
415
+ for (const declarator of declaration.declarations) {
416
+ const localName = declarator.id?.name;
417
+ if (localName) {
418
+ addExportBinding(analysis, localName, { localName });
419
+ }
420
+ }
421
+ } else if (
422
+ declaration?.type === "FunctionDeclaration" ||
423
+ declaration?.type === "ClassDeclaration"
424
+ ) {
425
+ addExportBinding(analysis, declaration.id?.name, {
426
+ localName: declaration.id?.name,
427
+ });
428
+ }
429
+
430
+ for (const specifier of exportNode.specifiers) {
431
+ const exportedName = specifier.exported?.name ?? specifier.exported?.value ?? null;
432
+ if (!exportedName) continue;
433
+ const localName = specifier.local?.name ?? specifier.local?.value ?? exportedName;
434
+ if (exportNode.source?.value) {
435
+ addExportBinding(analysis, exportedName, {
436
+ importedName: localName,
437
+ resolvedSource: resolveImport(normalizedFilename, exportNode.source.value),
438
+ });
439
+ } else {
440
+ addExportBinding(analysis, exportedName, { localName });
441
+ }
442
+ }
443
+ }
444
+ }
445
+ },
446
+ });
447
+
448
+ return analysis;
449
+ }
450
+
451
+ function isNamespaceStructuralUse(analysis, objectName, propertyName, seen) {
452
+ const importInfo = analysis.importBindings.get(objectName);
453
+ if (!importInfo?.resolvedSource || importInfo.importedName !== "*") {
454
+ return false;
455
+ }
456
+ const importedModule = analyzeModule(importInfo.resolvedSource);
457
+ return (
458
+ isStructuralExport(importedModule, propertyName, seen) ||
459
+ isStructuralCustomExport(importedModule, propertyName, seen)
460
+ );
461
+ }
462
+
463
+ function localCustomHookUsesStructural(analysis, localName, seen = new Set()) {
464
+ if (!analysis || !localName) return false;
465
+ const key = `${analysis.filename}:local:${localName}`;
466
+ if (analysis.customHookUsageCache.has(localName)) {
467
+ return analysis.customHookUsageCache.get(localName);
468
+ }
469
+ if (seen.has(key)) return false;
470
+ const nextSeen = new Set(seen);
471
+ nextSeen.add(key);
472
+
473
+ const fnPath = analysis.customHookPaths.get(localName);
474
+ if (!fnPath?.traverse) {
475
+ analysis.customHookUsageCache.set(localName, false);
476
+ return false;
477
+ }
478
+
479
+ let usesStructural = false;
480
+ fnPath.traverse({
481
+ CallExpression(callPath) {
482
+ if (usesStructural) {
483
+ callPath.stop();
484
+ return;
485
+ }
486
+ const callee = callPath.get("callee");
487
+ if (callee.isIdentifier()) {
488
+ const name = callee.node.name;
489
+ if (analysis.structuralLocals.has(name)) {
490
+ usesStructural = true;
491
+ callPath.stop();
492
+ return;
493
+ }
494
+ if (
495
+ analysis.customHookPaths.has(name) &&
496
+ localCustomHookUsesStructural(analysis, name, nextSeen)
497
+ ) {
498
+ usesStructural = true;
499
+ callPath.stop();
500
+ return;
501
+ }
502
+ const importInfo = analysis.importBindings.get(name);
503
+ if (importInfo?.resolvedSource && importInfo.importedName !== "*") {
504
+ const importedModule = analyzeModule(importInfo.resolvedSource);
505
+ if (
506
+ isStructuralExport(importedModule, importInfo.importedName, nextSeen) ||
507
+ isStructuralCustomExport(importedModule, importInfo.importedName, nextSeen)
508
+ ) {
509
+ usesStructural = true;
510
+ callPath.stop();
511
+ }
512
+ }
513
+ return;
514
+ }
515
+
516
+ if (callee.isMemberExpression({ computed: false })) {
517
+ const object = callee.get("object");
518
+ const property = callee.get("property");
519
+ if (
520
+ object.isIdentifier() &&
521
+ property.isIdentifier() &&
522
+ isNamespaceStructuralUse(analysis, object.node.name, property.node.name, nextSeen)
523
+ ) {
524
+ usesStructural = true;
525
+ callPath.stop();
526
+ }
527
+ }
528
+ },
529
+ });
530
+
531
+ analysis.customHookUsageCache.set(localName, usesStructural);
532
+ return usesStructural;
533
+ }
534
+
535
+ function getStructuralExportInfo(analysis, exportedName, seen = new Set()) {
536
+ if (!analysis || !exportedName) return false;
537
+ const key = `${analysis.filename}:${exportedName}`;
538
+ if (seen.has(key)) return false;
539
+ const nextSeen = new Set(seen);
540
+ nextSeen.add(key);
541
+
542
+ const exportInfo = analysis.exportBindings.get(exportedName);
543
+ if (!exportInfo) {
544
+ return false;
545
+ }
546
+
547
+ if (exportInfo.resolvedSource) {
548
+ return getStructuralExportInfo(
549
+ analyzeModule(exportInfo.resolvedSource),
550
+ exportInfo.importedName,
551
+ nextSeen
552
+ );
553
+ }
554
+
555
+ if (analysis.structuralLocals.has(exportInfo.localName)) {
556
+ return {
557
+ kind: "structural-hook",
558
+ ...(analysis.structuralLocalInfo.get(exportInfo.localName) || {
559
+ hasStaticPhase: false,
560
+ hasInstancePhase: true,
561
+ }),
562
+ };
563
+ }
564
+
565
+ const importInfo = analysis.importBindings.get(exportInfo.localName);
566
+ if (importInfo?.resolvedSource && importInfo.importedName !== "*") {
567
+ return getStructuralExportInfo(
568
+ analyzeModule(importInfo.resolvedSource),
569
+ importInfo.importedName,
570
+ nextSeen
571
+ );
572
+ }
573
+
574
+ return false;
575
+ }
576
+
577
+ function isStructuralExport(analysis, exportedName, seen = new Set()) {
578
+ return Boolean(getStructuralExportInfo(analysis, exportedName, seen));
579
+ }
580
+
581
+ function isStructuralCustomExport(analysis, exportedName, seen = new Set()) {
582
+ if (!analysis || !exportedName) return false;
583
+ const key = `${analysis.filename}:custom:${exportedName}`;
584
+ if (seen.has(key)) return false;
585
+ const nextSeen = new Set(seen);
586
+ nextSeen.add(key);
587
+
588
+ const exportInfo = analysis.exportBindings.get(exportedName);
589
+ if (!exportInfo) {
590
+ return false;
591
+ }
592
+
593
+ if (exportInfo.resolvedSource) {
594
+ return isStructuralCustomExport(
595
+ analyzeModule(exportInfo.resolvedSource),
596
+ exportInfo.importedName,
597
+ nextSeen
598
+ );
599
+ }
600
+
601
+ if (localCustomHookUsesStructural(analysis, exportInfo.localName, nextSeen)) {
602
+ return true;
603
+ }
604
+
605
+ const importInfo = analysis.importBindings.get(exportInfo.localName);
606
+ if (importInfo?.resolvedSource && importInfo.importedName !== "*") {
607
+ return isStructuralCustomExport(
608
+ analyzeModule(importInfo.resolvedSource),
609
+ importInfo.importedName,
610
+ nextSeen
611
+ );
612
+ }
613
+
614
+ return false;
615
+ }
616
+
617
+ return function structuralHookResolver({ filename, source, importedName }) {
618
+ const resolved = resolveImport(filename, source);
619
+ if (!resolved) return false;
620
+ const analysis = analyzeModule(resolved);
621
+ const structuralInfo = getStructuralExportInfo(analysis, importedName);
622
+ if (structuralInfo) {
623
+ return structuralInfo;
624
+ }
625
+ if (isStructuralCustomExport(analysis, importedName)) {
626
+ return "structural-custom-hook";
627
+ }
628
+ return false;
629
+ };
630
+ }
631
+
632
+ function normalizePath(value) {
633
+ return String(value || "").replace(/\\/g, "/");
634
+ }
635
+
636
+ function hashStableId(value) {
637
+ let hash = 2166136261;
638
+ const text = String(value);
639
+ for (let index = 0; index < text.length; index += 1) {
640
+ hash ^= text.charCodeAt(index);
641
+ hash = Math.imul(hash, 16777619);
642
+ }
643
+ return (hash >>> 0).toString(36);
644
+ }
645
+
646
+ function createStableIdCallsiteMetadata(callPath, state, t) {
647
+ const filename =
648
+ state.file?.opts?.sourceFileName ||
649
+ state.file?.opts?.filename ||
650
+ state.filename ||
651
+ "";
652
+ const normalizedFilename = normalizePath(filename);
653
+ const loc = callPath.node.loc?.start ?? null;
654
+ const start = typeof callPath.node.start === "number"
655
+ ? callPath.node.start
656
+ : 0;
657
+ const line = loc?.line ?? 0;
658
+ const column = loc?.column ?? 0;
659
+ const seed = `${normalizedFilename}:${line}:${column}:${start}`;
660
+ return t.stringLiteral(`litsx-stable-${hashStableId(seed)}`);
661
+ }
662
+
663
+ export default function transformLitsxHooks(api, options = {}) {
664
+ const plugin = createRuntimeHooksTransform({
665
+ pluginName: "transform-litsx-hooks",
666
+ runtimeModule: RUNTIME_MODULE,
667
+ importSources: IMPORT_SOURCES,
668
+ helperNames: RUNTIME_HELPERS,
669
+ callMetadataByHelper: {
670
+ useStableId: createStableIdCallsiteMetadata,
671
+ },
672
+ });
673
+
674
+ return plugin(api, {
675
+ ...options,
676
+ structuralHookResolver: createStructuralHookResolver(options),
677
+ });
678
+ }