diff options
author | 2021-03-21 00:44:42 -0700 | |
---|---|---|
committer | 2021-03-21 00:44:42 -0700 | |
commit | 417657f138fbc5e194df3dd511e3b9c8e53920fd (patch) | |
tree | c15f73c625d3c222304557f4f753204c65304607 /src/compiler/parse/index.ts | |
parent | 2082001ff8702ec48072b59caafe85573a3b2891 (diff) | |
download | astro-417657f138fbc5e194df3dd511e3b9c8e53920fd.tar.gz astro-417657f138fbc5e194df3dd511e3b9c8e53920fd.tar.zst astro-417657f138fbc5e194df3dd511e3b9c8e53920fd.zip |
lots of improvements
Diffstat (limited to 'src/compiler/parse/index.ts')
-rw-r--r-- | src/compiler/parse/index.ts | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/compiler/parse/index.ts b/src/compiler/parse/index.ts index eab2c42c5..f98119d73 100644 --- a/src/compiler/parse/index.ts +++ b/src/compiler/parse/index.ts @@ -232,33 +232,34 @@ export default function parse(template: string, options: ParserOptions = {}): As ); } - const instance_scripts = parser.js.filter((script) => script.context === 'default'); - const module_scripts = parser.js.filter((script) => script.context === 'module'); + // const instance_scripts = parser.js.filter((script) => script.context === 'default'); + // const module_scripts = parser.js.filter((script) => script.context === 'module'); + const hmx_scripts = parser.js.filter((script) => script.context === 'setup'); - if (instance_scripts.length > 1) { + if (hmx_scripts.length > 1) { parser.error( { code: 'invalid-script', - message: 'A component can only have one instance-level <script> element', + message: 'A component can only have one <script astro> element', }, - instance_scripts[1].start + hmx_scripts[1].start ); } - if (module_scripts.length > 1) { - parser.error( - { - code: 'invalid-script', - message: 'A component can only have one <script context="module"> element', - }, - module_scripts[1].start - ); - } + // if (module_scripts.length > 1) { + // parser.error( + // { + // code: 'invalid-script', + // message: 'A component can only have one <script context="module"> element', + // }, + // module_scripts[1].start + // ); + // } return { html: parser.html, css: parser.css[0], - instance: instance_scripts[0], - module: module_scripts[0], + // instance: instance_scripts[0], + module: hmx_scripts[0], }; } |