tempo-sdk 0.0.13 → 0.0.15

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.
@@ -37,9 +37,9 @@ __export(nextjs_loader_exports, {
37
37
  nextjsLoader: () => nextjsLoader
38
38
  });
39
39
  module.exports = __toCommonJS(nextjs_loader_exports);
40
- var import_node_fs4 = require("fs");
40
+ var import_node_fs2 = require("fs");
41
41
  var import_node_module = require("module");
42
- var import_node_path4 = require("path");
42
+ var import_node_path2 = require("path");
43
43
 
44
44
  // ../../modules/annotation/annotate-file.ts
45
45
  var import_oxc_parser2 = require("oxc-parser");
@@ -211,7 +211,6 @@ function computeTempoAnnotatedProps(params) {
211
211
  filepath,
212
212
  modifiedtsMs,
213
213
  computeAnnotatedProps,
214
- typeInfo,
215
214
  elementSupportOverrides
216
215
  } = params;
217
216
  const userProps = computeAnnotatedProps ? computeAnnotatedProps(info, filepath, modifiedtsMs) : defaultComputeAnnotatedProps(info, filepath, modifiedtsMs);
@@ -228,602 +227,42 @@ function computeTempoAnnotatedProps(params) {
228
227
  if (override) {
229
228
  return {
230
229
  ...userProps,
231
- "data-tempo-supports-style": override.supportsStyle,
232
- "data-tempo-supports-classname": override.supportsClassName,
233
230
  "data-tempo-supports-children": hasJsxAttribute(
234
231
  info,
235
232
  "data-tempo-supports-children"
236
233
  ) ? void 0 : override.supportsChildren
237
234
  };
238
235
  }
239
- const support = typeInfo?.get(info.element.openingElement.start);
240
- return {
241
- ...userProps,
242
- "data-tempo-supports-style": support?.supportsStyle ?? false,
243
- "data-tempo-supports-classname": support?.supportsClassName ?? false,
244
- "data-tempo-supports-children": hasJsxAttribute(
245
- info,
246
- "data-tempo-supports-children"
247
- ) ? void 0 : support?.supportsChildren ?? false
248
- };
249
- }
250
-
251
- // type-analyzer.ts
252
- var import_typescript2 = __toESM(require("typescript"), 1);
253
- var import_node_path3 = __toESM(require("path"), 1);
254
- var import_node_fs3 = require("fs");
255
-
256
- // ../../modules/typescript/workspace-service.ts
257
- var import_node_fs2 = require("fs");
258
- var import_node_path2 = __toESM(require("path"), 1);
259
- var import_typescript = __toESM(require("typescript"), 1);
260
- function canonicalPath(input) {
261
- const resolved = import_node_path2.default.resolve(input);
262
- try {
263
- return import_node_fs2.realpathSync.native(resolved);
264
- } catch {
265
- return resolved;
266
- }
267
- }
268
- function compareProjectPriority(left, right) {
269
- const depthDelta = right.rootDir.length - left.rootDir.length;
270
- if (depthDelta !== 0) {
271
- return depthDelta;
272
- }
273
- const priorityDelta = right.priority - left.priority;
274
- if (priorityDelta !== 0) {
275
- return priorityDelta;
276
- }
277
- return left.id.localeCompare(right.id);
278
- }
279
- function isWithinRoot(filePath, rootDir) {
280
- return filePath === rootDir || filePath.startsWith(`${rootDir}${import_node_path2.default.sep}`);
281
- }
282
- function loadProject(descriptor) {
283
- const id = descriptor.id.trim();
284
- if (!id) {
285
- throw new Error("Project id must be a non-empty string");
286
- }
287
- const tsconfigPath = canonicalPath(descriptor.tsconfigPath);
288
- const rootDir = canonicalPath(descriptor.rootDir);
289
- const readResult = import_typescript.default.readConfigFile(tsconfigPath, import_typescript.default.sys.readFile);
290
- if (readResult.error) {
291
- throw new Error(
292
- `Failed to read tsconfig at ${tsconfigPath}: ${import_typescript.default.flattenDiagnosticMessageText(
293
- readResult.error.messageText,
294
- "\n"
295
- )}`
296
- );
297
- }
298
- const parsed = import_typescript.default.parseJsonConfigFileContent(
299
- readResult.config,
300
- import_typescript.default.sys,
301
- import_node_path2.default.dirname(tsconfigPath)
302
- );
303
- if (parsed.errors.length > 0) {
304
- const message = parsed.errors.map(
305
- (diagnostic) => import_typescript.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n")
306
- ).join("; ");
307
- throw new Error(`Failed to parse tsconfig at ${tsconfigPath}: ${message}`);
308
- }
309
- const normalizedFiles = parsed.fileNames.map(
310
- (fileName) => canonicalPath(fileName)
311
- );
312
- return {
313
- id,
314
- rootDir,
315
- tsconfigPath,
316
- priority: descriptor.priority ?? 0,
317
- options: parsed.options,
318
- fileNames: normalizedFiles,
319
- moduleResolutionCache: import_typescript.default.createModuleResolutionCache(
320
- rootDir,
321
- (value) => value,
322
- parsed.options
323
- )
324
- };
325
- }
326
- function getFileMtimeVersion(filePath) {
327
- try {
328
- const stats = (0, import_node_fs2.statSync)(filePath);
329
- return String(stats.mtimeMs);
330
- } catch {
331
- return "0";
332
- }
333
- }
334
- function createTsWorkspaceService(descriptor) {
335
- if (descriptor.projects.length === 0) {
336
- throw new Error(
337
- "TsWorkspaceDescriptor.projects must include at least one project"
338
- );
339
- }
340
- const workspaceRoot = canonicalPath(descriptor.workspaceRoot);
341
- const loadedProjects = descriptor.projects.map(
342
- (project) => loadProject(project)
343
- );
344
- const projectsById = /* @__PURE__ */ new Map();
345
- for (const project of loadedProjects) {
346
- if (projectsById.has(project.id)) {
347
- throw new Error(`Duplicate project id: ${project.id}`);
348
- }
349
- projectsById.set(project.id, project);
350
- }
351
- const primaryProject = (descriptor.primaryProjectId ? projectsById.get(descriptor.primaryProjectId) : null) ?? loadedProjects[0];
352
- if (descriptor.primaryProjectId && !projectsById.has(descriptor.primaryProjectId)) {
353
- throw new Error(
354
- `Primary project id not found: ${descriptor.primaryProjectId}`
355
- );
356
- }
357
- const orderedProjects = [...loadedProjects].sort(compareProjectPriority);
358
- const rootFileNames = /* @__PURE__ */ new Set();
359
- for (const project of loadedProjects) {
360
- for (const fileName of project.fileNames) {
361
- rootFileNames.add(fileName);
362
- }
363
- }
364
- const inMemoryFiles = /* @__PURE__ */ new Map();
365
- let projectVersion = 0;
366
- function getOwningProject(filePath) {
367
- const canonicalFilePath = canonicalPath(filePath);
368
- for (const project of orderedProjects) {
369
- if (isWithinRoot(canonicalFilePath, project.rootDir)) {
370
- return project;
371
- }
372
- }
373
- return primaryProject;
374
- }
375
- const moduleResolutionHost = {
376
- fileExists: import_typescript.default.sys.fileExists,
377
- readFile: import_typescript.default.sys.readFile,
378
- realpath: import_typescript.default.sys.realpath,
379
- directoryExists: import_typescript.default.sys.directoryExists,
380
- getCurrentDirectory: () => workspaceRoot,
381
- getDirectories: import_typescript.default.sys.getDirectories
382
- };
383
- const host = {
384
- getScriptFileNames: () => Array.from(rootFileNames),
385
- getScriptVersion: (filePath) => {
386
- const canonicalFilePath = canonicalPath(filePath);
387
- const inMemory = inMemoryFiles.get(canonicalFilePath);
388
- if (inMemory) {
389
- return String(inMemory.version);
390
- }
391
- return getFileMtimeVersion(canonicalFilePath);
392
- },
393
- getScriptSnapshot: (filePath) => {
394
- const canonicalFilePath = canonicalPath(filePath);
395
- const inMemory = inMemoryFiles.get(canonicalFilePath);
396
- if (inMemory) {
397
- return import_typescript.default.ScriptSnapshot.fromString(inMemory.content);
398
- }
399
- const diskContent = import_typescript.default.sys.readFile(canonicalFilePath);
400
- if (diskContent === void 0) {
401
- return void 0;
402
- }
403
- return import_typescript.default.ScriptSnapshot.fromString(diskContent);
404
- },
405
- getCurrentDirectory: () => workspaceRoot,
406
- getCompilationSettings: () => primaryProject.options,
407
- getDefaultLibFileName: (options) => import_typescript.default.getDefaultLibFilePath(options),
408
- fileExists: import_typescript.default.sys.fileExists,
409
- readFile: import_typescript.default.sys.readFile,
410
- readDirectory: import_typescript.default.sys.readDirectory,
411
- directoryExists: import_typescript.default.sys.directoryExists,
412
- getDirectories: import_typescript.default.sys.getDirectories,
413
- useCaseSensitiveFileNames: () => import_typescript.default.sys.useCaseSensitiveFileNames,
414
- getProjectVersion: () => String(projectVersion),
415
- resolveModuleNames: (moduleNames, containingFile) => {
416
- const owningProject = getOwningProject(containingFile);
417
- return moduleNames.map((moduleName) => {
418
- const ownerResolution = import_typescript.default.resolveModuleName(
419
- moduleName,
420
- containingFile,
421
- owningProject.options,
422
- moduleResolutionHost,
423
- owningProject.moduleResolutionCache
424
- ).resolvedModule;
425
- if (ownerResolution) {
426
- return ownerResolution;
427
- }
428
- if (owningProject.id === primaryProject.id) {
429
- return void 0;
430
- }
431
- return import_typescript.default.resolveModuleName(
432
- moduleName,
433
- containingFile,
434
- primaryProject.options,
435
- moduleResolutionHost,
436
- primaryProject.moduleResolutionCache
437
- ).resolvedModule;
438
- });
439
- }
440
- };
441
- const languageService = import_typescript.default.createLanguageService(
442
- host,
443
- import_typescript.default.createDocumentRegistry()
444
- );
445
- return {
446
- updateFile(filePath, content) {
447
- const canonicalFilePath = canonicalPath(filePath);
448
- const currentVersion = inMemoryFiles.get(canonicalFilePath)?.version ?? 0;
449
- inMemoryFiles.set(canonicalFilePath, {
450
- version: currentVersion + 1,
451
- content
452
- });
453
- if (!rootFileNames.has(canonicalFilePath)) {
454
- rootFileNames.add(canonicalFilePath);
455
- }
456
- projectVersion += 1;
457
- },
458
- closeFile(filePath) {
459
- const canonicalFilePath = canonicalPath(filePath);
460
- inMemoryFiles.delete(canonicalFilePath);
461
- projectVersion += 1;
462
- },
463
- getProgram() {
464
- return languageService.getProgram() ?? null;
465
- },
466
- getSemanticDiagnostics(filePath) {
467
- const canonicalFilePath = canonicalPath(filePath);
468
- return languageService.getSemanticDiagnostics(canonicalFilePath);
469
- },
470
- getDefinition(filePath, position) {
471
- const canonicalFilePath = canonicalPath(filePath);
472
- return languageService.getDefinitionAtPosition(
473
- canonicalFilePath,
474
- position
475
- );
476
- },
477
- dispose() {
478
- languageService.dispose();
479
- }
480
- };
481
- }
482
-
483
- // type-analyzer.ts
484
- function isCustomComponent(node) {
485
- const text = node.getText();
486
- return text.length > 0 && text[0] !== text[0].toLowerCase();
487
- }
488
- function canonicalPath2(value) {
489
- const resolved = import_node_path3.default.resolve(value);
490
- try {
491
- return import_node_fs3.realpathSync.native(resolved);
492
- } catch {
493
- return resolved;
494
- }
495
- }
496
- function parseManagedTsconfigPaths(rawConfig) {
497
- if (!rawConfig || typeof rawConfig !== "object" || Array.isArray(rawConfig)) {
498
- return [];
499
- }
500
- const metadata = rawConfig.tempobook;
501
- if (!metadata || typeof metadata !== "object" || Array.isArray(metadata)) {
502
- return [];
503
- }
504
- const managedPaths = metadata.managedTsconfigPaths;
505
- if (!Array.isArray(managedPaths)) {
506
- return [];
507
- }
508
- return managedPaths.filter(
509
- (entry) => typeof entry === "string" && entry.trim().length > 0
510
- );
511
- }
512
- function parseProjectReferenceTsconfigPaths(references, configDir) {
513
- if (!references || references.length === 0) {
514
- return [];
515
- }
516
- const entries = [];
517
- for (const reference of references) {
518
- const referencePath = reference.path;
519
- if (!referencePath) {
520
- continue;
521
- }
522
- const resolvedPath = import_node_path3.default.resolve(configDir, referencePath);
523
- const tsconfigPath = resolvedPath.endsWith(".json") ? resolvedPath : import_node_path3.default.join(resolvedPath, "tsconfig.json");
524
- entries.push(tsconfigPath);
525
- }
526
- return entries;
527
- }
528
- function buildWorkspaceProjects(root, configPath, parsedConfig, rawConfig) {
529
- const configDir = import_node_path3.default.dirname(configPath);
530
- const projects = [
531
- {
532
- id: "root",
533
- rootDir: root,
534
- tsconfigPath: configPath,
535
- priority: 0
536
- }
537
- ];
538
- const seenTsconfigPaths = /* @__PURE__ */ new Set([canonicalPath2(configPath)]);
539
- const referencedTsconfigPaths = parseProjectReferenceTsconfigPaths(
540
- parsedConfig.projectReferences,
541
- configDir
542
- );
543
- const managedTsconfigPaths = parseManagedTsconfigPaths(rawConfig).map(
544
- (entry) => import_node_path3.default.resolve(configDir, entry)
545
- );
546
- const candidateTsconfigPaths = [
547
- ...managedTsconfigPaths,
548
- ...referencedTsconfigPaths
549
- ];
550
- for (const candidatePath of candidateTsconfigPaths) {
551
- const normalizedPath = canonicalPath2(candidatePath);
552
- if (seenTsconfigPaths.has(normalizedPath)) {
553
- continue;
554
- }
555
- if (!import_typescript2.default.sys.fileExists(normalizedPath)) {
556
- continue;
557
- }
558
- seenTsconfigPaths.add(normalizedPath);
559
- projects.push({
560
- id: `external-${projects.length}`,
561
- rootDir: import_node_path3.default.dirname(normalizedPath),
562
- tsconfigPath: normalizedPath,
563
- priority: 0
564
- });
565
- }
566
- return projects;
567
- }
568
- function createTypeAnalyzer(root) {
569
- const configPath = import_typescript2.default.findConfigFile(
570
- root,
571
- import_typescript2.default.sys.fileExists,
572
- "tsconfig.json"
573
- );
574
- if (!configPath) return null;
575
- const configFile = import_typescript2.default.readConfigFile(configPath, import_typescript2.default.sys.readFile);
576
- if (configFile.error) return null;
577
- const parsedConfig = import_typescript2.default.parseJsonConfigFileContent(
578
- configFile.config,
579
- import_typescript2.default.sys,
580
- root
581
- );
582
- const workspaceProjects = buildWorkspaceProjects(
583
- root,
584
- configPath,
585
- parsedConfig,
586
- configFile.config
587
- );
588
- const workspaceProjectRoots = workspaceProjects.map(
589
- (project) => canonicalPath2(project.rootDir)
590
- );
591
- const workspaceService = createTsWorkspaceService({
592
- workspaceRoot: root,
593
- primaryProjectId: "root",
594
- projects: workspaceProjects
595
- });
596
- let cssPropertiesType;
597
- function resolveCSSPropertiesType(checker, sourceFile) {
598
- if (cssPropertiesType !== void 0) return cssPropertiesType;
599
- try {
600
- let jsxNs = checker.resolveName(
601
- "JSX",
602
- sourceFile,
603
- import_typescript2.default.SymbolFlags.Namespace,
604
- false
605
- );
606
- if (!jsxNs) {
607
- const program = workspaceService.getProgram();
608
- const compilerOptions = program?.getCompilerOptions();
609
- const jsxImportSource = compilerOptions?.jsxImportSource ?? "react";
610
- const resolved = import_typescript2.default.resolveModuleName(
611
- `${jsxImportSource}/jsx-runtime`,
612
- sourceFile.fileName,
613
- compilerOptions,
614
- import_typescript2.default.sys
615
- );
616
- if (resolved.resolvedModule) {
617
- const runtimeFile = program?.getSourceFile(
618
- resolved.resolvedModule.resolvedFileName
619
- );
620
- if (runtimeFile) {
621
- const runtimeSymbol = checker.getSymbolAtLocation(runtimeFile);
622
- if (runtimeSymbol) {
623
- const exports2 = checker.getExportsOfModule(runtimeSymbol);
624
- jsxNs = exports2.find((s) => s.name === "JSX");
625
- }
626
- }
627
- }
628
- }
629
- if (!jsxNs) {
630
- cssPropertiesType = null;
631
- return null;
632
- }
633
- const intrinsicSym = checker.getExportsOfModule(jsxNs).find((s) => s.name === "IntrinsicElements") ?? checker.getDeclaredTypeOfSymbol(jsxNs).getProperty("IntrinsicElements");
634
- if (!intrinsicSym) {
635
- cssPropertiesType = null;
636
- return null;
637
- }
638
- const divSym = checker.getDeclaredTypeOfSymbol(intrinsicSym).getProperty("div");
639
- if (!divSym) {
640
- cssPropertiesType = null;
641
- return null;
642
- }
643
- const styleSym = checker.getTypeOfSymbol(divSym).getProperty("style");
644
- if (!styleSym) {
645
- cssPropertiesType = null;
646
- return null;
647
- }
648
- const styleType = checker.getTypeOfSymbol(styleSym);
649
- if (styleType.isUnion()) {
650
- const nonUndefined = styleType.types.find(
651
- (t) => !(t.flags & import_typescript2.default.TypeFlags.Undefined)
652
- );
653
- cssPropertiesType = nonUndefined ?? null;
654
- } else {
655
- cssPropertiesType = styleType;
656
- }
657
- } catch {
658
- cssPropertiesType = null;
659
- }
660
- return cssPropertiesType;
661
- }
662
- let reactNodeType;
663
- function resolveReactNodeType(checker, sourceFile) {
664
- if (reactNodeType !== void 0) return reactNodeType;
665
- try {
666
- let jsxNs = checker.resolveName(
667
- "JSX",
668
- sourceFile,
669
- import_typescript2.default.SymbolFlags.Namespace,
670
- false
671
- );
672
- if (!jsxNs) {
673
- const program = workspaceService.getProgram();
674
- const compilerOptions = program?.getCompilerOptions();
675
- const jsxImportSource = compilerOptions?.jsxImportSource ?? "react";
676
- const resolved = import_typescript2.default.resolveModuleName(
677
- `${jsxImportSource}/jsx-runtime`,
678
- sourceFile.fileName,
679
- compilerOptions,
680
- import_typescript2.default.sys
681
- );
682
- if (resolved.resolvedModule) {
683
- const runtimeFile = program?.getSourceFile(
684
- resolved.resolvedModule.resolvedFileName
685
- );
686
- if (runtimeFile) {
687
- const runtimeSymbol = checker.getSymbolAtLocation(runtimeFile);
688
- if (runtimeSymbol) {
689
- const exports2 = checker.getExportsOfModule(runtimeSymbol);
690
- jsxNs = exports2.find((s) => s.name === "JSX");
691
- }
692
- }
693
- }
694
- }
695
- if (!jsxNs) {
696
- reactNodeType = null;
697
- return null;
698
- }
699
- const intrinsicSym = checker.getExportsOfModule(jsxNs).find((s) => s.name === "IntrinsicElements") ?? checker.getDeclaredTypeOfSymbol(jsxNs).getProperty("IntrinsicElements");
700
- if (!intrinsicSym) {
701
- reactNodeType = null;
702
- return null;
703
- }
704
- const divSym = checker.getDeclaredTypeOfSymbol(intrinsicSym).getProperty("div");
705
- if (!divSym) {
706
- reactNodeType = null;
707
- return null;
708
- }
709
- const childrenSym = checker.getTypeOfSymbol(divSym).getProperty("children");
710
- if (!childrenSym) {
711
- reactNodeType = null;
712
- return null;
713
- }
714
- const childrenType = checker.getTypeOfSymbol(childrenSym);
715
- if (childrenType.isUnion()) {
716
- const nonUndefined = childrenType.types.find(
717
- (t) => !(t.flags & import_typescript2.default.TypeFlags.Undefined)
718
- );
719
- reactNodeType = nonUndefined ?? null;
720
- } else {
721
- reactNodeType = childrenType;
722
- }
723
- } catch {
724
- reactNodeType = null;
725
- }
726
- return reactNodeType;
727
- }
728
- return {
729
- analyzeFileTypes(filePath, source) {
730
- const canonicalFilePath = canonicalPath2(filePath);
731
- const belongsToWorkspace = workspaceProjectRoots.some(
732
- (projectRoot) => canonicalFilePath === projectRoot || canonicalFilePath.startsWith(`${projectRoot}${import_node_path3.default.sep}`)
733
- );
734
- if (!belongsToWorkspace) {
735
- return null;
736
- }
737
- workspaceService.updateFile(filePath, source);
738
- const program = workspaceService.getProgram();
739
- if (!program) return null;
740
- const sourceFile = program.getSourceFile(filePath);
741
- if (!sourceFile) return null;
742
- const checker = program.getTypeChecker();
743
- const cssProps = resolveCSSPropertiesType(checker, sourceFile);
744
- const result = /* @__PURE__ */ new Map();
745
- function visit(node) {
746
- if ((import_typescript2.default.isJsxOpeningElement(node) || import_typescript2.default.isJsxSelfClosingElement(node)) && isCustomComponent(node.tagName)) {
747
- const position = node.getStart(sourceFile);
748
- const attrsType = checker.getContextualType(node.attributes);
749
- let supportsStyle = false;
750
- let supportsClassName = false;
751
- let supportsChildren = false;
752
- if (attrsType) {
753
- const classNameProp = attrsType.getProperty("className");
754
- if (classNameProp) {
755
- const propType = checker.getTypeOfSymbol(classNameProp);
756
- supportsClassName = checker.isTypeAssignableTo(
757
- checker.getStringType(),
758
- propType
759
- );
760
- }
761
- const styleProp = attrsType.getProperty("style");
762
- if (styleProp && cssProps) {
763
- let propType = checker.getTypeOfSymbol(styleProp);
764
- if (propType.isUnion()) {
765
- const nonUndefined = propType.types.find(
766
- (t) => !(t.flags & import_typescript2.default.TypeFlags.Undefined)
767
- );
768
- if (nonUndefined) propType = nonUndefined;
769
- }
770
- supportsStyle = checker.isTypeAssignableTo(cssProps, propType);
771
- }
772
- const reactNode = resolveReactNodeType(checker, sourceFile);
773
- const childrenProp = attrsType.getProperty("children");
774
- if (childrenProp && reactNode) {
775
- let propType = checker.getTypeOfSymbol(childrenProp);
776
- if (propType.isUnion()) {
777
- const nonUndefined = propType.types.find(
778
- (t) => !(t.flags & import_typescript2.default.TypeFlags.Undefined)
779
- );
780
- if (nonUndefined) propType = nonUndefined;
781
- }
782
- supportsChildren = checker.isTypeAssignableTo(
783
- reactNode,
784
- propType
785
- );
786
- }
787
- }
788
- result.set(position, { supportsStyle, supportsClassName, supportsChildren });
789
- }
790
- import_typescript2.default.forEachChild(node, visit);
791
- }
792
- visit(sourceFile);
793
- return result;
794
- }
795
- };
236
+ return userProps;
796
237
  }
