-
Notifications
You must be signed in to change notification settings - Fork 17
/
language.go
36 lines (30 loc) · 1.03 KB
/
language.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package gazelle
import (
pnpm "aspect.build/cli/gazelle/js/pnpm"
"github.com/bazelbuild/bazel-gazelle/label"
"github.com/bazelbuild/bazel-gazelle/language"
)
const LanguageName = "js"
// The Gazelle extension for TypeScript rules.
// TypeScript satisfies the language.Language interface including the
// Configurer and Resolver types.
type TypeScript struct {
Configurer
Resolver
Language
// Importable files and the generating label.
fileLabels map[string]*label.Label
// Importable npm-like packages. Each pnpm project has its own set
// of importable npm packages.
// BUILDs alongside pnpm project roots have a map. BUILDs within a project contain a reference
// to the parent pnpm project map.
pnpmProjects *pnpm.PnpmProjectMap
}
// NewLanguage initializes a new TypeScript that satisfies the language.Language
// interface. This is the entrypoint for the extension initialization.
func NewLanguage() language.Language {
return &TypeScript{
fileLabels: make(map[string]*label.Label),
pnpmProjects: pnpm.NewPnpmProjectMap(),
}
}