@iebh/reflib 2.3.3 → 2.3.4
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/.vscode/launch.json +36 -35
- package/modules/shims/WritableStream-browser.js +14 -19
- package/package.json +1 -1
package/.vscode/launch.json
CHANGED
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"type": "node",
|
|
6
|
+
"request": "launch",
|
|
7
|
+
"name": "Debug Vite Server",
|
|
8
|
+
"runtimeExecutable": "/home/connor/.nvm/versions/node/v20.12.2/bin/npm",
|
|
9
|
+
"runtimeArgs": ["run", "dev"],
|
|
10
|
+
"cwd": "${workspaceFolder}/test/browser",
|
|
11
|
+
"console": "integratedTerminal",
|
|
12
|
+
"env": {
|
|
13
|
+
"VITE_DEV_SERVER_URL": "http://localhost:3000"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "Debug in Chrome",
|
|
18
|
+
"type": "chrome",
|
|
19
|
+
"request": "launch",
|
|
20
|
+
"url": "http://localhost:3000",
|
|
21
|
+
"webRoot": "${workspaceFolder}",
|
|
22
|
+
"sourceMaps": true,
|
|
23
|
+
"sourceMapPathOverrides": {
|
|
24
|
+
"/__vite-root/*": "${webRoot}/*",
|
|
25
|
+
"/@fs/*": "*",
|
|
26
|
+
"/@vite-root/*": "${webRoot}/*",
|
|
27
|
+
"/src/*": "${webRoot}/src/*",
|
|
28
|
+
"/modules/*": "${webRoot}/modules/*"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"compounds": [
|
|
33
|
+
{
|
|
34
|
+
"name": "Debug Vite + Chrome",
|
|
35
|
+
"configurations": ["Debug Vite Server", "Debug in Chrome"]
|
|
36
|
+
}
|
|
37
|
+
]
|
|
37
38
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import camelCase from '../../shared/camelCase.js';
|
|
2
1
|
import Emitter from '../../shared/emitter.js';
|
|
3
2
|
import CacxParser from '@iebh/cacx';
|
|
4
3
|
|
|
@@ -8,19 +7,20 @@ export class WritableStream {
|
|
|
8
7
|
this.parser = new CacxParser({
|
|
9
8
|
collect: false,
|
|
10
9
|
onTagOpen: (node) => {
|
|
11
|
-
|
|
10
|
+
console.log(node.tag, node.attrs);
|
|
11
|
+
const name = node.tag;
|
|
12
12
|
const attrs = node.attrs || {};
|
|
13
13
|
this.emitter.emit('opentag', name, attrs);
|
|
14
14
|
},
|
|
15
15
|
onTagClose: (node) => {
|
|
16
|
-
const name =
|
|
16
|
+
const name = node.tag;
|
|
17
|
+
// Emit text event before closing the tag
|
|
18
|
+
if (node.text && node.text.trim()) {
|
|
19
|
+
this.emitter.emit('text', node.text.trim());
|
|
20
|
+
}
|
|
17
21
|
this.emitter.emit('closetag', name);
|
|
18
22
|
},
|
|
19
|
-
|
|
20
|
-
// This method is called for each attribute, so we don't need to do anything here
|
|
21
|
-
return { [key]: val };
|
|
22
|
-
},
|
|
23
|
-
flattenText: true,
|
|
23
|
+
flattenText: false,
|
|
24
24
|
keyText: 'text',
|
|
25
25
|
keyAttrs: 'attrs',
|
|
26
26
|
});
|
|
@@ -34,23 +34,18 @@ export class WritableStream {
|
|
|
34
34
|
|
|
35
35
|
write(data) {
|
|
36
36
|
this.parser.append(data).exec();
|
|
37
|
-
|
|
38
|
-
// Emit text events for any text nodes
|
|
39
|
-
const currentNode = this.parser.stack.at(-1);
|
|
40
|
-
if (currentNode && currentNode.text) {
|
|
41
|
-
const text = currentNode.text.trim();
|
|
42
|
-
if (text) {
|
|
43
|
-
this.emitter.emit('text', text);
|
|
44
|
-
}
|
|
45
|
-
// Clear the text to avoid emitting it multiple times
|
|
46
|
-
currentNode.text = '';
|
|
47
|
-
}
|
|
48
37
|
}
|
|
49
38
|
|
|
50
39
|
end() {
|
|
51
40
|
// Process any remaining data
|
|
52
41
|
this.parser.exec();
|
|
53
42
|
|
|
43
|
+
// Emit text event for the last node if it has text
|
|
44
|
+
const lastNode = this.parser.stack.at(-1);
|
|
45
|
+
if (lastNode && lastNode.text && lastNode.text.trim()) {
|
|
46
|
+
this.emitter.emit('text', lastNode.text.trim());
|
|
47
|
+
}
|
|
48
|
+
|
|
54
49
|
// Emit end event
|
|
55
50
|
this.emitter.emit('end');
|
|
56
51
|
}
|