goscript 0.0.79 → 0.0.80

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.
@@ -1,6 +1,9 @@
1
1
  package compiler
2
2
 
3
3
  import (
4
+ "context"
5
+ "os"
6
+ "path/filepath"
4
7
  "slices"
5
8
  "testing"
6
9
 
@@ -126,3 +129,45 @@ func TestReadGsPackageMetadataNonExistent(t *testing.T) {
126
129
  t.Errorf("Expected empty async methods for non-existent package, got: %v", metadata.AsyncMethods)
127
130
  }
128
131
  }
132
+
133
+ func TestCompilePackagesCopiesHandwrittenDependencies(t *testing.T) {
134
+ tempDir, err := os.MkdirTemp("", "goscript-gs-deps")
135
+ if err != nil {
136
+ t.Fatalf("Failed to create temp dir: %v", err)
137
+ }
138
+ defer os.RemoveAll(tempDir)
139
+
140
+ wd, err := os.Getwd()
141
+ if err != nil {
142
+ t.Fatalf("Failed to get working directory: %v", err)
143
+ }
144
+
145
+ config := &Config{
146
+ OutputPath: tempDir,
147
+ Dir: filepath.Dir(wd),
148
+ AllDependencies: true,
149
+ DisableEmitBuiltin: false,
150
+ }
151
+
152
+ logger := logrus.New()
153
+ logger.SetLevel(logrus.WarnLevel)
154
+ le := logrus.NewEntry(logger)
155
+
156
+ comp, err := NewCompiler(config, le, nil)
157
+ if err != nil {
158
+ t.Fatalf("Failed to create compiler: %v", err)
159
+ }
160
+
161
+ _, err = comp.CompilePackages(
162
+ context.Background(),
163
+ "github.com/aperturerobotics/goscript/tests/tests/package_import_slices",
164
+ )
165
+ if err != nil {
166
+ t.Fatalf("Compilation failed: %v", err)
167
+ }
168
+
169
+ cmpPath := filepath.Join(tempDir, "@goscript", "cmp", "index.ts")
170
+ if _, err := os.Stat(cmpPath); err != nil {
171
+ t.Fatalf("Expected handwritten dependency at %s: %v", cmpPath, err)
172
+ }
173
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "dependencies": [
3
+ "cmp"
4
+ ]
5
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "goscript",
3
3
  "description": "Go to TypeScript transpiler",
4
- "version": "0.0.79",
4
+ "version": "0.0.80",
5
5
  "author": {
6
6
  "name": "Aperture Robotics LLC.",
7
7
  "email": "support@aperture.us",