A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/bootstrap-vue/bootstrap-vue/commit/56f8bb5af7fb7188da035210e8be28d7ae1c7bc1 below:

handle undocumented breaking changes in babel-standalone f… · bootstrap-vue/bootstrap-vue@56f8bb5 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+64

-13

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+64

-13

lines changed Original file line number Diff line number Diff line change

@@ -685,7 +685,6 @@ export default {

685 685

} else {

686 686

delete options.template

687 687

}

688 - 689 688

// Vue's `errorCapture` doesn't always handle errors in methods (although it

690 689

// does if the method is used as a `v-on`/`@` handler), so we wrap any methods

691 690

// with a try/catch handler so we can show the error in our GUI log console.

@@ -709,15 +708,15 @@ export default {

709 708

})

710 709

}

711 710 712 -

// Try and buld the user app

711 +

// Try and build the user app

713 712

try {

714 713

const holder = document.createElement('div')

715 714

this.$refs.result.appendChild(holder)

716 715

this.playVM = new Vue({

717 716

...options,

718 717

el: holder,

719 -

// Router needed for tooltips/popovers so they hide when

720 -

// docs route changes

718 +

// Router needed for tooltips/popovers/toasts so

719 +

// that they hide when docs route changes

721 720

router: this.$router,

722 721

// We set a fake parent so we can capture most runtime and

723 722

// render errors (this is an error boundary component)

@@ -751,15 +750,15 @@ export default {

751 750

this.compiledJs = null

752 751

return

753 752

}

754 -

const js = this.js.trim() || '{}'

753 +

const js = (this.js || '').trim() || '{}'

755 754

this.compiling = true

756 755

let compiled = null

757 756

this.$nextTick(() => {

758 757

this.requestAF(() => {

759 758

try {

760 759

// The app build process expects the app options to

761 760

// be assigned to the `options` variable

762 -

compiled = this.compiler(`;options = ${js};`)

761 +

compiled = this.compiler(';options = ' + js + ';')

763 762

} catch (err) {

764 763

this.errHandler(err, 'javascript')

765 764

window.console.error('Error in javascript', err)

Original file line number Diff line number Diff line change

@@ -1,12 +1,61 @@

1 -

// Utility for tranpiling ES6 code into ES5 for playground and v-play

1 +

// Utility for transpiling ES6 code into ES5 for playground and `v-play`

2 +

// Imported only on demand when needed

2 3

import { transform, disableScriptTags } from '@babel/standalone'

3 4 5 +

// Babel broke the standalone version via PR https://github.com/babel/babel/pull/10420

6 +

// Which assumes the browser supports String.prototype.trimLeft/Right

7 +

// IE 11 does not support either, and polyfill.io does not polyfill them

8 +

// So we do it here (as this file is only loaded if we need transpilation):

9 +

if (typeof window !== 'undefined') {

10 +

const Proto = window.String.prototype

11 + 12 +

// Ensure we have a `trimStart` method

13 +

;((obj, prop) => {

14 +

if (!(prop in obj && obj[prop])) {

15 +

const rx = /^\s+/

16 +

obj[prop] =

17 +

obj.trimLeft ||

18 +

function() {

19 +

return this.replace(rx, '')

20 +

}

21 +

}

22 +

})(Proto, 'trimStart')

23 + 24 +

// Ensure we have a `trimLeft` method

25 +

;((obj, prop) => {

26 +

if (!(prop in obj && obj[prop])) {

27 +

obj[prop] = obj.trimStart

28 +

}

29 +

})(Proto, 'trimLeft')

30 + 31 +

// Ensure we have a `trimEnd` method

32 +

;((obj, prop) => {

33 +

if (!(prop in obj && obj[prop])) {

34 +

const rx = /\s+$/

35 +

obj[prop] =

36 +

obj.trimRight ||

37 +

function() {

38 +

return this.replace(rx, '')

39 +

}

40 +

}

41 +

})(Proto, 'trimEnd')

42 + 43 +

// Ensure we have a `trimRight` method

44 +

;((obj, prop) => {

45 +

if (!(prop in obj && obj[prop])) {

46 +

obj[prop] = obj.trimEnd

47 +

}

48 +

})(Proto, 'trimRight')

49 +

}

50 + 51 +

// Prevent Babel/Standalone from processing <script> tag insertions

4 52

if (typeof window !== 'undefined' && window && window.removeEventListener) {

5 -

// Prevent Babel/Standalone from processing <script> tag insertions

6 53

disableScriptTags()

7 54

}

8 55 56 +

// Our babel transform options

9 57

const transformOptions = {

58 +

sourceType: 'script',

10 59

presets: ['es2015', 'es2016', 'es2017'],

11 60

plugins: [

12 61

// Not used as we need to import the helpers into the transpiled code

@@ -15,6 +64,7 @@ const transformOptions = {

15 64

]

16 65

}

17 66 67 +

// Our transpilation compiler method

18 68

export default function compileJs(code) {

19 69

if (!code) {

20 70

return ''

Original file line number Diff line number Diff line change

@@ -8,14 +8,16 @@ const tests = [

8 8

// Arrow functions

9 9

'const test1 = (a) => a',

10 10

// Object function shortcut

11 -

'const test2 = { a: 1, b () { return 0 } }',

11 +

'const test2 = { a: 1, b() { return 0 } }',

12 12

// Object shortcut

13 -

'const test3a = { a: 1}; const test3b = { test3a, b: 2 }',

14 -

// Object rest spread

15 -

'const test4a = { a: 1, b: 2}; const test4b = { c: 3, ...test4a }',

13 +

'const test3a = { a: 1 }; const test3b = { test3a, b: 2 }',

14 +

// Object spread

15 +

'const test4a = { a: 1, b: 2 }; const test4b = { c: 3, ...test4a }',

16 +

// Array spread

17 +

'const test5a = [1, 2]; const test5b = [...test5a, 3, 4]',

16 18

// String interpolation

17 19

/* eslint-disable no-template-curly-in-string */

18 -

'const test5a = "bar"; const test5b = `foo${test5a}`'

20 +

'const test6a = "bar"; const test6b = `foo${test6a}`'

19 21

/* eslint-enable no-template-curly-in-string */

20 22

]

21 23

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4