venetian 0.3.1-x86_64-linux → 0.4.0-x86_64-linux
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/AGENTS.md +151 -0
- data/CLAUDE.md +1 -0
- data/README.md +11 -0
- data/Rakefile +1 -0
- data/exe/x86_64-linux/node +2 -2
- data/exe/x86_64-linux/package/browsers.json +9 -9
- data/exe/x86_64-linux/package/cli.js +1 -0
- data/exe/x86_64-linux/package/lib/bootstrap.js +61 -0
- data/exe/x86_64-linux/package/lib/coreBundle.js +6393 -4170
- data/exe/x86_64-linux/package/lib/server/electron/loader.js +4 -0
- data/exe/x86_64-linux/package/lib/tools/cli-client/cli.js +2 -1
- data/exe/x86_64-linux/package/lib/tools/cli-client/help.json +99 -12
- data/exe/x86_64-linux/package/lib/tools/cli-client/output.js +17 -16
- data/exe/x86_64-linux/package/lib/tools/cli-client/program.js +8 -4
- data/exe/x86_64-linux/package/lib/tools/cli-client/session.js +2 -0
- data/exe/x86_64-linux/package/lib/tools/skills/playwright-cli/SKILL.md +71 -3
- data/exe/x86_64-linux/package/lib/tools/skills/playwright-cli/references/pr-attachments.md +60 -0
- data/exe/x86_64-linux/package/lib/tools/skills/playwright-cli/references/running-code.md +4 -0
- data/exe/x86_64-linux/package/lib/tools/skills/playwright-cli/references/session-management.md +2 -0
- data/exe/x86_64-linux/package/lib/tools/skills/playwright-cli/references/test-generation.md +1 -1
- data/exe/x86_64-linux/package/lib/tools/skills/playwright-cli/references/video-recording.md +76 -3
- data/exe/x86_64-linux/package/lib/tools/skills/playwright-trace/SKILL.md +1 -1
- data/exe/x86_64-linux/package/lib/utilsBundle.js +948 -227
- data/exe/x86_64-linux/package/lib/utilsBundle.js.LICENSE +6 -6
- data/exe/x86_64-linux/package/lib/vite/htmlReport/report.js +1 -1
- data/exe/x86_64-linux/package/lib/vite/recorder/assets/{codeMirrorModule-CVQWJZAA.js → codeMirrorModule-DK72OMRi.js} +1 -1
- data/exe/x86_64-linux/package/lib/vite/recorder/assets/index-Cn0mmDuv.js +129 -0
- data/exe/x86_64-linux/package/lib/vite/recorder/index.html +1 -1
- data/exe/x86_64-linux/package/lib/vite/traceViewer/assets/{codeMirrorModule-BbkfBe3n.js → codeMirrorModule-BEB2e8M3.js} +1 -1
- data/exe/x86_64-linux/package/lib/vite/traceViewer/assets/defaultSettingsView-D-g2vrvf.js +184 -0
- data/exe/x86_64-linux/package/lib/vite/traceViewer/assets/{xtermModule-DywYcAf8.js → xtermModule-B794rD2Z.js} +1 -1
- data/exe/x86_64-linux/package/lib/vite/traceViewer/{defaultSettingsView.Bqk9acqE.css → defaultSettingsView.C8BeHuxd.css} +1 -1
- data/exe/x86_64-linux/package/lib/vite/traceViewer/{index.B4cLoZK3.js → index.7-c5LSTW.js} +1 -1
- data/exe/x86_64-linux/package/lib/vite/traceViewer/index.html +3 -3
- data/exe/x86_64-linux/package/lib/vite/traceViewer/sw.bundle.js +3 -3
- data/exe/x86_64-linux/package/lib/vite/traceViewer/{uiMode.CU5KtEkS.js → uiMode.CYwC_gH1.js} +4 -4
- data/exe/x86_64-linux/package/lib/vite/traceViewer/uiMode.html +3 -3
- data/exe/x86_64-linux/package/package.json +1 -1
- data/exe/x86_64-linux/package/types/protocol.d.ts +468 -337
- data/exe/x86_64-linux/package/types/types.d.ts +572 -37
- data/lib/venetian/core.rb +1 -0
- data/lib/venetian/executable.rb +24 -5
- data/lib/venetian/playwright.rb +1 -0
- data/lib/venetian/transport_extensions.rb +17 -0
- data/lib/venetian/trust_store.rb +67 -0
- data/lib/venetian/upstream.rb +36 -1
- data/lib/venetian/version.rb +3 -2
- metadata +17 -12
- data/exe/x86_64-linux/package/lib/vite/recorder/assets/index-hrlLqLtq.js +0 -129
- data/exe/x86_64-linux/package/lib/vite/traceViewer/assets/defaultSettingsView-Ds6CBOo0.js +0 -182
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a85ccc842cc4cf0d2b050a237de2ff62f53f9de40b30d7520e0b5a14555882ba
|
|
4
|
+
data.tar.gz: f170084be2a272cd9d1c8b9a2b748c4d94a786f98c530990871b155526d33b9a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 59f2926a61379fe12c79564b8317be45bbe43228aa9f60ce087856d454889645df7eebafad1e9ae62607e75e0d08ed89c4ce81a3eede0a5c483118119a7c16d4
|
|
7
|
+
data.tar.gz: 1175bc11bf21281dc3ad582b14ae361cb81dccbe637011dcdc6bccfb2546bdeab6a21d75ee5be1b24bcc376b9842e5a811bfefe6c67115f8cada84ab7f60a17f
|
data/AGENTS.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Guidance for coding agents working on Venetian. See `README.md` for what the gem does from a user's point of view.
|
|
4
|
+
|
|
5
|
+
## What this is
|
|
6
|
+
|
|
7
|
+
Venetian packages a Node.js binary and the `playwright-core` npm package in platform-specific gems, so
|
|
8
|
+
`playwright-ruby-client` and `capybara-playwright-driver` work without a separate Node.js setup. It's the same
|
|
9
|
+
packaging approach as Playwright for Python, Java and .NET, and as `tailwindcss-ruby`.
|
|
10
|
+
|
|
11
|
+
The source gem (`ruby` platform) has no driver. The release tasks assemble a driver for each platform in
|
|
12
|
+
`Venetian::Upstream::NATIVE_PLATFORMS` and build a `venetian-<platform>` gem from it.
|
|
13
|
+
|
|
14
|
+
## Setup
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
bin/setup # bundle install
|
|
18
|
+
bundle exec rake # tests + RuboCop (the default task, what CI runs)
|
|
19
|
+
bundle exec rake test # tests only
|
|
20
|
+
bundle exec rubocop # lint only
|
|
21
|
+
N=/pattern/ bundle exec rake test # run tests matching a name
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Ruby >= 3.3. CI runs Ruby 3.3, 3.4 and 4.0 on Linux, 3.3 and 4.0 on Windows, and Rails 7.1, 7.2 and 8.0 on Linux.
|
|
25
|
+
To test against another Rails version, use a separate lockfile (gitignored):
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
BUNDLE_LOCKFILE=Gemfile.rails.lock RAILS_VERSION="~> 7.1.0" bundle exec rake test
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The tests don't need a driver, browsers or network access. They stub the executable or use fixtures in `test/fixtures/`.
|
|
32
|
+
`print_args.exe` there is built from `print_args.c` on Windows (`gcc -O2 -s -municode`, from `ridk exec`).
|
|
33
|
+
|
|
34
|
+
When you run `bundle` locally, check that `Gemfile.lock` still has its `bundler (x.y.z) sha256=...` line under
|
|
35
|
+
`CHECKSUMS`. Restore it before committing if it's gone.
|
|
36
|
+
|
|
37
|
+
## Layout
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
lib/venetian.rb Full entry point: Capybara extensions + Railtie
|
|
41
|
+
lib/venetian/playwright.rb Capybara-free entry point (require: "venetian/playwright"), Venetian.start
|
|
42
|
+
lib/venetian/core.rb Shared core: config accessors, Venetian.execute/system, Error
|
|
43
|
+
lib/venetian/version.rb VERSION, COMPATIBLE_PLAYWRIGHT_VERSION, NODE_VERSION
|
|
44
|
+
lib/venetian/upstream.rb NATIVE_PLATFORMS (gem platform => PlatformInfo), npm/nodejs.org URLs
|
|
45
|
+
lib/venetian/executable.rb Finds and validates the bundled node + package/cli.js, runs commands
|
|
46
|
+
lib/venetian/browser_installer.rb Browser and system-dependency installation, locking, writability checks
|
|
47
|
+
lib/venetian/trust_store.rb Environment pointing the bundled Node at Ruby's certificate authorities
|
|
48
|
+
lib/venetian/playwright_create_extensions.rb Prepended into Playwright's create: bundled CLI as default
|
|
49
|
+
lib/venetian/browser_runner_extensions.rb Prepended into Capybara::Playwright::BrowserRunner: auto-install
|
|
50
|
+
lib/venetian/connection_extensions.rb Prepended into Playwright::Connection: raises ForkedConnectionError after fork
|
|
51
|
+
lib/venetian/transport_extensions.rb Prepended into Playwright::Transport: runs the bundled driver with TrustStore
|
|
52
|
+
lib/venetian/system_test_case_extension.rb driven_by tracking, browser install before parallel forking
|
|
53
|
+
lib/venetian/railtie.rb Loads the Rake task, installs SystemTestCaseExtension
|
|
54
|
+
lib/venetian/gemspec.rb Venetian::GEMSPEC, the loaded spec for this gem
|
|
55
|
+
lib/tasks/venetian.rake User-facing venetian:install[browser] task
|
|
56
|
+
exe/playwright User-facing executable; exe/<platform>/ is generated and gitignored
|
|
57
|
+
|
|
58
|
+
rakelib/release_task.rb Release tasks: playwright-core download, per-platform tasks
|
|
59
|
+
rakelib/release_task/platform_task.rb <platform>:build/install/release, Node.js download and assembly
|
|
60
|
+
rakelib/upstream_task.rb update_keys and update_node tasks (run by scheduled workflows)
|
|
61
|
+
rakelib/tasks/ Shared task code: helpers, signatures, versioning, signed commits, PRs
|
|
62
|
+
rakelib/tasks/keys/ Pinned Node.js release keys (node.kbx) and npm registry keys (npm.json)
|
|
63
|
+
|
|
64
|
+
test/test_helper.rb Requires everything and defines the test DSL
|
|
65
|
+
test/venetian/ Tests for lib/venetian/
|
|
66
|
+
test/tasks/, test/upstream_task_test.rb Tests for rakelib/
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The assembled driver for each platform is `exe/<platform>/node` (`node.exe` on `x64-mingw-ucrt`) next to
|
|
70
|
+
`exe/<platform>/package/`, with `package/cli.js` as the entry point. `Executable.base_command` depends on this
|
|
71
|
+
layout, so keep it if you change the assembly. There's no wrapper script: `Executable.playwright_command`
|
|
72
|
+
(through `TrustStore::NodeCommand`) adds the Node options Venetian runs the driver with between the two.
|
|
73
|
+
|
|
74
|
+
## Releases and versions
|
|
75
|
+
|
|
76
|
+
- `Venetian::COMPATIBLE_PLAYWRIGHT_VERSION` must match `Playwright::COMPATIBLE_PLAYWRIGHT_VERSION` from
|
|
77
|
+
`playwright-ruby-client`. When Dependabot bumps the client, `rake sync_version` (in the Pull Request workflow) bumps
|
|
78
|
+
the gem version, the Playwright version and the gemspec requirement, and commits through the GitHub API.
|
|
79
|
+
- `Venetian::NODE_VERSION` is pinned. The Update Node workflow opens a PR for each new Node.js LTS release.
|
|
80
|
+
- The Update Keys workflow opens a PR when the pinned signing keys in `rakelib/tasks/keys/` change. Downloads are
|
|
81
|
+
checked against signed checksums (Node.js `SHASUMS256.txt.asc`, npm registry signatures), so don't bypass them.
|
|
82
|
+
- Releases happen on push to `main` when `rake release_source` says the current version isn't on RubyGems yet.
|
|
83
|
+
This requires CI and the Verify Build workflow (`rake install`, which builds and installs every platform gem) to pass.
|
|
84
|
+
To release, bump `VERSION` in `lib/venetian/version.rb`. Don't run `rake release` by hand.
|
|
85
|
+
- `rakelib/`, `Rakefile`, `.github/`, `upstream.rb` and `gemspec.rb` are owned by the maintainer (`CODEOWNERS`).
|
|
86
|
+
Changes there need extra care: a broken release task means a broken release.
|
|
87
|
+
|
|
88
|
+
## Code style
|
|
89
|
+
|
|
90
|
+
- RuboCop with `rubocop-minitest` and `rubocop-rake`, new cops enabled, double-quoted strings. Fix offences instead of
|
|
91
|
+
disabling cops or adding exclusions. If a class gets too long, split it up.
|
|
92
|
+
- `# frozen_string_literal: true` at the top of every Ruby file.
|
|
93
|
+
- Use anonymous argument forwarding (`*`, `**`, `&`, `...`) where it fits, like the rest of the code.
|
|
94
|
+
- Prefer `Pathname` (`join`, `dirname`, `mkpath`, `write`) to `File.join`/`File.expand_path` strings and `FileUtils`.
|
|
95
|
+
Call `.to_path` only where a String is needed, e.g. for ENV values or APIs that return Strings. The older rake code
|
|
96
|
+
still uses `File.join`; don't add more.
|
|
97
|
+
- Doc comments are RDoc. Modules and classes start with a `# # Title` heading and a one-line description; background
|
|
98
|
+
on why they exist goes in the commit message. Public methods get a short comment saying what they return or do.
|
|
99
|
+
- Don't comment methods marked `# :nodoc:` or private methods. Put the reasoning in the commit message. A short
|
|
100
|
+
inline comment on a genuinely non-obvious line is fine.
|
|
101
|
+
- Mark internal classes and modules `# :nodoc:` (`# :nodoc: all` for rake task classes). Public methods that only the
|
|
102
|
+
gem itself calls are `# :nodoc:` too (e.g. `BrowserInstaller.browsers_path`), rather than documented API.
|
|
103
|
+
- Read `ENV` where it's used rather than taking it as an argument so tests can pass a Hash. Tests set ENV and restore
|
|
104
|
+
it instead.
|
|
105
|
+
- Extensions to other gems are `*Extensions` modules prepended at the bottom of their own file, not monkey patches.
|
|
106
|
+
The entry points (`lib/venetian.rb`, `lib/venetian/playwright.rb`) decide which ones load.
|
|
107
|
+
- Debug output only appears when `VENETIAN_DEBUG` is set. Keep the gem quiet by default.
|
|
108
|
+
|
|
109
|
+
## Tests
|
|
110
|
+
|
|
111
|
+
- Minitest only. Every test file `require "test_helper"` and nothing else. Add new requires to `test/test_helper.rb`.
|
|
112
|
+
- Classes subclass `Minitest::Test` and use the declarative DSL from `test_helper.rb`: `test "does something" do`,
|
|
113
|
+
`setup do`, `teardown do`. No `def test_*`, no `Minitest::Spec`/`describe`/`it`, and no custom base test class.
|
|
114
|
+
- Split long test classes into nested concerns instead of disabling `Metrics` cops:
|
|
115
|
+
|
|
116
|
+
```ruby
|
|
117
|
+
class ExecutableTest < Minitest::Test
|
|
118
|
+
module Running
|
|
119
|
+
module Tests
|
|
120
|
+
extend ActiveSupport::Concern
|
|
121
|
+
|
|
122
|
+
included do
|
|
123
|
+
test "..." do
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
private
|
|
128
|
+
|
|
129
|
+
# helpers for this topic
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
include Running::Tests
|
|
134
|
+
end
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Name concerns after the topic (`Running`, `Discovery`), not the class under test. Helpers only one concern uses go
|
|
138
|
+
in its `private` section; shared setup, teardown and stubbing helpers stay in the class.
|
|
139
|
+
- `assert_raises` takes `match:` to check the exception message.
|
|
140
|
+
- Restore any ENV you change in `teardown` or an `ensure`.
|
|
141
|
+
- Tests must pass on Windows too: watch out for path separators, `node.exe`, and commands run through `cmd.exe`.
|
|
142
|
+
|
|
143
|
+
## Commits and pull requests
|
|
144
|
+
|
|
145
|
+
- Commit messages are a single imperative sentence describing the behaviour change, with no type prefix, e.g.
|
|
146
|
+
"Verify the Node.js and playwright-core downloads" or "Raise when gh can't say whether there's a pull request".
|
|
147
|
+
Put the reasoning in the body if it isn't obvious.
|
|
148
|
+
- Commits are authored by the configured git user. Coding agents add only a `Co-Authored-By` trailer, with no other
|
|
149
|
+
trailers such as session links.
|
|
150
|
+
- Work on a branch and open a PR against `main`. Don't push to `main` directly.
|
|
151
|
+
- Workflows use least-privilege `permissions` and `persist-credentials: false` on checkout. Keep that for new ones.
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|
data/README.md
CHANGED
|
@@ -130,6 +130,17 @@ $ playwright --version
|
|
|
130
130
|
Version 1.61.1
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
+
### Certificates
|
|
134
|
+
|
|
135
|
+
The bundled Node has its own OpenSSL and certificate authorities, which can lag behind your system's, e.g. when a
|
|
136
|
+
certificate authority is distrusted. So Venetian runs Node with `--use-openssl-ca`, pointing it at the certificate
|
|
137
|
+
authorities Ruby's OpenSSL uses (`OpenSSL::X509::DEFAULT_CERT_FILE` and `DEFAULT_CERT_DIR`, or `SSL_CERT_FILE` and
|
|
138
|
+
`SSL_CERT_DIR` if set). Playwright then trusts what e.g. `Net::HTTP` does, such as a corporate proxy's certificate
|
|
139
|
+
authority installed on your system, and nothing more. To use Node's bundled certificate authorities instead, set
|
|
140
|
+
`VENETIAN_BUNDLED_CA=1`. Venetian also leaves Node's certificate authorities alone if you've chosen them with
|
|
141
|
+
`--use-bundled-ca` or `--use-system-ca` in `NODE_OPTIONS`, or with `NODE_USE_SYSTEM_CA=1`, as the bundled Node won't
|
|
142
|
+
combine those with `--use-openssl-ca`. `NODE_EXTRA_CA_CERTS` works as usual either way.
|
|
143
|
+
|
|
133
144
|
### Getting more output
|
|
134
145
|
|
|
135
146
|
Noisy output during a test run is often frustrating, so the gem is quiet by default.
|
data/Rakefile
CHANGED
data/exe/x86_64-linux/node
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: data/exe/x86_64-linux/node
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 126816376 bytes
|
|
4
|
+
sha256: 67ca5783febb8bf85736c79fcdd92c8d6d465a0eb2a082672bcdfa76a506751c
|
|
@@ -3,39 +3,39 @@
|
|
|
3
3
|
"browsers": [
|
|
4
4
|
{
|
|
5
5
|
"name": "chromium",
|
|
6
|
-
"revision": "
|
|
6
|
+
"revision": "1248",
|
|
7
7
|
"installByDefault": true,
|
|
8
|
-
"browserVersion": "
|
|
8
|
+
"browserVersion": "156.0.8078.4",
|
|
9
9
|
"title": "Chrome for Testing"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
"name": "chromium-headless-shell",
|
|
13
|
-
"revision": "
|
|
13
|
+
"revision": "1248",
|
|
14
14
|
"installByDefault": true,
|
|
15
|
-
"browserVersion": "
|
|
15
|
+
"browserVersion": "156.0.8078.4",
|
|
16
16
|
"title": "Chrome Headless Shell"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"name": "firefox",
|
|
20
|
-
"revision": "
|
|
20
|
+
"revision": "1555",
|
|
21
21
|
"installByDefault": true,
|
|
22
|
-
"browserVersion": "
|
|
22
|
+
"browserVersion": "157.0",
|
|
23
23
|
"title": "Firefox"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"name": "webkit",
|
|
27
|
-
"revision": "
|
|
27
|
+
"revision": "2370",
|
|
28
28
|
"installByDefault": true,
|
|
29
29
|
"revisionOverrides": {
|
|
30
30
|
"mac14": "2251",
|
|
31
31
|
"mac14-arm64": "2251"
|
|
32
32
|
},
|
|
33
|
-
"browserVersion": "
|
|
33
|
+
"browserVersion": "27.2",
|
|
34
34
|
"title": "WebKit"
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
"name": "ffmpeg",
|
|
38
|
-
"revision": "
|
|
38
|
+
"revision": "1013",
|
|
39
39
|
"installByDefault": true
|
|
40
40
|
},
|
|
41
41
|
{
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
require('./lib/bootstrap');
|
|
17
18
|
const { libCli, libCliTestStub } = require('./lib/coreBundle');
|
|
18
19
|
const { program } = require('./lib/utilsBundle');
|
|
19
20
|
libCli.decorateProgram(program);
|
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var bootstrap_exports = {};
|
|
20
|
+
__export(bootstrap_exports, {
|
|
21
|
+
processExit: () => processExit
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(bootstrap_exports);
|
|
2
24
|
const minimumMajorNodeVersion = 20;
|
|
3
25
|
const currentNodeVersion = process.versions.node;
|
|
4
26
|
const major = +currentNodeVersion.split(".")[0];
|
|
@@ -10,6 +32,41 @@ Please update your version of Node.js.`
|
|
|
10
32
|
);
|
|
11
33
|
process.exit(1);
|
|
12
34
|
}
|
|
35
|
+
let stopProfiling = (callback) => callback();
|
|
36
|
+
if (process.env.PW_PROFILE_DIR) {
|
|
37
|
+
const fs = require("fs");
|
|
38
|
+
const path = require("path");
|
|
39
|
+
const { Session } = require("inspector");
|
|
40
|
+
const profileDir = path.resolve(process.env.PW_PROFILE_DIR);
|
|
41
|
+
const script = process.argv[1] ? path.basename(process.argv[1], path.extname(process.argv[1])) : "node";
|
|
42
|
+
const command = /^[a-z][\w-]*$/i.test(process.argv[2] ?? "") ? process.argv[2] : void 0;
|
|
43
|
+
const profileName = [script, command, process.pid].filter(Boolean).join("-");
|
|
44
|
+
const session = new Session();
|
|
45
|
+
session.connect();
|
|
46
|
+
session.post("Profiler.enable");
|
|
47
|
+
session.post("Profiler.start");
|
|
48
|
+
stopProfiling = (callback) => {
|
|
49
|
+
stopProfiling = (callback2) => callback2();
|
|
50
|
+
session.post("Profiler.stop", (error, result) => {
|
|
51
|
+
try {
|
|
52
|
+
if (!error) {
|
|
53
|
+
fs.mkdirSync(profileDir, { recursive: true });
|
|
54
|
+
fs.writeFileSync(path.join(profileDir, profileName + ".cpuprofile"), JSON.stringify(result.profile));
|
|
55
|
+
}
|
|
56
|
+
} finally {
|
|
57
|
+
callback();
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
process.on("beforeExit", () => stopProfiling(() => {
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
function processExit(code) {
|
|
65
|
+
stopProfiling(() => {
|
|
66
|
+
process.exit(code);
|
|
67
|
+
});
|
|
68
|
+
return void 0;
|
|
69
|
+
}
|
|
13
70
|
if (process.env.PW_INSTRUMENT_MODULES) {
|
|
14
71
|
const Module = require("module");
|
|
15
72
|
const originalLoad = Module._load;
|
|
@@ -86,3 +143,7 @@ if (process.env.PW_INSTRUMENT_MODULES) {
|
|
|
86
143
|
` + flatLines.join("\n") + "\n");
|
|
87
144
|
});
|
|
88
145
|
}
|
|
146
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
147
|
+
0 && (module.exports = {
|
|
148
|
+
processExit
|
|
149
|
+
});
|