Skip to content

Commit 0ae53cc

Browse files
authored
ISSUE-221 Per request, upgrading dependency goja to v0.0.0-20230812105242-81d76064690d to include all ES6 features (#222)
This is a major upgrade for omniparser since the upgrade of goja requires go version 1.16, thus we're bumping omniparser min go version to 1.16 as well. Be careful when you upgrade omniparser.
1 parent dd04a11 commit 0ae53cc

File tree

8 files changed

+72
-30
lines changed

8 files changed

+72
-30
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up Go 1.x
1717
uses: actions/setup-go@v2
1818
with:
19-
go-version: '^1.14.2'
19+
go-version: '^1.16.2'
2020
id: go
2121

2222
- name: Check out code into the Go module directory

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.14
1+
FROM golang:1.16
22
WORKDIR /omniparser
33
COPY . .
44
# when Dockerfile building in heroku, .git isn't available (removed by heroku slug compiler)

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Omniparser is a native Golang ETL parser that ingests input data of various form
99
XML, EDI/X12/EDIFACT, JSON**, and custom formats) in streaming fashion and transforms data into desired JSON output
1010
based on a schema written in JSON.
1111

12-
Min Golang Version: 1.14
12+
Min Golang Version: 1.16
1313

1414
## Licenses and Sponsorship
1515
Omniparser is publicly available under [MIT License](./LICENSE).
@@ -69,7 +69,7 @@ As for now (2023/03/14), all of our previous free docker hosting solutions went
6969
situations.
7070

7171
## Requirements
72-
- Golang 1.14 or later.
72+
- Golang 1.16 or later.
7373

7474
## Recent Major Feature Additions/Changes
7575
- 2022/09: v1.0.4 released: added `csv2` file format that supersedes the original `csv` format with support of hierarchical and nested records.

doc/gettingstarted.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ and by the CLI tool.
66

77
## Prerequisites and Notes
88

9-
- Golang 1.14 installed.
9+
- Golang 1.16 installed.
1010
- [`github.com/jf-tech/omniparser`](https://github.com/jf-tech/omniparser) cloned (assuming the clone
1111
location is: `~/dev/jf-tech/omniparser/`)
1212
- The guide assumes Mac OS or Linux dev environment. If you're on Windows, you need make minor

extensions/omniv21/customfuncs/javascript_test.go

+12-5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ func TestJavaScript(t *testing.T) {
6060
err: "",
6161
expected: "one-2",
6262
},
63+
{
64+
name: "#issue-221: verify ES6 String.prototype.replaceAll() implementation",
65+
js: "\"tic tac toe\".replaceAll('t', 'b');",
66+
args: nil,
67+
err: "",
68+
expected: "bic bac boe",
69+
},
6370
// all error cases
6471
{
6572
name: "num of args wrong",
@@ -79,7 +86,7 @@ func TestJavaScript(t *testing.T) {
7986
name: "javascript throws",
8087
js: "throw 'failure';",
8188
args: nil,
82-
err: "failure at <eval>:1:7(1)",
89+
err: "failure at <eval>:1:1(1)",
8390
expected: nil,
8491
},
8592
{
@@ -157,10 +164,10 @@ func TestJavaScriptClearVarsAfterRunProgram(t *testing.T) {
157164
}
158165

159166
// go test -bench=. -benchmem -benchtime=30s
160-
// BenchmarkJavaScriptWithNoCache-8 225940 160696 ns/op 136620 B/op 1698 allocs/op
161-
// BenchmarkJavaScriptWithCache-8 22289469 1612 ns/op 140 B/op 9 allocs/op
162-
// BenchmarkConcurrentJavaScriptWithNoCache-8 1479 24486799 ns/op 27331471 B/op 339793 allocs/op
163-
// BenchmarkConcurrentJavaScriptWithCache-8 69219 517898 ns/op 34722 B/op 1952 allocs/op
167+
// BenchmarkJavaScriptWithNoCache-8 371036 96020 ns/op 149597 B/op 1860 allocs/op
168+
// BenchmarkJavaScriptWithCache-8 36966369 976.9 ns/op 177 B/op 8 allocs/op
169+
// BenchmarkConcurrentJavaScriptWithNoCache-8 3368 10797315 ns/op 29926101 B/op 372172 allocs/op
170+
// BenchmarkConcurrentJavaScriptWithCache-8 199069 181978 ns/op 36569 B/op 1750 allocs/op
164171

165172
var (
166173
benchTitles = []string{"", "Dr", "Sir"}

extensions/omniv21/fileformat/flatfile/recdecl.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type RecDecl interface {
1919
// flexibility. Note RecDecl's ChildDecls need to return child decls and each format specific decl
2020
// is different, so that's the first incompatibility here that ChildDecls cannot be even be included
2121
// in the struct if we go down the RecDecl being struct route. Yes, generics can do that but we
22-
// don't want to move omniparser 1.14 dependency up all the way to 1.18 simply because of this.
22+
// don't want to move omniparser 1.16 dependency up all the way to 1.18 simply because of this.
2323
// Second, depending on formats, the default values for min/max are different: csv/fixed-length
2424
// min/max default to 0/-1, but for EDI min/max default to 1/1. Given these incompatibility and
2525
// loss of flexibility, we chose to stick with the RecDecl interface route and have each format

go.mod

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
module github.com/jf-tech/omniparser
22

3-
go 1.14
3+
go 1.16
44

55
require (
66
github.com/antchfx/xmlquery v1.3.1
77
github.com/antchfx/xpath v1.1.11
88
github.com/bradleyjkemp/cupaloy v2.3.0+incompatible
9-
github.com/dlclark/regexp2 v1.2.1 // indirect
10-
github.com/dop251/goja v0.0.0-20201002140143-8ce18d86df5f
9+
github.com/dop251/goja v0.0.0-20230812105242-81d76064690d
1110
github.com/go-chi/chi v4.1.2+incompatible
12-
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
1311
github.com/google/uuid v1.1.2
1412
github.com/jf-tech/go-corelib v0.0.14
1513
github.com/spf13/cobra v1.0.0
1614
github.com/spf13/pflag v1.0.5 // indirect
1715
github.com/stretchr/testify v1.6.1
1816
github.com/xeipuuv/gojsonschema v1.2.0
19-
golang.org/x/net v0.0.0-20200904194848-62affa334b73
20-
golang.org/x/text v0.3.3
21-
gopkg.in/yaml.v2 v2.3.0 // indirect
17+
golang.org/x/net v0.0.0-20220722155237-a158d28d115b
18+
golang.org/x/text v0.3.8
2219
)

0 commit comments

Comments
 (0)