Commit a23018c9 authored by rockyl's avatar rockyl

属性计算方法抽离

parent e600c203
import crypto from 'crypto';
import { compute } from 'props-compute';
/**
* Created by rockyl on 2019-11-29.
......@@ -280,13 +281,14 @@ async function divideCode(data, {debug, compile, uglify, getProcesses, getScript
const custom = typeof item === 'string' ? JSON.parse(item) : item;
customManager.deal(custom);
let {props, assetMapping} = customs.find(c => c.id === custom.id);
if (props) {
/*if (props) {
for (let key in custom.props) {
if (!props.hasOwnProperty(key) && custom.props[key].hasOwnProperty('default')) {
props[key] = custom.props[key].default;
}
}
}
}*/
compute(props, custom.props);
for (let uuid in assetMapping) {
let asset = custom.assets.find(item => item.uuid === uuid);
if (asset) {
......
This diff is collapsed.
......@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var crypto = _interopDefault(require('crypto'));
var propsCompute = require('props-compute');
/**
* Created by rockyl on 2019-11-29.
......@@ -286,13 +287,14 @@ async function divideCode(data, {debug, compile, uglify, getProcesses, getScript
const custom = typeof item === 'string' ? JSON.parse(item) : item;
customManager.deal(custom);
let {props, assetMapping} = customs.find(c => c.id === custom.id);
if (props) {
/*if (props) {
for (let key in custom.props) {
if (!props.hasOwnProperty(key) && custom.props[key].hasOwnProperty('default')) {
props[key] = custom.props[key].default;
}
}
}
}*/
propsCompute.compute(props, custom.props);
for (let uuid in assetMapping) {
let asset = custom.assets.find(item => item.uuid === uuid);
if (asset) {
......
This diff is collapsed.
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('crypto')) :
typeof define === 'function' && define.amd ? define(['exports', 'crypto'], factory) :
(global = global || self, factory(global['zeroing-pack'] = {}, global.crypto));
}(this, function (exports, crypto) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('crypto'), require('props-compute')) :
typeof define === 'function' && define.amd ? define(['exports', 'crypto', 'props-compute'], factory) :
(global = global || self, factory(global['zeroing-pack'] = {}, global.crypto, global.propsCompute));
}(this, function (exports, crypto, propsCompute) { 'use strict';
crypto = crypto && crypto.hasOwnProperty('default') ? crypto['default'] : crypto;
......@@ -286,13 +286,14 @@ ${scripts}
const custom = typeof item === 'string' ? JSON.parse(item) : item;
customManager.deal(custom);
let {props, assetMapping} = customs.find(c => c.id === custom.id);
if (props) {
/*if (props) {
for (let key in custom.props) {
if (!props.hasOwnProperty(key) && custom.props[key].hasOwnProperty('default')) {
props[key] = custom.props[key].default;
}
}
}
}*/
propsCompute.compute(props, custom.props);
for (let uuid in assetMapping) {
let asset = custom.assets.find(item => item.uuid === uuid);
if (asset) {
......
This diff is collapsed.
......@@ -5,7 +5,7 @@
"module": "dist/index.es.js",
"license": "MIT",
"dependencies": {
"props-compute": "http://gitlab2.dui88.com/laoqifeng/props-compute.git"
},
"scripts": {
"build": "rollup -c"
......
......@@ -5,6 +5,7 @@
import ProcessManager from "./ProcessManager";
import ScriptManager from "./ScriptManager";
import CustomManager from "./CustomManager";
import {compute} from "props-compute";
const TAG = 'zeroing-code-divider';
......@@ -101,13 +102,14 @@ export async function divideCode(data, {debug, compile, uglify, getProcesses, ge
const custom = typeof item === 'string' ? JSON.parse(item) : item;
customManager.deal(custom);
let {props, assetMapping} = customs.find(c => c.id === custom.id);
if (props) {
/*if (props) {
for (let key in custom.props) {
if (!props.hasOwnProperty(key) && custom.props[key].hasOwnProperty('default')) {
props[key] = custom.props[key].default;
}
}
}
}*/
compute(props, custom.props);
for (let uuid in assetMapping) {
let asset = custom.assets.find(item => item.uuid === uuid);
if (asset) {
......
......@@ -2,3 +2,6 @@
# yarn lockfile v1
"props-compute@http://gitlab2.dui88.com/laoqifeng/props-compute.git":
version "1.0.0"
resolved "http://gitlab2.dui88.com/laoqifeng/props-compute.git#c676e9e12a06ccc3556101197171ee47e9ebdd3c"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment