Repository: incubator-weex Updated Branches: refs/heads/master 1caeda497 -> c6a8d29ad
* [jsfm] support to build a standalnoe polyfill package Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/c6a8d29a Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/c6a8d29a Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/c6a8d29a Branch: refs/heads/master Commit: c6a8d29adb5e2da03d8814632c65c81289b1526e Parents: 1caeda4 Author: Hanks <zhanghan...@gmail.com> Authored: Wed May 9 11:00:22 2018 +0800 Committer: Hanks <zhanghan...@gmail.com> Committed: Wed May 9 11:00:22 2018 +0800 ---------------------------------------------------------------------- build/build.js | 1 + build/config.js | 7 +++++++ package.json | 1 + runtime/entries/polyfill.js | 29 +++++++++++++++++++++++++++++ 4 files changed, 38 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6a8d29a/build/build.js ---------------------------------------------------------------------- diff --git a/build/build.js b/build/build.js index 2eff062..4c4e530 100644 --- a/build/build.js +++ b/build/build.js @@ -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 http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6a8d29a/build/config.js ---------------------------------------------------------------------- diff --git a/build/config.js b/build/config.js index a1acb76..9b582e2 100644 --- a/build/config.js +++ b/build/config.js @@ -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: { http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6a8d29a/package.json ---------------------------------------------------------------------- diff --git a/package.json b/package.json index 616afb2..4a1ea6a 100644 --- a/package.json +++ b/package.json @@ -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", http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6a8d29a/runtime/entries/polyfill.js ---------------------------------------------------------------------- diff --git a/runtime/entries/polyfill.js b/runtime/entries/polyfill.js new file mode 100644 index 0000000..5ca34d8 --- /dev/null +++ b/runtime/entries/polyfill.js @@ -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'