-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b2a7477
Showing
183 changed files
with
39,893 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# Created by https://www.toptal.com/developers/gitignore/api/go,macos,linux,windows | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=go,macos,linux,windows | ||
|
||
### Go ### | ||
# If you prefer the allow list template instead of the deny list, see community template: | ||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore | ||
# | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
### Linux ### | ||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
### macOS ### | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### macOS Patch ### | ||
# iCloud generated files | ||
*.icloud | ||
|
||
### Windows ### | ||
# Windows thumbnail cache files | ||
Thumbs.db | ||
Thumbs.db:encryptable | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
|
||
# Dump file | ||
*.stackdump | ||
|
||
# Folder config file | ||
[Dd]esktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msix | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/go,macos,linux,windows |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
### Fixed | ||
- Use string length to ensure null character-containing strings in Go/JS are not terminated early. | ||
- Object.Set with an empty key string is now supported | ||
|
||
## [v0.7.0] - 2021-12-09 | ||
|
||
### Added | ||
- Support for calling constructors functions with NewInstance on Function | ||
- Access "this" from function callback | ||
- value.SameValue(otherValue) function to compare values for sameness | ||
- Undefined, Null functions to get these constant values for the isolate | ||
- Support for calling a method on an object. | ||
- Support for calling `IsExecutionTerminating` on isolate to check if execution is still terminating. | ||
- Support for setting and getting internal fields for template object instances | ||
- Support for CPU profiling | ||
- Add V8 build for Apple Silicon | ||
- Add support for throwing an exception directly via the isolate's ThrowException function. | ||
- Support for compiling a context-dependent UnboundScript which can be run in any context of the isolate it was compiled in. | ||
- Support for creating a code cache from an UnboundScript which can be used to create an UnboundScript in other isolates | ||
to run a pre-compiled script in new contexts. | ||
- Included compile error location in `%+v` formatting of JSError | ||
- Enable i18n support | ||
|
||
### Changed | ||
- Removed error return value from NewIsolate which never fails | ||
- Removed error return value from NewContext which never fails | ||
- Removed error return value from Context.Isolate() which never fails | ||
- Removed error return value from NewObjectTemplate and NewFunctionTemplate. Panic if given a nil argument. | ||
- Function Call accepts receiver as first argument. This **subtle breaking change** will compile old code but interpret the first argument as the receiver. Use `Undefined` to prepend an argument to fix old Call use. | ||
- Removed Windows support until its build issues are addressed. | ||
- Upgrade to V8 9.6.180.12 | ||
|
||
### Fixed | ||
- Add some missing error propagation | ||
- Fix crash from template finalizer releasing V8 data, let it be disposed with the isolate | ||
- Fix crash by keeping alive the template while its C++ pointer is still being used | ||
- Fix crash from accessing function template callbacks outside of `RunScript`, such as in `JSONStringify` | ||
|
||
## [v0.6.0] - 2021-05-11 | ||
|
||
### Added | ||
- Promise resolver and promise result | ||
- Convert a Value to a Function and invoke it. Thanks to [@robfig](https://github.com/robfig) | ||
- Windows static binary. Thanks to [@cleiner](https://github.com/cleiner) | ||
- Setting/unsetting of V8 feature flags | ||
- Register promise callbacks in Go. Thanks to [@robfig](https://github.com/robfig) | ||
- Get Function from a template for a given context. Thanks to [@robfig](https://github.com/robfig) | ||
|
||
### Changed | ||
- Upgrade to V8 9.0.257.18 | ||
|
||
### Fixed | ||
- Go GC attempting to free C memory (via finalizer) of values after an Isolate is disposed causes a panic | ||
|
||
## [v0.5.1] - 2021-02-19 | ||
|
||
### Fixed | ||
- Memory being held by Values after the associated Context is closed | ||
|
||
## [v0.5.0] - 2021-02-08 | ||
|
||
### Added | ||
- Support for the BigInt value to the big.Int Go type | ||
- Create Object Templates with primitive values, including other Object Templates | ||
- Configure Object Template as the global object of any new Context | ||
- Function Templates with callbacks to Go | ||
- Value to Object type, including Get/Set/Has/Delete methods | ||
- Get Global Object from the Context | ||
- Convert an Object Template to an instance of an Object | ||
|
||
### Changed | ||
- NewContext() API has been improved to handle optional global object, as well as optional Isolate | ||
- Package error messages are now prefixed with `v8go` rather than the struct name | ||
- Deprecated `iso.Close()` in favor of `iso.Dispose()` to keep consistancy with the C++ API | ||
- Upgraded V8 to 8.8.278.14 | ||
- Licence BSD 3-Clause (same as V8 and Go) | ||
|
||
## [v0.4.0] - 2021-01-14 | ||
|
||
### Added | ||
- Value methods for checking value kind (is string, number, array etc) | ||
- C formatting via `clang-format` to aid future development | ||
- Support of vendoring with `go mod vendor` | ||
- Value methods to convert to primitive data types | ||
|
||
### Changed | ||
- Use g++ (default for cgo) for linux builds of the static v8 lib | ||
|
||
## [v0.3.0] - 2020-12-18 | ||
|
||
### Added | ||
- Support for Windows via [MSYS2](https://www.msys2.org/). Thanks to [@neptoess](https://github.com/neptoess) | ||
|
||
### Changed | ||
- Upgraded V8 to 8.7.220.31 | ||
|
||
## [v0.2.0] - 2020-01-25 | ||
|
||
### Added | ||
- Manually dispose of the isolate when required | ||
- Monitor isolate heap statistics. Thanks to [@mehrdadrad](https://github.com/mehrdadrad) | ||
|
||
### Changed | ||
- Upgrade V8 to 8.0.426.15 | ||
|
||
## [v0.1.0] - 2019-09-22 | ||
|
||
### Changed | ||
- Upgrade V8 to 7.7.299.9 | ||
|
||
## [v0.0.1] - 2019-09-2020 | ||
|
||
### Added | ||
- Create V8 Isolate | ||
- Create Contexts | ||
- Run JavaScript scripts | ||
- Get Values back from JavaScript in Go | ||
- Get detailed JavaScript errors in Go, including stack traces | ||
- Terminate long running scripts from any Goroutine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# How to contribute | ||
|
||
**Working on your first Pull Request?** You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github) | ||
|
||
## Guidelines for Pull Requests | ||
|
||
How to get your contributions merged smoothly and quickly. | ||
|
||
* Create **small PRs** that are narrowly focused on **addressing a single concern**. We often times receive PRs that are trying to fix several things at a time, but only one fix is considered acceptable, nothing gets merged and both author's & review's time is wasted. Create more PRs to address different concerns and everyone will be happy. | ||
|
||
* For speculative changes, consider opening an issue and discussing it first. | ||
|
||
* Provide a good **PR description** as a record of **what** change is being made and **why** it was made. Link to a github issue if it exists. | ||
|
||
* Unless your PR is trivial, you should expect there will be reviewer comments that you'll need to address before merging. We expect you to be reasonably responsive to those comments, otherwise the PR will be closed after 2-3 weeks of inactivity. | ||
|
||
* Maintain **clean commit history** and use **meaningful commit messages**. PRs with messy commit history are difficult to review and won't be merged. Use `rebase -i upstream/main` to curate your commit history and/or to bring in latest changes from master (but avoid rebasing in the middle of a code review). | ||
|
||
* Keep your PR up to date with upstream/master (if there are merge conflicts, we can't really merge your change). | ||
|
||
* Exceptions to the rules can be made if there's a compelling reason for doing so. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright (c) 2019 Roger Chapman and the v8go contributors. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.DEFAULT_GOAL := build | ||
|
||
GO ?= go | ||
GO_RUN_TOOLS ?= $(GO) run -modfile ./tools/go.mod | ||
GO_TEST = $(GO_RUN_TOOLS) gotest.tools/gotestsum --format pkgname | ||
|
||
|
||
.PHONY: generate | ||
generate: | ||
go generate ./... | ||
|
||
.PHONY: fmt | ||
fmt: ## Run go fmt against code. | ||
go run mvdan.cc/gofumpt -w . | ||
|
||
.PHONY: vet | ||
vet: ## Run go vet against code. | ||
go vet ./... | ||
|
||
.PHONY: test | ||
test: fmt vet ## Run tests. | ||
mkdir -p .test/reports | ||
$(GO_TEST) --junitfile .test/reports/unit-test.xml -- -race ./... -count=1 -short -cover -coverprofile .test/reports/unit-test-coverage.out | ||
|
||
.PHONY: lint | ||
lint: ## Run lint. | ||
$(GO_RUN_TOOLS) github.com/golangci/golangci-lint/cmd/golangci-lint run --timeout 5m -c .golangci.yml | ||
|
||
.PHONY: clean | ||
clean: ## Remove previous build. | ||
find . -type f -name '*.gen.go' -exec rm {} + | ||
git checkout go.mod |
Oops, something went wrong.