Commit 0cb1266f authored by rockyl's avatar rockyl

库版本锁

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