stage-browser 0.1.0 → 0.2.0
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.
- package/README.md +92 -45
- package/build/icon.icns +0 -0
- package/build/icon.png +0 -0
- package/dist/bin/stage.js +111 -0
- package/dist/main/cli-args.js +28 -0
- package/dist/main/context-menu.js +68 -0
- package/dist/main/context.js +2 -0
- package/dist/main/extensions.js +78 -0
- package/dist/main/ipc.js +73 -0
- package/dist/main/main.js +282 -0
- package/dist/main/menu.js +140 -0
- package/dist/main/reveal.js +170 -0
- package/dist/main/selftest.js +570 -0
- package/dist/main/store.js +85 -0
- package/dist/main/suggest.js +43 -0
- package/dist/main/tabs.js +324 -0
- package/dist/main/ui-window.js +133 -0
- package/dist/main/url.js +38 -0
- package/dist/main/window.js +133 -0
- package/dist/preload/extension-compat.js +163 -0
- package/dist/preload/ui-preload.js +34 -0
- package/dist/shared/contract.js +6 -0
- package/dist/ui/app.js +692 -0
- package/{src → dist}/ui/index.html +15 -5
- package/dist/ui/mock.js +500 -0
- package/{src → dist}/ui/styles.css +55 -14
- package/node_modules/@types/chrome/LICENSE +21 -0
- package/node_modules/@types/chrome/README.md +15 -0
- package/node_modules/@types/chrome/chrome-cast/index.d.ts +1156 -0
- package/node_modules/@types/chrome/har-format/index.d.ts +6 -0
- package/node_modules/@types/chrome/index.d.ts +13786 -0
- package/node_modules/@types/chrome/package.json +99 -0
- package/node_modules/@types/filesystem/LICENSE +21 -0
- package/node_modules/@types/filesystem/README.md +15 -0
- package/node_modules/@types/filesystem/index.d.ts +564 -0
- package/node_modules/@types/filesystem/package.json +26 -0
- package/node_modules/@types/filewriter/LICENSE +21 -0
- package/node_modules/@types/filewriter/README.md +15 -0
- package/node_modules/@types/filewriter/index.d.ts +166 -0
- package/node_modules/@types/filewriter/package.json +25 -0
- package/node_modules/@types/har-format/LICENSE +21 -0
- package/node_modules/@types/har-format/README.md +15 -0
- package/node_modules/@types/har-format/index.d.ts +938 -0
- package/node_modules/@types/har-format/package.json +31 -0
- package/node_modules/adm-zip/LICENSE +21 -0
- package/node_modules/adm-zip/README.md +90 -0
- package/node_modules/adm-zip/adm-zip.js +1020 -0
- package/node_modules/adm-zip/headers/entryHeader.js +396 -0
- package/node_modules/adm-zip/headers/index.js +2 -0
- package/node_modules/adm-zip/headers/mainHeader.js +177 -0
- package/node_modules/adm-zip/methods/deflater.js +33 -0
- package/node_modules/adm-zip/methods/index.js +3 -0
- package/node_modules/adm-zip/methods/inflater.js +64 -0
- package/node_modules/adm-zip/methods/zipcrypto.js +175 -0
- package/node_modules/adm-zip/package.json +56 -0
- package/node_modules/adm-zip/types.d.ts +223 -0
- package/node_modules/adm-zip/util/constants.js +142 -0
- package/node_modules/adm-zip/util/decoder.js +5 -0
- package/node_modules/adm-zip/util/errors.js +66 -0
- package/node_modules/adm-zip/util/fattr.js +76 -0
- package/node_modules/adm-zip/util/index.js +5 -0
- package/node_modules/adm-zip/util/utils.js +481 -0
- package/node_modules/adm-zip/zipEntry.js +415 -0
- package/node_modules/adm-zip/zipFile.js +466 -0
- package/node_modules/debug/LICENSE +20 -0
- package/node_modules/debug/README.md +481 -0
- package/node_modules/debug/package.json +64 -0
- package/node_modules/debug/src/browser.js +272 -0
- package/node_modules/debug/src/common.js +292 -0
- package/node_modules/debug/src/index.js +10 -0
- package/node_modules/debug/src/node.js +263 -0
- package/node_modules/electron-chrome-web-store/README.md +143 -0
- package/node_modules/electron-chrome-web-store/dist/chrome-web-store.preload.js +299 -0
- package/node_modules/electron-chrome-web-store/dist/cjs/browser/index.js +1674 -0
- package/node_modules/electron-chrome-web-store/dist/esm/browser/index.mjs +950 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/api.d.ts +2 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/crx3.d.ts +20 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/id.d.ts +9 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/index.d.ts +62 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/installer.d.ts +29 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/loader.d.ts +18 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/types.d.ts +21 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/updater.d.ts +6 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/utils.d.ts +4 -0
- package/node_modules/electron-chrome-web-store/dist/types/common/constants.d.ts +44 -0
- package/node_modules/electron-chrome-web-store/dist/types/renderer/chrome-web-store.preload.d.ts +1 -0
- package/node_modules/electron-chrome-web-store/package.json +43 -0
- package/node_modules/ms/index.js +162 -0
- package/node_modules/ms/license.md +21 -0
- package/node_modules/ms/package.json +38 -0
- package/node_modules/ms/readme.md +59 -0
- package/node_modules/pbf/LICENSE +27 -0
- package/node_modules/pbf/README.md +293 -0
- package/node_modules/pbf/bin/pbf +17 -0
- package/node_modules/pbf/compile.js +441 -0
- package/node_modules/pbf/dist/pbf-dev.js +838 -0
- package/node_modules/pbf/dist/pbf.js +1 -0
- package/node_modules/pbf/index.d.ts +206 -0
- package/node_modules/pbf/index.js +830 -0
- package/node_modules/pbf/package.json +63 -0
- package/node_modules/protocol-buffers-schema/.travis.yml +7 -0
- package/node_modules/protocol-buffers-schema/LICENSE +21 -0
- package/node_modules/protocol-buffers-schema/README.md +122 -0
- package/node_modules/protocol-buffers-schema/example.js +11 -0
- package/node_modules/protocol-buffers-schema/example.proto +13 -0
- package/node_modules/protocol-buffers-schema/index.js +6 -0
- package/node_modules/protocol-buffers-schema/package.json +31 -0
- package/node_modules/protocol-buffers-schema/parse.js +769 -0
- package/node_modules/protocol-buffers-schema/stringify.js +206 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/basic.json +90 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/basic.proto +11 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/comments.json +99 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/comments.proto +19 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/complex.json +125 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/complex.proto +30 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/enum.json +42 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/enum.proto +8 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/escaped-quotes.json +32 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/escaped-quotes.proto +3 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/extend.json +167 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/extend.proto +19 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/import.json +30 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/import.proto +6 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/map.json +33 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/map.proto +3 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/no-tags.proto +8 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/oneof.json +41 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/oneof.proto +6 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/option.json +364 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/option.proto +72 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/options.json +47 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/options.proto +8 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/pheromon-trajectories.proto +8 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/reserved.json +55 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/reserved.proto +17 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/search.json +30 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/search.proto +5 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/service.json +108 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/service.proto +30 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/valid-packed.proto +35 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/version.json +90 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/version.proto +13 -0
- package/node_modules/protocol-buffers-schema/test/index.js +157 -0
- package/node_modules/protocol-buffers-schema/tokenize.js +56 -0
- package/node_modules/resolve-protobuf-schema/.travis.yml +3 -0
- package/node_modules/resolve-protobuf-schema/LICENSE +21 -0
- package/node_modules/resolve-protobuf-schema/README.md +49 -0
- package/node_modules/resolve-protobuf-schema/index.js +50 -0
- package/node_modules/resolve-protobuf-schema/package.json +25 -0
- package/node_modules/resolve-protobuf-schema/test/a.proto +5 -0
- package/node_modules/resolve-protobuf-schema/test/b.proto +5 -0
- package/node_modules/resolve-protobuf-schema/test/c.proto +3 -0
- package/node_modules/resolve-protobuf-schema/test/index.js +49 -0
- package/package.json +35 -11
- package/bin/stage.js +0 -52
- package/src/main/cli-args.js +0 -28
- package/src/main/context-menu.js +0 -64
- package/src/main/extensions.js +0 -61
- package/src/main/main.js +0 -310
- package/src/main/menu.js +0 -171
- package/src/main/reveal.js +0 -141
- package/src/main/selftest.js +0 -383
- package/src/main/store.js +0 -77
- package/src/main/suggest.js +0 -50
- package/src/main/tabs.js +0 -351
- package/src/main/url.js +0 -37
- package/src/main/window.js +0 -71
- package/src/preload/extension-compat.js +0 -34
- package/src/preload/ui-preload.js +0 -40
- package/src/ui/app.js +0 -588
- package/src/ui/mock.js +0 -455
- /package/{src → dist}/ui/newtab.html +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module.exports = function (sch) {
|
|
2
|
+
var noComments = function (line) {
|
|
3
|
+
var i = line.indexOf('//')
|
|
4
|
+
return i > -1 ? line.slice(0, i) : line
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
var noMultilineComments = function () {
|
|
8
|
+
var inside = false
|
|
9
|
+
return function (token) {
|
|
10
|
+
if (token === '/*') {
|
|
11
|
+
inside = true
|
|
12
|
+
return false
|
|
13
|
+
}
|
|
14
|
+
if (token === '*/') {
|
|
15
|
+
inside = false
|
|
16
|
+
return false
|
|
17
|
+
}
|
|
18
|
+
return !inside
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var trim = function (line) {
|
|
23
|
+
return line.trim()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var removeQuotedLines = function (list) {
|
|
27
|
+
return function (str) {
|
|
28
|
+
var s = '$' + list.length + '$'
|
|
29
|
+
list.push(str)
|
|
30
|
+
return s
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var restoreQuotedLines = function (list) {
|
|
35
|
+
var re = /^\$(\d+)\$$/
|
|
36
|
+
return function (line) {
|
|
37
|
+
var m = line.match(re)
|
|
38
|
+
return m ? list[+m[1]] : line
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var replacements = []
|
|
43
|
+
return sch
|
|
44
|
+
.replace(/"(\\"|[^"\n])*?"|'(\\'|[^'\n])*?'/gm, removeQuotedLines(replacements))
|
|
45
|
+
.replace(/([;,{}()=:[\]<>]|\/\*|\*\/)/g, ' $1 ')
|
|
46
|
+
.split(/\n/)
|
|
47
|
+
.map(trim)
|
|
48
|
+
.filter(Boolean)
|
|
49
|
+
.map(noComments)
|
|
50
|
+
.map(trim)
|
|
51
|
+
.filter(Boolean)
|
|
52
|
+
.join('\n')
|
|
53
|
+
.split(/\s+|\n+/gm)
|
|
54
|
+
.filter(noMultilineComments())
|
|
55
|
+
.map(restoreQuotedLines(replacements))
|
|
56
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Mathias Buus
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# resolve-protobuf-schema
|
|
2
|
+
|
|
3
|
+
Read a protobuf schema from the disk, parse it and resolve all imports
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install resolve-protobuf-schema
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
[](http://travis-ci.org/mafintosh/resolve-protobuf-schema)
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Store the following example protobuf schema in `test.proto`
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
message Test {
|
|
17
|
+
optional string test = 1;
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Then run
|
|
22
|
+
|
|
23
|
+
``` js
|
|
24
|
+
var resolve = require('resolve-protobuf-schema')
|
|
25
|
+
console.log(resolve.sync('test.proto')) // prints the parsed schema
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Schema imports will resolved as well
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
import "./test.proto"
|
|
32
|
+
|
|
33
|
+
message AnotherTest {
|
|
34
|
+
optional string test = 1;
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
``` js
|
|
39
|
+
console.log(resolve.sync('./another-test.proto')) // will print a combined parsed schema
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## API
|
|
43
|
+
|
|
44
|
+
* `resolve(path, cb)` read and resolve a schema
|
|
45
|
+
* `resolve.sync(path)` sync version of `resolve`
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
MIT
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var schema = require('protocol-buffers-schema')
|
|
2
|
+
var fs = require('fs')
|
|
3
|
+
var path = require('path')
|
|
4
|
+
|
|
5
|
+
var merge = function(a, b) {
|
|
6
|
+
a.messages = a.messages.concat(b.messages)
|
|
7
|
+
a.enums = a.enums.concat(b.enums)
|
|
8
|
+
return a
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
var readSync = function(filename) {
|
|
12
|
+
if (!/\.proto$/i.test(filename) && !fs.existsSync(filename)) filename += '.proto'
|
|
13
|
+
|
|
14
|
+
var sch = schema(fs.readFileSync(filename, 'utf-8'))
|
|
15
|
+
var imports = [].concat(sch.imports || [])
|
|
16
|
+
|
|
17
|
+
imports.forEach(function(i) {
|
|
18
|
+
sch = merge(sch, readSync(path.resolve(path.dirname(filename), i)))
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
return sch
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var read = function(filename, cb) {
|
|
25
|
+
fs.exists(filename, function(exists) {
|
|
26
|
+
if (!exists && !/\.proto$/i.test(filename)) filename += '.proto'
|
|
27
|
+
|
|
28
|
+
fs.readFile(filename, 'utf-8', function(err, proto) {
|
|
29
|
+
if (err) return cb(err)
|
|
30
|
+
|
|
31
|
+
var sch = schema(proto)
|
|
32
|
+
var imports = [].concat(sch.imports || [])
|
|
33
|
+
|
|
34
|
+
var loop = function() {
|
|
35
|
+
if (!imports.length) return cb(null, sch)
|
|
36
|
+
|
|
37
|
+
read(path.resolve(path.dirname(filename), imports.shift()), function(err, ch) {
|
|
38
|
+
if (err) return cb(err)
|
|
39
|
+
sch = merge(sch, ch)
|
|
40
|
+
loop()
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
loop()
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
module.exports = read
|
|
50
|
+
module.exports.sync = readSync
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "resolve-protobuf-schema",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Read a protobuf schema from the disk, parse it and resolve all imports",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"protocol-buffers-schema": "^3.3.1"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"tape": "^3.0.0"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "tape test/index.js"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/mafintosh/resolve-protobuf-schema.git"
|
|
18
|
+
},
|
|
19
|
+
"author": "Mathias Buus (@mafintosh)",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/mafintosh/resolve-protobuf-schema/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/mafintosh/resolve-protobuf-schema"
|
|
25
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var tape = require('tape')
|
|
2
|
+
var schema = require('../')
|
|
3
|
+
|
|
4
|
+
var test = function(name, fn) {
|
|
5
|
+
tape(name, function(t) {
|
|
6
|
+
fn(t, schema)
|
|
7
|
+
})
|
|
8
|
+
tape(name+' sync', function(t) {
|
|
9
|
+
fn(t, function(name, cb) {
|
|
10
|
+
cb(null, schema.sync(name))
|
|
11
|
+
})
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
test('c', function(t, schema) {
|
|
16
|
+
schema(__dirname+'/c.proto', function(err, sch) {
|
|
17
|
+
t.notOk(err, 'no err')
|
|
18
|
+
t.same(sch.messages.length, 1)
|
|
19
|
+
schema(__dirname+'/c', function(err, sch) {
|
|
20
|
+
t.notOk(err, 'no err')
|
|
21
|
+
t.same(sch.messages.length, 1)
|
|
22
|
+
t.end()
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
test('b imports c', function(t, schema) {
|
|
28
|
+
schema(__dirname+'/b.proto', function(err, sch) {
|
|
29
|
+
t.notOk(err, 'no err')
|
|
30
|
+
t.same(sch.messages.length, 2)
|
|
31
|
+
schema(__dirname+'/b', function(err, sch) {
|
|
32
|
+
t.notOk(err, 'no err')
|
|
33
|
+
t.same(sch.messages.length, 2)
|
|
34
|
+
t.end()
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test('a imports b imports c', function(t, schema) {
|
|
40
|
+
schema(__dirname+'/a.proto', function(err, sch) {
|
|
41
|
+
t.notOk(err, 'no err')
|
|
42
|
+
t.same(sch.messages.length, 3)
|
|
43
|
+
schema(__dirname+'/a', function(err, sch) {
|
|
44
|
+
t.notOk(err, 'no err')
|
|
45
|
+
t.same(sch.messages.length, 3)
|
|
46
|
+
t.end()
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
})
|
package/package.json
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stage-browser",
|
|
3
3
|
"productName": "Stage",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"description": "A minimal Chromium browser for screen sharing: the page fills the window, tabs hide until you reach for them.",
|
|
6
|
-
"main": "
|
|
6
|
+
"main": "dist/main/main.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
8
|
+
"build": "rm -rf dist && tsc && cp src/ui/*.html src/ui/*.css dist/ui/ && chmod +x dist/bin/stage.js",
|
|
9
|
+
"typecheck": "tsc --noEmit && tsc -p scripts",
|
|
10
|
+
"prepare": "npm run build",
|
|
11
|
+
"start": "npm run build && electron .",
|
|
12
|
+
"selftest": "npm run build && STAGE_SELFTEST=1 electron .",
|
|
13
|
+
"ui:preview": "npm run build && node scripts/ui-preview.mts",
|
|
14
|
+
"cli:install": "sh scripts/install-cli.sh",
|
|
15
|
+
"lint": "oxlint --deny-warnings",
|
|
16
|
+
"lint:fix": "oxlint --fix"
|
|
12
17
|
},
|
|
13
18
|
"dependencies": {
|
|
14
19
|
"electron": "^45.4.1",
|
|
@@ -16,19 +21,19 @@
|
|
|
16
21
|
"electron-chrome-web-store": "^0.13.0"
|
|
17
22
|
},
|
|
18
23
|
"bin": {
|
|
19
|
-
"stage": "bin/stage.js"
|
|
24
|
+
"stage": "dist/bin/stage.js"
|
|
20
25
|
},
|
|
21
26
|
"files": [
|
|
22
|
-
"
|
|
23
|
-
"src/",
|
|
27
|
+
"dist/",
|
|
24
28
|
"build/icon.png",
|
|
29
|
+
"build/icon.icns",
|
|
25
30
|
"README.md"
|
|
26
31
|
],
|
|
27
32
|
"os": [
|
|
28
33
|
"darwin"
|
|
29
34
|
],
|
|
30
35
|
"engines": {
|
|
31
|
-
"node": ">=
|
|
36
|
+
"node": ">=22"
|
|
32
37
|
},
|
|
33
38
|
"keywords": [
|
|
34
39
|
"browser",
|
|
@@ -38,5 +43,24 @@
|
|
|
38
43
|
"presentation",
|
|
39
44
|
"demo"
|
|
40
45
|
],
|
|
41
|
-
"license": "MIT"
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/andrewckor/stage-browser.git"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/andrewckor/stage-browser#readme",
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "https://github.com/andrewckor/stage-browser/issues"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/node": "^26.6.6",
|
|
57
|
+
"oxlint": "^1.94.0",
|
|
58
|
+
"typescript": "^7.0.2"
|
|
59
|
+
},
|
|
60
|
+
"overrides": {
|
|
61
|
+
"adm-zip": "^0.6.1"
|
|
62
|
+
},
|
|
63
|
+
"bundleDependencies": [
|
|
64
|
+
"electron-chrome-web-store"
|
|
65
|
+
]
|
|
42
66
|
}
|
package/bin/stage.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict'
|
|
3
|
-
const fs = require('fs')
|
|
4
|
-
const path = require('path')
|
|
5
|
-
const { spawn } = require('child_process')
|
|
6
|
-
|
|
7
|
-
const root = path.resolve(path.dirname(fs.realpathSync(__filename)), '..')
|
|
8
|
-
const args = process.argv.slice(2)
|
|
9
|
-
const pkg = require(path.join(root, 'package.json'))
|
|
10
|
-
|
|
11
|
-
const HELP = `Stage ${pkg.version} - a minimal browser for screen sharing
|
|
12
|
-
|
|
13
|
-
Usage:
|
|
14
|
-
stage open Stage (restores the last session)
|
|
15
|
-
stage <url|domain|words> ... open each argument as a tab; bare words become a Google search
|
|
16
|
-
stage --size 1280x720 ... set the window's content size
|
|
17
|
-
stage --pin start with the tab bar pinned
|
|
18
|
-
stage --fresh skip the saved session
|
|
19
|
-
stage --fg run in the foreground with logs in the terminal
|
|
20
|
-
stage --help | --version
|
|
21
|
-
`
|
|
22
|
-
|
|
23
|
-
if (args.includes('--help') || args.includes('-h')) {
|
|
24
|
-
process.stdout.write(HELP)
|
|
25
|
-
process.exit(0)
|
|
26
|
-
}
|
|
27
|
-
if (args.includes('--version') || args.includes('-v')) {
|
|
28
|
-
console.log(pkg.version)
|
|
29
|
-
process.exit(0)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
let electron
|
|
33
|
-
try {
|
|
34
|
-
electron = require('electron')
|
|
35
|
-
} catch (e) {
|
|
36
|
-
console.error('stage: could not find Electron. Run `npm install` in ' + root)
|
|
37
|
-
process.exit(1)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const fg = args.includes('--fg')
|
|
41
|
-
const child = spawn(electron, [root, ...args], fg ? { stdio: 'inherit' } : { detached: true, stdio: 'ignore' })
|
|
42
|
-
child.on('error', (e) => {
|
|
43
|
-
console.error('stage: failed to launch: ' + e.message)
|
|
44
|
-
process.exit(1)
|
|
45
|
-
})
|
|
46
|
-
if (fg) {
|
|
47
|
-
child.on('exit', (code, signal) => process.exit(signal ? 1 : code || 0))
|
|
48
|
-
} else {
|
|
49
|
-
child.unref()
|
|
50
|
-
// spawn errors surface asynchronously; give them a tick before exiting
|
|
51
|
-
setImmediate(() => process.exit(0))
|
|
52
|
-
}
|
package/src/main/cli-args.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
// Parses Stage's CLI arguments out of an argv array shaped like
|
|
3
|
-
// [electronBinary, appPath, ...userArgs] (also what second-instance delivers).
|
|
4
|
-
// Chromium/Electron switches (--inspect, --remote-debugging-port=..., etc.) are ignored.
|
|
5
|
-
|
|
6
|
-
function parseArgs(argv, appRoot) {
|
|
7
|
-
const out = { urls: [], size: null, pin: false, fresh: false }
|
|
8
|
-
// argv is [electron, appPath, ...args]; second-instance may carry extra leading entries,
|
|
9
|
-
// so anchor on the app path when we know it.
|
|
10
|
-
const at = appRoot ? argv.findIndex((a) => a === appRoot || a === '.') : -1
|
|
11
|
-
const args = at >= 0 ? argv.slice(at + 1) : argv.slice(2)
|
|
12
|
-
for (let i = 0; i < args.length; i++) {
|
|
13
|
-
const a = args[i]
|
|
14
|
-
if (!a) continue
|
|
15
|
-
if (a === '--pin') out.pin = true
|
|
16
|
-
else if (a === '--fresh') out.fresh = true
|
|
17
|
-
else if (a === '--fg') continue
|
|
18
|
-
else if (a === '--size' || a.startsWith('--size=')) {
|
|
19
|
-
const v = a === '--size' ? args[++i] : a.slice(7)
|
|
20
|
-
const m = /^(\d{2,5})x(\d{2,5})$/i.exec(v || '')
|
|
21
|
-
if (m) out.size = { width: +m[1], height: +m[2] }
|
|
22
|
-
} else if (a.startsWith('--') || a.startsWith('-psn_')) continue
|
|
23
|
-
else out.urls.push(a)
|
|
24
|
-
}
|
|
25
|
-
return out
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
module.exports = { parseArgs }
|
package/src/main/context-menu.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
const { Menu, MenuItem, clipboard } = require('electron')
|
|
3
|
-
|
|
4
|
-
function showPageMenu(ctx, tab, params) {
|
|
5
|
-
const wc = tab.wc
|
|
6
|
-
const nav = wc.navigationHistory
|
|
7
|
-
const f = params.editFlags
|
|
8
|
-
const items = []
|
|
9
|
-
const sep = () => items.length && items[items.length - 1].type !== 'separator' && items.push({ type: 'separator' })
|
|
10
|
-
|
|
11
|
-
if (params.linkURL) {
|
|
12
|
-
items.push({ label: 'Open Link in New Tab', click: () => ctx.tabs.create({ url: params.linkURL, activate: false, index: ctx.tabs.insertIndexAfterActive() }) })
|
|
13
|
-
items.push({ label: 'Copy Link Address', click: () => clipboard.writeText(params.linkURL) })
|
|
14
|
-
sep()
|
|
15
|
-
}
|
|
16
|
-
if (params.mediaType === 'image') {
|
|
17
|
-
items.push({ label: 'Copy Image', click: () => wc.copyImageAt(params.x, params.y) })
|
|
18
|
-
sep()
|
|
19
|
-
}
|
|
20
|
-
if (params.isEditable || params.selectionText) {
|
|
21
|
-
if (params.isEditable) items.push({ label: 'Cut', enabled: f.canCut, role: 'cut' })
|
|
22
|
-
items.push({ label: 'Copy', enabled: f.canCopy, role: 'copy' })
|
|
23
|
-
if (params.isEditable) items.push({ label: 'Paste', enabled: f.canPaste, role: 'paste' })
|
|
24
|
-
items.push({ label: 'Select All', enabled: f.canSelectAll, role: 'selectAll' })
|
|
25
|
-
sep()
|
|
26
|
-
}
|
|
27
|
-
if (!params.isEditable) {
|
|
28
|
-
items.push({ label: 'Back', enabled: nav.canGoBack(), click: () => nav.goBack() })
|
|
29
|
-
items.push({ label: 'Forward', enabled: nav.canGoForward(), click: () => nav.goForward() })
|
|
30
|
-
items.push({ label: 'Reload', click: () => wc.reload() })
|
|
31
|
-
sep()
|
|
32
|
-
if (!params.selectionText) items.push({ label: 'Select All', enabled: f.canSelectAll, role: 'selectAll' })
|
|
33
|
-
}
|
|
34
|
-
sep()
|
|
35
|
-
items.push({ label: 'Inspect Element', click: () => wc.inspectElement(params.x, params.y) })
|
|
36
|
-
|
|
37
|
-
const menu = Menu.buildFromTemplate(items)
|
|
38
|
-
if (ctx.ext) {
|
|
39
|
-
const extItems = ctx.ext.getContextMenuItems(wc, params)
|
|
40
|
-
if (extItems.length) {
|
|
41
|
-
menu.append(new MenuItem({ type: 'separator' }))
|
|
42
|
-
for (const i of extItems) menu.append(i)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
menu.popup({ window: ctx.win })
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function showTabMenu(ctx, id) {
|
|
49
|
-
const tab = ctx.tabs.get(id)
|
|
50
|
-
if (!tab) return
|
|
51
|
-
const i = ctx.tabs.list.indexOf(tab)
|
|
52
|
-
Menu.buildFromTemplate([
|
|
53
|
-
{ label: 'Reload', click: () => tab.wc.reload() },
|
|
54
|
-
{ label: 'Duplicate', click: () => ctx.tabs.duplicate(id) },
|
|
55
|
-
{ label: tab.muted ? 'Unmute Tab' : 'Mute Tab', click: () => ctx.tabs.toggleMute(id) },
|
|
56
|
-
{ type: 'separator' },
|
|
57
|
-
{ label: 'Close Other Tabs', enabled: ctx.tabs.list.length > 1, click: () => ctx.tabs.closeOthers(id) },
|
|
58
|
-
{ label: 'Close Tabs to the Right', enabled: i < ctx.tabs.list.length - 1, click: () => ctx.tabs.closeRight(id) },
|
|
59
|
-
{ type: 'separator' },
|
|
60
|
-
{ label: 'Close', click: () => ctx.tabs.close(id) },
|
|
61
|
-
]).popup({ window: ctx.win })
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
module.exports = { showPageMenu, showTabMenu }
|
package/src/main/extensions.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
const path = require('path')
|
|
3
|
-
const { ElectronChromeExtensions } = require('electron-chrome-extensions')
|
|
4
|
-
const { installChromeWebStore, installExtension, uninstallExtension } = require('electron-chrome-web-store')
|
|
5
|
-
|
|
6
|
-
const OKTA_ID = 'glnpjglilkicbckjpbgcfkogebgllemb'
|
|
7
|
-
const WEB_STORE_URL = 'https://chromewebstore.google.com/'
|
|
8
|
-
|
|
9
|
-
function createExtensions(ctx) {
|
|
10
|
-
const ext = new ElectronChromeExtensions({
|
|
11
|
-
session: ctx.session,
|
|
12
|
-
createTab: async (details) => {
|
|
13
|
-
const tab = ctx.tabs.create({ url: details.url, activate: details.active !== false, index: ctx.tabs.insertIndexAfterActive() })
|
|
14
|
-
return [tab.wc, ctx.win]
|
|
15
|
-
},
|
|
16
|
-
selectTab: (wc) => ctx.tabs.activate(wc.id),
|
|
17
|
-
removeTab: (wc) => ctx.tabs.close(wc.id),
|
|
18
|
-
})
|
|
19
|
-
// Registered after the library's preload (which the constructor above registers), so it runs
|
|
20
|
-
// second and can fill in constants on the chrome.* objects the library created.
|
|
21
|
-
const compat = path.join(__dirname, '..', 'preload', 'extension-compat.js')
|
|
22
|
-
ctx.session.registerPreloadScript({ id: 'stage-extension-compat-frame', type: 'frame', filePath: compat })
|
|
23
|
-
ctx.session.registerPreloadScript({ id: 'stage-extension-compat-sw', type: 'service-worker', filePath: compat })
|
|
24
|
-
// <browser-action-list> in the UI view loads icons over crx://
|
|
25
|
-
ElectronChromeExtensions.handleCRXProtocol(ctx.uiView.webContents.session)
|
|
26
|
-
|
|
27
|
-
ext.on('browser-action-popup-created', (popup) => {
|
|
28
|
-
const bw = popup.browserWindow
|
|
29
|
-
ctx.reveal.setPopupOpen(true)
|
|
30
|
-
if (!ctx.quitting) ctx.reveal.show()
|
|
31
|
-
const done = () => {
|
|
32
|
-
ctx.reveal.setPopupOpen(false)
|
|
33
|
-
if (!ctx.win.isDestroyed()) ctx.win.off('focus', onFocus)
|
|
34
|
-
}
|
|
35
|
-
// the library's own blur handling can miss when focus moves to a BaseWindow
|
|
36
|
-
const onFocus = () => !popup.isDestroyed() && popup.destroy()
|
|
37
|
-
ctx.win.on('focus', onFocus)
|
|
38
|
-
if (bw) bw.once('closed', done)
|
|
39
|
-
else done()
|
|
40
|
-
})
|
|
41
|
-
return ext
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
async function setupWebStore(ctx) {
|
|
45
|
-
await installChromeWebStore({ session: ctx.session })
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function installed(ctx) {
|
|
49
|
-
const exts = ctx.session.extensions ? ctx.session.extensions.getAllExtensions() : ctx.session.getAllExtensions()
|
|
50
|
-
return exts.map((e) => ({ id: e.id, name: e.name, version: e.version }))
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function install(ctx, id) {
|
|
54
|
-
return installExtension(id, { session: ctx.session })
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function remove(ctx, id) {
|
|
58
|
-
return uninstallExtension(id, { session: ctx.session })
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
module.exports = { createExtensions, setupWebStore, installed, install, remove, OKTA_ID, WEB_STORE_URL }
|