browser-commander 0.31.0 → 0.31.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.31.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c8f52e3: Upgrade Links Notation to ^0.25.2 so consumers using 0.25.2 can share one copy without an override. Preserve trace text containing lone UTF-16 surrogates, verify export/import and streaming compatibility, and document the new empty/control-value literals for consumers upgrading older parsers.
|
|
8
|
+
|
|
3
9
|
## 0.31.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browser-commander",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.1",
|
|
4
4
|
"description": "Universal browser automation library that supports Playwright, Puppeteer, and Selenium with a unified API",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"command-stream": "^2.0.2",
|
|
85
85
|
"csv-parse": "^7.0.3",
|
|
86
86
|
"gifenc": "^1.0.3",
|
|
87
|
-
"links-notation": "^0.
|
|
87
|
+
"links-notation": "^0.25.2",
|
|
88
88
|
"log-lazy": "^1.0.4",
|
|
89
89
|
"plist": "^5.0.0",
|
|
90
90
|
"test-anywhere": "^0.9.1",
|
package/src/traces/links.js
CHANGED
|
@@ -107,11 +107,11 @@ const HEAD_FIELDS = new Set([
|
|
|
107
107
|
/**
|
|
108
108
|
* Make one value safe to write as a link.
|
|
109
109
|
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
110
|
+
* Keep the representation's legacy escapes even though current Links Notation
|
|
111
|
+
* can quote both quote characters. Newlines must not split a record across
|
|
112
|
+
* lines. Lone UTF-16 surrogates are escaped too: the notation requires valid
|
|
113
|
+
* Unicode, but JavaScript trace strings can hold individual surrogate units.
|
|
114
|
+
* All these encodings are reversible, so the export loses no scalar text.
|
|
115
115
|
*
|
|
116
116
|
* @param {*} value - Any scalar from a trace record
|
|
117
117
|
* @returns {string} Text that survives a format and parse round trip
|
|
@@ -122,9 +122,13 @@ export function encodeLinkText(value) {
|
|
|
122
122
|
.replaceAll('\\', '\\\\')
|
|
123
123
|
.replaceAll('\n', '\\n')
|
|
124
124
|
.replaceAll('\r', '\\r')
|
|
125
|
-
.replaceAll('\t', '\\t')
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
.replaceAll('\t', '\\t')
|
|
126
|
+
// Unicode mode matches lone surrogates without splitting valid pairs.
|
|
127
|
+
.replace(
|
|
128
|
+
/[\ud800-\udfff]/gu,
|
|
129
|
+
(unit) => `\\u${unit.charCodeAt(0).toString(16)}`
|
|
130
|
+
);
|
|
131
|
+
// Preserve the existing encoding for values holding both quote characters.
|
|
128
132
|
return escaped.includes("'") && escaped.includes('"')
|
|
129
133
|
? escaped.replaceAll('"', '\\u0022')
|
|
130
134
|
: escaped;
|
|
@@ -139,8 +143,9 @@ export function encodeLinkText(value) {
|
|
|
139
143
|
export function decodeLinkText(text) {
|
|
140
144
|
const decoded = { '\\': '\\', n: '\n', r: '\r', t: '\t', u0022: '"' };
|
|
141
145
|
return String(text).replace(
|
|
142
|
-
/\\(\\|n|r|t|u0022)/g,
|
|
143
|
-
(match, code) =>
|
|
146
|
+
/\\(\\|n|r|t|u0022|ud[89a-f][0-9a-f]{2})/g,
|
|
147
|
+
(match, code) =>
|
|
148
|
+
decoded[code] ?? String.fromCharCode(Number.parseInt(code.slice(1), 16))
|
|
144
149
|
);
|
|
145
150
|
}
|
|
146
151
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { Parser, StreamParser } from 'links-notation';
|
|
4
|
+
import {
|
|
5
|
+
decodeLinkText,
|
|
6
|
+
formatTraceLinks,
|
|
7
|
+
timelineLink,
|
|
8
|
+
} from '../../../src/traces/links.js';
|
|
9
|
+
import { readRepoText } from '../../helpers/repo.js';
|
|
10
|
+
|
|
11
|
+
describe(
|
|
12
|
+
'trace compatibility with Links Notation (issue #168)',
|
|
13
|
+
{ timeout: 10000 },
|
|
14
|
+
() => {
|
|
15
|
+
it('preserves scalar text through the formatter, parser and trace decoder', () => {
|
|
16
|
+
for (const text of [
|
|
17
|
+
'',
|
|
18
|
+
'#comment',
|
|
19
|
+
'issue#168',
|
|
20
|
+
'~1{61}',
|
|
21
|
+
'both\'and" with `backticks`',
|
|
22
|
+
'line\r\nbreak\ttab\\literal\\u0022\\ud800\\udfff',
|
|
23
|
+
'\u0000\u0001\u007f',
|
|
24
|
+
'a\u00a0b\u2028c\u2029d\ufeff',
|
|
25
|
+
'Tiếng Việt 日本語 🧭 e\u0301',
|
|
26
|
+
'\ud800',
|
|
27
|
+
'\udfff',
|
|
28
|
+
'🧭\ud800🧭\udfff',
|
|
29
|
+
]) {
|
|
30
|
+
const line = formatTraceLinks([
|
|
31
|
+
timelineLink({ kind: 'console', text }),
|
|
32
|
+
]);
|
|
33
|
+
assert.equal(line.split('\n').length, 2, 'one record per line');
|
|
34
|
+
const [parsed] = new Parser().parse(line);
|
|
35
|
+
const field = parsed.values.find((value) => value.id === 'text');
|
|
36
|
+
assert.equal(decodeLinkText(field.values[0].id), text);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('imports the existing cross-language golden export in arbitrary chunks', () => {
|
|
41
|
+
const text = readRepoText(
|
|
42
|
+
'js/tests/fixtures/traces/conformance/expected/trace.lino'
|
|
43
|
+
);
|
|
44
|
+
const expected = new Parser().parse(text);
|
|
45
|
+
assert.equal(expected.length, 27);
|
|
46
|
+
for (const chunkSize of [1, 17, text.length]) {
|
|
47
|
+
const stream = new StreamParser();
|
|
48
|
+
for (let offset = 0; offset < text.length; offset += chunkSize) {
|
|
49
|
+
stream.write(text.slice(offset, offset + chunkSize));
|
|
50
|
+
}
|
|
51
|
+
stream.end();
|
|
52
|
+
assert.deepEqual(stream.drain(), expected);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
);
|
|
@@ -544,8 +544,8 @@ describe('trace links export (issue #94)', () => {
|
|
|
544
544
|
// The notation's formatter and parser decide whether an export can be read
|
|
545
545
|
// back, so the range this package depends on and the version the tests
|
|
546
546
|
// proved are the same range.
|
|
547
|
-
assert.strictEqual(manifest.dependencies['links-notation'], '^0.
|
|
548
|
-
assert.match(installed.version, /^0\.
|
|
547
|
+
assert.strictEqual(manifest.dependencies['links-notation'], '^0.25.2');
|
|
548
|
+
assert.match(installed.version, /^0\.25\./);
|
|
549
549
|
});
|
|
550
550
|
|
|
551
551
|
it('should export a bundle named by path as readily as an open one', async () => {
|