content-entry-transform 1.5.0 → 1.5.2
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/package.json +2 -2
- package/src/expression-transformer.mjs +13 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "content-entry-transform",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@types/node": "^22.15.17",
|
|
30
|
-
"content-entry": "^14.1.
|
|
30
|
+
"content-entry": "^14.1.3",
|
|
31
31
|
"iterable-string-interceptor": "^3.0.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
@@ -33,11 +33,10 @@ export function createPropertiesInterceptor(properties) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
return value;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
36
|
+
} else {
|
|
38
37
|
return leadIn + e + leadOut;
|
|
39
38
|
}
|
|
40
|
-
|
|
39
|
+
// return "";
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
yield ev(expression, 0);
|
|
@@ -46,21 +45,19 @@ export function createPropertiesInterceptor(properties) {
|
|
|
46
45
|
|
|
47
46
|
/**
|
|
48
47
|
* Transformer expanding '{{}}' expressions
|
|
49
|
-
* @param {string} match
|
|
50
|
-
* @param {Object} properties
|
|
51
|
-
* @param {string} name
|
|
52
|
-
* @returns
|
|
48
|
+
* @param {string} match
|
|
49
|
+
* @param {Object} properties
|
|
50
|
+
* @param {string} name
|
|
51
|
+
* @returns
|
|
53
52
|
*/
|
|
54
53
|
export function createExpressionTransformer(
|
|
55
54
|
match,
|
|
56
55
|
properties,
|
|
57
56
|
name = "expression"
|
|
58
57
|
) {
|
|
59
|
-
|
|
60
58
|
const decoder = new TextDecoder();
|
|
61
59
|
|
|
62
|
-
async function
|
|
63
|
-
{
|
|
60
|
+
async function* streamToText(stream) {
|
|
64
61
|
for await (const chunk of stream) {
|
|
65
62
|
yield decoder.decode(chunk);
|
|
66
63
|
}
|
|
@@ -70,13 +67,15 @@ export function createExpressionTransformer(
|
|
|
70
67
|
name,
|
|
71
68
|
match,
|
|
72
69
|
transform: async entry => {
|
|
70
|
+
const stream = await entry.stream;
|
|
73
71
|
const ne = new IteratorContentEntry(
|
|
74
72
|
entry.name,
|
|
75
73
|
{ destination: entry.destination },
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
() =>
|
|
75
|
+
iterableStringInterceptor(
|
|
76
|
+
streamToText(stream),
|
|
77
|
+
createPropertiesInterceptor(properties)
|
|
78
|
+
)
|
|
80
79
|
);
|
|
81
80
|
return ne;
|
|
82
81
|
}
|