capybara-simulated 0.0.7 → 0.1.1
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.
- checksums.yaml +4 -4
- data/README.md +303 -158
- data/lib/capybara/simulated/asset_cache.rb +232 -0
- data/lib/capybara/simulated/browser.rb +3409 -845
- data/lib/capybara/simulated/driver.rb +341 -134
- data/lib/capybara/simulated/errors.rb +9 -5
- data/lib/capybara/simulated/js/bridge.bundle.js +19738 -0
- data/lib/capybara/simulated/js/snapshot_stubs.js +110 -0
- data/lib/capybara/simulated/node.rb +151 -163
- data/lib/capybara/simulated/quickjs_runtime.rb +424 -0
- data/lib/capybara/simulated/runtime_shared.rb +183 -0
- data/lib/capybara/simulated/script_cache.rb +168 -0
- data/lib/capybara/simulated/sourcemap.rb +119 -0
- data/lib/capybara/simulated/stack_resolver.rb +97 -0
- data/lib/capybara/simulated/trace.rb +111 -0
- data/lib/capybara/simulated/v8_runtime.rb +987 -0
- data/lib/capybara/simulated/version.rb +3 -1
- data/lib/capybara/simulated/webauthn_state.rb +367 -0
- data/lib/capybara/simulated/whitespace_normalizer.rb +45 -0
- data/lib/capybara/simulated/worker_runtime.rb +30 -0
- data/lib/capybara/simulated.rb +31 -4
- data/lib/capybara-simulated.rb +2 -0
- data/vendor/js/vendor.bundle.js +13 -0
- metadata +24 -32
- data/vendor/esbuild-wasm/LICENSE.md +0 -21
- data/vendor/esbuild-wasm/bin/esbuild +0 -91
- data/vendor/esbuild-wasm/esbuild.wasm +0 -0
- data/vendor/esbuild-wasm/lib/main.js +0 -2337
- data/vendor/esbuild-wasm/wasm_exec.js +0 -575
- data/vendor/esbuild-wasm/wasm_exec_node.js +0 -40
- data/vendor/js/bundle-modules.mjs +0 -168
- data/vendor/js/csim.bundle.js +0 -91560
- data/vendor/js/entry.mjs +0 -23
- data/vendor/js/prelude.js +0 -190
- data/vendor/js/runtime.js +0 -2208
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 Evan Wallace
|
|
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 all
|
|
13
|
-
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 THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// Forward to the automatically-generated WebAssembly loader from the Go compiler
|
|
4
|
-
|
|
5
|
-
const module_ = require('module');
|
|
6
|
-
const path = require('path');
|
|
7
|
-
const fs = require('fs');
|
|
8
|
-
|
|
9
|
-
const wasm_exec_node = path.join(__dirname, '..', 'wasm_exec_node.js');
|
|
10
|
-
const esbuild_wasm = path.join(__dirname, '..', 'esbuild.wasm');
|
|
11
|
-
|
|
12
|
-
const code = fs.readFileSync(wasm_exec_node, 'utf8');
|
|
13
|
-
const wrapper = new Function('require', 'WebAssembly', code);
|
|
14
|
-
|
|
15
|
-
function instantiate(bytes, importObject) {
|
|
16
|
-
// Using this API causes "./esbuild --version" to run around 1 second faster
|
|
17
|
-
// than using the "WebAssembly.instantiate()" API when run in node (v12.16.2)
|
|
18
|
-
const module = new WebAssembly.Module(bytes);
|
|
19
|
-
const instance = new WebAssembly.Instance(module, importObject);
|
|
20
|
-
return Promise.resolve({ instance, module });
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Node has another bug where using "fs.read" to read from stdin reads
|
|
24
|
-
// everything successfully and then throws an error, but only on Windows. Go's
|
|
25
|
-
// WebAssembly support uses "fs.read" so it hits this problem. This is a patch
|
|
26
|
-
// to try to work around the bug in node. This bug has been reported to node
|
|
27
|
-
// at least twice in https://github.com/nodejs/node/issues/35997 and in
|
|
28
|
-
// https://github.com/nodejs/node/issues/19831. This issue has also been
|
|
29
|
-
// reported to the Go project: https://github.com/golang/go/issues/43913.
|
|
30
|
-
const read = fs.read;
|
|
31
|
-
fs.read = function () {
|
|
32
|
-
const callback = arguments[5];
|
|
33
|
-
arguments[5] = function (err, count) {
|
|
34
|
-
if (count === 0 && err && err.code === 'EOF') {
|
|
35
|
-
arguments[0] = null;
|
|
36
|
-
}
|
|
37
|
-
return callback.apply(this, arguments);
|
|
38
|
-
};
|
|
39
|
-
return read.apply(this, arguments);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// Hack around a Unicode bug in node: https://github.com/nodejs/node/issues/24550.
|
|
43
|
-
// See this for the matching Go issue: https://github.com/golang/go/issues/43917.
|
|
44
|
-
const write = fs.write;
|
|
45
|
-
fs.write = function (fd, buf, offset, length, position, callback) {
|
|
46
|
-
if (offset === 0 && length === buf.length && position === null) {
|
|
47
|
-
if (fd === process.stdout.fd) {
|
|
48
|
-
try {
|
|
49
|
-
process.stdout.write(buf, err => err ? callback(err, 0, null) : callback(null, length, buf));
|
|
50
|
-
} catch (err) {
|
|
51
|
-
callback(err, 0, null);
|
|
52
|
-
}
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (fd === process.stderr.fd) {
|
|
56
|
-
try {
|
|
57
|
-
process.stderr.write(buf, err => err ? callback(err, 0, null) : callback(null, length, buf));
|
|
58
|
-
} catch (err) {
|
|
59
|
-
callback(err, 0, null);
|
|
60
|
-
}
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return write.apply(this, arguments);
|
|
65
|
-
};
|
|
66
|
-
const writeSync = fs.writeSync;
|
|
67
|
-
fs.writeSync = function (fd, buf) {
|
|
68
|
-
if (fd === process.stdout.fd) return process.stdout.write(buf), buf.length;
|
|
69
|
-
if (fd === process.stderr.fd) return process.stderr.write(buf), buf.length;
|
|
70
|
-
return writeSync.apply(this, arguments);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
// WASM code generated with Go 1.17.2+ will crash when run in a situation with
|
|
74
|
-
// many environment variables: https://github.com/golang/go/issues/49011. An
|
|
75
|
-
// example of this situation is running a Go-compiled WASM executable in GitHub
|
|
76
|
-
// Actions. Work around this by filtering node's copy of environment variables
|
|
77
|
-
// down to only include the environment variables that esbuild currently uses.
|
|
78
|
-
const esbuildUsedEnvVars = [
|
|
79
|
-
'NO_COLOR',
|
|
80
|
-
'NODE_PATH',
|
|
81
|
-
'npm_config_user_agent',
|
|
82
|
-
'WT_SESSION',
|
|
83
|
-
]
|
|
84
|
-
for (let key in process.env) {
|
|
85
|
-
if (esbuildUsedEnvVars.indexOf(key) < 0) {
|
|
86
|
-
delete process.env[key]
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
process.argv.splice(2, 0, esbuild_wasm);
|
|
91
|
-
wrapper(module_.createRequire(wasm_exec_node), Object.assign(Object.create(WebAssembly), { instantiate }));
|
|
Binary file
|