Commit 0cb1266f authored by rockyl's avatar rockyl

库版本锁

parent 1b6d4100
......@@ -188,11 +188,13 @@ ${scripts}
* Created by rockyl on 2019-12-20.
*/
async function divideCode(data, {debug, compile, uglify, getProcesses, getScripts, getCustoms}) {
async function divideCode(data, {debug, compile, uglify, getPackages}) {
const processManager = new ProcessManager();
const scriptManager = new ScriptManager();
const customManager = new CustomManager();
const dependencies = data.dependencies;
/*=====START process =====*/
//console.log(TAG, 'start process');
let processIDs = [];
......@@ -201,7 +203,7 @@ async function divideCode(data, {debug, compile, uglify, getProcesses, getScript
let bProcessIDs = processIDs;
while (true) {
let newPids = await addBuiltinProcesses(builtinProcesses, bProcessIDs, getProcesses);
let newPids = await addBuiltinProcesses(builtinProcesses, bProcessIDs, getPackages, dependencies);
bProcessIDs = [];
for (let id of newPids) {
if (!processIDs.includes(id)) {
......@@ -255,7 +257,7 @@ async function divideCode(data, {debug, compile, uglify, getProcesses, getScript
//let scriptsContainer = data.scripts = {};
//let scriptsCode = '';
if (scriptIDs.length > 0) {
const scripts = await getScripts(scriptIDs);
const scripts = await getPackages(scriptIDs);
for (let scriptData of scripts) {
let script = typeof scriptData === 'string' ? JSON.parse(scriptData) : scriptData;
//scriptsContainer[id] = code;
......@@ -276,7 +278,7 @@ async function divideCode(data, {debug, compile, uglify, getProcesses, getScript
//data.customs = [];
const customs = data.customs;
if (customs && customs.length > 0) {
let customMetas = await getCustoms(customs.map(item => item.id));
let customMetas = await getPackages(customs.map(item => item.id));
data.customs = customMetas.map(item => {
const custom = typeof item === 'string' ? JSON.parse(item) : item;
customManager.deal(custom);
......@@ -337,10 +339,14 @@ function findDepPidsBat(list, processes) {
}
}
async function addBuiltinProcesses(list, ids, getProcesses) {
async function addBuiltinProcesses(list, ids, getPackages, dependencies) {
let newPids = [];
let schema = {};
if (ids.length > 0) {
let processes = await getProcesses(ids);
for(let id of ids){
schema[id] = dependencies[id];
}
let processes = await getPackages(schema);
for (let processData of processes) {
let process = typeof processData === 'string' ? JSON.parse(processData) : processData;
list.push(process);
......
This diff is collapsed.
......@@ -194,11 +194,13 @@ ${scripts}
* Created by rockyl on 2019-12-20.
*/
async function divideCode(data, {debug, compile, uglify, getProcesses, getScripts, getCustoms}) {
async function divideCode(data, {debug, compile, uglify, getPackages}) {
const processManager = new ProcessManager();
const scriptManager = new ScriptManager();
const customManager = new CustomManager();
const dependencies = data.dependencies;
/*=====START process =====*/
//console.log(TAG, 'start process');
let processIDs = [];
......@@ -207,7 +209,7 @@ async function divideCode(data, {debug, compile, uglify, getProcesses, getScript
let bProcessIDs = processIDs;
while (true) {
let newPids = await addBuiltinProcesses(builtinProcesses, bProcessIDs, getProcesses);
let newPids = await addBuiltinProcesses(builtinProcesses, bProcessIDs, getPackages, dependencies);
bProcessIDs = [];
for (let id of newPids) {
if (!processIDs.includes(id)) {
......@@ -261,7 +263,7 @@ async function divideCode(data, {debug, compile, uglify, getProcesses, getScript
//let scriptsContainer = data.scripts = {};
//let scriptsCode = '';
if (scriptIDs.length > 0) {
const scripts = await getScripts(scriptIDs);
const scripts = await getPackages(scriptIDs);
for (let scriptData of scripts) {
let script = typeof scriptData === 'string' ? JSON.parse(scriptData) : scriptData;
//scriptsContainer[id] = code;
......@@ -282,7 +284,7 @@ async function divideCode(data, {debug, compile, uglify, getProcesses, getScript
//data.customs = [];
const customs = data.customs;
if (customs && customs.length > 0) {
let customMetas = await getCustoms(customs.map(item => item.id));
let customMetas = await getPackages(customs.map(item => item.id));
data.customs = customMetas.map(item => {
const custom = typeof item === 'string' ? JSON.parse(item) : item;
customManager.deal(custom);
......@@ -343,10 +345,14 @@ function findDepPidsBat(list, processes) {
}
}
async function addBuiltinProcesses(list, ids, getProcesses) {
async function addBuiltinProcesses(list, ids, getPackages, dependencies) {
let newPids = [];
let schema = {};
if (ids.length > 0) {
let processes = await getProcesses(ids);
for(let id of ids){
schema[id] = dependencies[id];
}
let processes = await getPackages(schema);
for (let processData of processes) {
let process = typeof processData === 'string' ? JSON.parse(processData) : processData;
list.push(process);
......
This diff is collapsed.
......@@ -193,11 +193,13 @@ ${scripts}
* Created by rockyl on 2019-12-20.
*/
async function divideCode(data, {debug, compile, uglify, getProcesses, getScripts, getCustoms}) {
async function divideCode(data, {debug, compile, uglify, getPackages}) {
const processManager = new ProcessManager();
const scriptManager = new ScriptManager();
const customManager = new CustomManager();
const dependencies = data.dependencies;
/*=====START process =====*/
//console.log(TAG, 'start process');
let processIDs = [];
......@@ -206,7 +208,7 @@ ${scripts}
let bProcessIDs = processIDs;
while (true) {
let newPids = await addBuiltinProcesses(builtinProcesses, bProcessIDs, getProcesses);
let newPids = await addBuiltinProcesses(builtinProcesses, bProcessIDs, getPackages, dependencies);
bProcessIDs = [];
for (let id of newPids) {
if (!processIDs.includes(id)) {
......@@ -260,7 +262,7 @@ ${scripts}
//let scriptsContainer = data.scripts = {};
//let scriptsCode = '';
if (scriptIDs.length > 0) {
const scripts = await getScripts(scriptIDs);
const scripts = await getPackages(scriptIDs);
for (let scriptData of scripts) {
let script = typeof scriptData === 'string' ? JSON.parse(scriptData) : scriptData;
//scriptsContainer[id] = code;
......@@ -281,7 +283,7 @@ ${scripts}
//data.customs = [];
const customs = data.customs;
if (customs && customs.length > 0) {
let customMetas = await getCustoms(customs.map(item => item.id));
let customMetas = await getPackages(customs.map(item => item.id));
data.customs = customMetas.map(item => {
const custom = typeof item === 'string' ? JSON.parse(item) : item;
customManager.deal(custom);
......@@ -342,10 +344,14 @@ ${scripts}
}
}
async function addBuiltinProcesses(list, ids, getProcesses) {
async function addBuiltinProcesses(list, ids, getPackages, dependencies) {
let newPids = [];
let schema = {};
if (ids.length > 0) {
let processes = await getProcesses(ids);
for(let id of ids){
schema[id] = dependencies[id];
}
let processes = await getPackages(schema);
for (let processData of processes) {
let process = typeof processData === 'string' ? JSON.parse(processData) : processData;
list.push(process);
......
This diff is collapsed.
......@@ -9,11 +9,13 @@ import {compute} from "props-compute";
const TAG = 'zeroing-code-divider';
export async function divideCode(data, {debug, compile, uglify, getProcesses, getScripts, getCustoms}) {
export async function divideCode(data, {debug, compile, uglify, getPackages}) {
const processManager = new ProcessManager();
const scriptManager = new ScriptManager();
const customManager = new CustomManager();
const dependencies = data.dependencies;
/*=====START process =====*/
//console.log(TAG, 'start process');
let processIDs = [];
......@@ -22,7 +24,7 @@ export async function divideCode(data, {debug, compile, uglify, getProcesses, ge
let bProcessIDs = processIDs;
while (true) {
let newPids = await addBuiltinProcesses(builtinProcesses, bProcessIDs, getProcesses);
let newPids = await addBuiltinProcesses(builtinProcesses, bProcessIDs, getPackages, dependencies);
bProcessIDs = [];
for (let id of newPids) {
if (!processIDs.includes(id)) {
......@@ -76,7 +78,7 @@ export async function divideCode(data, {debug, compile, uglify, getProcesses, ge
//let scriptsContainer = data.scripts = {};
//let scriptsCode = '';
if (scriptIDs.length > 0) {
const scripts = await getScripts(scriptIDs);
const scripts = await getPackages(scriptIDs);
for (let scriptData of scripts) {
let script = typeof scriptData === 'string' ? JSON.parse(scriptData) : scriptData;
//scriptsContainer[id] = code;
......@@ -97,7 +99,7 @@ export async function divideCode(data, {debug, compile, uglify, getProcesses, ge
//data.customs = [];
const customs = data.customs;
if (customs && customs.length > 0) {
let customMetas = await getCustoms(customs.map(item => item.id));
let customMetas = await getPackages(customs.map(item => item.id));
data.customs = customMetas.map(item => {
const custom = typeof item === 'string' ? JSON.parse(item) : item;
customManager.deal(custom);
......@@ -158,10 +160,14 @@ function findDepPidsBat(list, processes) {
}
}
async function addBuiltinProcesses(list, ids, getProcesses) {
async function addBuiltinProcesses(list, ids, getPackages, dependencies) {
let newPids = [];
let schema = {};
if (ids.length > 0) {
let processes = await getProcesses(ids);
for(let id of ids){
schema[id] = dependencies[id];
}
let processes = await getPackages(schema);
for (let processData of processes) {
let process = typeof processData === 'string' ? JSON.parse(processData) : processData;
list.push(process);
......
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