@snap/valdi 1.1.7 → 1.2.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.
- package/.metadata/.bazelrc.template +9 -7
- package/.metadata/AGENTS.md.template +7 -0
- package/.metadata/MODULE.bazel.template +47 -3
- package/.metadata/README.md.template +2 -2
- package/.metadata/bzl/patches/rules_python/1.9.0/BUILD.bazel.template +1 -0
- package/.metadata/bzl/patches/rules_python/1.9.0/remove_setuptools_spaces.patch.template +96 -0
- package/.metadata/skill-tests-README.md.template +1 -1
- package/README.md +47 -14
- package/bundled-skills/registry.json +2 -1
- package/bundled-skills/skills/valdi-animations/skill.md +49 -0
- package/bundled-skills/skills/valdi-async/skill.md +3 -2
- package/bundled-skills/skills/valdi-async/tests/README.md +1 -1
- package/bundled-skills/skills/valdi-bazel/skill.md +2 -6
- package/bundled-skills/skills/valdi-component-tests/tests/README.md +1 -1
- package/bundled-skills/skills/valdi-cpp-runtime/skill.md +18 -0
- package/bundled-skills/skills/valdi-custom-view/skill.md +1 -1
- package/bundled-skills/skills/valdi-error-handling/skill.md +1 -1
- package/bundled-skills/skills/valdi-gestures/skill.md +3 -3
- package/bundled-skills/skills/valdi-migrate/skill.md +2 -1
- package/bundled-skills/skills/valdi-migrate/tests/README.md +2 -2
- package/bundled-skills/skills/valdi-mock-breakdown/skill.md +4 -4
- package/bundled-skills/skills/valdi-mock-to-module/skill.md +9 -6
- package/bundled-skills/skills/valdi-overview/skill.md +2 -1
- package/bundled-skills/skills/valdi-perf/skill.md +121 -5
- package/bundled-skills/skills/valdi-perf/tests/README.md +1 -1
- package/bundled-skills/skills/valdi-pr-review/skill.md +189 -0
- package/bundled-skills/skills/valdi-profile/skill.md +5 -3
- package/bundled-skills/skills/valdi-setup/skill.md +3 -6
- package/bundled-skills/skills/valdi-testing/skill.md +1 -1
- package/bundled-skills/skills/valdi-tsx/skill.md +47 -11
- package/bundled-skills/skills/valdi-tsx/tests/README.md +1 -1
- package/debugger/README.md +356 -0
- package/debugger/debugger-actions.js +373 -0
- package/debugger/debugger-api.js +225 -0
- package/debugger/debugger-bootstrap.js +295 -0
- package/debugger/debugger-model.js +790 -0
- package/debugger/debugger-performance.js +573 -0
- package/debugger/debugger-preview-html.js +676 -0
- package/debugger/debugger-providers.js +389 -0
- package/debugger/debugger-render.js +529 -0
- package/debugger/debugger-runtime.js +387 -0
- package/debugger/debugger-session.js +188 -0
- package/debugger/debugger-settings.js +209 -0
- package/debugger/debugger-state.js +221 -0
- package/debugger/debugger-tree-model.js +539 -0
- package/debugger/debugger.css +1865 -0
- package/debugger/devtools-panel.css +1318 -0
- package/debugger/devtools-panel.html +273 -0
- package/debugger/devtools-panel.js +3329 -0
- package/debugger/index.html +279 -0
- package/dist/commands/bootstrap.js +7 -6
- package/dist/commands/build.js +7 -1
- package/dist/commands/debugger.js +163 -0
- package/dist/commands/doctor.js +3 -62
- package/dist/commands/export.js +47 -16
- package/dist/commands/hotreload.js +247 -27
- package/dist/commands/inspect.js +5 -2
- package/dist/commands/inspect_commands/input.js +176 -0
- package/dist/commands/inspect_commands/snapshot.js +1 -1
- package/dist/commands/inspect_commands/tree.js +1 -1
- package/dist/commands/install.js +79 -2
- package/dist/commands/projectsync.js +15 -0
- package/dist/commands/webHotreload.js +31 -0
- package/dist/core/constants.js +34 -7
- package/dist/debugger/chromiumConsole.js +279 -0
- package/dist/debugger/inputClient.js +473 -0
- package/dist/debugger/server.js +3801 -0
- package/dist/debugger/targetRegistry.js +436 -0
- package/dist/debugger/webPreviewPerformance.js +864 -0
- package/dist/index.js +0 -0
- package/dist/utils/BazelClient.js +34 -5
- package/dist/utils/applicationUtils.js +20 -2
- package/dist/utils/buildInfo.js +5 -1
- package/dist/utils/chromiumDevToolsClient.js +350 -0
- package/dist/utils/cliUtils.js +2 -2
- package/dist/utils/daemonClient.js +364 -44
- package/dist/utils/directorySync.js +153 -0
- package/dist/utils/githubUtils.js +1 -1
- package/dist/utils/hermesClient.js +82 -176
- package/dist/utils/loopbackHost.js +14 -0
- package/dist/utils/owlCdpClient.js +282 -0
- package/dist/utils/owlDevToolsExtension.js +142 -0
- package/dist/utils/processUtils.js +14 -0
- package/dist/utils/stringUtils.js +13 -1
- package/dist/utils/webApplicationSession.js +58 -0
- package/dist/utils/webHotReloadSession.js +212 -0
- package/dist/utils/webServerUtils.js +195 -0
- package/dist/utils/zipUtils.js +20 -2
- package/package.json +4 -2
- package/dist/commands/inspect_commands/snapshot.spec.js +0 -105
- package/dist/core/packageFiles.spec.js +0 -29
- package/dist/preview/previewGenerator.spec.js +0 -203
- package/dist/preview/viewModelParser.spec.js +0 -171
- package/dist/utils/linuxDistro.spec.js +0 -122
- package/dist/utils/skillsAdapters.spec.js +0 -141
- package/dist/utils/stringUtils.spec.js +0 -81
package/dist/commands/install.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handler = exports.builder = exports.describe = exports.command = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
4
6
|
const constants_1 = require("../core/constants");
|
|
5
7
|
const BazelClient_1 = require("../utils/BazelClient");
|
|
6
8
|
const applicationUtils_1 = require("../utils/applicationUtils");
|
|
7
9
|
const buildInfo_1 = require("../utils/buildInfo");
|
|
8
10
|
const deviceUtils_1 = require("../utils/deviceUtils");
|
|
9
11
|
const errorUtils_1 = require("../utils/errorUtils");
|
|
12
|
+
const tempDir_1 = require("../utils/tempDir");
|
|
10
13
|
const logUtils_1 = require("../utils/logUtils");
|
|
14
|
+
const processUtils_1 = require("../utils/processUtils");
|
|
15
|
+
const webApplicationSession_1 = require("../utils/webApplicationSession");
|
|
16
|
+
const webHotReloadSession_1 = require("../utils/webHotReloadSession");
|
|
17
|
+
const webServerUtils_1 = require("../utils/webServerUtils");
|
|
11
18
|
async function valdiInstall(argv) {
|
|
12
19
|
const bazel = new BazelClient_1.BazelClient();
|
|
13
20
|
const buildInfo = await (0, buildInfo_1.getBuildInfo)(argv, bazel, true);
|
|
@@ -48,10 +55,63 @@ async function valdiInstall(argv) {
|
|
|
48
55
|
await bazel.runTarget(buildInfo.application, buildInfo.bazelArgs);
|
|
49
56
|
break;
|
|
50
57
|
}
|
|
58
|
+
case constants_1.PLATFORM.WEB: {
|
|
59
|
+
const outputFilePath = await argv.getArgumentOrResolve('target_output_path', () => {
|
|
60
|
+
console.log('Resolving output paths...');
|
|
61
|
+
return (0, applicationUtils_1.getOutputFilePath)(bazel, (0, applicationUtils_1.applicationExtensionForPlatform)(buildInfo.platform), buildInfo.application, buildInfo.bazelArgs);
|
|
62
|
+
});
|
|
63
|
+
await bazel.buildTarget(buildInfo.application, buildInfo.bazelArgs);
|
|
64
|
+
const tempDir = (0, tempDir_1.makeTempDir)();
|
|
65
|
+
fs_1.default.mkdirSync(tempDir);
|
|
66
|
+
try {
|
|
67
|
+
const workspaceRoot = await bazel.getWorkspaceRoot();
|
|
68
|
+
const applicationTarget = (await bazel.resolveLabel(buildInfo.application)).toString();
|
|
69
|
+
const hotreloadTarget = (0, webHotReloadSession_1.inferWebHotReloadTarget)(applicationTarget);
|
|
70
|
+
const session = await (0, webApplicationSession_1.startWebApplicationSession)({
|
|
71
|
+
archivePath: outputFilePath,
|
|
72
|
+
host: argv.getArgument('host') ?? '127.0.0.1',
|
|
73
|
+
liveReload: hotreloadTarget !== undefined,
|
|
74
|
+
port: argv.getArgument('port') ?? 0,
|
|
75
|
+
workingDir: tempDir,
|
|
76
|
+
});
|
|
77
|
+
const hotReloadRegistration = hotreloadTarget === undefined
|
|
78
|
+
? undefined
|
|
79
|
+
: await (0, webHotReloadSession_1.registerWebHotReloadSession)({
|
|
80
|
+
applicationTarget,
|
|
81
|
+
bazelArgs: buildInfo.bazelArgs,
|
|
82
|
+
hotreloadTarget,
|
|
83
|
+
onPublish: async () => {
|
|
84
|
+
await session.publish();
|
|
85
|
+
console.log(`Reloaded web application at ${(0, logUtils_1.wrapInColor)(session.url, constants_1.ANSI_COLORS.GREEN_COLOR)}`);
|
|
86
|
+
},
|
|
87
|
+
workspaceRoot,
|
|
88
|
+
});
|
|
89
|
+
try {
|
|
90
|
+
console.log(`Serving web application at ${(0, logUtils_1.wrapInColor)(session.url, constants_1.ANSI_COLORS.GREEN_COLOR)}`);
|
|
91
|
+
if (hotreloadTarget) {
|
|
92
|
+
console.log(`For hot reload, run ${(0, logUtils_1.wrapInColor)(`valdi hotreload --target ${hotreloadTarget}`, constants_1.ANSI_COLORS.GREEN_COLOR)} in another terminal.`);
|
|
93
|
+
}
|
|
94
|
+
if (argv.getArgument('open') ?? true) {
|
|
95
|
+
(0, webServerUtils_1.openUrlInDefaultBrowser)(session.url);
|
|
96
|
+
}
|
|
97
|
+
(0, errorUtils_1.logReproduceThisCommandIfNeeded)(argv);
|
|
98
|
+
console.log('Press Ctrl+C to stop the web server.');
|
|
99
|
+
await (0, processUtils_1.waitForShutdownSignal)();
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
await hotReloadRegistration?.close();
|
|
103
|
+
await session.close();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
fs_1.default.rmSync(tempDir, { force: true, recursive: true });
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
51
111
|
}
|
|
52
112
|
}
|
|
53
113
|
exports.command = 'install <platform>';
|
|
54
|
-
exports.describe = 'Build and install the application to the connected device';
|
|
114
|
+
exports.describe = 'Build and install the application to the connected device or local web server';
|
|
55
115
|
exports.builder = (0, applicationUtils_1.makeArgsBuilder)((yargs) => {
|
|
56
116
|
yargs
|
|
57
117
|
.option('application', {
|
|
@@ -70,8 +130,25 @@ exports.builder = (0, applicationUtils_1.makeArgsBuilder)((yargs) => {
|
|
|
70
130
|
requiresArg: true,
|
|
71
131
|
})
|
|
72
132
|
.option('simulator', {
|
|
73
|
-
describe: '
|
|
133
|
+
describe: 'Build for the iOS simulator (default). Pass --no-simulator to build for a device',
|
|
74
134
|
type: 'boolean',
|
|
135
|
+
})
|
|
136
|
+
.option('open', {
|
|
137
|
+
describe: 'Open the web application in the default browser after starting the server',
|
|
138
|
+
type: 'boolean',
|
|
139
|
+
default: true,
|
|
140
|
+
})
|
|
141
|
+
.option('host', {
|
|
142
|
+
describe: 'Host to bind when serving a web application',
|
|
143
|
+
type: 'string',
|
|
144
|
+
default: '127.0.0.1',
|
|
145
|
+
requiresArg: true,
|
|
146
|
+
})
|
|
147
|
+
.option('port', {
|
|
148
|
+
describe: 'Port to bind when serving a web application. Use 0 to select an available port automatically',
|
|
149
|
+
type: 'number',
|
|
150
|
+
default: 0,
|
|
151
|
+
requiresArg: true,
|
|
75
152
|
});
|
|
76
153
|
});
|
|
77
154
|
exports.handler = (0, errorUtils_1.makeCommandHandler)(valdiInstall);
|
|
@@ -7,6 +7,7 @@ const tslib_1 = require("tslib");
|
|
|
7
7
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
8
8
|
const promises_1 = tslib_1.__importDefault(require("fs/promises"));
|
|
9
9
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
10
|
+
const constants_1 = require("../core/constants");
|
|
10
11
|
const errors_1 = require("../core/errors");
|
|
11
12
|
const BazelClient_1 = require("../utils/BazelClient");
|
|
12
13
|
const byString_1 = require("../utils/byString");
|
|
@@ -58,6 +59,19 @@ function bazelLabelToAbsolutePath(workspaceInfo, label) {
|
|
|
58
59
|
return path_1.default.join(workspaceInfo.workspaceRoot, targetPath);
|
|
59
60
|
}
|
|
60
61
|
}
|
|
62
|
+
async function ensureStableExecConfig(workspaceRoot) {
|
|
63
|
+
const bazelrcPath = path_1.default.join(workspaceRoot, '.bazelrc');
|
|
64
|
+
if (!fs_1.default.existsSync(bazelrcPath)) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const content = await promises_1.default.readFile(bazelrcPath, 'utf8');
|
|
68
|
+
if (/(^|\n)[^\n#]*:stable_exec\b/.test(content)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const separator = content.endsWith('\n') ? '\n' : '\n\n';
|
|
72
|
+
await promises_1.default.writeFile(bazelrcPath, content + separator + constants_1.STABLE_EXEC_BAZELRC_BLOCK);
|
|
73
|
+
console.log('Added the stable_exec config to .bazelrc so alternating builds and tests stop recompiling shared tools.');
|
|
74
|
+
}
|
|
61
75
|
async function buildProjectSyncs(bazel, workspaceRoot, projectSyncTargets) {
|
|
62
76
|
await bazel.buildTargets(projectSyncTargets);
|
|
63
77
|
const buildOutputs = await bazel.queryBuildOutputs(projectSyncTargets);
|
|
@@ -272,6 +286,7 @@ async function runProjectSync(bazel, inputTargets, vscodeLaunchPath, generateLau
|
|
|
272
286
|
console.log('Resolving dependencies of resolved Valdi targets...');
|
|
273
287
|
const workspaceRoot = await bazel.getWorkspaceRoot();
|
|
274
288
|
const executionRoot = await bazel.getExecutionRoot();
|
|
289
|
+
await ensureStableExecConfig(workspaceRoot);
|
|
275
290
|
const allProjectSyncOutputs = await buildProjectSyncs(bazel, workspaceRoot, inputTargets);
|
|
276
291
|
console.log('Generating tsconfig.json files...');
|
|
277
292
|
const workspaceName = path_1.default.basename(executionRoot);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = exports.builder = exports.describe = exports.command = void 0;
|
|
4
|
+
const constants_1 = require("../core/constants");
|
|
5
|
+
const BazelClient_1 = require("../utils/BazelClient");
|
|
6
|
+
const errorUtils_1 = require("../utils/errorUtils");
|
|
7
|
+
const logUtils_1 = require("../utils/logUtils");
|
|
8
|
+
async function valdiWebHotreload(argv) {
|
|
9
|
+
const client = new BazelClient_1.BazelClient();
|
|
10
|
+
const target = argv.getArgument('target');
|
|
11
|
+
if (!target) {
|
|
12
|
+
throw new Error('--target is required (e.g. //experiments/helloworld_playground:dev)');
|
|
13
|
+
}
|
|
14
|
+
(0, errorUtils_1.logReproduceThisCommandIfNeeded)(argv);
|
|
15
|
+
console.log((0, logUtils_1.wrapInColor)(`Starting webpack-dev-server via ${target} ...`, constants_1.ANSI_COLORS.GREEN_COLOR));
|
|
16
|
+
await client.runTarget(target, '--define enable_web=true');
|
|
17
|
+
}
|
|
18
|
+
exports.command = 'web-hotreload --target <bazel-target>';
|
|
19
|
+
exports.describe = 'Start a Valdi web playground with hot module reload (webpack-dev-server). '
|
|
20
|
+
+ 'Pass the Bazel label of the playground :dev target created by '
|
|
21
|
+
+ 'valdi_web_playground(hmr_config = ...).';
|
|
22
|
+
const builder = (yargs) => {
|
|
23
|
+
yargs.option('target', {
|
|
24
|
+
describe: 'Bazel label of the playground :dev js_binary (e.g. //experiments/helloworld_playground:dev)',
|
|
25
|
+
type: 'string',
|
|
26
|
+
requiresArg: true,
|
|
27
|
+
demandOption: true,
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
exports.builder = builder;
|
|
31
|
+
exports.handler = (0, errorUtils_1.makeCommandHandler)(valdiWebHotreload);
|
package/dist/core/constants.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TEST_BUILD_FLAGS = exports.CLI_BUILD_FLAGS = exports.LINUX_BUILD_FLAGS = exports.MACOS_BUILD_FLAGS = exports.IOS_BUILD_FLAGS = exports.IOS_DEVICE_BUILD_FLAGS = exports.RELEASE_BUILD_FLAGS = exports.DEBUG_BUILD_FLAGS = exports.ENABLE_RUNTIME_TRACES_BUILD_FLAGS = exports.ENABLE_RUNTIME_LOGS_BUILD_FLAGS = exports.ANDROID_X86_64_BUILD_FLAGS = exports.ANDROID_ARMV7_BUILD_FLAGS = exports.ANDROID_ARM64_BUILD_FLAGS = exports.ANDROID_BUILD_FLAGS = exports.COPY_CONFIG_PATH = exports.LINUX_SETUP_SCRIPT_DIR_PATH = exports.MACOS_SETUP_SCRIPT_DIR_PATH = exports.SETUP_SCRIPT_DIR_PATH = exports.BOOTSTRAP_DIR_PATH = exports.META_DIR_PATH = exports.CONFIG_DIR_PATH = exports.CLI_ROOT = exports.ANDROID_EXPORTED_LIBRARY_TAG = exports.IOS_EXPORTED_LIBRARY_TAG = exports.CLI_BAZEL_APPLICATION_TAG = exports.LINUX_BAZEL_APPLICATION_TAG = exports.MACOS_BAZEL_APPLICATION_TAG = exports.ANDROID_BAZEL_APPLICATION_TAG = exports.IOS_BAZEL_APPLICATION_TAG = exports.VALID_PLATFORMS = exports.TEMPLATE_BASE_PATHS = exports.ALL_ARCHITECTURES = exports.Architecture = exports.PLATFORM = exports.ANSI_COLORS = exports.BAZEL_EXECUTABLES = exports.BAZEL_BIN_ENV = exports.VALDI_CONFIG_PATHS = void 0;
|
|
3
|
+
exports.TEST_BUILD_FLAGS = exports.WEB_BUILD_FLAGS = exports.CLI_BUILD_FLAGS = exports.LINUX_BUILD_FLAGS = exports.MACOS_BUILD_FLAGS = exports.IOS_BUILD_FLAGS = exports.IOS_DEVICE_BUILD_FLAGS = exports.RELEASE_BUILD_FLAGS = exports.DEBUG_BUILD_FLAGS = exports.ENABLE_RUNTIME_TRACES_BUILD_FLAGS = exports.ENABLE_RUNTIME_LOGS_BUILD_FLAGS = exports.STABLE_EXEC_BAZELRC_BLOCK = exports.STABLE_EXEC_BUILD_FLAGS = exports.ANDROID_X86_64_BUILD_FLAGS = exports.ANDROID_ARMV7_BUILD_FLAGS = exports.ANDROID_ARM64_BUILD_FLAGS = exports.ANDROID_BUILD_FLAGS = exports.COPY_CONFIG_PATH = exports.LINUX_SETUP_SCRIPT_DIR_PATH = exports.MACOS_SETUP_SCRIPT_DIR_PATH = exports.SETUP_SCRIPT_DIR_PATH = exports.BOOTSTRAP_DIR_PATH = exports.META_DIR_PATH = exports.CONFIG_DIR_PATH = exports.CLI_ROOT = exports.WEB_EXPORTED_LIBRARY_TAG = exports.ANDROID_EXPORTED_LIBRARY_TAG = exports.IOS_EXPORTED_LIBRARY_TAG = exports.WEB_BAZEL_APPLICATION_TAG = exports.CLI_BAZEL_APPLICATION_TAG = exports.LINUX_BAZEL_APPLICATION_TAG = exports.MACOS_BAZEL_APPLICATION_TAG = exports.ANDROID_BAZEL_APPLICATION_TAG = exports.IOS_BAZEL_APPLICATION_TAG = exports.VALID_PLATFORMS = exports.TEMPLATE_BASE_PATHS = exports.ALL_ARCHITECTURES = exports.Architecture = exports.PLATFORM = exports.ANSI_COLORS = exports.BAZEL_EXECUTABLES = exports.BAZEL_BIN_ENV = exports.VALDI_CONFIG_PATHS = void 0;
|
|
4
|
+
exports.androidPlatformsFlag = androidPlatformsFlag;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
7
|
exports.VALDI_CONFIG_PATHS = ['~/.valdi/config.yaml', '~/.valdi/config.yml'];
|
|
@@ -22,6 +23,7 @@ var PLATFORM;
|
|
|
22
23
|
PLATFORM["MACOS"] = "macos";
|
|
23
24
|
PLATFORM["LINUX"] = "linux";
|
|
24
25
|
PLATFORM["CLI"] = "cli";
|
|
26
|
+
PLATFORM["WEB"] = "web";
|
|
25
27
|
})(PLATFORM || (exports.PLATFORM = PLATFORM = {}));
|
|
26
28
|
var Architecture;
|
|
27
29
|
(function (Architecture) {
|
|
@@ -44,15 +46,26 @@ var TEMPLATE_BASE_PATHS;
|
|
|
44
46
|
TEMPLATE_BASE_PATHS["GIT_IGNORE"] = ".gitignore.template";
|
|
45
47
|
TEMPLATE_BASE_PATHS["EDITOR_CONFIG"] = ".editorconfig.template";
|
|
46
48
|
TEMPLATE_BASE_PATHS["AGENTS"] = "AGENTS.md.template";
|
|
49
|
+
TEMPLATE_BASE_PATHS["RULES_PYTHON_PATCH"] = "bzl/patches/rules_python/1.9.0/remove_setuptools_spaces.patch.template";
|
|
50
|
+
TEMPLATE_BASE_PATHS["RULES_PYTHON_PATCH_BUILD"] = "bzl/patches/rules_python/1.9.0/BUILD.bazel.template";
|
|
47
51
|
})(TEMPLATE_BASE_PATHS || (exports.TEMPLATE_BASE_PATHS = TEMPLATE_BASE_PATHS = {}));
|
|
48
|
-
exports.VALID_PLATFORMS = [
|
|
52
|
+
exports.VALID_PLATFORMS = [
|
|
53
|
+
PLATFORM.ANDROID,
|
|
54
|
+
PLATFORM.IOS,
|
|
55
|
+
PLATFORM.MACOS,
|
|
56
|
+
PLATFORM.LINUX,
|
|
57
|
+
PLATFORM.CLI,
|
|
58
|
+
PLATFORM.WEB,
|
|
59
|
+
];
|
|
49
60
|
exports.IOS_BAZEL_APPLICATION_TAG = 'valdi_ios_application';
|
|
50
61
|
exports.ANDROID_BAZEL_APPLICATION_TAG = 'valdi_android_application';
|
|
51
62
|
exports.MACOS_BAZEL_APPLICATION_TAG = 'valdi_macos_application';
|
|
52
63
|
exports.LINUX_BAZEL_APPLICATION_TAG = 'valdi_linux_application';
|
|
53
64
|
exports.CLI_BAZEL_APPLICATION_TAG = 'valdi_cli_application';
|
|
65
|
+
exports.WEB_BAZEL_APPLICATION_TAG = 'valdi_web_application';
|
|
54
66
|
exports.IOS_EXPORTED_LIBRARY_TAG = 'valdi_ios_exported_library';
|
|
55
67
|
exports.ANDROID_EXPORTED_LIBRARY_TAG = 'valdi_android_exported_library';
|
|
68
|
+
exports.WEB_EXPORTED_LIBRARY_TAG = 'valdi_web_exported_library';
|
|
56
69
|
exports.CLI_ROOT = path_1.default.join(__dirname, '../..');
|
|
57
70
|
exports.CONFIG_DIR_PATH = path_1.default.join(exports.CLI_ROOT, '.config');
|
|
58
71
|
exports.META_DIR_PATH = path_1.default.join(exports.CLI_ROOT, '.metadata');
|
|
@@ -62,12 +75,25 @@ exports.MACOS_SETUP_SCRIPT_DIR_PATH = path_1.default.join(exports.SETUP_SCRIPT_D
|
|
|
62
75
|
exports.LINUX_SETUP_SCRIPT_DIR_PATH = path_1.default.join(exports.SETUP_SCRIPT_DIR_PATH, 'linux');
|
|
63
76
|
exports.COPY_CONFIG_PATH = path_1.default.join(exports.CONFIG_DIR_PATH, 'copyconfig.json');
|
|
64
77
|
exports.ANDROID_BUILD_FLAGS = ['--copt=-DANDROID_WITH_JNI', '--repo_env=VALDI_PLATFORM_DEPENDENCIES=android'];
|
|
65
|
-
|
|
66
|
-
|
|
78
|
+
exports.ANDROID_ARM64_BUILD_FLAGS = ['--define', 'client_repo_arm64=true'];
|
|
79
|
+
exports.ANDROID_ARMV7_BUILD_FLAGS = ['--define', 'client_repo_arm32=true'];
|
|
80
|
+
exports.ANDROID_X86_64_BUILD_FLAGS = ['--define', 'client_repo_x86_64=true'];
|
|
81
|
+
const ANDROID_PLATFORMS = {
|
|
82
|
+
[Architecture.ARM64]: '@snap_platforms//os:android_arm64',
|
|
83
|
+
[Architecture.ARMV7]: '@snap_platforms//os:android_arm32',
|
|
84
|
+
[Architecture.X86_64]: '@snap_platforms//os:android_x86_64',
|
|
85
|
+
};
|
|
86
|
+
function androidPlatformsFlag(architectures) {
|
|
87
|
+
return `--android_platforms=${architectures.map(architecture => ANDROID_PLATFORMS[architecture]).join(',')}`;
|
|
67
88
|
}
|
|
68
|
-
exports.
|
|
69
|
-
exports.
|
|
70
|
-
|
|
89
|
+
exports.STABLE_EXEC_BUILD_FLAGS = ['--config=stable_exec'];
|
|
90
|
+
exports.STABLE_EXEC_BAZELRC_BLOCK = `# Alternating a Valdi test target and a web/npm target trims test-only options
|
|
91
|
+
# differently, so their exec tool configs collide under one output path and
|
|
92
|
+
# recompile thousands of shared tool actions. Opt-in config that the \`valdi\`
|
|
93
|
+
# CLI passes to its build/test flows so they converge; raw \`bazel\` keeps the
|
|
94
|
+
# default. Changing test flags (e.g. --test_output) repopulates it once.
|
|
95
|
+
build:stable_exec --notrim_test_configuration
|
|
96
|
+
`;
|
|
71
97
|
exports.ENABLE_RUNTIME_LOGS_BUILD_FLAGS = ['--@valdi//bzl/runtime_flags:enable_logging'];
|
|
72
98
|
exports.ENABLE_RUNTIME_TRACES_BUILD_FLAGS = ['--@valdi//bzl/runtime_flags:enable_tracing'];
|
|
73
99
|
exports.DEBUG_BUILD_FLAGS = ['--snap_flavor=platform_development'];
|
|
@@ -78,4 +104,5 @@ const INLINE_ASSETS_BUILD_FLAGS = ['--@valdi//bzl/valdi:assets_mode=inline'];
|
|
|
78
104
|
exports.MACOS_BUILD_FLAGS = [...INLINE_ASSETS_BUILD_FLAGS, '--repo_env=VALDI_PLATFORM_DEPENDENCIES=macos'];
|
|
79
105
|
exports.LINUX_BUILD_FLAGS = [...INLINE_ASSETS_BUILD_FLAGS, '--repo_env=VALDI_PLATFORM_DEPENDENCIES=linux'];
|
|
80
106
|
exports.CLI_BUILD_FLAGS = [...INLINE_ASSETS_BUILD_FLAGS, '--repo_env=VALDI_PLATFORM_DEPENDENCIES=cli'];
|
|
107
|
+
exports.WEB_BUILD_FLAGS = ['--define', 'enable_web=true', ...INLINE_ASSETS_BUILD_FLAGS];
|
|
81
108
|
exports.TEST_BUILD_FLAGS = INLINE_ASSETS_BUILD_FLAGS;
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChromiumConsoleSource = exports.ChromiumConsoleLevel = exports.MAX_CHROMIUM_CONSOLE_MESSAGE_LENGTH = void 0;
|
|
4
|
+
exports.formatChromiumConsoleEvent = formatChromiumConsoleEvent;
|
|
5
|
+
exports.MAX_CHROMIUM_CONSOLE_MESSAGE_LENGTH = 16_384;
|
|
6
|
+
const MAX_CONSOLE_ARGUMENTS = 64;
|
|
7
|
+
const MAX_CONSOLE_FRAGMENT_LENGTH = exports.MAX_CHROMIUM_CONSOLE_MESSAGE_LENGTH * 2;
|
|
8
|
+
const MAX_PREVIEW_PROPERTIES = 12;
|
|
9
|
+
const MISSING_PROPERTY = Symbol('missing-property');
|
|
10
|
+
const UNAVAILABLE_PROPERTY = Symbol('unavailable-property');
|
|
11
|
+
const SENSITIVE_CONSOLE_KEY = /authorization|cookie|(?:access|refresh|id)[_-]?token|api[_-]?key|password|passwd|credential|secret|private[_-]?input/i;
|
|
12
|
+
const STANDALONE_JWT = /\beyJ[A-Za-z0-9_-]{2,1021}\.[A-Za-z0-9_-]{2,4096}\.[A-Za-z0-9_-]{2,1024}\b/g;
|
|
13
|
+
const STANDALONE_AWS_ACCESS_KEY = /\bA(?:KIA|SIA)[0-9A-Z]{16}\b/g;
|
|
14
|
+
const STANDALONE_GITHUB_TOKEN = /\b(?:gh[pousr]_[A-Za-z0-9]{20,255}|github_pat_[A-Za-z0-9_]{20,255})\b/g;
|
|
15
|
+
const STANDALONE_GOOGLE_API_KEY = /\bAIza[0-9A-Za-z_-]{35}\b/g;
|
|
16
|
+
const STANDALONE_SLACK_TOKEN = /\bxox[a-z]-[0-9A-Za-z-]{10,255}\b/g;
|
|
17
|
+
var ChromiumConsoleLevel;
|
|
18
|
+
(function (ChromiumConsoleLevel) {
|
|
19
|
+
ChromiumConsoleLevel["Debug"] = "debug";
|
|
20
|
+
ChromiumConsoleLevel["Error"] = "error";
|
|
21
|
+
ChromiumConsoleLevel["Info"] = "info";
|
|
22
|
+
ChromiumConsoleLevel["Log"] = "log";
|
|
23
|
+
ChromiumConsoleLevel["Warning"] = "warn";
|
|
24
|
+
})(ChromiumConsoleLevel || (exports.ChromiumConsoleLevel = ChromiumConsoleLevel = {}));
|
|
25
|
+
var ChromiumConsoleSource;
|
|
26
|
+
(function (ChromiumConsoleSource) {
|
|
27
|
+
ChromiumConsoleSource["Browser"] = "browser";
|
|
28
|
+
ChromiumConsoleSource["Console"] = "console";
|
|
29
|
+
ChromiumConsoleSource["Exception"] = "exception";
|
|
30
|
+
})(ChromiumConsoleSource || (exports.ChromiumConsoleSource = ChromiumConsoleSource = {}));
|
|
31
|
+
function readOwnDataProperty(value, key) {
|
|
32
|
+
try {
|
|
33
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
34
|
+
if (descriptor === undefined)
|
|
35
|
+
return MISSING_PROPERTY;
|
|
36
|
+
return Object.prototype.hasOwnProperty.call(descriptor, 'value') ? descriptor.value : UNAVAILABLE_PROPERTY;
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return UNAVAILABLE_PROPERTY;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function readOwnString(value, key) {
|
|
43
|
+
const property = readOwnDataProperty(value, key);
|
|
44
|
+
return typeof property === 'string' ? property : undefined;
|
|
45
|
+
}
|
|
46
|
+
function safeArrayLength(value) {
|
|
47
|
+
try {
|
|
48
|
+
if (!Array.isArray(value))
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const length = readOwnDataProperty(value, 'length');
|
|
55
|
+
return typeof length === 'number' && Number.isSafeInteger(length) && length >= 0 ? length : null;
|
|
56
|
+
}
|
|
57
|
+
function boundedFragment(value) {
|
|
58
|
+
const redacted = redactConsoleText(value);
|
|
59
|
+
return redacted.length > MAX_CONSOLE_FRAGMENT_LENGTH
|
|
60
|
+
? `${redacted.slice(0, MAX_CONSOLE_FRAGMENT_LENGTH)}…`
|
|
61
|
+
: redacted;
|
|
62
|
+
}
|
|
63
|
+
function formatPrimitive(value) {
|
|
64
|
+
switch (typeof value) {
|
|
65
|
+
case 'string': {
|
|
66
|
+
return boundedFragment(value);
|
|
67
|
+
}
|
|
68
|
+
case 'number':
|
|
69
|
+
case 'bigint':
|
|
70
|
+
case 'boolean':
|
|
71
|
+
case 'undefined': {
|
|
72
|
+
return String(value);
|
|
73
|
+
}
|
|
74
|
+
case 'symbol': {
|
|
75
|
+
return value.description === undefined ? 'Symbol()' : `Symbol(${boundedFragment(value.description)})`;
|
|
76
|
+
}
|
|
77
|
+
default: {
|
|
78
|
+
return value === null ? 'null' : null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function formatPreviewProperty(value, isArray) {
|
|
83
|
+
if (typeof value !== 'object' || value === null)
|
|
84
|
+
return '[Unavailable]';
|
|
85
|
+
const name = readOwnString(value, 'name') ?? '';
|
|
86
|
+
const rawValue = readOwnString(value, 'value') ?? readOwnString(value, 'type') ?? 'undefined';
|
|
87
|
+
const formattedValue = SENSITIVE_CONSOLE_KEY.test(name) ? '[REDACTED]' : boundedFragment(rawValue);
|
|
88
|
+
return isArray ? formattedValue : `${boundedFragment(name)}: ${formattedValue}`;
|
|
89
|
+
}
|
|
90
|
+
function formatRemotePreview(remoteObject) {
|
|
91
|
+
const previewValue = readOwnDataProperty(remoteObject, 'preview');
|
|
92
|
+
const preview = typeof previewValue === 'object' && previewValue !== null ? previewValue : null;
|
|
93
|
+
const propertiesValue = preview ? readOwnDataProperty(preview, 'properties') : MISSING_PROPERTY;
|
|
94
|
+
const propertyCount = safeArrayLength(propertiesValue);
|
|
95
|
+
const description = readOwnString(remoteObject, 'description') ??
|
|
96
|
+
(preview ? readOwnString(preview, 'description') : undefined) ??
|
|
97
|
+
readOwnString(remoteObject, 'type') ??
|
|
98
|
+
'[Unavailable]';
|
|
99
|
+
if (propertyCount === null || propertyCount === 0)
|
|
100
|
+
return boundedFragment(description);
|
|
101
|
+
const subtype = (preview ? readOwnString(preview, 'subtype') : undefined) ?? readOwnString(remoteObject, 'subtype');
|
|
102
|
+
const isArray = subtype === 'array';
|
|
103
|
+
const formatted = [];
|
|
104
|
+
const count = Math.min(propertyCount, MAX_PREVIEW_PROPERTIES);
|
|
105
|
+
for (let index = 0; index < count; index += 1) {
|
|
106
|
+
const property = readOwnDataProperty(propertiesValue, String(index));
|
|
107
|
+
formatted.push(formatPreviewProperty(property, isArray));
|
|
108
|
+
}
|
|
109
|
+
const overflow = preview ? readOwnDataProperty(preview, 'overflow') === true : false;
|
|
110
|
+
if (overflow || propertyCount > MAX_PREVIEW_PROPERTIES)
|
|
111
|
+
formatted.push('…');
|
|
112
|
+
return isArray ? `[${formatted.join(', ')}]` : `{${formatted.join(', ')}}`;
|
|
113
|
+
}
|
|
114
|
+
function formatRemoteObject(value) {
|
|
115
|
+
if (value === MISSING_PROPERTY || value === UNAVAILABLE_PROPERTY)
|
|
116
|
+
return '[Unavailable]';
|
|
117
|
+
const primitive = formatPrimitive(value);
|
|
118
|
+
if (primitive !== null)
|
|
119
|
+
return primitive;
|
|
120
|
+
if (typeof value !== 'object' || value === null)
|
|
121
|
+
return '[Unavailable]';
|
|
122
|
+
const type = readOwnString(value, 'type');
|
|
123
|
+
const subtype = readOwnString(value, 'subtype');
|
|
124
|
+
if (type === 'undefined')
|
|
125
|
+
return 'undefined';
|
|
126
|
+
if (subtype === 'null')
|
|
127
|
+
return 'null';
|
|
128
|
+
const unserializableValue = readOwnString(value, 'unserializableValue');
|
|
129
|
+
if (unserializableValue !== undefined)
|
|
130
|
+
return boundedFragment(unserializableValue);
|
|
131
|
+
const remoteValue = readOwnDataProperty(value, 'value');
|
|
132
|
+
if (remoteValue !== MISSING_PROPERTY && remoteValue !== UNAVAILABLE_PROPERTY) {
|
|
133
|
+
const formattedValue = formatPrimitive(remoteValue);
|
|
134
|
+
if (formattedValue !== null)
|
|
135
|
+
return formattedValue;
|
|
136
|
+
}
|
|
137
|
+
if (subtype === 'error') {
|
|
138
|
+
const errorDescription = readOwnString(value, 'description');
|
|
139
|
+
if (errorDescription !== undefined)
|
|
140
|
+
return boundedFragment(errorDescription);
|
|
141
|
+
}
|
|
142
|
+
return formatRemotePreview(value);
|
|
143
|
+
}
|
|
144
|
+
function formatConsoleArguments(value) {
|
|
145
|
+
const length = safeArrayLength(value);
|
|
146
|
+
if (length === null)
|
|
147
|
+
return null;
|
|
148
|
+
if (length === 0)
|
|
149
|
+
return '';
|
|
150
|
+
const count = Math.min(length, MAX_CONSOLE_ARGUMENTS);
|
|
151
|
+
const arguments_ = [];
|
|
152
|
+
const formatted = [];
|
|
153
|
+
let formattedLength = 0;
|
|
154
|
+
let inputTruncated = false;
|
|
155
|
+
for (let index = 0; index < count; index += 1) {
|
|
156
|
+
const argument = readOwnDataProperty(value, String(index));
|
|
157
|
+
const formattedArgument = formatRemoteObject(argument);
|
|
158
|
+
const separatorLength = formatted.length === 0 ? 0 : 1;
|
|
159
|
+
const remainingLength = MAX_CONSOLE_FRAGMENT_LENGTH - formattedLength - separatorLength;
|
|
160
|
+
if (remainingLength <= 0) {
|
|
161
|
+
formatted.push('…');
|
|
162
|
+
inputTruncated = true;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
arguments_.push(argument);
|
|
166
|
+
if (formattedArgument.length > remainingLength) {
|
|
167
|
+
formatted.push(`${formattedArgument.slice(0, Math.max(0, remainingLength - 1))}…`);
|
|
168
|
+
inputTruncated = true;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
formatted.push(formattedArgument);
|
|
172
|
+
formattedLength += separatorLength + formattedArgument.length;
|
|
173
|
+
}
|
|
174
|
+
if (!inputTruncated && length > arguments_.length && formattedLength < MAX_CONSOLE_FRAGMENT_LENGTH) {
|
|
175
|
+
formatted.push('…');
|
|
176
|
+
}
|
|
177
|
+
const firstValue = typeof arguments_[0] === 'object' && arguments_[0] !== null
|
|
178
|
+
? readOwnDataProperty(arguments_[0], 'value')
|
|
179
|
+
: MISSING_PROPERTY;
|
|
180
|
+
if (typeof firstValue !== 'string' || !/%[%Ocdfios]/.test(formatted[0] ?? '')) {
|
|
181
|
+
return formatted.join(' ');
|
|
182
|
+
}
|
|
183
|
+
let nextArgument = 1;
|
|
184
|
+
const substituted = (formatted[0] ?? '').replaceAll(/%([%Ocdfios])/g, (match, specifier) => {
|
|
185
|
+
if (specifier === '%')
|
|
186
|
+
return '%';
|
|
187
|
+
if (nextArgument >= arguments_.length)
|
|
188
|
+
return match;
|
|
189
|
+
const argument = formatted[nextArgument++] ?? '';
|
|
190
|
+
if (specifier === 'c')
|
|
191
|
+
return '';
|
|
192
|
+
if (specifier === 'd' || specifier === 'i')
|
|
193
|
+
return String(Number.parseInt(argument, 10));
|
|
194
|
+
if (specifier === 'f')
|
|
195
|
+
return String(Number.parseFloat(argument));
|
|
196
|
+
return argument;
|
|
197
|
+
});
|
|
198
|
+
return [substituted, ...formatted.slice(nextArgument)].join(' ');
|
|
199
|
+
}
|
|
200
|
+
function redactConsoleText(text) {
|
|
201
|
+
return text
|
|
202
|
+
.replaceAll(STANDALONE_JWT, '[REDACTED]')
|
|
203
|
+
.replaceAll(STANDALONE_AWS_ACCESS_KEY, '[REDACTED]')
|
|
204
|
+
.replaceAll(STANDALONE_GITHUB_TOKEN, '[REDACTED]')
|
|
205
|
+
.replaceAll(STANDALONE_GOOGLE_API_KEY, '[REDACTED]')
|
|
206
|
+
.replaceAll(STANDALONE_SLACK_TOKEN, '[REDACTED]')
|
|
207
|
+
.replaceAll(/\b(?:sk-(?:proj-|svcacct-)?[\w-]{12,}|sess-[\w-]{12,})\b/g, '[REDACTED]')
|
|
208
|
+
.replaceAll(/\bbearer\s+[\w+./~-]+=*/gi, 'Bearer [REDACTED]')
|
|
209
|
+
.replaceAll(/(["']?\b(?:authorization|proxy-authorization|cookie|set-cookie)["']?\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\n\r,]+)/gi, '$1[REDACTED]')
|
|
210
|
+
.replaceAll(/(["']?\b(?:access[_-]?token|refresh[_-]?token|id[_-]?token|api[_-]?key|password|passwd|credential|secret|private[_-]?input)["']?\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\n\r&,;}]+)/gi, '$1[REDACTED]')
|
|
211
|
+
.replaceAll(/([&?](?:access_token|refresh_token|id_token|api_key|token|code|password|key|session)=)[^\s#&]+/gi, '$1[REDACTED]');
|
|
212
|
+
}
|
|
213
|
+
function normalizeConsoleLevel(level) {
|
|
214
|
+
switch (level) {
|
|
215
|
+
case 'error':
|
|
216
|
+
case 'assert': {
|
|
217
|
+
return ChromiumConsoleLevel.Error;
|
|
218
|
+
}
|
|
219
|
+
case 'warn':
|
|
220
|
+
case 'warning': {
|
|
221
|
+
return ChromiumConsoleLevel.Warning;
|
|
222
|
+
}
|
|
223
|
+
case 'info': {
|
|
224
|
+
return ChromiumConsoleLevel.Info;
|
|
225
|
+
}
|
|
226
|
+
case 'debug':
|
|
227
|
+
case 'verbose':
|
|
228
|
+
case 'trace': {
|
|
229
|
+
return ChromiumConsoleLevel.Debug;
|
|
230
|
+
}
|
|
231
|
+
default: {
|
|
232
|
+
return ChromiumConsoleLevel.Log;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function makeConsoleEntry(level, message, source, timestamp) {
|
|
237
|
+
const redacted = boundedFragment(message);
|
|
238
|
+
return {
|
|
239
|
+
level: normalizeConsoleLevel(level),
|
|
240
|
+
message: redacted.length > exports.MAX_CHROMIUM_CONSOLE_MESSAGE_LENGTH
|
|
241
|
+
? `${redacted.slice(0, exports.MAX_CHROMIUM_CONSOLE_MESSAGE_LENGTH)}…`
|
|
242
|
+
: redacted,
|
|
243
|
+
source,
|
|
244
|
+
timestamp: typeof timestamp === 'number' && Number.isFinite(timestamp) ? timestamp : Date.now(),
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
function formatChromiumConsoleEvent(event) {
|
|
248
|
+
if (typeof event !== 'object' || event === null)
|
|
249
|
+
return null;
|
|
250
|
+
const method = readOwnString(event, 'method');
|
|
251
|
+
const paramsValue = readOwnDataProperty(event, 'params');
|
|
252
|
+
if (typeof paramsValue !== 'object' || paramsValue === null)
|
|
253
|
+
return null;
|
|
254
|
+
if (method === 'Runtime.consoleAPICalled') {
|
|
255
|
+
const message = formatConsoleArguments(readOwnDataProperty(paramsValue, 'args'));
|
|
256
|
+
if (message === null)
|
|
257
|
+
return null;
|
|
258
|
+
return makeConsoleEntry(readOwnDataProperty(paramsValue, 'type'), message, ChromiumConsoleSource.Console, readOwnDataProperty(paramsValue, 'timestamp'));
|
|
259
|
+
}
|
|
260
|
+
if (method === 'Log.entryAdded') {
|
|
261
|
+
const entry = readOwnDataProperty(paramsValue, 'entry');
|
|
262
|
+
if (typeof entry !== 'object' || entry === null)
|
|
263
|
+
return null;
|
|
264
|
+
const message = readOwnString(entry, 'text');
|
|
265
|
+
if (message === undefined)
|
|
266
|
+
return null;
|
|
267
|
+
return makeConsoleEntry(readOwnDataProperty(entry, 'level'), message, ChromiumConsoleSource.Browser, readOwnDataProperty(entry, 'timestamp'));
|
|
268
|
+
}
|
|
269
|
+
if (method === 'Runtime.exceptionThrown') {
|
|
270
|
+
const details = readOwnDataProperty(paramsValue, 'exceptionDetails');
|
|
271
|
+
if (typeof details !== 'object' || details === null)
|
|
272
|
+
return null;
|
|
273
|
+
const exception = readOwnDataProperty(details, 'exception');
|
|
274
|
+
const description = typeof exception === 'object' && exception !== null ? readOwnString(exception, 'description') : undefined;
|
|
275
|
+
const message = description ?? readOwnString(details, 'text') ?? 'Uncaught exception';
|
|
276
|
+
return makeConsoleEntry(ChromiumConsoleLevel.Error, message, ChromiumConsoleSource.Exception, readOwnDataProperty(paramsValue, 'timestamp'));
|
|
277
|
+
}
|
|
278
|
+
return null;
|
|
279
|
+
}
|