@w6s/cordova-import
Advanced tools
Comparing version 1.1.0 to 1.2.0
/*! | ||
* @w6s/cordova-import.js v1.1.0 | ||
* @w6s/cordova-import.js v1.2.0 | ||
* (c) 2019 WorkPlusFE | ||
*/ | ||
!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";var o=function(t,e,r,n,o,i,a,u){if(!t){var c;if(void 0===e)c=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[r,n,o,i,a,u],s=0;(c=Error(e.replace(/%s/g,function(){return f[s++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var $t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(t){return!!~t.indexOf("android")}var t,u=(function(t,e){var n="__lodash_hash_undefined__",o=9007199254740991,r="[object Arguments]",i="[object AsyncFunction]",a="[object Function]",u="[object GeneratorFunction]",c="[object Null]",d="[object Object]",f="[object Proxy]",s="[object Undefined]",l=/^\[object .+?Constructor\]$/,p=/^(?:0|[1-9]\d*)$/,v={};v["[object Float32Array]"]=v["[object Float64Array]"]=v["[object Int8Array]"]=v["[object Int16Array]"]=v["[object Int32Array]"]=v["[object Uint8Array]"]=v["[object Uint8ClampedArray]"]=v["[object Uint16Array]"]=v["[object Uint32Array]"]=!0,v[r]=v["[object Array]"]=v["[object ArrayBuffer]"]=v["[object Boolean]"]=v["[object DataView]"]=v["[object Date]"]=v["[object Error]"]=v[a]=v["[object Map]"]=v["[object Number]"]=v[d]=v["[object RegExp]"]=v["[object Set]"]=v["[object String]"]=v["[object WeakMap]"]=!1;var h="object"==typeof $t&&$t&&$t.Object===Object&&$t,y="object"==typeof self&&self&&self.Object===Object&&self,_=h||y||Function("return this")(),b=e&&!e.nodeType&&e,g=b&&t&&!t.nodeType&&t,j=g&&g.exports===b,m=j&&h.process,w=function(){try{var t=g&&g.require&&g.require("util").types;return t||m&&m.binding&&m.binding("util")}catch(t){}}(),A=w&&w.isTypedArray;var O,z,S,x=Array.prototype,k=Object.prototype,U=_["__core-js_shared__"],E=Function.prototype.toString,P=k.hasOwnProperty,T=(O=/[^.]+$/.exec(U&&U.keys&&U.keys.IE_PROTO||""))?"Symbol(src)_1."+O:"",I=k.toString,F=E.call(Object),M=RegExp("^"+E.call(P).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),B=j?_.Buffer:void 0,C=_.Symbol,D=_.Uint8Array,$=B?B.allocUnsafe:void 0,H=(z=Object.getPrototypeOf,function(t){return z(S(t))}),K=(S=Object).create,N=k.propertyIsEnumerable,R=x.splice,L=C?C.toStringTag:void 0,W=function(){try{var t=yt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),q=B?B.isBuffer:void 0,V=Math.max,G=Date.now,J=yt(_,"Map"),Q=yt(Object,"create"),X=function(t){if(!Pt(t))return{};if(K)return K(t);Y.prototype=t;var e=new Y;return Y.prototype=void 0,e};function Y(){}function Z(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function tt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function et(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function rt(t){var e=this.__data__=new tt(t);this.size=e.size}function nt(t,e){var r=St(t),n=!r&&zt(t),o=!r&&!n&&kt(t),i=!r&&!n&&!o&&Ft(t),a=r||n||o||i,u=a?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],c=u.length;for(var f in t)!e&&!P.call(t,f)||a&&("length"==f||o&&("offset"==f||"parent"==f)||i&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||_t(f,c))||u.push(f);return u}function ot(t,e,r){(void 0===r||Ot(t[e],r))&&(void 0!==r||e in t)||at(t,e,r)}function it(t,e){for(var r=t.length;r--;)if(Ot(t[r][0],e))return r;return-1}function at(t,e,r){"__proto__"==e&&W?W(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}Z.prototype.clear=function(){this.__data__=Q?Q(null):{},this.size=0},Z.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Z.prototype.get=function(t){var e=this.__data__;if(Q){var r=e[t];return r===n?void 0:r}return P.call(e,t)?e[t]:void 0},Z.prototype.has=function(t){var e=this.__data__;return Q?void 0!==e[t]:P.call(e,t)},Z.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Q&&void 0===e?n:e,this},tt.prototype.clear=function(){this.__data__=[],this.size=0},tt.prototype.delete=function(t){var e=this.__data__,r=it(e,t);return 0<=r&&(r==e.length-1?e.pop():R.call(e,r,1),--this.size,!0)},tt.prototype.get=function(t){var e=this.__data__,r=it(e,t);return r<0?void 0:e[r][1]},tt.prototype.has=function(t){return-1<it(this.__data__,t)},tt.prototype.set=function(t,e){var r=this.__data__,n=it(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},et.prototype.clear=function(){this.size=0,this.__data__={hash:new Z,map:new(J||tt),string:new Z}},et.prototype.delete=function(t){var e=dt(this,t).delete(t);return this.size-=e?1:0,e},et.prototype.get=function(t){return dt(this,t).get(t)},et.prototype.has=function(t){return dt(this,t).has(t)},et.prototype.set=function(t,e){var r=dt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},rt.prototype.clear=function(){this.__data__=new tt,this.size=0},rt.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},rt.prototype.get=function(t){return this.__data__.get(t)},rt.prototype.has=function(t){return this.__data__.has(t)},rt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof tt){var n=r.__data__;if(!J||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new et(n)}return r.set(t,e),this.size=r.size,this};var ut,ct=function(t,e,r){for(var n=-1,o=Object(t),i=r(t),a=i.length;a--;){var u=i[ut?a:++n];if(!1===e(o[u],u,o))break}return t};function ft(t){return null==t?void 0===t?s:c:L&&L in Object(t)?function(t){var e=P.call(t,L),r=t[L];try{var n=!(t[L]=void 0)}catch(t){}var o=I.call(t);n&&(e?t[L]=r:delete t[L]);return o}(t):I.call(t)}function st(t){return Tt(t)&&ft(t)==r}function lt(t){return!(!Pt(t)||(e=t,T&&T in e))&&(Ut(t)?M:l).test(function(t){if(null!=t){try{return E.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}function pt(t){if(!Pt(t))return function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}(t);var e=bt(t),r=[];for(var n in t)("constructor"!=n||!e&&P.call(t,n))&&r.push(n);return r}function vt(n,o,i,a,u){n!==o&&ct(o,function(t,e){if(u=u||new rt,Pt(t))!function(t,e,r,n,o,i,a){var u=gt(t,r),c=gt(e,r),f=a.get(c);if(f)return ot(t,r,f);var s=i?i(u,c,r+"",t,e,a):void 0,l=void 0===s;if(l){var p=St(c),v=!p&&kt(c),h=!p&&!v&&Ft(c);s=c,p||v||h?s=St(u)?u:function(t){return Tt(t)&&xt(t)}(u)?function(t,e){var r=-1,n=t.length;e=e||Array(n);for(;++r<n;)e[r]=t[r];return e}(u):v?function(t,e){if(e)return t.slice();var r=t.length,n=$?$(r):new t.constructor(r);return t.copy(n),n}(c,!(l=!1)):h?function(t,e){var r=e?function(t){var e=new t.constructor(t.byteLength);return new D(e).set(new D(t)),e}(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(c,!(l=!1)):[]:function(t){if(!Tt(t)||ft(t)!=d)return!1;var e=H(t);if(null===e)return!0;var r=P.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&E.call(r)==F}(c)||zt(c)?zt(s=u)?s=function(t){return function(t,e,r,n){var o=!r;r=r||{};var i=-1,a=e.length;for(;++i<a;){var u=e[i],c=n?n(r[u],t[u],u,r,t):void 0;void 0===c&&(c=t[u]),o?at(r,u,c):(l=c,p=(f=r)[s=u],P.call(f,s)&&Ot(p,l)&&(void 0!==l||s in f)||at(f,s,l))}var f,s,l,p;return r}(t,Mt(t))}(u):Pt(u)&&!Ut(u)||(s=function(t){return"function"!=typeof t.constructor||bt(t)?{}:X(H(t))}(c)):l=!1}l&&(a.set(c,s),o(s,c,n,i,a),a.delete(c));ot(t,r,s)}(n,o,e,i,vt,a,u);else{var r=a?a(gt(n,e),t,e+"",n,o,u):void 0;void 0===r&&(r=t),ot(n,e,r)}},Mt)}function ht(t,e){return At((i=t,u=Dt,a=V(void 0===(a=e)?i.length-1:a,0),function(){for(var t=arguments,e=-1,r=V(t.length-a,0),n=Array(r);++e<r;)n[e]=t[a+e];e=-1;for(var o=Array(a+1);++e<a;)o[e]=t[e];return o[a]=u(n),function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}(i,this,o)}),t+"");var i,a,u}function dt(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function yt(t,e){var r,n,o=(n=e,null==(r=t)?void 0:r[n]);return lt(o)?o:void 0}function _t(t,e){var r=typeof t;return!!(e=null==e?o:e)&&("number"==r||"symbol"!=r&&p.test(t))&&-1<t&&t%1==0&&t<e}function bt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||k)}function gt(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var jt,mt,wt,At=(jt=W?function(t,e){return W(t,"toString",{configurable:!0,enumerable:!1,value:(r=e,function(){return r}),writable:!0});var r}:Dt,wt=mt=0,function(){var t=G(),e=16-(t-wt);if(wt=t,0<e){if(800<=++mt)return arguments[0]}else mt=0;return jt.apply(void 0,arguments)});function Ot(t,e){return t===e||t!=t&&e!=e}var zt=st(function(){return arguments}())?st:function(t){return Tt(t)&&P.call(t,"callee")&&!N.call(t,"callee")},St=Array.isArray;function xt(t){return null!=t&&Et(t.length)&&!Ut(t)}var kt=q||function(){return!1};function Ut(t){if(!Pt(t))return!1;var e=ft(t);return e==a||e==u||e==i||e==f}function Et(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=o}function Pt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Tt(t){return null!=t&&"object"==typeof t}var It,Ft=A?(It=A,function(t){return It(t)}):function(t){return Tt(t)&&Et(t.length)&&!!v[ft(t)]};function Mt(t){return xt(t)?nt(t,!0):pt(t)}var Bt,Ct=(Bt=function(t,e,r){vt(t,e,r)},ht(function(t,e){var r=-1,n=e.length,o=1<n?e[n-1]:void 0,i=2<n?e[2]:void 0;for(o=3<Bt.length&&"function"==typeof o?(n--,o):void 0,i&&function(t,e,r){if(!Pt(r))return!1;var n=typeof e;return!!("number"==n?xt(r)&&_t(e,r.length):"string"==n&&e in r)&&Ot(r[e],t)}(e[0],e[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++r<n;){var a=e[r];a&&Bt(t,a,r,o)}return t}));function Dt(t){return t}t.exports=Ct}(t={exports:{}},t.exports),t.exports),c={SDK_HOST:"//workplus.io/",cordovajs:{iOS:"ios.cordova.min.js",android:"android.cordova.min.js",local:"applocal://cordova.min.js"},pcSDKUri:""},f=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.config=t?u(c,{SDK_HOST:t}):c}var t,r,n;return t=e,(r=[{key:"openInWorkPlus",value:function(){return!!~this.userAgent.indexOf("workplus")}},{key:"getImportUri",value:function(){var t,e,r=this.getCurrentPlatformByUserAgent();return o(r,"Please open in the correct webview"),this.mustUseHttpModel()?(e=r,"".concat((t=this.config).SDK_HOST).concat(t.cordovajs[e])):this.config.cordovajs.local}},{key:"mustUseHttpModel",value:function(){return!(!self.frameElement||"IFRAME"!=self.frameElement.tagName)||!("https:"!==window.location.protocol||!a(this.userAgent))}},{key:"getCurrentPlatformByUserAgent",value:function(){return~this.userAgent.indexOf("iphone")?"iOS":!!a(this.userAgent)&&"android"}},{key:"userAgent",get:function(){return window.navigator.userAgent.toLowerCase()}}])&&i(t.prototype,r),n&&i(t,n),e}();!function(){try{var t=new f;if(!t.openInWorkPlus())return;var e=t.getImportUri();r=e,(n=document.createElement("script")).setAttribute("type","text/javascript"),n.setAttribute("src",r),document.getElementsByTagName("head")[0].appendChild(n)}catch(t){o(!1,t)}var r,n}()}); |
'use strict'; | ||
import { parse } from '@w6s/query-string'; | ||
import invariant from 'invariant'; | ||
@@ -5,0 +4,0 @@ import CordovaImportLib from './lib'; |
{ | ||
"name": "@w6s/cordova-import", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Automatic CordovaJs import util.", | ||
@@ -48,3 +48,2 @@ "main": "lib/@w6s/cordova-import-es.js", | ||
"dependencies": { | ||
"@w6s/query-string": "1.2.1", | ||
"invariant": "^2.2.4", | ||
@@ -51,0 +50,0 @@ "lodash.isstring": "^4.0.1", |
@@ -1,4 +0,4 @@ | ||
# @w6s/cordova-import | ||
# cordova-import [![Build Status](https://travis-ci.org/WorkPlusFE/cordova-import.svg?branch=master)](https://travis-ci.org/WorkPlusFE/cordova-import) | ||
`cordova-import.js`提供在 WorkPlus WebView 中注入 cordova 的能力,默认以`local`的方式注入,但同时会根据不同的环境,例如轻应用的访问协议(http、https),是否在 iframe 内打开等,自动选择最佳的注入方式,开发者无需关注过多的注入细节,开箱即用,一步到位! | ||
> `cordova-import.js`提供在 WorkPlus WebView 中注入 cordova 的能力,默认以`local`的方式注入,但同时会根据不同的环境,例如轻应用的访问协议(http、https),是否在 iframe 内打开等,自动选择最佳的注入方式,开发者无需关注过多的注入细节,开箱即用,一步到位! | ||
@@ -9,3 +9,3 @@ ### 如何使用 | ||
当前该脚本的发布地址为`//workplus.io/cordova-import.js`,可在[Release页面](https://github.com/WorkPlusFE/cordova-import/releases/tag/v1.0)进行下载。 | ||
当前该脚本的发布地址为`//workplus.io/cordova-import.js`,可在[Release页面](https://github.com/WorkPlusFE/cordova-import/releases/tag/v1.1)进行下载。 | ||
@@ -12,0 +12,0 @@ > 单页面应用(SPA)引入一次即可,多页面应用还需在每个页面都单独引入 |
@@ -25,3 +25,3 @@ import path from'path'; | ||
], | ||
external: null, | ||
external: Object.keys(pkg.dependencies), | ||
output: [{ | ||
@@ -40,2 +40,3 @@ file: resolveFile(pkg['main']), | ||
if (env === 'production') { | ||
config.external = null; | ||
config.plugins.push( | ||
@@ -42,0 +43,0 @@ replace({ 'process.env.NODE_ENV': '"production"' }), |
'use strict'; | ||
import { parse } from '@w6s/query-string'; | ||
import invariant from 'invariant'; | ||
@@ -5,0 +4,0 @@ import CordovaImportLib from './lib'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
3
33487
538
- Removed@w6s/query-string@1.2.1
- Removed@w6s/query-string@1.2.1(transitive)