Skip to content

Commit

Permalink
* [jsfm] support to build a standalnoe polyfill package
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanks10100 committed May 9, 2018
1 parent 1caeda4 commit c6a8d29
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ async function build (name) {
case 'jsfm':
case 'native': pkgName = 'weex-js-framework'; break
case 'env': pkgName = 'weex-env'; break
case 'polyfill': pkgName = 'weex-polyfill'; break
case 'vue': pkgName = 'weex-vue'; break
case 'rax': pkgName = 'weex-rax'; break
case 'runtime': pkgName = 'weex-js-runtime'; break
Expand Down
7 changes: 7 additions & 0 deletions build/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ const configs = {
+ `var global = this; var process = {env:{}};`
}
},
'weex-polyfill': {
input: absolute('runtime/entries/polyfill.js'),
output: {
format: 'iife',
file: absolute('pre-build/weex-polyfill')
}
},
'weex-vue': {
input: absolute('runtime/entries/vue.js'),
output: {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"scripts": {
"build:jsfm": "node build/build.js jsfm",
"build:env": "WEEX_FREEZE=true node build/build.js env",
"build:polyfill": "node build/build.js polyfill",
"build:native": "node build/build.js native",
"build:vue": "node build/build.js vue",
"build:rax": "node build/build.js rax",
Expand Down
29 changes: 29 additions & 0 deletions runtime/entries/polyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import '../shared/polyfill/arrayFrom'
import '../shared/polyfill/objectAssign'
import '../shared/polyfill/objectSetPrototypeOf'

// import promise hack and polyfills
import '../shared/polyfill/promise'
import 'core-js/modules/es6.object.to-string'
import 'core-js/modules/es6.string.iterator'
import 'core-js/modules/web.dom.iterable'
import 'core-js/modules/es6.promise'

0 comments on commit c6a8d29

Please sign in to comment.