{"body":"diff --git a/bin/lib/todo-routes.rakumod b/bin/lib/todo-routes.rakumod\nindex de47a0d..918019e 100644\n--- a/bin/lib/todo-routes.rakumod\n+++ b/bin/lib/todo-routes.rakumod\n@@ -4,6 +4,8 @@ use Cro::HTTP::Router;\n use Cro::WebApp::Template;\n use Todo;\n \n+unit module todo-routes;\n+\n sub todo-routes is export {\n \troute {\n \t\t#resources-from %?RESOURCES;\ndiff --git a/lib/Cromponent.rakumod b/lib/Cromponent.rakumod\nindex 1bb5708..62df257 100644\n--- a/lib/Cromponent.rakumod\n+++ b/lib/Cromponent.rakumod\n@@ -137,34 +137,57 @@ sub compile-cromponent($cromponent) {\n \t\t\t.die\n \t\t}\n \t}\n-\t# If letting this commented, it gives this error when running: raku -Ilib -Ibin/lib -e 'use todo-routes'\n-\t#\n-\t# ❯ raku -Ilib -Ibin/lib -e 'use todo-routes'\n-\t#===SORRY!=== Error while compiling -e\n-\t#X::Comp::BeginTime.new(use-case => \"evaluating a BEGIN\", exception => X::Comp::AdHoc.new(pos => Any, filename => Any, line => Any, directive-filename => Any, column => Any, modules => [], is-compile-time => Any, pre => Any, post => Any, highexpect => [], payload => \"lang-call cannot invoke object of type 'VMNull' belonging to no language\"), pos => Any, filename => \"/Users/fernando/Cromponent/EVAL_86\", line => 1, directive-filename => Any, column => Any, modules => [], is-compile-time => Bool::True, pre => Any, post => Any, highexpect => [])\n-\t#===SORRY!=== Error while compiling /Users/fernando/Cromponent/EVAL_86\n-\t#An exception X::Comp::AdHoc occurred while evaluating a BEGIN:\n-\t#lang-call cannot invoke object of type 'VMNull' belonging to no language\n-\t#at /Users/fernando/Cromponent/EVAL_86:1\n-\t#Exception details:\n-\t#  ===SORRY!=== Error while compiling\n-\t#  lang-call cannot invoke object of type 'VMNull' belonging to no language\n-\t#  at line\n-\t#\n-\t#at -e:1\n-\t#\n-\t# if you uncomment this line, it will remobe prelude from the generated code, ahd the error will be:\n-\t#❯ raku -Ilib -Ibin/lib -e 'use todo-routes'\n-\t#===SORRY!=== Error while compiling -e\n-\t#Missing or wrong version of dependency 'EVAL_85' (from '/Users/fernando/Cromponent/bin/lib/todo-routes.rakumod (todo-routes)')\n-\t#at -e:1\n-\t#\n-\t# But independently from this line, if you run: raku -Ilib -Ibin/lib -e 'use Todo'\n-\t# it worksw correctly\n-\t#\n-\t#$ast.children.shift; # Removes prelude from generated code\n+\t$ast does role :: {\n+my constant %escapes = %(\n+    '&' => '&amp;',\n+    '<' => '&lt;',\n+    '>' => '&gt;',\n+    '\"' => '&quot;',\n+    \"'\" => '&apos;',\n+);\n+\n+multi escape-text(Mu:U $t, Mu $file, Mu $line) {\n+    %*WARNINGS{\"An expression at $file:$line evaluated to $t.^name()\"}++;\n+    ''\n+}\n+\n+multi escape-text(Mu:D $text, Mu $, Mu $) {\n+    $text.Str.subst(/<[<>&]>/, { %escapes{.Str} }, :g)\n+}\n+\n+multi escape-attribute(Mu:U $t, Mu $file, Mu $line) {\n+    %*WARNINGS{\"An expression at $file:$line evaluted to $t.^name()\"}++;\n+    ''\n+}\n+\n+multi escape-attribute(Mu:D $attr, Mu $, Mu $) {\n+    $attr.Str.subst(/<[&\"']>/, { %escapes{.Str} }, :g)\n+}\n+\t\tmethod compile() {\n+\t\t\tdd $*TEMPLATE-REPOSITORY;\n+\t\t\tmy $*IN-SUB = False;\n+\t\t\tmy $*IN-FRAGMENT = False;\n+\t\t\tmy $children-compiled = @.children.map(*.compile).join(\", \");\n+\t\t\tuse MONKEY-SEE-NO-EVAL;\n+\t\t\tmulti sub trait_mod:<is>(Routine $r, :$TEMPLATE-EXPORT-SUB!) {\n+\t\t\t    %*TEMPLATE-EXPORTS<sub>{$r.name.substr('__TEMPLATE_SUB__'.chars)} = $r;\n+\t\t\t}\n+\t\t\tmulti sub trait_mod:<is>(Routine $r, :$TEMPLATE-EXPORT-MACRO!) {\n+\t\t\t    %*TEMPLATE-EXPORTS<macro>{$r.name.substr('__TEMPLATE_MACRO__'.chars)} = $r;\n+\t\t\t}\n+\t\t\tmulti sub trait_mod:<is>(Routine $r, :$TEMPLATE-EXPORT-FRAGMENT!) {\n+\t\t\t    %*TEMPLATE-EXPORTS<fragment>{$r.name.substr('__TEMPLATE_FRAGMENT__'.chars)} = $r;\n+\t\t\t}\n+\t\t\tmy %*TEMPLATE-EXPORTS = :sub{}, :macro{}, :fragment{};\n+\t\t\tmy $code = 'sub ($_) { join \"\", (' ~ $children-compiled ~ ') }';\n+\t\t\twarn $code;\n+\t\t\tmy $renderer = EVAL $code;\n+\t\t\treturn Map.new((:$renderer, exports => %*TEMPLATE-EXPORTS, :@.used-files));\n+\t\t}\n+\t}\n+\t$ast.children.shift;\n \tmy $compiled = $ast.compile;\n-\t#dd $compiled;\n+\tdd $compiled;\n \t$compiled\n }\n \n@@ -232,10 +255,11 @@ sub cromponent-library($component) is export {\n \t)\n }\n \n+\n multi EXPORT(--> Map()) {\n \t'&trait_mod:<is>' => &trait_mod:<is>,\n \t'&EXPORT' => sub {\n-\t\t[|@components-sub, |@components-macro].map({ |cromponent-library $_ }).Map\n+\t\t[|@components-sub, |@components-macro].flatmap({ |cromponent-library $_ }).Map\n \t},\n }\n \n","name":"","extension":"txt","url":"https://www.irccloud.com/pastebin/mejcKNv5","modified":1735411611,"id":"mejcKNv5","size":4312,"lines":115,"own_paste":false,"theme":"","date":1735411611}