@node9/proxy 1.12.7 → 1.12.8

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.
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2016, Daniel Martí. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are
5
+ met:
6
+
7
+ * Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above
10
+ copyright notice, this list of conditions and the following disclaimer
11
+ in the documentation and/or other materials provided with the
12
+ distribution.
13
+ * Neither the name of the copyright holder nor the names of its
14
+ contributors may be used to endorse or promote products derived from
15
+ this software without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,84 @@
1
+ ## mvdan-sh
2
+
3
+ This package is a JavaScript version of a shell package written in Go, available
4
+ at https://github.com/mvdan/sh.
5
+
6
+ It is transpiled from Go to JS using https://github.com/gopherjs/gopherjs.
7
+
8
+ ### Sample usage
9
+
10
+ ```
11
+ const sh = require('mvdan-sh')
12
+ const syntax = sh.syntax
13
+
14
+ var parser = syntax.NewParser()
15
+ var printer = syntax.NewPrinter()
16
+
17
+ var src = "echo 'foo'"
18
+ var f = parser.Parse(src, "src.sh")
19
+
20
+ // print out the syntax tree
21
+ syntax.DebugPrint(f)
22
+ console.log()
23
+
24
+ // replace all single quoted string values
25
+ syntax.Walk(f, function(node) {
26
+ if (syntax.NodeType(node) == "SglQuoted") {
27
+ node.Value = "bar"
28
+ }
29
+ return true
30
+ })
31
+
32
+ // print the code back out
33
+ console.log(printer.Print(f)) // echo 'bar'
34
+ ```
35
+
36
+ You can find more samples in
37
+ [testmain.js](https://github.com/mvdan/sh/blob/master/_js/testmain.js).
38
+
39
+ ### Available APIs
40
+
41
+ The APIs listed below are wrapped to be usable in JavaScript. Follow the links
42
+ to read their documentation.
43
+
44
+ * [syntax.NewParser](https://pkg.go.dev/mvdan.cc/sh/v3/syntax#NewParser)
45
+ - [Parser.Parse](https://pkg.go.dev/mvdan.cc/sh/v3/syntax#Parser.Parse)
46
+ - [Parser.Interactive](https://pkg.go.dev/mvdan.cc/sh/v3/syntax#Parser.Interactive)
47
+ - [Parser.Incomplete](https://pkg.go.dev/mvdan.cc/sh/v3/syntax#Parser.Incomplete)
48
+ * [syntax.DebugPrint](https://pkg.go.dev/mvdan.cc/sh/v3/syntax#DebugPrint)
49
+ * [syntax.Walk](https://pkg.go.dev/mvdan.cc/sh/v3/syntax#Walk)
50
+ * [syntax.NewPrinter](https://pkg.go.dev/mvdan.cc/sh/v3/syntax#NewPrinter)
51
+ - [Printer.Print](https://pkg.go.dev/mvdan.cc/sh/v3/syntax#Printer.Print)
52
+
53
+ Constructor options like
54
+ [syntax.KeepComments](https://pkg.go.dev/mvdan.cc/sh/v3/syntax#KeepComments) are
55
+ also available.
56
+
57
+ The original `io.Reader` parameters can take a string or a
58
+ [stream.Readable](https://nodejs.org/api/stream.html#stream_class_stream_readable)
59
+ object. `io.Writer` parameters are replaced by string returns.
60
+
61
+ The nodes you will find in the syntax tree are all equivalent to the nodes you
62
+ will see on the Go API. To get the type of a node, use `syntax.NodeType` as the
63
+ example above shows. Some of the most common node types include:
64
+
65
+ * [syntax.File](https://pkg.go.dev/mvdan.cc/sh/v3/syntax#File)
66
+ * [syntax.Stmt](https://pkg.go.dev/mvdan.cc/sh/v3/syntax#Stmt)
67
+ * [syntax.CallExpr](https://pkg.go.dev/mvdan.cc/sh/v3/syntax#CallExpr)
68
+ * [syntax.Word](https://pkg.go.dev/mvdan.cc/sh/v3/syntax#Word)
69
+ * [syntax.Lit](https://pkg.go.dev/mvdan.cc/sh/v3/syntax#Lit)
70
+
71
+ The five above will show up in your syntax tree if you parse a `echo foo`
72
+ command, which you can see if you use `syntax.DebugPrint` to inspect the syntax
73
+ tree.
74
+
75
+ ### Building
76
+
77
+ You will need:
78
+
79
+ * Latest Go 1.17.x
80
+ * NodeJS, to run the `testmain.js` test suite
81
+
82
+ Then, simply run `./build`. The result will be `index.js`, which isn't minified.
83
+ At the time of writing, `index.js` weighs 1.7MiB in plaintext, and 220KiB when
84
+ minified and gzipped.