Return the script tag to replace the {{{ SCRIPT }}} tag in the target.
(self)
| 2812 | self.src = None |
| 2813 | |
| 2814 | def replacement(self): |
| 2815 | """Return the script tag to replace the {{{ SCRIPT }}} tag in the target.""" |
| 2816 | assert (self.src or self.inline) and not (self.src and self.inline) |
| 2817 | if self.src: |
| 2818 | src = quote(self.src) |
| 2819 | filename = f'./{src}' |
| 2820 | if settings.EXPORT_ES6: |
| 2821 | return f''' |
| 2822 | <script type="module"> |
| 2823 | import initModule from "{filename}"; |
| 2824 | initModule(Module); |
| 2825 | </script> |
| 2826 | ''' |
| 2827 | else: |
| 2828 | if settings.MODULARIZE: |
| 2829 | return f'<script type="text/javascript" src="{src}"></script>' |
| 2830 | else: |
| 2831 | return f'<script async type="text/javascript" src="{src}"></script>' |
| 2832 | else: |
| 2833 | return f'<script id="mainScript">\n{self.inline}\n</script>' |
| 2834 | |
| 2835 | |
| 2836 | def filter_out_fake_dynamic_libs(options, inputs): |
no outgoing calls
no test coverage detected