797
238
 
798
239
  // nextjs-loader.ts
799
240
  var ROOT_META_NAME = "tempo-project-root";
800
241
  var cachedCanonicalRoot = null;
801
- var cachedTypeAnalyzer = null;
802
242
  var cachedUserComputeProps;
803
243
  var cachedComputeModulePath = null;
804
244
  function _resetLoaderState() {
805
245
  cachedCanonicalRoot = null;
806
- cachedTypeAnalyzer = null;
807
246
  cachedUserComputeProps = void 0;
808
247
  cachedComputeModulePath = null;
809
248
  }
810
- function stripQueryAndHash(path3) {
811
- const queryIdx = path3.indexOf("?");
812
- const hashIdx = path3.indexOf("#");
813
- let end = path3.length;
249
+ function stripQueryAndHash(path) {
250
+ const queryIdx = path.indexOf("?");
251
+ const hashIdx = path.indexOf("#");
252
+ let end = path.length;
814
253
  if (queryIdx !== -1) end = Math.min(end, queryIdx);
815
254
  if (hashIdx !== -1) end = Math.min(end, hashIdx);
816
- return path3.slice(0, end);
255
+ return path.slice(0, end);
817
256
  }
818
257
  function resolveCanonicalRoot(rootContext) {
819
258
  try {
820
- return import_node_fs4.realpathSync.native(rootContext);
259
+ return import_node_fs2.realpathSync.native(rootContext);
821
260
  } catch {
822
261
  return rootContext;
823
262
  }
824
263
  }
825
- function isInNodeModules(path3) {
826
- return path3.includes(`${import_node_path4.sep}node_modules${import_node_path4.sep}`);
264
+ function isInNodeModules(path) {
265
+ return path.includes(`${import_node_path2.sep}node_modules${import_node_path2.sep}`);
827
266
  }
828
267
  function findFirstJSXElement(program, tagName) {
829
268
  let result = null;
@@ -891,7 +330,7 @@ function injectRootMetaIntoAnnotatedSource(annotatedSource, filename, root) {
891
330
  return injectRootMetaIntoSource(annotatedSource, filename, root);
892
331
  }
893
332
  function loadUserComputeProps(modulePath, canonicalRoot) {
894
- const resolved = (0, import_node_path4.resolve)(canonicalRoot, modulePath);
333
+ const resolved = (0, import_node_path2.resolve)(canonicalRoot, modulePath);
895
334
  const requireFromRoot = (0, import_node_module.createRequire)(`${canonicalRoot}/__tempo_loader__.js`);
896
335
  const mod = requireFromRoot(resolved);
897
336
  const fn = mod && (mod.default ?? mod);
@@ -921,13 +360,6 @@ function nextjsLoader(source) {
921
360
  cachedCanonicalRoot = resolveCanonicalRoot(this.rootContext);
922
361
  }
923
362
  const canonicalRoot = cachedCanonicalRoot;
924
- if (cachedTypeAnalyzer === null) {
925
- try {
926
- cachedTypeAnalyzer = createTypeAnalyzer(canonicalRoot);
927
- } catch {
928
- cachedTypeAnalyzer = { analyzeFileTypes: () => null };
929
- }
930
- }
931
363
  const userModule = options.computeAnnotatedPropsModule;
932
364
  if (userModule && userModule !== cachedComputeModulePath) {
933
365
  try {
@@ -940,12 +372,8 @@ function nextjsLoader(source) {
940
372
  cachedUserComputeProps = null;
941
373
  }
942
374
  const userComputeProps = cachedUserComputeProps;
943
- const filepath = (0, import_node_path4.relative)(canonicalRoot, cleanPath);
944
- const modifiedtsMs = Math.trunc((0, import_node_fs4.statSync)(cleanPath).mtimeMs);
945
- const typeInfo = cachedTypeAnalyzer?.analyzeFileTypes(
946
- cleanPath,
947
- source
948
- ) ?? null;
375
+ const filepath = (0, import_node_path2.relative)(canonicalRoot, cleanPath);
376
+ const modifiedtsMs = Math.trunc((0, import_node_fs2.statSync)(cleanPath).mtimeMs);
949
377
  const annotated = annotateFile(
950
378
  source,
951
379
  cleanPath,
@@ -953,8 +381,7 @@ function nextjsLoader(source) {
953
381
  info,
954
382
  filepath,
955
383
  modifiedtsMs,
956
- computeAnnotatedProps: userComputeProps ?? void 0,
957
- typeInfo
384
+ computeAnnotatedProps: userComputeProps ?? void 0
958
385
  })
959
386
  );
960
387
  let finalSource = annotated.annotatedSource;