New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support for Vue 2.6 #445
support for Vue 2.6 #445
Changes from 11 commits
d7790ae
75da6d3
18d377d
7e8768e
d3bd9b3
8e0e8d7
267603f
46c69b6
a9032f6
3ee431c
26f876c
85aea58
2b26db5
91b4285
8972f31
270afe8
293cb5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,12 @@ const banner = (name, version) => ` | |
* Released under the MIT license. | ||
*/ | ||
` | ||
const intro = ` | ||
if (!this['process']) { | ||
global.process = process = {env:{}} | ||
} | ||
` | ||
|
||
const resolveVue = p => { | ||
return path.resolve(process.cwd(), 'node_modules', 'vue/src/', p) + '/' | ||
} | ||
|
@@ -36,6 +42,7 @@ const builds = { | |
entry: './platform/nativescript/framework.js', | ||
dest: './dist/index.js', | ||
moduleName: 'NativeScript-Vue', | ||
intro: intro, | ||
banner: banner('NativeScript-Vue'), | ||
external(id) { | ||
return id.startsWith('tns-core-modules') || id.startsWith('weex') | ||
|
@@ -57,6 +64,8 @@ const genConfig = (name) => { | |
input: opts.entry, | ||
external: opts.external, | ||
output: { | ||
strict: false, | ||
farfromrefug marked this conversation as resolved.
Show resolved
Hide resolved
|
||
intro: opts.intro, | ||
file: opts.dest, | ||
format: opts.format || 'cjs', | ||
banner: opts.banner, | ||
|
@@ -72,10 +81,9 @@ const genConfig = (name) => { | |
replace({ | ||
__WEEX__: false, | ||
__VERSION__: VueVersion, | ||
'process.env.NODE_ENV': "'development'", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @farfromrefug Does this remove all the development related help messages that vue prints? If so - can this be re-enabled while developing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well it s the user choice by replacing within his weback config. that code was making the appear always, even in prod There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @farfromrefug alright, so as far as I understand this change, this should still allow the help messages to appear unless webpack sets the env to "production"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rigor789 indeed it will appear by default because it checks for |
||
'let _isServer': 'let _isServer = false', | ||
'process.env.VUE_VERSION': `'${VueVersion}'`, | ||
'process.env.NS_VUE_VERSION': `'${NSVueVersion}'` | ||
'process.env.VUE_VERSION': `process.env.VUE_VERSION || '${VueVersion}'`, | ||
'process.env.NS_VUE_VERSION': `process.env.NS_VUE_VERSION || '${NSVueVersion}'` | ||
}), | ||
flow(), | ||
buble(), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { parseComponent } from './compiler/sfc/parser' | ||
export { compile, compileToFunctions } from './compiler/index' | ||
export { registerElement } from './element-registry' | ||
// register all components | ||
export { registerElement } from './compiler/element-registry' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
import { registerElement } from '../element-register' | ||
export { registerElement } | ||
|
||
registerElement( | ||
'AbsoluteLayout', | ||
() => require('tns-core-modules/ui/layouts/absolute-layout').AbsoluteLayout | ||
) | ||
registerElement( | ||
'ActivityIndicator', | ||
() => require('tns-core-modules/ui/activity-indicator').ActivityIndicator | ||
) | ||
registerElement('Border', () => require('tns-core-modules/ui/border').Border) | ||
registerElement('Button', () => require('tns-core-modules/ui/button').Button) | ||
registerElement( | ||
'ContentView', | ||
() => require('tns-core-modules/ui/content-view').ContentView | ||
) | ||
registerElement( | ||
'DatePicker', | ||
() => require('tns-core-modules/ui/date-picker').DatePicker, | ||
{ | ||
model: { | ||
prop: 'date', | ||
event: 'dateChange' | ||
} | ||
} | ||
) | ||
registerElement( | ||
'DockLayout', | ||
() => require('tns-core-modules/ui/layouts/dock-layout').DockLayout | ||
) | ||
registerElement( | ||
'GridLayout', | ||
() => require('tns-core-modules/ui/layouts/grid-layout').GridLayout | ||
) | ||
registerElement( | ||
'HtmlView', | ||
() => require('tns-core-modules/ui/html-view').HtmlView | ||
) | ||
registerElement('Image', () => require('tns-core-modules/ui/image').Image) | ||
registerElement('img', () => require('tns-core-modules/ui/image').Image) | ||
registerElement('Label', () => require('tns-core-modules/ui/label').Label) | ||
registerElement( | ||
'ListPicker', | ||
() => require('tns-core-modules/ui/list-picker').ListPicker, | ||
{ | ||
model: { | ||
prop: 'selectedIndex', | ||
event: 'selectedIndexChange' | ||
} | ||
} | ||
) | ||
registerElement( | ||
'NativeActionBar', | ||
() => require('tns-core-modules/ui/action-bar').ActionBar | ||
) | ||
registerElement( | ||
'NativeActionItem', | ||
() => require('tns-core-modules/ui/action-bar').ActionItem | ||
) | ||
registerElement( | ||
'NativeListView', | ||
() => require('tns-core-modules/ui/list-view').ListView | ||
) | ||
registerElement( | ||
'NativeNavigationButton', | ||
() => require('tns-core-modules/ui/action-bar').NavigationButton | ||
) | ||
registerElement('Page', () => require('tns-core-modules/ui/page').Page, { | ||
skipAddToDom: true | ||
}) | ||
registerElement( | ||
'Placeholder', | ||
() => require('tns-core-modules/ui/placeholder').Placeholder | ||
) | ||
registerElement( | ||
'Progress', | ||
() => require('tns-core-modules/ui/progress').Progress | ||
) | ||
registerElement( | ||
'ProxyViewContainer', | ||
() => require('tns-core-modules/ui/proxy-view-container').ProxyViewContainer | ||
) | ||
registerElement( | ||
'Repeater', | ||
() => require('tns-core-modules/ui/repeater').Repeater | ||
) | ||
registerElement( | ||
'ScrollView', | ||
() => require('tns-core-modules/ui/scroll-view').ScrollView | ||
) | ||
registerElement( | ||
'SearchBar', | ||
() => require('tns-core-modules/ui/search-bar').SearchBar, | ||
{ | ||
model: { | ||
prop: 'text', | ||
event: 'textChange' | ||
} | ||
} | ||
) | ||
registerElement( | ||
'SegmentedBar', | ||
() => require('tns-core-modules/ui/segmented-bar').SegmentedBar, | ||
{ | ||
model: { | ||
prop: 'selectedIndex', | ||
event: 'selectedIndexChange' | ||
} | ||
} | ||
) | ||
registerElement( | ||
'SegmentedBarItem', | ||
() => require('tns-core-modules/ui/segmented-bar').SegmentedBarItem | ||
) | ||
registerElement('Slider', () => require('tns-core-modules/ui/slider').Slider, { | ||
model: { | ||
prop: 'value', | ||
event: 'valueChange' | ||
} | ||
}) | ||
registerElement( | ||
'StackLayout', | ||
() => require('tns-core-modules/ui/layouts/stack-layout').StackLayout | ||
) | ||
registerElement( | ||
'FlexboxLayout', | ||
() => require('tns-core-modules/ui/layouts/flexbox-layout').FlexboxLayout | ||
) | ||
registerElement('Switch', () => require('tns-core-modules/ui/switch').Switch, { | ||
model: { | ||
prop: 'checked', | ||
event: 'checkedChange' | ||
} | ||
}) | ||
|
||
registerElement( | ||
'NativeTabView', | ||
() => require('tns-core-modules/ui/tab-view').TabView, | ||
{ | ||
model: { | ||
prop: 'selectedIndex', | ||
event: 'selectedIndexChange' | ||
} | ||
} | ||
) | ||
registerElement( | ||
'NativeTabViewItem', | ||
() => require('tns-core-modules/ui/tab-view').TabViewItem, | ||
{ | ||
skipAddToDom: true | ||
} | ||
) | ||
|
||
registerElement( | ||
'TextField', | ||
() => require('tns-core-modules/ui/text-field').TextField | ||
) | ||
registerElement( | ||
'TextView', | ||
() => require('tns-core-modules/ui/text-view').TextView | ||
) | ||
registerElement( | ||
'TimePicker', | ||
() => require('tns-core-modules/ui/time-picker').TimePicker, | ||
{ | ||
model: { | ||
prop: 'time', | ||
event: 'timeChange' | ||
} | ||
} | ||
) | ||
registerElement( | ||
'WebView', | ||
() => require('tns-core-modules/ui/web-view').WebView | ||
) | ||
registerElement( | ||
'WrapLayout', | ||
() => require('tns-core-modules/ui/layouts/wrap-layout').WrapLayout | ||
) | ||
registerElement( | ||
'FormattedString', | ||
() => require('text/formatted-string').FormattedString | ||
) | ||
registerElement('Span', () => require('text/span').Span) | ||
|
||
registerElement( | ||
'DetachedContainer', | ||
() => require('tns-core-modules/ui/proxy-view-container').ProxyViewContainer, | ||
{ | ||
skipAddToDom: true | ||
} | ||
) | ||
registerElement( | ||
'DetachedText', | ||
() => require('tns-core-modules/ui/placeholder').Placeholder, | ||
{ | ||
skipAddToDom: true | ||
} | ||
) | ||
registerElement( | ||
'Comment', | ||
() => require('tns-core-modules/ui/placeholder').Placeholder | ||
) | ||
registerElement( | ||
'Document', | ||
() => require('tns-core-modules/ui/proxy-view-container').ProxyViewContainer, | ||
{ | ||
skipAddToDom: true | ||
} | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,17 +4,17 @@ import { parseText } from 'compiler/parser/text-parser' | |
function transformNode(el, options) { | ||
const warn = options.warn || baseWarn | ||
const staticClass = getAndRemoveAttr(el, 'class') | ||
if (process.env.NODE_ENV !== 'production' && staticClass) { | ||
const expression = parseText(staticClass, options.delimiters) | ||
if (expression) { | ||
warn( | ||
`class="${staticClass}": ` + | ||
'Interpolation inside attributes has been removed. ' + | ||
'Use v-bind or the colon shorthand instead. For example, ' + | ||
'instead of <div class="{{ val }}">, use <div :class="val">.' | ||
) | ||
} | ||
} | ||
// if (process.env.NODE_ENV !== 'production' && staticClass) { | ||
// const expression = parseText(staticClass, options.delimiters) | ||
// if (expression) { | ||
// warn( | ||
// `class="${staticClass}": ` + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @farfromrefug any reason this has been removed? Interpolation in attributes should not be used - and should be warned about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well it was a deprecation warning that was implying a regexp test on every transform node. Seemed like it was time to remove it. But i can bring it back if you prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @farfromrefug Just checked and it is still present in vue (web), so let's keep it there until even vue removes it! :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
// 'Interpolation inside attributes has been removed. ' + | ||
// 'Use v-bind or the colon shorthand instead. For example, ' + | ||
// 'instead of <div class="{{ val }}">, use <div :class="val">.' | ||
// ) | ||
// } | ||
// } | ||
if (staticClass) { | ||
el.staticClass = JSON.stringify(staticClass) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@farfromrefug any reason you are not checking for
global.process
? In this case I believe it does the same thing, since we are in a global context - but still curious if there is something I'm not aware of! :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well to be honest i am not sure how "process" is handled in Nativescript. What i know is that VueJs checks
process
and notglobal.process
. That's why i used this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@farfromrefug
process
is not defined in NativeScript by default, and the reason we're adding it manually is that some vue plugins check forprocess.env
which then causes issues since it's trying to access propertyenv
of undefined. Checking if it exists onglobal
and then adding to it ensures that bothglobal.process
and justprocess
are defined.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rigor789 VueJs 2.6 also uses it. So you are saying that i should do?:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@farfromrefug yeah that looks good to me, just change
this['process']
toglobal['process']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, testing
global.process