@ttsc/strip 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.
- package/driver/config.go +36 -2
- package/package.json +1 -1
package/driver/config.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"
|
|
@@ -850,7 +852,7 @@ func stripResolveConfigTsgo(anchors []string) string {
|
|
|
850
852
|
// the package nor its platform dependency.
|
|
851
853
|
//
|
|
852
854
|
// Mirrors resolveTsgo.ts so the Go plugin and the JS launcher name one file:
|
|
853
|
-
//
|
|
855
|
+
// declared npm aliases before `typescript`, then the native platform package
|
|
854
856
|
// resolved from that manifest, then `lib/tsc` inside it.
|
|
855
857
|
//
|
|
856
858
|
// The install is chased to its real directory before the second hop, because
|
|
@@ -861,7 +863,39 @@ func stripResolveConfigTsgo(anchors []string) string {
|
|
|
861
863
|
// package. NTFS junctions defeat filepath.EvalSymlinks, so the link component
|
|
862
864
|
// is chased by hand first, the same order stripLoaderTempBase uses.
|
|
863
865
|
func stripTsgoBinaryFrom(anchor string) string {
|
|
864
|
-
|
|
866
|
+
names, err := compileraliases.Names(anchor)
|
|
867
|
+
if err != nil {
|
|
868
|
+
return ""
|
|
869
|
+
}
|
|
870
|
+
manifest := ""
|
|
871
|
+
for _, name := range names {
|
|
872
|
+
if name == "typescript" && manifest != "" {
|
|
873
|
+
break
|
|
874
|
+
}
|
|
875
|
+
candidate := stripNodePackageManifestFrom(anchor, name)
|
|
876
|
+
if candidate == "" {
|
|
877
|
+
continue
|
|
878
|
+
}
|
|
879
|
+
body, err := os.ReadFile(candidate)
|
|
880
|
+
var metadata struct {
|
|
881
|
+
Name string `json:"name"`
|
|
882
|
+
Version string `json:"version"`
|
|
883
|
+
}
|
|
884
|
+
if err != nil || json.Unmarshal(body, &metadata) != nil {
|
|
885
|
+
return ""
|
|
886
|
+
}
|
|
887
|
+
major, err := strconv.Atoi(strings.SplitN(metadata.Version, ".", 2)[0])
|
|
888
|
+
if err == nil && major < 7 {
|
|
889
|
+
continue
|
|
890
|
+
}
|
|
891
|
+
if name != "typescript" && (metadata.Name != "typescript" || err != nil) {
|
|
892
|
+
continue
|
|
893
|
+
}
|
|
894
|
+
if manifest != "" && stripRealpathIfPossible(stripResolveDirLink(filepath.Dir(manifest))) != stripRealpathIfPossible(stripResolveDirLink(filepath.Dir(candidate))) {
|
|
895
|
+
return ""
|
|
896
|
+
}
|
|
897
|
+
manifest = candidate
|
|
898
|
+
}
|
|
865
899
|
if manifest == "" {
|
|
866
900
|
return ""
|
|
867
901
|
}
|
package/package.json
CHANGED