Documentation ¶
Overview ¶
SPDX-License-Identifier: Apache-2.0
Copyright © 2023 The listen.dev team <engineering@garnet.ai>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright © 2023 The listen.dev team <engineering@garnet.ai>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright © 2023 The listen.dev team <engineering@garnet.ai>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright © 2023 The listen.dev team <engineering@garnet.ai>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright © 2023 The listen.dev team <engineering@garnet.ai>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright © 2023 The listen.dev team <engineering@garnet.ai>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright © 2023 The listen.dev team <engineering@garnet.ai>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright © 2023 The listen.dev team <engineering@garnet.ai>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright © 2023 The listen.dev team <engineering@garnet.ai>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright © 2023 The listen.dev team <engineering@garnet.ai>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func DefaultVersionResolutionStrategy(versions semver.Collection) *semver.Version
- func GetFromRegistry(ctx context.Context, name, version string) (io.ReadCloser, string, error)
- func GetVersionsFromRegistry(ctx context.Context, name string, constraints *semver.Constraints) (semver.Collection, error)
- func GetVersionsFromRegistryResponse(body io.ReadCloser, constraints *semver.Constraints) (semver.Collection, error)
- func Version(ctx context.Context) (string, error)
- type DependencyType
- type LockfileVersion
- type Package
- type PackageJSON
- type PackageLockDependency
- type PackageLockJSON
- type Packages
- type VersionResolutionStrategy
Constants ¶
This section is empty.
Variables ¶
var AllDependencyTypes = []DependencyType{ Dependencies, DevDependencies, PeerDependencies, BundleDependencies, OptionalDependencies, }
var DependencyTypeIDs = map[DependencyType][]string{ Dependencies: {Dependencies.String()}, DevDependencies: {DevDependencies.String()}, PeerDependencies: {PeerDependencies.String()}, BundleDependencies: {BundleDependencies.String()}, OptionalDependencies: {OptionalDependencies.String()}, }
Functions ¶
func DefaultVersionResolutionStrategy ¶ added in v0.3.0
func DefaultVersionResolutionStrategy(versions semver.Collection) *semver.Version
DefaultVersionResolutionStrategy returns the highest semantic version in a collection of versions.
func GetFromRegistry ¶
GetFromRegistry asks to the npm registry for the details of a package by name, and optionally, by version.
func GetVersionsFromRegistry ¶ added in v0.3.0
func GetVersionsFromRegistryResponse ¶ added in v0.3.0
func GetVersionsFromRegistryResponse(body io.ReadCloser, constraints *semver.Constraints) (semver.Collection, error)
Types ¶
type DependencyType ¶ added in v0.3.0
type DependencyType enumflag.Flag
const ( All DependencyType = (iota + 1) * 22 Dependencies DevDependencies PeerDependencies BundleDependencies OptionalDependencies )
func (DependencyType) Name ¶ added in v0.3.0
func (dt DependencyType) Name() string
func (DependencyType) String ¶ added in v0.3.0
func (dt DependencyType) String() string
type LockfileVersion ¶
type LockfileVersion struct {
Value int `json:"lockfileVersion" name:"lockfile version" validate:"gte=1,lte=3"`
}
type Package ¶
type PackageJSON ¶ added in v0.3.0
type PackageJSON interface {
Deps(context.Context, VersionResolutionStrategy, ...DependencyType) map[DependencyType]map[string]*semver.Version
}
func GetPackageJSONFromDir ¶ added in v0.3.0
func GetPackageJSONFromDir(dir string) (PackageJSON, error)
func NewPackageJSONFromReader ¶ added in v0.3.0
func NewPackageJSONFromReader(reader io.Reader) (PackageJSON, error)
type PackageLockDependency ¶
type PackageLockJSON ¶
type PackageLockJSON interface { Deps() map[string]PackageLockDependency Encode() string Ok() bool Version() int }
func NewPackageLockJSON ¶
func NewPackageLockJSON() PackageLockJSON
NewPackageLockJSON is a factory to create an empty (and invalid) PackageLockJSON.
func NewPackageLockJSONFromBytes ¶
func NewPackageLockJSONFromBytes(b []byte) (PackageLockJSON, error)
func NewPackageLockJSONFromDir ¶
func NewPackageLockJSONFromDir(ctx context.Context, dir string) (PackageLockJSON, error)
NewPackageLockJSONFromDir creates a PackageLockJSON instance from the package.json in the dir directory (if any).
func NewPackageLockJSONFromReader ¶
func NewPackageLockJSONFromReader(reader io.Reader) (PackageLockJSON, error)
NewPackageLockJSONFromReader creates a PackageLockJSON instance from by reading the contents of a package-lock.json file.
type VersionResolutionStrategy ¶ added in v0.3.0
type VersionResolutionStrategy func(semver.Collection) *semver.Version
The VersionResolutionStrategy is a function that, given a version constraints, returns back an exact version.