File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ let url
5656 const evUrlori = queryObject . evalUrlori ?? ''
5757 const evUrlmodi = queryObject . evalUrlmodi ?? ''
5858 const wrap_response = queryObject . wrap_response
59- const compatibilityOnly = queryObject . compatibilityOnly
59+ const compatibilityOnly = istrue ( queryObject . compatibilityOnly )
60+ const isScriptConversion = type . endsWith ( '-script' )
6061
6162 const subconverter = queryObject . subconverter
6263
@@ -361,8 +362,7 @@ global.$done = _scriptSonverterDone
361362 }
362363 if ( type === 'qx-script' || compatibilityOnly ) {
363364 const content = `${ prefix } \n${ compatibilityOnly ? body : body . replace ( / \$ d o n e \( / g, '_scriptSonverterDone(' ) } `
364- body = `${ prepend || '' }
365- const _scriptSonverterCompatibilityType = typeof $response !== 'undefined' ? 'response' : typeof $request !== 'undefined' ? 'request' : ''
365+ body = `const _scriptSonverterCompatibilityType = typeof $response !== 'undefined' ? 'response' : typeof $request !== 'undefined' ? 'request' : ''
366366const _scriptSonverterCompatibilityDone = $done
367367try {
368368 ${ content }
@@ -379,7 +379,12 @@ try {
379379 } else {
380380 throw e
381381 }
382- }`
382+ }`
383+ }
384+
385+ if ( prepend && isScriptConversion ) {
386+ body = `${ prepend }
387+ ${ body } `
383388 }
384389
385390 status = status ?? 200
Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ let url
5656 const evUrlori = queryObject . evalUrlori ?? ''
5757 const evUrlmodi = queryObject . evalUrlmodi ?? ''
5858 const wrap_response = queryObject . wrap_response
59- const compatibilityOnly = queryObject . compatibilityOnly
59+ const compatibilityOnly = istrue ( queryObject . compatibilityOnly )
60+ const isScriptConversion = type . endsWith ( '-script' )
6061
6162 const subconverter = queryObject . subconverter
6263
@@ -361,8 +362,7 @@ global.$done = _scriptSonverterDone
361362 }
362363 if ( type === 'qx-script' || compatibilityOnly ) {
363364 const content = `${ prefix } \n${ compatibilityOnly ? body : body . replace ( / \$ d o n e \( / g, '_scriptSonverterDone(' ) } `
364- body = `${ prepend || '' }
365- const _scriptSonverterCompatibilityType = typeof $response !== 'undefined' ? 'response' : typeof $request !== 'undefined' ? 'request' : ''
365+ body = `const _scriptSonverterCompatibilityType = typeof $response !== 'undefined' ? 'response' : typeof $request !== 'undefined' ? 'request' : ''
366366const _scriptSonverterCompatibilityDone = $done
367367try {
368368 ${ content }
@@ -379,7 +379,12 @@ try {
379379 } else {
380380 throw e
381381 }
382- }`
382+ }`
383+ }
384+
385+ if ( prepend && isScriptConversion ) {
386+ body = `${ prepend }
387+ ${ body } `
383388 }
384389
385390 status = status ?? 200
You can’t perform that action at this time.
0 commit comments