@ttsc/banner 0.33.0-next.1 → 0.33.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.
Files changed (2) hide show
  1. package/driver/banner.go +25 -2
  2. package/package.json +2 -2
package/driver/banner.go CHANGED
@@ -5,14 +5,17 @@ import (
5
5
  "context"
6
6
  "crypto/sha256"
7
7
  "encoding/json"
8
+ "errors"
8
9
  "fmt"
9
10
  "os"
10
11
  "os/exec"
11
12
  "path/filepath"
12
13
  "runtime"
13
14
  "strings"
15
+ "syscall"
14
16
 
15
17
  "github.com/samchon/ttsc/packages/ttsc/driver"
18
+ "github.com/samchon/ttsc/packages/ttsc/driver/configloaderscratch"
16
19
  "github.com/samchon/ttsc/packages/ttsc/driver/resolutioninputs"
17
20
  "github.com/samchon/ttsc/packages/ttsc/driver/windowsjunction"
18
21
  )
@@ -573,9 +576,10 @@ func decodeBannerConfigLoaderOutput(output []byte) (bannerLoadedConfig, error) {
573
576
  //
574
577
  // Both tools this spawns, the launcher and the compiler handed to it, are
575
578
  // resolved from the project rather than from the process environment alone; see
576
- // configToolAnchors.
579
+ // configToolAnchors. When TEMP is on another volume, an already-open identity
580
+ // store can hold the loader without changing the config directory's metadata.
577
581
  func loadBannerTypeScriptConfigFileWithInputs(location, resolutionRoot string) (bannerLoadedConfig, error) {
578
- tempDir, err := os.MkdirTemp(loaderTempBase(location, os.TempDir()), "ttsc-banner-config-")
582
+ tempDir, err := createBannerConfigLoaderTempDir(location, os.TempDir(), os.Getenv("TTSC_NATIVE_PLUGIN_RECORD_ROOT"))
579
583
  if err != nil {
580
584
  return bannerLoadedConfig{}, fmt.Errorf("@ttsc/banner: create config loader tempdir: %w", err)
581
585
  }
@@ -626,6 +630,25 @@ func loadBannerTypeScriptConfigFileWithInputs(location, resolutionRoot string) (
626
630
  return loaded, nil
627
631
  }
628
632
 
633
+ // createBannerConfigLoaderTempDir uses this invocation's existing identity
634
+ // directory when it is safe for the config; otherwise it preserves the
635
+ // historical loader base. Expected filesystem refusal of the preferred base
636
+ // also falls back, while unexpected errors remain visible to the caller.
637
+ func createBannerConfigLoaderTempDir(location, systemTemp, recordRoot string) (string, error) {
638
+ preferred := configloaderscratch.IdentityTempBase(location, systemTemp, recordRoot)
639
+ var tempDir string
640
+ var err error
641
+ if preferred != "" {
642
+ tempDir, err = os.MkdirTemp(preferred, "ttsc-banner-config-")
643
+ }
644
+ if preferred == "" || (err != nil &&
645
+ (os.IsPermission(err) || os.IsNotExist(err) ||
646
+ errors.Is(err, syscall.ENOTDIR) || errors.Is(err, syscall.EROFS))) {
647
+ tempDir, err = os.MkdirTemp(loaderTempBase(location, systemTemp), "ttsc-banner-config-")
648
+ }
649
+ return tempDir, err
650
+ }
651
+
629
652
  // prepareBannerTypeScriptConfigLoader owns the ordered preparation needed before
630
653
  // the loader process can start: dependency links, resolution recorder, generated
631
654
  // loader and tsconfig. Its caller supplies the invocation's filesystem operations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttsc/banner",
3
- "version": "0.33.0-next.1",
3
+ "version": "0.33.0",
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.33.0-next.1"
39
+ "ttsc": "0.33.0"
40
40
  },
41
41
  "repository": {
42
42
  "type": "git",