odac 1.4.11 → 1.4.13

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/src/View.js CHANGED
@@ -443,12 +443,7 @@ class View {
443
443
  content = this.#parseOdacTag(content)
444
444
  content = content.replace(/`/g, '\\\\`').replace(/\$\{/g, '\\\\${')
445
445
 
446
- jsBlocks.forEach((jsContent, index) => {
447
- content = content.replace(`___ODAC_JS_BLOCK_${index}___`, jsContent)
448
- })
449
-
450
446
  let result = 'html += `\n' + content + '\n`'
451
- content = content.split('\n')
452
447
  for (let key in this.#functions) {
453
448
  let att = ''
454
449
  let func = this.#functions[key]
@@ -517,6 +512,14 @@ class View {
517
512
  }
518
513
  }
519
514
  }
515
+
516
+ // Restore <script:odac> JS bodies after function processing so the regex
517
+ // pipeline above never sees user JS as template syntax. Use a function
518
+ // replacer to keep $-sequences in the JS literal (e.g. $$, $&) intact.
519
+ jsBlocks.forEach((jsContent, index) => {
520
+ result = result.replace(`___ODAC_JS_BLOCK_${index}___`, () => jsContent)
521
+ })
522
+
520
523
  let cache = `${nodeCrypto.createHash('md5').update(file).digest('hex')}`
521
524
  await fsPromises.mkdir(CACHE_DIR, {recursive: true})
522
525
  await fsPromises.writeFile(