thunderous 2.4.2 → 2.4.3
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/dist/index.cjs +4 -3
- package/dist/index.js +4 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -299,8 +299,9 @@ var wrapTemplate = ({ tagName, serverRender, options }) => {
|
|
|
299
299
|
return finalScopedRenderString;
|
|
300
300
|
};
|
|
301
301
|
var insertTemplates = (tagName, template, inputString) => {
|
|
302
|
-
|
|
303
|
-
|
|
302
|
+
const tagRegex = new RegExp(`<\\s*${tagName}((?:\\s+[^>]*)*)\\s*>`, "gm");
|
|
303
|
+
return inputString.replace(tagRegex, ($match, $1) => {
|
|
304
|
+
const attrs = $1.split(/(?<=")\s+/).filter((attr) => attr.trim() !== "").map((attr) => {
|
|
304
305
|
const [_key, _value] = attr.split("=");
|
|
305
306
|
const key = _key.trim();
|
|
306
307
|
const value = _value?.replace(/"/g, "") ?? "";
|
|
@@ -310,7 +311,7 @@ var insertTemplates = (tagName, template, inputString) => {
|
|
|
310
311
|
for (const [key, value] of attrs) {
|
|
311
312
|
scopedResult = scopedResult.replace(new RegExp(`{{attr:${key}}}`, "gm"), value);
|
|
312
313
|
}
|
|
313
|
-
return $
|
|
314
|
+
return $match + scopedResult;
|
|
314
315
|
});
|
|
315
316
|
};
|
|
316
317
|
var clientOnlyCallback = (fn) => {
|
package/dist/index.js
CHANGED
|
@@ -264,8 +264,9 @@ var wrapTemplate = ({ tagName, serverRender, options }) => {
|
|
|
264
264
|
return finalScopedRenderString;
|
|
265
265
|
};
|
|
266
266
|
var insertTemplates = (tagName, template, inputString) => {
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
const tagRegex = new RegExp(`<\\s*${tagName}((?:\\s+[^>]*)*)\\s*>`, "gm");
|
|
268
|
+
return inputString.replace(tagRegex, ($match, $1) => {
|
|
269
|
+
const attrs = $1.split(/(?<=")\s+/).filter((attr) => attr.trim() !== "").map((attr) => {
|
|
269
270
|
const [_key, _value] = attr.split("=");
|
|
270
271
|
const key = _key.trim();
|
|
271
272
|
const value = _value?.replace(/"/g, "") ?? "";
|
|
@@ -275,7 +276,7 @@ var insertTemplates = (tagName, template, inputString) => {
|
|
|
275
276
|
for (const [key, value] of attrs) {
|
|
276
277
|
scopedResult = scopedResult.replace(new RegExp(`{{attr:${key}}}`, "gm"), value);
|
|
277
278
|
}
|
|
278
|
-
return $
|
|
279
|
+
return $match + scopedResult;
|
|
279
280
|
});
|
|
280
281
|
};
|
|
281
282
|
var clientOnlyCallback = (fn) => {
|