fix: handle commented class declations
(cherry picked from commit 29894ffcca34ef60d1a9a27d9be19abd62d66a23)
This commit is contained in:
parent
019662052a
commit
4dabcebee5
@ -167,8 +167,13 @@ export function getScript(doctype, view = 'Form') {
|
||||
|
||||
// utility function to setup a form controller
|
||||
function getClassNames(script) {
|
||||
const withoutComments = script
|
||||
.replace(/\/\/.*$/gm, '') // Remove single-line comments
|
||||
.replace(/\/\*[\s\S]*?\*\//g, '') // Remove multi-line comments
|
||||
|
||||
// Match class declarations
|
||||
return (
|
||||
[...script.matchAll(/class\s+([A-Za-z0-9_]+)/g)].map(
|
||||
[...withoutComments.matchAll(/class\s+([A-Za-z0-9_]+)/g)].map(
|
||||
(match) => match[1],
|
||||
) || []
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user