提交 6aaf8783 编写于 作者: fxy060608's avatar fxy060608

feat(mp): remove @dcloudio/uni-shared

上级 5a913d36
...@@ -19,8 +19,11 @@ type API_TYPES = ...@@ -19,8 +19,11 @@ type API_TYPES =
| typeof API_TYPE_ASYNC | typeof API_TYPE_ASYNC
| typeof API_TYPE_RETURN | typeof API_TYPE_RETURN
function validateProtocol(name: string, args: any[], protocol: ApiProtocols) { function validateProtocol(
console.log(name, args, protocol) _name: string,
_args: any[],
_protocol: ApiProtocols
) {
return true return true
} }
......
...@@ -1250,8 +1250,7 @@ var decode = function(base64) { ...@@ -1250,8 +1250,7 @@ var decode = function(base64) {
const API_TYPE_SYNC = 1; const API_TYPE_SYNC = 1;
const API_TYPE_ASYNC = 2; const API_TYPE_ASYNC = 2;
const API_TYPE_RETURN = 3; const API_TYPE_RETURN = 3;
function validateProtocol(name, args, protocol) { function validateProtocol(_name, _args, _protocol) {
console.log(name, args, protocol);
return true; return true;
} }
function formatApiArgs(args, options) { function formatApiArgs(args, options) {
...@@ -1262,7 +1261,7 @@ function formatApiArgs(args, options) { ...@@ -1262,7 +1261,7 @@ function formatApiArgs(args, options) {
function createApi({type: type2, name, options}, fn, protocol) { function createApi({type: type2, name, options}, fn, protocol) {
return function(...args) { return function(...args) {
if (type2 === API_TYPE_SYNC) { if (type2 === API_TYPE_SYNC) {
if (!(process.env.NODE_ENV !== "production" && protocol && !validateProtocol(name, args, protocol))) { if (!(process.env.NODE_ENV !== "production" && protocol && !validateProtocol())) {
return fn.apply(null, formatApiArgs(args, options)); return fn.apply(null, formatApiArgs(args, options));
} }
} }
......
import { isArray, isPromise, isFunction, isPlainObject, hasOwn, isString } from '@vue/shared'; import { isArray, isPromise, isFunction, isPlainObject, hasOwn, isString } from '@vue/shared';
const API_TYPE_SYNC = 1; const API_TYPE_SYNC = 1;
function validateProtocol(name, args, protocol) { function validateProtocol(_name, _args, _protocol) {
console.log(name, args, protocol);
return true; return true;
} }
function formatApiArgs(args, options) { function formatApiArgs(args, options) {
...@@ -13,7 +12,7 @@ function formatApiArgs(args, options) { ...@@ -13,7 +12,7 @@ function formatApiArgs(args, options) {
function createApi({ type, name, options }, fn, protocol) { function createApi({ type, name, options }, fn, protocol) {
return function (...args) { return function (...args) {
if (type === API_TYPE_SYNC) { if (type === API_TYPE_SYNC) {
if (!((process.env.NODE_ENV !== 'production') && protocol && !validateProtocol(name, args, protocol))) { if (!((process.env.NODE_ENV !== 'production') && protocol && !validateProtocol())) {
return fn.apply(null, formatApiArgs(args, options)); return fn.apply(null, formatApiArgs(args, options));
} }
} }
......
import { capitalize, hasOwn, isArray, toNumber, isPlainObject, isObject, isFunction, extend, NOOP, EMPTY_OBJ, camelize } from '@vue/shared'; import { capitalize, hasOwn, isArray, toNumber, isPlainObject, isObject, isFunction, extend, NOOP, EMPTY_OBJ, camelize } from '@vue/shared';
import { stringifyQuery } from '@dcloudio/uni-shared';
function setModel(target, key, value, modifiers) { function setModel(target, key, value, modifiers) {
if (isArray(modifiers)) { if (isArray(modifiers)) {
...@@ -218,6 +217,26 @@ function initCreateApp(parseAppOptions) { ...@@ -218,6 +217,26 @@ function initCreateApp(parseAppOptions) {
}; };
} }
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
const res = obj
? Object.keys(obj)
.map(key => {
let val = obj[key];
if (typeof val === undefined || val === null) {
val = '';
}
else if (isPlainObject(val)) {
val = JSON.stringify(val);
}
return encodeStr(key) + '=' + encodeStr(val);
})
.filter(x => x.length > 0)
.join('&')
: null;
return res ? `?${res}` : '';
}
function initVueIds(vueIds, mpInstance) { function initVueIds(vueIds, mpInstance) {
if (!vueIds) { if (!vueIds) {
return; return;
......
import { isArray, isPromise, isFunction, isPlainObject, hasOwn, isString } from '@vue/shared'; import { isArray, isPromise, isFunction, isPlainObject, hasOwn, isString } from '@vue/shared';
const API_TYPE_SYNC = 1; const API_TYPE_SYNC = 1;
function validateProtocol(name, args, protocol) { function validateProtocol(_name, _args, _protocol) {
console.log(name, args, protocol);
return true; return true;
} }
function formatApiArgs(args, options) { function formatApiArgs(args, options) {
...@@ -13,7 +12,7 @@ function formatApiArgs(args, options) { ...@@ -13,7 +12,7 @@ function formatApiArgs(args, options) {
function createApi({ type, name, options }, fn, protocol) { function createApi({ type, name, options }, fn, protocol) {
return function (...args) { return function (...args) {
if (type === API_TYPE_SYNC) { if (type === API_TYPE_SYNC) {
if (!((process.env.NODE_ENV !== 'production') && protocol && !validateProtocol(name, args, protocol))) { if (!((process.env.NODE_ENV !== 'production') && protocol && !validateProtocol())) {
return fn.apply(null, formatApiArgs(args, options)); return fn.apply(null, formatApiArgs(args, options));
} }
} }
......
import { isArray, hasOwn, toNumber, isPlainObject, isObject, isFunction, extend, NOOP, camelize } from '@vue/shared'; import { isArray, hasOwn, toNumber, isPlainObject, isObject, isFunction, extend, NOOP, camelize } from '@vue/shared';
import { stringifyQuery } from '@dcloudio/uni-shared';
function setModel(target, key, value, modifiers) { function setModel(target, key, value, modifiers) {
if (isArray(modifiers)) { if (isArray(modifiers)) {
...@@ -209,6 +208,26 @@ function initCreateApp(parseAppOptions) { ...@@ -209,6 +208,26 @@ function initCreateApp(parseAppOptions) {
}; };
} }
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
const res = obj
? Object.keys(obj)
.map(key => {
let val = obj[key];
if (typeof val === undefined || val === null) {
val = '';
}
else if (isPlainObject(val)) {
val = JSON.stringify(val);
}
return encodeStr(key) + '=' + encodeStr(val);
})
.filter(x => x.length > 0)
.join('&')
: null;
return res ? `?${res}` : '';
}
function initBehavior(options) { function initBehavior(options) {
return Behavior(options); return Behavior(options);
} }
......
import { isArray, isPromise, isFunction, isPlainObject, hasOwn, isString } from '@vue/shared'; import { isArray, isPromise, isFunction, isPlainObject, hasOwn, isString } from '@vue/shared';
const API_TYPE_SYNC = 1; const API_TYPE_SYNC = 1;
function validateProtocol(name, args, protocol) { function validateProtocol(_name, _args, _protocol) {
console.log(name, args, protocol);
return true; return true;
} }
function formatApiArgs(args, options) { function formatApiArgs(args, options) {
...@@ -13,7 +12,7 @@ function formatApiArgs(args, options) { ...@@ -13,7 +12,7 @@ function formatApiArgs(args, options) {
function createApi({ type, name, options }, fn, protocol) { function createApi({ type, name, options }, fn, protocol) {
return function (...args) { return function (...args) {
if (type === API_TYPE_SYNC) { if (type === API_TYPE_SYNC) {
if (!((process.env.NODE_ENV !== 'production') && protocol && !validateProtocol(name, args, protocol))) { if (!((process.env.NODE_ENV !== 'production') && protocol && !validateProtocol())) {
return fn.apply(null, formatApiArgs(args, options)); return fn.apply(null, formatApiArgs(args, options));
} }
} }
......
import { isArray, hasOwn, toNumber, isPlainObject, isObject, isFunction, extend, NOOP, camelize } from '@vue/shared'; import { isArray, hasOwn, toNumber, isPlainObject, isObject, isFunction, extend, NOOP, camelize } from '@vue/shared';
import { stringifyQuery } from '@dcloudio/uni-shared';
function setModel(target, key, value, modifiers) { function setModel(target, key, value, modifiers) {
if (isArray(modifiers)) { if (isArray(modifiers)) {
...@@ -209,6 +208,26 @@ function initCreateApp(parseAppOptions) { ...@@ -209,6 +208,26 @@ function initCreateApp(parseAppOptions) {
}; };
} }
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
const res = obj
? Object.keys(obj)
.map(key => {
let val = obj[key];
if (typeof val === undefined || val === null) {
val = '';
}
else if (isPlainObject(val)) {
val = JSON.stringify(val);
}
return encodeStr(key) + '=' + encodeStr(val);
})
.filter(x => x.length > 0)
.join('&')
: null;
return res ? `?${res}` : '';
}
function initBehavior(options) { function initBehavior(options) {
return Behavior(options); return Behavior(options);
} }
......
import { isArray, isPromise, isFunction, isPlainObject, hasOwn, isString } from '@vue/shared'; import { isArray, isPromise, isFunction, isPlainObject, hasOwn, isString } from '@vue/shared';
const API_TYPE_SYNC = 1; const API_TYPE_SYNC = 1;
function validateProtocol(name, args, protocol) { function validateProtocol(_name, _args, _protocol) {
console.log(name, args, protocol);
return true; return true;
} }
function formatApiArgs(args, options) { function formatApiArgs(args, options) {
...@@ -13,7 +12,7 @@ function formatApiArgs(args, options) { ...@@ -13,7 +12,7 @@ function formatApiArgs(args, options) {
function createApi({ type, name, options }, fn, protocol) { function createApi({ type, name, options }, fn, protocol) {
return function (...args) { return function (...args) {
if (type === API_TYPE_SYNC) { if (type === API_TYPE_SYNC) {
if (!((process.env.NODE_ENV !== 'production') && protocol && !validateProtocol(name, args, protocol))) { if (!((process.env.NODE_ENV !== 'production') && protocol && !validateProtocol())) {
return fn.apply(null, formatApiArgs(args, options)); return fn.apply(null, formatApiArgs(args, options));
} }
} }
......
import { isArray, hasOwn, toNumber, isPlainObject, isObject, isFunction, extend, NOOP, camelize } from '@vue/shared'; import { isArray, hasOwn, toNumber, isPlainObject, isObject, isFunction, extend, NOOP, camelize } from '@vue/shared';
import { stringifyQuery } from '@dcloudio/uni-shared';
function setModel(target, key, value, modifiers) { function setModel(target, key, value, modifiers) {
if (isArray(modifiers)) { if (isArray(modifiers)) {
...@@ -212,6 +211,26 @@ function initCreateApp(parseAppOptions) { ...@@ -212,6 +211,26 @@ function initCreateApp(parseAppOptions) {
}; };
} }
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
const res = obj
? Object.keys(obj)
.map(key => {
let val = obj[key];
if (typeof val === undefined || val === null) {
val = '';
}
else if (isPlainObject(val)) {
val = JSON.stringify(val);
}
return encodeStr(key) + '=' + encodeStr(val);
})
.filter(x => x.length > 0)
.join('&')
: null;
return res ? `?${res}` : '';
}
function initBehavior(options) { function initBehavior(options) {
return Behavior(options); return Behavior(options);
} }
......
import { isArray, isPromise, isFunction, isPlainObject, hasOwn, isString } from '@vue/shared'; import { isArray, isPromise, isFunction, isPlainObject, hasOwn, isString } from '@vue/shared';
const API_TYPE_SYNC = 1; const API_TYPE_SYNC = 1;
function validateProtocol(name, args, protocol) { function validateProtocol(_name, _args, _protocol) {
console.log(name, args, protocol);
return true; return true;
} }
function formatApiArgs(args, options) { function formatApiArgs(args, options) {
...@@ -13,7 +12,7 @@ function formatApiArgs(args, options) { ...@@ -13,7 +12,7 @@ function formatApiArgs(args, options) {
function createApi({ type, name, options }, fn, protocol) { function createApi({ type, name, options }, fn, protocol) {
return function (...args) { return function (...args) {
if (type === API_TYPE_SYNC) { if (type === API_TYPE_SYNC) {
if (!((process.env.NODE_ENV !== 'production') && protocol && !validateProtocol(name, args, protocol))) { if (!((process.env.NODE_ENV !== 'production') && protocol && !validateProtocol())) {
return fn.apply(null, formatApiArgs(args, options)); return fn.apply(null, formatApiArgs(args, options));
} }
} }
......
import { isArray, hasOwn, toNumber, isPlainObject, isObject, isFunction, extend, NOOP, camelize } from '@vue/shared'; import { isArray, hasOwn, toNumber, isPlainObject, isObject, isFunction, extend, NOOP, camelize } from '@vue/shared';
import { stringifyQuery } from '@dcloudio/uni-shared';
function setModel(target, key, value, modifiers) { function setModel(target, key, value, modifiers) {
if (isArray(modifiers)) { if (isArray(modifiers)) {
...@@ -209,6 +208,26 @@ function initCreateApp(parseAppOptions) { ...@@ -209,6 +208,26 @@ function initCreateApp(parseAppOptions) {
}; };
} }
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
const res = obj
? Object.keys(obj)
.map(key => {
let val = obj[key];
if (typeof val === undefined || val === null) {
val = '';
}
else if (isPlainObject(val)) {
val = JSON.stringify(val);
}
return encodeStr(key) + '=' + encodeStr(val);
})
.filter(x => x.length > 0)
.join('&')
: null;
return res ? `?${res}` : '';
}
function initBehavior(options) { function initBehavior(options) {
return Behavior(options); return Behavior(options);
} }
......
import { isArray, isPromise, isFunction, isPlainObject, hasOwn, isString } from '@vue/shared'; import { isArray, isPromise, isFunction, isPlainObject, hasOwn, isString } from '@vue/shared';
const API_TYPE_SYNC = 1; const API_TYPE_SYNC = 1;
function validateProtocol(name, args, protocol) { function validateProtocol(_name, _args, _protocol) {
console.log(name, args, protocol);
return true; return true;
} }
function formatApiArgs(args, options) { function formatApiArgs(args, options) {
...@@ -13,7 +12,7 @@ function formatApiArgs(args, options) { ...@@ -13,7 +12,7 @@ function formatApiArgs(args, options) {
function createApi({ type, name, options }, fn, protocol) { function createApi({ type, name, options }, fn, protocol) {
return function (...args) { return function (...args) {
if (type === API_TYPE_SYNC) { if (type === API_TYPE_SYNC) {
if (!((process.env.NODE_ENV !== 'production') && protocol && !validateProtocol(name, args, protocol))) { if (!((process.env.NODE_ENV !== 'production') && protocol && !validateProtocol())) {
return fn.apply(null, formatApiArgs(args, options)); return fn.apply(null, formatApiArgs(args, options));
} }
} }
......
import { isArray, hasOwn, toNumber, isPlainObject, isObject, isFunction, extend, NOOP, camelize } from '@vue/shared'; import { isArray, hasOwn, toNumber, isPlainObject, isObject, isFunction, extend, NOOP, camelize } from '@vue/shared';
import { stringifyQuery } from '@dcloudio/uni-shared';
function setModel(target, key, value, modifiers) { function setModel(target, key, value, modifiers) {
if (isArray(modifiers)) { if (isArray(modifiers)) {
...@@ -209,6 +208,26 @@ function initCreateApp(parseAppOptions) { ...@@ -209,6 +208,26 @@ function initCreateApp(parseAppOptions) {
}; };
} }
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
const res = obj
? Object.keys(obj)
.map(key => {
let val = obj[key];
if (typeof val === undefined || val === null) {
val = '';
}
else if (isPlainObject(val)) {
val = JSON.stringify(val);
}
return encodeStr(key) + '=' + encodeStr(val);
})
.filter(x => x.length > 0)
.join('&')
: null;
return res ? `?${res}` : '';
}
function initBehavior(options) { function initBehavior(options) {
return Behavior(options); return Behavior(options);
} }
......
...@@ -46,7 +46,6 @@ function createConfig(entryFile, output, plugins = []) { ...@@ -46,7 +46,6 @@ function createConfig(entryFile, output, plugins = []) {
const external = [ const external = [
'@vue/shared', '@vue/shared',
'@dcloudio/uni-shared',
...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}) ...Object.keys(pkg.peerDependencies || {})
] ]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册