@ttsc/evidence 0.33.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/native/loader.go CHANGED
@@ -11,6 +11,7 @@ import (
11
11
  shimast "github.com/microsoft/typescript-go/shim/ast"
12
12
  shimcore "github.com/microsoft/typescript-go/shim/core"
13
13
  shimparser "github.com/microsoft/typescript-go/shim/parser"
14
+ shimtspath "github.com/microsoft/typescript-go/shim/tspath"
14
15
  )
15
16
 
16
17
  // typeScriptLoader materializes TypeScript inventories for a reference
@@ -123,14 +124,25 @@ func (loader *typeScriptLoader) parse(relative string) *artifactInventory {
123
124
  loader.failures[relative] = err.Error()
124
125
  return nil
125
126
  }
127
+ // The parser's file name must be rooted. The read above resolves a relative
128
+ // path against the working directory (only an empty project root leaves one),
129
+ // so anchor the name at that same directory: it names the file that was read.
130
+ absolute, err := filepath.Abs(resolveProjectPath(loader.root, relative))
131
+ if err != nil {
132
+ loader.failures[relative] = err.Error()
133
+ return nil
134
+ }
135
+ fileName, ok := shimtspath.TryRootedFilePathFromAbsolute(absolute)
136
+ if !ok {
137
+ loader.failures[relative] = "the TypeScript source path is not rooted: " + absolute
138
+ return nil
139
+ }
126
140
  kind := shimcore.ScriptKindTS
127
141
  if strings.HasSuffix(strings.ToLower(relative), ".tsx") {
128
142
  kind = shimcore.ScriptKindTSX
129
143
  }
130
144
  file := shimparser.ParseSourceFile(
131
- shimast.SourceFileParseOptions{
132
- FileName: filepath.ToSlash(resolveProjectPath(loader.root, relative)),
133
- },
145
+ shimast.SourceFileParseOptions{FileName: fileName},
134
146
  string(content),
135
147
  kind,
136
148
  )
@@ -66,7 +66,7 @@ func (singularRule) Check(ctx *rule.Context, node *shimast.Node) {
66
66
  return
67
67
  }
68
68
 
69
- base, extension := splitModuleBaseName(ctx.File.FileName())
69
+ base, extension := splitModuleBaseName(string(ctx.File.FileName()))
70
70
  if base == "index" {
71
71
  return
72
72
  }
@@ -35,12 +35,12 @@ func extendTypeScriptInventories(
35
35
  ) {
36
36
  bases := typeScriptMatchBases(config, root)
37
37
  for _, file := range sources {
38
- if file == nil || !isTypeScriptPath(file.FileName()) {
38
+ if file == nil || !isTypeScriptPath(string(file.FileName())) {
39
39
  continue
40
40
  }
41
41
  for _, entry := range bases {
42
42
  base := entry.base
43
- relative, ok := entry.relativeOf(file.FileName())
43
+ relative, ok := entry.relativeOf(string(file.FileName()))
44
44
  if !ok || !isTypeScriptPath(relative) {
45
45
  continue
46
46
  }
@@ -2050,11 +2050,11 @@ func recordGovernedTypeScriptFiles(
2050
2050
  }
2051
2051
  bases := typeScriptMatchBases(declared, root)
2052
2052
  for _, file := range sources {
2053
- if file == nil || !isTypeScriptPath(file.FileName()) {
2053
+ if file == nil || !isTypeScriptPath(string(file.FileName())) {
2054
2054
  continue
2055
2055
  }
2056
2056
  for _, entry := range bases {
2057
- relative, ok := entry.relativeOf(file.FileName())
2057
+ relative, ok := entry.relativeOf(string(file.FileName()))
2058
2058
  if !ok || !isTypeScriptPath(relative) {
2059
2059
  continue
2060
2060
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttsc/evidence",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "description": "Evidence-graph lint contributor for @ttsc/lint: declare provenance with a JSDoc @evidence tag and fail the build when it is missing or dangling.",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -49,8 +49,8 @@
49
49
  "@types/node": "^25.3.0",
50
50
  "rimraf": "^6.1.2",
51
51
  "typescript": "^7.0.2",
52
- "@ttsc/lint": "0.33.0",
53
- "ttsc": "0.33.0"
52
+ "@ttsc/lint": "0.34.0",
53
+ "ttsc": "0.34.0"
54
54
  },
55
55
  "dependencies": {
56
56
  "@prisma/prisma-schema-wasm": "7.10.0-2.d0368e25c88e68caa4d283b5f2d88d1b76ed9356",