@ttsc/banner 0.34.1 → 0.34.3

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.
Files changed (2) hide show
  1. package/driver/banner.go +36 -2
  2. package/package.json +2 -2
package/driver/banner.go CHANGED
@@ -11,10 +11,12 @@ import (
11
11
  "os/exec"
12
12
  "path/filepath"
13
13
  "runtime"
14
+ "strconv"
14
15
  "strings"
15
16
  "syscall"
16
17
 
17
18
  "github.com/samchon/ttsc/packages/ttsc/driver"
19
+ "github.com/samchon/ttsc/packages/ttsc/driver/compileraliases"
18
20
  "github.com/samchon/ttsc/packages/ttsc/driver/configloaderscratch"
19
21
  "github.com/samchon/ttsc/packages/ttsc/driver/resolutioninputs"
20
22
  "github.com/samchon/ttsc/packages/ttsc/driver/windowsjunction"
@@ -1044,7 +1046,7 @@ func resolveConfigTsgo(anchors []string) string {
1044
1046
  // nor its platform dependency.
1045
1047
  //
1046
1048
  // Mirrors resolveTsgo.ts so the Go plugin and the JS launcher name one file:
1047
- // the `typescript` manifest, then `@typescript/typescript-<platform>-<arch>`
1049
+ // declared npm aliases before `typescript`, then the native platform package
1048
1050
  // resolved from that manifest, then `lib/tsc` inside it.
1049
1051
  //
1050
1052
  // The install is chased to its real directory before the second hop, because
@@ -1055,7 +1057,39 @@ func resolveConfigTsgo(anchors []string) string {
1055
1057
  // package. NTFS junctions defeat filepath.EvalSymlinks, so the link component
1056
1058
  // is chased by hand first, the same order loaderTempBase uses.
1057
1059
  func tsgoBinaryFrom(anchor string) string {
1058
- manifest := nodePackageManifestFrom(anchor, "typescript")
1060
+ names, err := compileraliases.Names(anchor)
1061
+ if err != nil {
1062
+ return ""
1063
+ }
1064
+ manifest := ""
1065
+ for _, name := range names {
1066
+ if name == "typescript" && manifest != "" {
1067
+ break
1068
+ }
1069
+ candidate := nodePackageManifestFrom(anchor, name)
1070
+ if candidate == "" {
1071
+ continue
1072
+ }
1073
+ body, err := os.ReadFile(candidate)
1074
+ var metadata struct {
1075
+ Name string `json:"name"`
1076
+ Version string `json:"version"`
1077
+ }
1078
+ if err != nil || json.Unmarshal(body, &metadata) != nil {
1079
+ return ""
1080
+ }
1081
+ major, err := strconv.Atoi(strings.SplitN(metadata.Version, ".", 2)[0])
1082
+ if err == nil && major < 7 {
1083
+ continue
1084
+ }
1085
+ if name != "typescript" && (metadata.Name != "typescript" || err != nil) {
1086
+ continue
1087
+ }
1088
+ if manifest != "" && realpathIfPossible(resolveDirLink(filepath.Dir(manifest))) != realpathIfPossible(resolveDirLink(filepath.Dir(candidate))) {
1089
+ return ""
1090
+ }
1091
+ manifest = candidate
1092
+ }
1059
1093
  if manifest == "" {
1060
1094
  return ""
1061
1095
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttsc/banner",
3
- "version": "0.34.1",
3
+ "version": "0.34.3",
4
4
  "description": "First-party ttsc plugin that adds package-documentation JSDoc banners during emit.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -36,7 +36,7 @@
36
36
  "@types/node": "^25.3.0",
37
37
  "rimraf": "^6.1.2",
38
38
  "typescript": "^7.0.2",
39
- "ttsc": "0.34.1"
39
+ "ttsc": "0.34.3"
40
40
  },
41
41
  "repository": {
42
42
  "type": "git",