You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@weex.apache.org by Hanks Zhang <zh...@gmail.com> on 2017/12/11 08:12:41 UTC
About the framework type annotation
The "framework type annotation" is a special syntax written in js bundle to
indicate which framework it is using, such as Vue and Rax. Refer to its
document [1] the annotation looks like:
// { "framework": "Vue" }
or
// { "framework": "Rax" }
It's comment with special format actually, however, it is often been
removed by the many build tools while minify or uglify. It is fragile and
not standard.
I think we should use "Directive Prologues" [2] to indicate the framework
type of js bundle. This feature is used to declare the *strict model*. It
looks like:
"use weex:vue";
or
"use weex:rax";
Both ' (single quote) and " (double quotes) are fine. With or without
; (semicolon) is fine.
What do you think fellows?
[1]
http://weex-project.io/references/advanced/extend-jsfm.html#JS-Bundle-format-requirements
[2] http://ecma-international.org/ecma-262/5.1/#sec-14.1
Re: About the framework type annotation
Posted by Jonathan Dong <jo...@outlook.com>.
It looks good to me. // { “framework”: “Vue/Rax” } looks tricky, and we cannot add license disclaimer before it.
One question, how do we handle the backward compatibility issue?
On 11 Dec 2017, at 4:12 PM, Hanks Zhang <zh...@gmail.com>> wrote:
Re: About the framework type annotation
Posted by Hanks Zhang <zh...@gmail.com>.
I think we could take three steps to get the framework type of a js bundle.
1. Parse the URL params, use a special key to specify the framework type.
This will skip the string parsing and save time.
2. Parse the "use weex:vue" or "use weex:rax" in the code string.
3. Parse the // { "Framework": “Vue/Rax” }, just to be compatible with the
previous syntax.
If there still failed to parse a reasonable framework type after these
steps, then throw an error or use "Vue" as default.
2017-12-11 16:28 GMT+08:00 Adam Feng <cx...@gmail.com>:
> Is there any way to avoid string parsing, for example, get framework type
> from returning value while executing the bundle?
>
> Thanks.
> Adam Feng
>
> On 11 Dec 2017, 4:12 PM +0800, Hanks Zhang <zh...@gmail.com>, wrote:
> > The "framework type annotation" is a special syntax written in js bundle
> to
> > indicate which framework it is using, such as Vue and Rax. Refer to its
> > document [1] the annotation looks like:
> >
> > // { "framework": "Vue" }
> >
> > or
> >
> > // { "framework": "Rax" }
> >
> > It's comment with special format actually, however, it is often been
> > removed by the many build tools while minify or uglify. It is fragile and
> > not standard.
> >
> > I think we should use "Directive Prologues" [2] to indicate the framework
> > type of js bundle. This feature is used to declare the *strict model*. It
> > looks like:
> >
> > "use weex:vue";
> >
> > or
> >
> > "use weex:rax";
> >
> > Both ' (single quote) and " (double quotes) are fine. With or without
> > ; (semicolon) is fine.
> >
> > What do you think fellows?
> >
> >
> > [1]
> > http://weex-project.io/references/advanced/extend-
> jsfm.html#JS-Bundle-format-requirements
> > [2] http://ecma-international.org/ecma-262/5.1/#sec-14.1
>
Re: About the framework type annotation
Posted by Adam Feng <cx...@gmail.com>.
Is there any way to avoid string parsing, for example, get framework type from returning value while executing the bundle?
Thanks.
Adam Feng
On 11 Dec 2017, 4:12 PM +0800, Hanks Zhang <zh...@gmail.com>, wrote:
> The "framework type annotation" is a special syntax written in js bundle to
> indicate which framework it is using, such as Vue and Rax. Refer to its
> document [1] the annotation looks like:
>
> // { "framework": "Vue" }
>
> or
>
> // { "framework": "Rax" }
>
> It's comment with special format actually, however, it is often been
> removed by the many build tools while minify or uglify. It is fragile and
> not standard.
>
> I think we should use "Directive Prologues" [2] to indicate the framework
> type of js bundle. This feature is used to declare the *strict model*. It
> looks like:
>
> "use weex:vue";
>
> or
>
> "use weex:rax";
>
> Both ' (single quote) and " (double quotes) are fine. With or without
> ; (semicolon) is fine.
>
> What do you think fellows?
>
>
> [1]
> http://weex-project.io/references/advanced/extend-jsfm.html#JS-Bundle-format-requirements
> [2] http://ecma-international.org/ecma-262/5.1/#sec-14.1