diff --git a/CHANGELOG.md b/CHANGELOG.md index ad6f4f49..390b4904 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 1.4.0 +- Components of a user provided component library can now be used inside + `` to create interactive demos of components. - Support _Table of Contents_ on documents. - Introduced new `` documentation component. diff --git a/Makefile b/Makefile index 179f01fb..66ebd23f 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ FRONTEND ?= $(shell pwd)/frontend/build DDT ?= $(shell pwd)/../example-design-system +COMPONENTS ?= $(shell pwd)/../example-component-library/build VERSION ?= head-$(shell git rev-parse --short HEAD) LDFLAGS = -X main.Version=$(VERSION) @@ -28,7 +29,7 @@ profile: .PHONY: dev dev: go build -tags=dev -ldflags "$(LDFLAGS)" $(CMD_PKG) - ./dsk -frontend $(FRONTEND) "$(DDT)" + ./dsk -frontend $(FRONTEND) -components $(COMPONENTS) "$(DDT)" rm dsk .PHONY: clean diff --git a/cmd/dsk/main.go b/cmd/dsk/main.go index 108ee3d8..1a77e488 100644 --- a/cmd/dsk/main.go +++ b/cmd/dsk/main.go @@ -58,10 +58,11 @@ func main() { } }() - host := flag.String("host", "127.0.0.1", "host IP to bind to") - port := flag.String("port", "8080", "port to bind to") - version := flag.Bool("version", false, "print DSK version") - noColor := flag.Bool("no-color", false, "disables color output") + fhost := flag.String("host", "127.0.0.1", "host IP to bind to") + fport := flag.String("port", "8080", "port to bind to") + fversion := flag.Bool("version", false, "print DSK version") + fnoColor := flag.Bool("no-color", false, "disables color output") + fcomponents := flag.String("components", "", "path to component library assets") ffrontend := flag.String("frontend", "", "path to a frontend, to use instead of the built-in") fallowOrigin := flag.String("allow-origin", "", "origins from which browsers can access the HTTP API; for multiple origins, use a comma as a separator, the wildcard * is supported; to allow all use *") flag.Parse() @@ -70,14 +71,14 @@ func main() { log.Fatalf("Too many arguments given, expecting exactly 0 or 1") } - if *version { + if *fversion { fmt.Println(Version) os.Exit(1) } // Color package automatically disables colors when not a TTY. We // don't need to check for an interactive terminal here again. - if *noColor { + if *fnoColor { color.NoColor = true } whiteOnBlue := color.New(color.FgWhite, color.BgBlue) @@ -114,7 +115,17 @@ func main() { if err != nil { panic(err) } - log.Printf("Detected live path: %s", livePath) + log.Printf("Using live path: %s", livePath) + + var componentsPath string + if *fcomponents != "" { + componentsPath = *fcomponents + } + + var frontendPath string + if *ffrontend != "" { + frontendPath = *ffrontend + } allowOrigins := strings.Split(*fallowOrigin, ",") if len(allowOrigins) != 0 { @@ -124,7 +135,8 @@ func main() { app = plex.NewApp( // assign to global Version, livePath, - *ffrontend, + componentsPath, + frontendPath, ) ctx, cancel := context.WithCancel(context.Background()) app.Teardown.AddCancelFunc(cancel) @@ -133,6 +145,12 @@ func main() { log.Fatal(red.Sprintf("Failed to initialize application: %s", err)) } + if componentsPath != "" { + if err := app.OpenComponents(ctx); err != nil { + log.Print(red.Sprintf("Failed to start application: %s", err)) + } + } + if app.HasMultiVersionsSupport() { log.Printf("Detected support for multi-versions") @@ -145,7 +163,7 @@ func main() { apis := map[int]httputil.Mountable{ 1: api.NewV1(app.Sources, app.Version, app.Broker, allowOrigins), - 2: api.NewV2(app.Sources, app.Version, app.Broker, allowOrigins), + 2: api.NewV2(app.Sources, app.Components, app.Version, app.Broker, allowOrigins), } for av, a := range apis { log.Printf("Mounting APIv%d HTTP mux...", av) @@ -159,7 +177,7 @@ func main() { log.Print("Mounting frontend HTTP mux...") mux.Handle("/", app.Frontend.HTTPMux()) - addr := fmt.Sprintf("%s:%s", *host, *port) + addr := fmt.Sprintf("%s:%s", *fhost, *fport) if isTerminal { log.Print("-------------------------------------------") log.Printf("Please visit: %s", green.Sprint("http://"+addr)) diff --git a/frontend/.yarnrc.yml b/frontend/.yarnrc.yml index bf59b46b..2e886ad4 100644 --- a/frontend/.yarnrc.yml +++ b/frontend/.yarnrc.yml @@ -3,4 +3,5 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -yarnPath: ".yarn/releases/yarn-berry.cjs" \ No newline at end of file +yarnPath: ".yarn/releases/yarn-berry.cjs" +nodeLinker: node-modules diff --git a/frontend/src/Playground/index.js b/frontend/src/Playground/index.js index ba040c22..86c5e2a3 100644 --- a/frontend/src/Playground/index.js +++ b/frontend/src/Playground/index.js @@ -10,9 +10,11 @@ import React, { useState, useEffect } from 'react'; import './Playground.css'; import { Client } from '@rundsk/js-sdk'; +// TODO: annonations currently use src attribute isn't that confusing, would expect this to become the contents of the playground. function Playground(props) { const [annotationData, setAnnotationData] = useState({ annotations: [] }); const [highlightedAnnotation, setHighlightedAnnotation] = useState(null); + const [stage, setStage] = useState(null); let classes = ['playground']; @@ -105,7 +107,7 @@ function Playground(props) { {annotationMarkers} {/* This wrapper doesn’t do any styling, we just need the content to be isolated for stuff like :first-child to work */} -
{props.children}
+
{stage}
{annotations.length > 0 &&
{annotations}
} diff --git a/frontend/src/playground-runtime.jsx b/frontend/src/playground-runtime.jsx new file mode 100644 index 00000000..71947747 --- /dev/null +++ b/frontend/src/playground-runtime.jsx @@ -0,0 +1,6 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; + +document.addEventListener('DOMContentLoaded', () => { + ReactDOM.render(, document.getElementById('root')); +}); diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 326647ca..b8f502df 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -4518,7 +4518,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:^3.0.0, debug@npm:^3.1.1, debug@npm:^3.2.5, debug@npm:^3.2.6": +"debug@npm:^3.0.0, debug@npm:^3.1.1, debug@npm:^3.2.5": version: 3.2.7 resolution: "debug@npm:3.2.7" dependencies: @@ -4564,13 +4564,6 @@ __metadata: languageName: node linkType: hard -"deep-extend@npm:^0.6.0": - version: 0.6.0 - resolution: "deep-extend@npm:0.6.0" - checksum: 856d7f52db152c19fc5a70439ea938461cfb9338a632496fe370050dc73d3291cd76fc6713f604a5c126612dee9cac0f6da1d4b88ba4b0caa4f7214345879b89 - languageName: node - linkType: hard - "deep-is@npm:~0.1.3": version: 0.1.3 resolution: "deep-is@npm:0.1.3" @@ -4678,15 +4671,6 @@ __metadata: languageName: node linkType: hard -"detect-libc@npm:^1.0.3": - version: 1.0.3 - resolution: "detect-libc@npm:1.0.3" - bin: - detect-libc: ./bin/detect-libc.js - checksum: 6cec442139459ec2e8517076974b0eba42079885938683eca013c2e0b5db02ef048870725ce68e7ac8e4cf17e482f67d7322f45bbc5f203b7332817bc7833b39 - languageName: node - linkType: hard - "detect-newline@npm:^2.1.0": version: 2.1.0 resolution: "detect-newline@npm:2.1.0" @@ -6230,15 +6214,6 @@ __metadata: languageName: node linkType: hard -"fs-minipass@npm:^1.2.5": - version: 1.2.7 - resolution: "fs-minipass@npm:1.2.7" - dependencies: - minipass: ^2.6.0 - checksum: eb59a93065f25457e5d1d10a064e22565e704b03140d5ef86a71a57155b13aa645811126fed2a5a282df8dc9c40df9c9d696f6b2d93c181071a971221d0a454b - languageName: node - linkType: hard - "fs-minipass@npm:^2.0.0": version: 2.0.0 resolution: "fs-minipass@npm:2.0.0" @@ -6277,14 +6252,12 @@ fsevents@2.1.2: linkType: hard fsevents@^1.2.7: - version: 1.2.11 - resolution: "fsevents@npm:1.2.11" + version: 1.2.13 + resolution: "fsevents@npm:1.2.13" dependencies: bindings: ^1.5.0 nan: ^2.12.1 - node-gyp: latest - node-pre-gyp: "*" - checksum: aed1040495a4751298fa2df107fe387efd71d4b4dbc31e3044e86192318cccbca38481a9ad8a069aa24f42fdc6d793a04dc93bab4227178e58f9c9f76e3824ed + checksum: e70509558b5f49ce9dfacb8f9e2848c6e6751a61966027789561145a9c4ae9ba4c6b28b531bc8b4ae52fdd2d4c90a3bf314e6794717e51838b27910bb41ce588 languageName: node linkType: hard @@ -6298,14 +6271,12 @@ fsevents@^1.2.7: linkType: hard "fsevents@patch:fsevents@^1.2.7#builtin": - version: 1.2.11 - resolution: "fsevents@patch:fsevents@npm%3A1.2.11#builtin::version=1.2.11&hash=11e9ea" + version: 1.2.13 + resolution: "fsevents@patch:fsevents@npm%3A1.2.13#builtin::version=1.2.13&hash=11e9ea" dependencies: bindings: ^1.5.0 nan: ^2.12.1 - node-gyp: latest - node-pre-gyp: "*" - checksum: 1f931b0da1d8120668a9c9479f59a5098b814509280c7a35aa8b4a1777bf46f758aa7f9217bfe0392a0a4d389cea32bad2c17e52f27e0ee5dbe7bb714f4fe2dc + checksum: 7bc048c164eb72f91b18ba7cd2ba30679a0afe57e9cd6352eac4bdbc4ddd4ca2ea98674d0bd3a80e96427469adc433c13532494b36aea40fceab36e198982182 languageName: node linkType: hard @@ -7044,7 +7015,7 @@ fsevents@~2.3.1: languageName: node linkType: hard -"iconv-lite@npm:0.4.24, iconv-lite@npm:^0.4.24, iconv-lite@npm:^0.4.4": +"iconv-lite@npm:0.4.24, iconv-lite@npm:^0.4.24": version: 0.4.24 resolution: "iconv-lite@npm:0.4.24" dependencies: @@ -7094,15 +7065,6 @@ fsevents@~2.3.1: languageName: node linkType: hard -"ignore-walk@npm:^3.0.1": - version: 3.0.3 - resolution: "ignore-walk@npm:3.0.3" - dependencies: - minimatch: ^3.0.4 - checksum: 08394ce8c47dc086d44ef65a1e1d30352ff3d6605bdec90f59e985b710cc660aafa7975cb30312891d21d826d10b3a8b3210c5d68251678e2dcd366362865170 - languageName: node - linkType: hard - "ignore@npm:^3.3.5": version: 3.3.10 resolution: "ignore@npm:3.3.10" @@ -7233,7 +7195,7 @@ fsevents@~2.3.1: languageName: node linkType: hard -"ini@npm:^1.3.5, ini@npm:~1.3.0": +"ini@npm:^1.3.5": version: 1.3.8 resolution: "ini@npm:1.3.8" checksum: 62189ce7ea44c5778e757e4232c581212e838f3c39e79d931bb9152fd4b9275f09fb20b96afdd60ba9f5d7996b92486cad6cc617fcb84ff4beedd1b33b86221e @@ -9384,16 +9346,6 @@ fsevents@~2.3.1: languageName: node linkType: hard -"minipass@npm:^2.6.0, minipass@npm:^2.8.6, minipass@npm:^2.9.0": - version: 2.9.0 - resolution: "minipass@npm:2.9.0" - dependencies: - safe-buffer: ^5.1.2 - yallist: ^3.0.0 - checksum: 57a49f9523fdc495625184f4ef5a101615d3ee0c06f0c37e2ed7140c12deeecbd404539bd605b985100836006409b11b627a3148941dcc4ade24f0f078557836 - languageName: node - linkType: hard - "minipass@npm:^3.0.0, minipass@npm:^3.1.0, minipass@npm:^3.1.1, minipass@npm:^3.1.3": version: 3.1.3 resolution: "minipass@npm:3.1.3" @@ -9403,15 +9355,6 @@ fsevents@~2.3.1: languageName: node linkType: hard -"minizlib@npm:^1.2.1": - version: 1.3.3 - resolution: "minizlib@npm:1.3.3" - dependencies: - minipass: ^2.9.0 - checksum: 8d12782dd943ea92bb3e8e5dc4fe21201b56e77e5f12723c29159cf01dd0d50330dd071897dec270b3861994fb07a982b2473e5c2f42bf5f4b180ab18bf81c06 - languageName: node - linkType: hard - "minizlib@npm:^2.0.0, minizlib@npm:^2.1.1": version: 2.1.2 resolution: "minizlib@npm:2.1.2" @@ -9471,7 +9414,7 @@ fsevents@~2.3.1: languageName: node linkType: hard -"mkdirp@npm:^0.5.0, mkdirp@npm:^0.5.1, mkdirp@npm:^0.5.3, mkdirp@npm:^0.5.5, mkdirp@npm:~0.5.1": +"mkdirp@npm:^0.5.1, mkdirp@npm:^0.5.3, mkdirp@npm:^0.5.5, mkdirp@npm:~0.5.1": version: 0.5.5 resolution: "mkdirp@npm:0.5.5" dependencies: @@ -9619,19 +9562,6 @@ fsevents@~2.3.1: languageName: node linkType: hard -"needle@npm:^2.5.2": - version: 2.6.0 - resolution: "needle@npm:2.6.0" - dependencies: - debug: ^3.2.6 - iconv-lite: ^0.4.4 - sax: ^1.2.4 - bin: - needle: bin/needle - checksum: 0a00060d586b984ccfe89ba95228a9510ec258eeba62349450d590ea5a92831cd997b191f211220bd112236fc8734c7e6cd64d674b7e6d55784fa992d9e3a7a4 - languageName: node - linkType: hard - "negotiator@npm:0.6.2": version: 0.6.2 resolution: "negotiator@npm:0.6.2" @@ -9755,26 +9685,6 @@ fsevents@~2.3.1: languageName: node linkType: hard -"node-pre-gyp@npm:*": - version: 0.17.0 - resolution: "node-pre-gyp@npm:0.17.0" - dependencies: - detect-libc: ^1.0.3 - mkdirp: ^0.5.5 - needle: ^2.5.2 - nopt: ^4.0.3 - npm-packlist: ^1.4.8 - npmlog: ^4.1.2 - rc: ^1.2.8 - rimraf: ^2.7.1 - semver: ^5.7.1 - tar: ^4.4.13 - bin: - node-pre-gyp: bin/node-pre-gyp - checksum: 9bed997d98ae6f58a1665060e1f9e61806ca48f4cb8fcefe7f8cfe4ddca0abdcfb3fc627c2d3f39522748bd3b8cfce250c4bfa1147aee668317e027982d4bb3b - languageName: node - linkType: hard - "node-releases@npm:^1.1.52, node-releases@npm:^1.1.71": version: 1.1.71 resolution: "node-releases@npm:1.1.71" @@ -9782,18 +9692,6 @@ fsevents@~2.3.1: languageName: node linkType: hard -"nopt@npm:^4.0.3": - version: 4.0.3 - resolution: "nopt@npm:4.0.3" - dependencies: - abbrev: 1 - osenv: ^0.1.4 - bin: - nopt: bin/nopt.js - checksum: bf7b8c15fd035bf1faa897ec83c3fe5a459beb51a09dfad9413429382139784c3f05e11847d2e5de7160a813c5c8c6cf74c34f22b483c08fdaf465586f293f49 - languageName: node - linkType: hard - "nopt@npm:^5.0.0": version: 5.0.0 resolution: "nopt@npm:5.0.0" @@ -9859,33 +9757,6 @@ fsevents@~2.3.1: languageName: node linkType: hard -"npm-bundled@npm:^1.0.1": - version: 1.1.1 - resolution: "npm-bundled@npm:1.1.1" - dependencies: - npm-normalize-package-bin: ^1.0.1 - checksum: f51ddba86970fc568a40449f51348de535ac71d93a2ce31195e978d0189899a0da696b3e51a5eb6e77a88890482ac873767c58c81763dda3dab410c9c1e99ca5 - languageName: node - linkType: hard - -"npm-normalize-package-bin@npm:^1.0.1": - version: 1.0.1 - resolution: "npm-normalize-package-bin@npm:1.0.1" - checksum: 495fae761551a765064f6937ed578a1d749c110355b63f5bbf6df9f0237862639de184a5c13fb9982d2a7745b2bd983e427bf16893ad98f20e53a32ad0254fc9 - languageName: node - linkType: hard - -"npm-packlist@npm:^1.4.8": - version: 1.4.8 - resolution: "npm-packlist@npm:1.4.8" - dependencies: - ignore-walk: ^3.0.1 - npm-bundled: ^1.0.1 - npm-normalize-package-bin: ^1.0.1 - checksum: 34c4bbd47daccd64e5e432b435ec37339bd472900dccd2a8f003d5004b4fff67b8561aadbbedaa5a5effd1dab9126b89fb28355fef1f3e85ff60ecf6b21433d9 - languageName: node - linkType: hard - "npm-run-path@npm:^2.0.0": version: 2.0.2 resolution: "npm-run-path@npm:2.0.2" @@ -10190,30 +10061,13 @@ fsevents@~2.3.1: languageName: node linkType: hard -"os-homedir@npm:^1.0.0": - version: 1.0.2 - resolution: "os-homedir@npm:1.0.2" - checksum: 725256246b2cec353250ec46442e3cfa7bc96ef92285d448a90f12f4bbd78c1bf087051b2cef0382da572e1a9ebc8aa24bd0940a3bdc633c3e3012eef1dc6848 - languageName: node - linkType: hard - -"os-tmpdir@npm:^1.0.0, os-tmpdir@npm:~1.0.2": +"os-tmpdir@npm:~1.0.2": version: 1.0.2 resolution: "os-tmpdir@npm:1.0.2" checksum: ca158a3c2e48748adc7736cdbe4c593723f8ed8581d2aae2f2a30fdb9417d4ba14bed1cd487d47561898a7b1ece88bce69745e9ce0303e1dea9ea7d22d1f1082 languageName: node linkType: hard -"osenv@npm:^0.1.4": - version: 0.1.5 - resolution: "osenv@npm:0.1.5" - dependencies: - os-homedir: ^1.0.0 - os-tmpdir: ^1.0.0 - checksum: 1c7462808c5ff0c2816b11f2f46265a98c395586058f98d73a6deac82955744484b277baedceeb962c419f3b75d0831a77ce7cf38b9e4f20729943ba79d72b08 - languageName: node - linkType: hard - "p-each-series@npm:^1.0.0": version: 1.0.0 resolution: "p-each-series@npm:1.0.0" @@ -11892,20 +11746,6 @@ fsevents@~2.3.1: languageName: node linkType: hard -"rc@npm:^1.2.8": - version: 1.2.8 - resolution: "rc@npm:1.2.8" - dependencies: - deep-extend: ^0.6.0 - ini: ~1.3.0 - minimist: ^1.2.0 - strip-json-comments: ~2.0.1 - bin: - rc: ./cli.js - checksum: ea2b7f7cee201a67923a2240de594a5d9b59bd312b814b06536d3d609a416dfd6fb9b85ea2abfd3b8a4eb5ed33eaff946ee75a8f2b7fb10941073c5cfee6b7a5 - languageName: node - linkType: hard - "react-app-polyfill@npm:^1.0.6": version: 1.0.6 resolution: "react-app-polyfill@npm:1.0.6" @@ -13770,13 +13610,6 @@ resolve@1.15.0: languageName: node linkType: hard -"strip-json-comments@npm:~2.0.1": - version: 2.0.1 - resolution: "strip-json-comments@npm:2.0.1" - checksum: e60d99aa2849c27a04dce0620334f45822197df6b83664dd3746971e9a0a766d989dbb8d87f9cb7350725d2b5df401a2343222ad06e36a1ba7d62c6633267fcb - languageName: node - linkType: hard - "style-loader@npm:0.23.1": version: 0.23.1 resolution: "style-loader@npm:0.23.1" @@ -13895,21 +13728,6 @@ resolve@1.15.0: languageName: node linkType: hard -"tar@npm:^4.4.13": - version: 4.4.13 - resolution: "tar@npm:4.4.13" - dependencies: - chownr: ^1.1.1 - fs-minipass: ^1.2.5 - minipass: ^2.8.6 - minizlib: ^1.2.1 - mkdirp: ^0.5.0 - safe-buffer: ^5.1.2 - yallist: ^3.0.3 - checksum: d325c316ac329ecb18f2b8cd3f85a80ab4a4105ada601b9253aaafae3fc14268e3cd874ccc265b6a08e60ebd17fbc31bd3dbc0d1018f874b536eb2a6e8ef6d9c - languageName: node - linkType: hard - "tar@npm:^6.0.2, tar@npm:^6.1.0": version: 6.1.0 resolution: "tar@npm:6.1.0" @@ -15186,7 +15004,7 @@ resolve@1.15.0: languageName: node linkType: hard -"yallist@npm:^3.0.0, yallist@npm:^3.0.2, yallist@npm:^3.0.3": +"yallist@npm:^3.0.2": version: 3.1.1 resolution: "yallist@npm:3.1.1" checksum: f352c93b92f601bb0399210bca37272e669c961e9bd886bac545380598765cbfdfb4f166e7b6c57ca4ec8a5af4ab3fa0fd78a47f9a7d655a3d580ff0fc9e7d79 diff --git a/go.mod b/go.mod index 8a2dc125..204d9842 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/RoaringBitmap/roaring v0.5.5 // indirect github.com/blevesearch/bleve v1.0.14 github.com/coreos/go-semver v0.3.0 + github.com/evanw/esbuild v0.12.8 // indirect github.com/fatih/color v1.10.0 github.com/glycerine/go-unsnap-stream v0.0.0-20210130063903-47dfef350d96 // indirect github.com/go-yaml/yaml v2.1.0+incompatible diff --git a/go.sum b/go.sum index 8268fb5e..524a37d9 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,4 @@ +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= @@ -9,6 +10,7 @@ github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBb github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6 h1:G1bPvciwNyF7IUmKXNt9Ak3m6u9DE1rF+RmtIkBpVdA= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= @@ -18,6 +20,7 @@ github.com/blevesearch/bleve v1.0.14 h1:Q8r+fHTt35jtGXJUM0ULwM3Tzg+MRfyai4ZkWDy2 github.com/blevesearch/bleve v1.0.14/go.mod h1:e/LJTr+E7EaoVdkQZTfoz7dt4KoDNvDbLb8MSKuNTLQ= github.com/blevesearch/blevex v1.0.0 h1:pnilj2Qi3YSEGdWgLj1Pn9Io7ukfXPoQcpAI1Bv8n/o= github.com/blevesearch/blevex v1.0.0/go.mod h1:2rNVqoG2BZI8t1/P1awgTKnGlx5MP9ZbtEciQaNhswc= +github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5 h1:/4ikScMMYMqsRFWJjCyzd3CNWB0lxvqDkqa5nEv6NMc= github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5/go.mod h1:PN0QNTLs9+j1bKy3d/GB/59wsNBFC4sWLWG3k69lWbc= github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo= github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M= @@ -37,32 +40,47 @@ github.com/blevesearch/zap/v14 v14.0.5 h1:NdcT+81Nvmp2zL+NhwSvGSLh7xNgGL8QRVZ67n github.com/blevesearch/zap/v14 v14.0.5/go.mod h1:bWe8S7tRrSBTIaZ6cLRbgNH4TUDaC9LZSpRGs85AsGY= github.com/blevesearch/zap/v15 v15.0.3 h1:Ylj8Oe+mo0P25tr9iLPp33lN6d4qcztGjaIsP51UxaY= github.com/blevesearch/zap/v15 v15.0.3/go.mod h1:iuwQrImsh1WjWJ0Ue2kBqY83a0rFtJTqfa9fp1rbVVU= +github.com/coreos/etcd v3.3.10+incompatible h1:jFneRYjIvLMLhDLCzuTuU4rSJUjRplcJQ7pD7MnhC04= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible h1:bXhRBIXoTm9BYHS3gE0TtQuyNZyeEMux2sDi4oo5YOo= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/couchbase/ghistogram v0.1.0 h1:b95QcQTCzjTUocDXp/uMgSNQi8oj1tGwnJ4bODWZnps= github.com/couchbase/ghistogram v0.1.0/go.mod h1:s1Jhy76zqfEecpNWJfWUiKZookAFaiGOEoyzgHt9i7k= +github.com/couchbase/moss v0.1.0 h1:HCL+xxHUwmOaL44kMM/gU08OW6QGCui1WVFO58bjhNI= github.com/couchbase/moss v0.1.0/go.mod h1:9MaHIaRuy9pvLPUJxB8sh8OrLfyDczECVL37grCIubs= github.com/couchbase/vellum v1.0.2 h1:BrbP0NKiyDdndMPec8Jjhy0U47CZ0Lgx3xUC2r9rZqw= github.com/couchbase/vellum v1.0.2/go.mod h1:FcwrEivFpNi24R3jLOs3n+fs5RnuQnQqCLBJ1uAg1W4= +github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/creack/pty v1.1.7 h1:6pwm8kMQKCmgUg0ZHTm5+/YvRK0s3THD/28+T6/kk4A= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d h1:SwD98825d6bdB+pEuTxWOXiSjBrHdOl/UVp75eI7JT8= github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d/go.mod h1:URriBxXwVq5ijiJ12C7iIZqlA69nTlI+LgI6/pwftG8= +github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 h1:iwZdTE0PVqJCos1vaoKsclOGD3ADKpshg3SRtYBbwso= github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= +github.com/cznic/strutil v0.0.0-20181122101858-275e90344537 h1:MZRmHqDBd0vxNwenEbKSQqRVT24d3C05ft8kduSwlqM= github.com/cznic/strutil v0.0.0-20181122101858-275e90344537/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= +github.com/evanw/esbuild v0.12.8 h1:NVQ1+s3yHyAh+uHtG50/DrMCndKbUVwmYmOAGWM/jxU= +github.com/evanw/esbuild v0.12.8/go.mod h1:y2AFBAGVelPqPodpdtxWWqe6n2jYf5FrsJbligmRmuw= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= @@ -91,14 +109,19 @@ github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/icza/dyno v0.0.0-20200205103839-49cb13720835 h1:f1irK5f03uGGj+FjgQfZ5VhdKNVQVJ4skHsedzVohQ4= github.com/icza/dyno v0.0.0-20200205103839-49cb13720835/go.mod h1:c1tRKs5Tx7E2+uHGSyyncziFjvGpgv4H2HrqXeUQ/Uk= +github.com/ikawaha/kagome.ipadic v1.1.2 h1:pFxZ1PpMpc6ZoBK712YN5cVK0u/ju2DZ+gRIOriJFFs= github.com/ikawaha/kagome.ipadic v1.1.2/go.mod h1:DPSBbU0czaJhAb/5uKQZHMc9MTVRpDugJfX+HddPHHg= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= +github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= @@ -107,14 +130,18 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kevinburke/ssh_config v1.1.0 h1:pH/t1WS9NzT8go394IqZeJTMHVm6Cr6ZJ6AQ+mdNo/o= github.com/kevinburke/ssh_config v1.1.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/kljensen/snowball v0.6.0 h1:6DZLCcZeL0cLfodx+Md4/OLC6b/bfurWUOUGs1ydfOU= github.com/kljensen/snowball v0.6.0/go.mod h1:27N7E8fVU5H68RlUmnWwZCfxgt4POBJfENGMvNRhldw= +github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -124,6 +151,7 @@ github.com/microcosm-cc/bluemonday v1.0.7 h1:6yAQfk4XT+PI/dk1ZeBp1gr3Q2Hd1DR0O3a github.com/microcosm-cc/bluemonday v1.0.7/go.mod h1:HOT/6NaBlR0f9XlxD3zolN6Z3N8Lp4pvhp+jLS5ihnI= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mozillazg/go-unidecode v0.1.1 h1:uiRy1s4TUqLbcROUrnCN/V85Jlli2AmDF6EeAXOeMHE= github.com/mozillazg/go-unidecode v0.1.1/go.mod h1:fYMdhyjni9ZeEmS6OE/GJHDLsF8TQvIVDwYR/drR26Q= @@ -131,9 +159,13 @@ github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM= github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pelletier/go-buffruneio v0.2.0 h1:U4t4R6YkofJ5xHm3dJzuRpPZ0mr5MMCoAWooScCR7aA= github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo= +github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/philhofer/fwd v1.1.1 h1:GdGcTjf5RNAxwS4QLsiMzJYj5KEvPJD3Abr261yRQXQ= @@ -143,7 +175,9 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 h1:dY6ETXrvDG7Sa4vE8ZQG4yqWg6UnOcbqTAahkV813vQ= github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8= github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM= @@ -160,12 +194,19 @@ github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06B github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvqWEUH6SjNiu7VhSjuVFTFiTcphaLU= github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= +github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/src-d/gcfg v1.4.0 h1:xXbNR5AlLSA315x2UO+fTSSAXCDf+Ar38/6oyGbDKQ4= github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI= @@ -173,6 +214,7 @@ github.com/steveyen/gtreap v0.1.0 h1:CjhzTa274PyJLJuMZwIzCO1PfC00oRa8d1Kc78bFXJM github.com/steveyen/gtreap v0.1.0/go.mod h1:kl/5J7XbrOmlIbYIXdRHDDE5QxHqpk0cmkT7Z4dM9/Y= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -180,13 +222,16 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= +github.com/tebeka/snowball v0.4.2 h1:ujvgLOr6IHbsvB2Vgz27IcxWqDrNu9/oPhhe74lN/Kc= github.com/tebeka/snowball v0.4.2/go.mod h1:4IfL14h1lvwZcp1sfXuuc7/7yCsvVffTWxWxCLfFpYg= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tinylib/msgp v1.1.5 h1:2gXmtWueD2HefZHQe1QOy9HVzmFrLOVvsXwXBQ0ayy0= github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= +github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31 h1:OXcKh35JaYsGMRzpvFkLv/MEyPuL49CThT1pZ8aSml4= github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 h1:3SVOIvH7Ae1KRYyQWRjXWJEA9sS/c/pjvH++55Gr648= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/willf/bitset v1.1.11 h1:N7Z7E9UvjW+sGsEl7k/SJrvY2reP1A07MrGuCjIOjRE= @@ -194,7 +239,9 @@ github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 h1:ESFSdwYZvkeru3RtdrYueztKhOBCSAAzS4Gf+k0tEow= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.2.1 h1:ruQGxdhGHe7FWOJPT0mKs5+pD2Xs1Bm/kdGlHO04FmM= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= @@ -206,8 +253,10 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -222,6 +271,7 @@ golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -239,6 +289,7 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -270,6 +321,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/src-d/go-billy.v4 v4.3.2 h1:0SQA1pRztfTFx2miS8sA97XvooFeNOmvUenF4o0EcVg= gopkg.in/src-d/go-billy.v4 v4.3.2/go.mod h1:nDjArDMp+XMs1aFAESLRjfGSgfvoYN0hDfzEk0GjC98= @@ -277,6 +329,7 @@ gopkg.in/src-d/go-git-fixtures.v3 v3.5.0 h1:ivZFOIltbce2Mo8IjzUHAFoq/IylO9WHhNOA gopkg.in/src-d/go-git-fixtures.v3 v3.5.0/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g= gopkg.in/src-d/go-git.v4 v4.13.1 h1:SRtFyV8Kxc0UP7aCHcijOMQGPxHSmMOPrzulQWolkYE= gopkg.in/src-d/go-git.v4 v4.13.1/go.mod h1:nx5NYcxdKxq5fpltdHnPa2Exj4Sx0EclMWZQbYDu2z8= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= diff --git a/internal/api/v2.go b/internal/api/v2.go index 46cb81e0..4fc81eeb 100644 --- a/internal/api/v2.go +++ b/internal/api/v2.go @@ -7,10 +7,21 @@ package api import ( + "bytes" + "errors" + "log" "net/http" + "os" "path/filepath" + "strings" "time" + "html/template" + "io/ioutil" + textTpl "text/template" + + esbuild "github.com/evanw/esbuild/pkg/api" + "github.com/rs/cors" "github.com/rundsk/dsk/internal/bus" "github.com/rundsk/dsk/internal/ddt" @@ -19,14 +30,74 @@ import ( "github.com/rundsk/dsk/internal/search" ) -func NewV2(ss *plex.Sources, appVersion string, b *bus.Broker, allowOrigins []string) *V2 { +func NewV2(ss *plex.Sources, cmps *plex.Components, appVersion string, b *bus.Broker, allowOrigins []string) *V2 { + jsTemplate, err := textTpl.New("playground-runtime-instance").Parse(`{{define "RuntimeInstance"}}import ThePlaygroundInQuestion from '{{.ImportPath}}'; + +{{.RuntimeJS | }} +{{end}} +`) + if err != nil { + log.Fatal("Unable to load js playground template", err) + } + + htmlTemplate, err := template.New("playground-template").Parse(`{{define "T"}} + + + + + + +
+ +{{end}} +`) + + if err != nil { + log.Fatal("Unable to load html playground template", err) + } + return &V2{ v1: NewV1(ss, appVersion, b, allowOrigins), allowOrigins: allowOrigins, sources: ss, + components: cmps, + playground: &PlaygroundInstance{ + jsTemplate: *jsTemplate, + htmlTemplate: *htmlTemplate, + }, } } +type PlaygroundRuntimeData struct { + jsRoot string + cssRoot string +} + +type PlaygroundInstanceSource struct { + runtimeJS template.JS + importPath template.JSStr +} + +type PlaygroundInstance struct { + htmlTemplate template.Template + jsTemplate textTpl.Template + + // byContentHash maps a hash to a playground source file something like the following + // + // ``` + // import React, {useCallback} from 'react' + + // export default () => { + // const onClick = useCallback(() => { + // alert('Oh yeah') + // }, []) + + // return + // } + // ``` + byContentHash map[string]string +} + type V2 struct { v1 *V1 @@ -39,6 +110,9 @@ type V2 struct { allowOrigins []string sources *plex.Sources + + components *plex.Components + playground *PlaygroundInstance } // V2FullSearchResults differs from V2FilterResults in some @@ -82,6 +156,13 @@ func (api V2) HTTPMux() http.Handler { mux.HandleFunc("/messages", api.v1.MessagesHandler) mux.HandleFunc("/", api.v1.NotFoundHandler) + mux.HandleFunc("/playgrounds/", func(w http.ResponseWriter, r *http.Request) { + if filepath.Ext(r.URL.Path) != ".html" { + api.PlaygroundAssetHandler(w, r) + } else { + api.PlaygroundHandler(w, r) + } + }) // An empty slice of origins indicates that CORS shoule be // disabled. If we'd pass an empty slice to the CORS middleware // it'd be interpreted to allow all origins. We want to be "secure @@ -172,3 +253,114 @@ func (api V2) FilterHandler(w http.ResponseWriter, r *http.Request) { wr.OK(api.NewTreeFilterResults(results, total, took)) } + +func (api V2) PlaygroundHandler(w http.ResponseWriter, r *http.Request) { + wr := httputil.NewResponder(w, r, "text/html") + r.Body.Close() + + id := strings.TrimSuffix(r.URL.Path[len("/playgrounds/"):], "/index.html") + log.Printf("Requesting HTML for Playground with ID %s", id) + + tmpPlaygroundInstance, err := ioutil.TempFile(os.TempDir(), "*.jsx") + if err != nil { + log.Fatal("Cannot create temporary file", err) + } + + // TODO Populate map, maybe with node_doc_transformer? + playgroundSrc := api.playground.byContentHash[id] + + if playgroundSrc == "" { + wr.Error(httputil.ErrNoSuchAsset, errors.New("No such contenthash")) + return + } + + // Remember to clean up the file afterwards + defer os.Remove(tmpPlaygroundInstance.Name()) + + // Example writing to the file + if _, err = tmpPlaygroundInstance.Write([]byte(playgroundSrc)); err != nil { + log.Fatal("Failed to write to temporary file", err) + } + + playgroundRuntime, err := os.ReadFile(filepath.Join("frontend", "src", "playground-runtime.jsx")) + + if err != nil { + log.Fatal("Cannot read playground runtime") + } + + playgroundRuntimeTmp, err := ioutil.TempFile(os.TempDir(), "*.jsx") + if err != nil { + log.Fatal("Cannot create temporary file", err) + } + + // Remember to clean up the file afterwards + defer os.Remove(playgroundRuntimeTmp.Name()) + + var b bytes.Buffer + api.playground.jsTemplate.Execute(&b, PlaygroundInstanceSource{ + importPath: template.JSStr(template.JSEscapeString(tmpPlaygroundInstance.Name())), + runtimeJS: template.JS(playgroundRuntime), + }) + + if _, err = playgroundRuntimeTmp.Write(b.Bytes()); err != nil { + log.Fatal("Failed to write to temporary file", err) + } + + result := esbuild.Build(esbuild.BuildOptions{ + EntryPointsAdvanced: []esbuild.EntryPoint{{InputPath: playgroundRuntimeTmp.Name(), + OutputPath: id}}, + Outdir: filepath.Join(api.components.Path), + Bundle: true, + Write: true, + NodePaths: []string{"frontend/node_modules"}, + PublicPath: "/api/v2/playgrounds", + LogLevel: esbuild.LogLevelDebug, + }) + + // Close the file + if err := tmpPlaygroundInstance.Close(); err != nil { + log.Fatal(err) + } + + if len(result.Errors) > 0 { + log.Fatal(result.Errors[0].Text) + wr.Error(httputil.Err, nil) + } + + var tpl bytes.Buffer + if err := api.playground.htmlTemplate.Execute(&tpl, PlaygroundRuntimeData{ + jsRoot: filepath.Join("/api/v2/playgrounds", id+".js"), + cssRoot: api.components.CSSEntryPoint, + }); err != nil { + wr.Error(httputil.Err, err) + } + + wr.OK(tpl.Bytes()) +} + +// Serves a playground's assets. +func (api V2) PlaygroundAssetHandler(w http.ResponseWriter, r *http.Request) { + wr := httputil.NewResponder(w, r, "") + r.Body.Close() + + path := r.URL.Path[len("/playgrounds/"):] + + if err := httputil.CheckSafePath(path, api.components.Path); err != nil { + wr.Error(httputil.ErrUnsafePath, err) + return + } + + asset, err := api.components.FS.Open(path) + if err != nil { + wr.Error(httputil.ErrNoSuchAsset, err) + return + } + defer asset.Close() + + info, err := asset.Stat() + if err != nil { + wr.Error(httputil.Err, err) + return + } + http.ServeContent(w, r, info.Name(), info.ModTime(), asset) +} diff --git a/internal/notify/watcher.go b/internal/notify/watcher.go index 3a09d824..b0c42bcd 100644 --- a/internal/notify/watcher.go +++ b/internal/notify/watcher.go @@ -12,8 +12,8 @@ import ( "path/filepath" "strings" - "github.com/rundsk/dsk/internal/bus" core "github.com/rjeczalik/notify" + "github.com/rundsk/dsk/internal/bus" ) func NewWatcher(path string) (*Watcher, error) { diff --git a/internal/plex/app.go b/internal/plex/app.go index a0a4deeb..b51f8df5 100644 --- a/internal/plex/app.go +++ b/internal/plex/app.go @@ -20,14 +20,15 @@ import ( git "gopkg.in/src-d/go-git.v4" ) -func NewApp(version string, livePath string, frontendPath string) *App { +func NewApp(version string, livePath string, componentsPath string, frontendPath string) *App { log.Print("Initializing application...") return &App{ - Teardown: &Teardown{Scope: "app"}, - Version: version, - livePath: livePath, - frontendPath: frontendPath, + Teardown: &Teardown{Scope: "app"}, + Version: version, + livePath: livePath, + componentsPath: componentsPath, + frontendPath: frontendPath, } } @@ -44,6 +45,9 @@ type App struct { // livePath is the absolute path to the live DDT. livePath string + // componentsPath is an absolute path to a directory containing (transpiled and bundled) assets of a component library + componentsPath string + LiveConfigDB config.DB Broker *bus.Broker @@ -52,6 +56,8 @@ type App struct { Sources *Sources + Components *Components + Frontend *frontend.Frontend } @@ -208,6 +214,12 @@ func (app *App) OpenVersions(ctx context.Context) error { return nil } +func (app *App) OpenComponents(ctx context.Context) error { + cmps, err := NewComponents(app.componentsPath) + app.Components = cmps + return err +} + func (app *App) Close() error { return app.Teardown.Close() } diff --git a/internal/plex/components.go b/internal/plex/components.go new file mode 100644 index 00000000..0249f2c2 --- /dev/null +++ b/internal/plex/components.go @@ -0,0 +1,44 @@ +// Copyright 2021 Marius Wilms, Christoph Labacher. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package plex + +import ( + "log" + "net/http" + "os" + "path/filepath" +) + +func NewComponents(path string) (*Components, error) { + log.Printf("Initializing components from path %s...", path) + + path, err := filepath.Abs(path) + return &Components{ + FS: http.Dir(path), + Path: path, + }, err +} + +type Components struct { + FS http.FileSystem + + Path string + + JSEntryPoint string + CSSEntryPoint string +} + +func (cmps *Components) Detect() { + hasFile := func(path string) bool { + if _, err := os.Stat(path); err == nil { + return true + } + return false + } + if hasFile("index.js") { + cmps.JSEntryPoint = "index.js" + } +}