Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-pack
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
zeroing-pack
Commits
4034ca64
Commit
4034ca64
authored
Dec 23, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复自定义模块的问题
parent
9587a0d8
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
7 additions
and
279 deletions
+7
-279
index.es.js
dist/index.es.js
+1
-92
index.es.js.map
dist/index.es.js.map
+1
-1
index.js
dist/index.js
+1
-92
index.js.map
dist/index.js.map
+1
-1
index.umd.js
dist/index.umd.js
+1
-92
index.umd.js.map
dist/index.umd.js.map
+1
-1
index.js
src/index.js
+1
-0
No files found.
dist/index.es.js
View file @
4034ca64
...
@@ -70,6 +70,7 @@ async function packData(data, {debug, packedAssets, getProcesses, getScripts, ge
...
@@ -70,6 +70,7 @@ async function packData(data, {debug, packedAssets, getProcesses, getScripts, ge
newData
.
assets
=
packedAssets
||
data
.
assets
;
newData
.
assets
=
packedAssets
||
data
.
assets
;
newData
.
dataMapping
=
data
.
dataMapping
;
newData
.
dataMapping
=
data
.
dataMapping
;
newData
.
processes
=
data
.
processes
;
newData
.
processes
=
data
.
processes
;
newData
.
customs
=
data
.
customs
;
delete
newData
.
options
.
tpl
;
delete
newData
.
options
.
tpl
;
deleteUnusedData
(
newData
.
processes
);
deleteUnusedData
(
newData
.
processes
);
...
@@ -86,98 +87,6 @@ async function packData(data, {debug, packedAssets, getProcesses, getScripts, ge
...
@@ -86,98 +87,6 @@ async function packData(data, {debug, packedAssets, getProcesses, getScripts, ge
getProcesses
,
getScripts
,
getCustoms
,
getProcesses
,
getScripts
,
getCustoms
,
});
});
/*/!*=====START process =====*!/
console.log(TAG, 'start process');
let processIDs = [];
findDepPidsBat(processIDs, newData.processes);
let builtinProcesses = newData.builtinProcesses = [];
let bProcessIDs = processIDs;
while (true) {
let newPids = await addBuiltinProcesses(builtinProcesses, bProcessIDs, getProcesses);
bProcessIDs = [];
for (let id of newPids) {
if (!processIDs.includes(id)) {
bProcessIDs.push(id);
processIDs.push(id);
}
}
if (bProcessIDs.length === 0) {
break;
}
}
for (let process of newData.processes) {
processManager.deal(process);
}
console.log(TAG, 'processManager.generateCurrent()');
processManager.generateCurrent();
await processManager.compile(); //自定义过程先编译
for (let process of builtinProcesses) {
processManager.deal(process);
}
let processScriptContent = processManager.generate();
//console.log(processScriptContent);
if (!debug) {
processScriptContent = uglify(processScriptContent);
}
/!*=====END process =====*!/
/!*=====START script =====*!/
console.log(TAG, 'start script');
let scriptIDs = [];
for (let view of newData.views) {
traverseNode(view, (node) => {
if (node.scripts && node.scripts.length > 0) {
for (let {script} of node.scripts) {
if (!scriptIDs.includes(script)) {
scriptIDs.push(script);
}
}
}
});
}
//console.log('scriptIDs:', scriptIDs);
//let scriptsContainer = newData.scripts = {};
//let scriptsCode = '';
if (scriptIDs.length > 0) {
const scripts = await getScripts(scriptIDs);
for (let scriptData of scripts) {
let script = JSON.parse(scriptData);
//scriptsContainer[id] = code;
scriptManager.deal(script);
}
//console.log('scripts:', scriptsContainer);
}
let scriptsContent = scriptManager.generate();
//console.log(scriptsContent);
if (!debug) {
scriptsContent = uglify(scriptsContent);
}
/!*=====END script =====*!/
/!*=====START custom =====*!/
console.log(TAG, 'start custom');
//newData.customs = [];
if (data.customs && data.customs.length > 0) {
/!*newData.customs = *!/
(await getCustoms(data.customs)).map(item => {
customManager.deal(JSON.parse(item));
//return JSON.parse(item);
})
}
let customScriptContent = customManager.generate();
//console.log(customScriptContent);
if (!debug) {
customScriptContent = uglify(customScriptContent);
}
/!*=====END custom =====*!/*/
return
{
return
{
data
:
JSON
.
stringify
(
newData
),
data
:
JSON
.
stringify
(
newData
),
processScriptContent
,
processScriptContent
,
...
...
dist/index.es.js.map
View file @
4034ca64
{
"version"
:
3
,
"file"
:
"index.es.js"
,
"sources"
:
[
"../src/code-process.js"
,
"../src/index.js"
],
"sourcesContent"
:
[
"/**
\n
* Created by rockyl on 2019-11-30.
\n
*/
\n\n
import babel from '@babel/core';
\n\n
const UglifyJS = require('uglify-js');
\n\n
export async function compile(source, debug = false) {\n
\t
const {code, map} = await babel.transformAsync(source, {\n
\t\t
presets: [
\n\t\t\t
['@babel/env', {}]
\n\t\t
],
\n\t\t
babelrc: false,
\n\t\t
sourceMaps: debug,
\n\t
});
\n\n\t
const result =
{
\n\t\tcode,\n\t
}
;
\n\t
if (map) {\n
\t\t
result.sourcemap = map.mappings;
\n\t
}
\n\t
return result;
\n
}
\n\n
export function uglify(source){\n
\t
const uglifyResult = UglifyJS.minify(source,
{
\n\t
}
);
\n\t
if (!uglifyResult.error) {\n
\t\t
return uglifyResult.code;
\n\t
}
\n
}"
,
"/**
\n
* Created by rockyl on 2019-11-13.
\n
*
\n
* 项目打包
\n
*/
\n\n
import decamelize from 'decamelize'
\n
import {uglify, compile} from
\"
./code-process
\"
;
\n
import
{
divideCode
}
from 'zeroing-code-divider';
\n\n
const replaceFields = ['pageTitle', 'containerId'];
\n
const TAG = 'zeroing-pack';
\n\n
export async function pack(data, options) {\n
\t
let version = Date.now() + Math.floor(Math.random() * 1000);
\n\t
pageTemplate(data, data.options, version);
\n\t
const newData = await packData(data, options);
\n\n\t
return {\n
\t\t
version,
\n\t\t
data: newData,
\n\t
}
\n
}
\n\n
export function fillTpl(data, params) {\n
\t
const
{
options
}
= data;
\n\t
fillTemplate(options.newTpl, options, params);
\n\n\t
const newTpl = options.newTpl;
\n\t
delete options.newTpl;
\n\t
return newTpl;
\n
}
\n\n
async function packData(data, {debug, packedAssets, getProcesses, getScripts, getCustoms}) {\n
\t
let newData = {};
\n\t
newData.options = data.options;
\n\t
newData.views = data.views;
\n\t
newData.assets = packedAssets || data.assets;
\n\t
newData.dataMapping = data.dataMapping;
\n\t
newData.processes = data.processes;
\n\n\t
delete newData.options.tpl;
\n\t
deleteUnusedData(newData.processes);
\n\n\t
console.log(TAG, 'start');
\n\n\t
const
{
\n\t\tprocessScriptContent,\n\t\tscriptsContent,\n\t\tcustomScriptContent,\n\t
}
= await divideCode(newData, {\n
\t\t
debug,
\n\t\t
uglify, compile,
\n\t\t
getProcesses, getScripts, getCustoms,
\n\t
});
\n\n\t
/*/!*=====START process =====*!/
\n\t
console.log(TAG, 'start process');
\n\t
let processIDs = [];
\n\t
findDepPidsBat(processIDs, newData.processes);
\n\t
let builtinProcesses = newData.builtinProcesses = [];
\n\n\t
let bProcessIDs = processIDs;
\n\t
while (true) {\n
\t\t
let newPids = await addBuiltinProcesses(builtinProcesses, bProcessIDs, getProcesses);
\n\t\t
bProcessIDs = [];
\n\t\t
for (let id of newPids) {\n
\t\t\t
if (!processIDs.includes(id))
{
\n\t\t\t\tbProcessIDs.push(id);\n\t\t\t\tprocessIDs.push(id);\n\t\t\t}\n\t\t
}
\n\t\t
if (bProcessIDs.length === 0)
{
\n\t\t\tbreak;\n\t\t}\n\t
}
\n\n\t
for (let process of newData.processes)
{
\n\t\tprocessManager.deal(process);\n\t
}
\n\n\t
console.log(TAG, 'processManager.generateCurrent()');
\n\n\t
processManager.generateCurrent();
\n\t
await processManager.compile(); //自定义过程先编译
\n\n\t
for (let process of builtinProcesses)
{
\n\t\tprocessManager.deal(process);\n\t
}
\n\n\t
let processScriptContent = processManager.generate();
\n\t
//console.log(processScriptContent);
\n\t
if (!debug) {\n
\t\t
processScriptContent = uglify(processScriptContent);
\n\t
}
\n\t
/!*=====END process =====*!/
\n\n\t
/!*=====START script =====*!/
\n\t
console.log(TAG, 'start script');
\n\t
let scriptIDs = [];
\n\t
for (let view of newData.views) {\n
\t\t
traverseNode(view, (node) => {\n
\t\t\t
if (node.scripts && node.scripts.length > 0) {\n
\t\t\t\t
for (let
{
script
}
of node.scripts) {\n
\t\t\t\t\t
if (!scriptIDs.includes(script))
{
\n\t\t\t\t\t\tscriptIDs.push(script);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t
}
\n\t
//console.log('scriptIDs:', scriptIDs);
\n\t
//let scriptsContainer = newData.scripts = {};
\n\t
//let scriptsCode = '';
\n\t
if (scriptIDs.length > 0) {\n
\t\t
const scripts = await getScripts(scriptIDs);
\n\t\t
for (let scriptData of scripts) {\n
\t\t\t
let script = JSON.parse(scriptData);
\n\t\t\t
//scriptsContainer[id] = code;
\n\t\t\t
scriptManager.deal(script);
\n\t\t
}
\n\t\t
//console.log('scripts:', scriptsContainer);
\n\t
}
\n\n\t
let scriptsContent = scriptManager.generate();
\n\t
//console.log(scriptsContent);
\n\t
if (!debug) {\n
\t\t
scriptsContent = uglify(scriptsContent);
\n\t
}
\n\t
/!*=====END script =====*!/
\n\n\t
/!*=====START custom =====*!/
\n\t
console.log(TAG, 'start custom');
\n\t
//newData.customs = [];
\n\t
if (data.customs && data.customs.length > 0) {\n
\t\t
/!*newData.customs = *!/
\n\t\t
(await getCustoms(data.customs)).map(item => {\n
\t\t\t
customManager.deal(JSON.parse(item));
\n\t\t\t
//return JSON.parse(item);
\n\t\t
})
\n\t
}
\n\t
let customScriptContent = customManager.generate();
\n\t
//console.log(customScriptContent);
\n\t
if (!debug) {\n
\t\t
customScriptContent = uglify(customScriptContent);
\n\t
}
\n\t
/!*=====END custom =====*!/*/
\n\n\t
return {\n
\t\t
data: JSON.stringify(newData),
\n\t\t
processScriptContent,
\n\t\t
scriptsContent,
\n\t\t
customScriptContent,
\n\t
};
\n
}
\n\n
const unusedFields = ['design'];
\n\n
function deleteUnusedData(processes) {\n
\t
for (let process of processes) {\n
\t\t
if (process.sub) {\n
\t\t\t
for (let uuid in process.sub) {\n
\t\t\t\t
let subProcess = process.sub[uuid];
\n\t\t\t\t
for (let field of unusedFields) {\n
\t\t\t\t\t
if (subProcess.hasOwnProperty(field)) {\n
\t\t\t\t\t\t
delete subProcess[field];
\n\t\t\t\t\t
}
\n\t\t\t\t
}
\n\t\t\t
}
\n\t\t
}
\n\t\t
if (process.metas && process.metas.length > 0)
{
\n\t\t\tdeleteUnusedData(process.metas);\n\t\t}\n\t}\n
}
\n\n
function findDepPids(list, process) {\n
\t
if (process.sub) {\n
\t\t
for (let key in process.sub) {\n
\t\t\t
let p = process.sub[key];
\n\t\t\t
if (!list.includes(p.meta))
{
\n\t\t\t\tlist.push(p.meta);\n\t\t\t}\n\t\t}\n\t}\n
}
\n\n
function findDepPidsBat(list, processes) {\n
\t
for (let process of processes) {\n
\t\t
findDepPids(list, process);
\n\t
}
\n
}
\n\n
async function addBuiltinProcesses(list, ids, getProcesses) {\n
\t
let newPids = [];
\n\t
if (ids.length > 0) {\n
\t\t
let processes = await getProcesses(ids);
\n\t\t
for (let processData of processes) {\n
\t\t\t
let process = JSON.parse(processData);
\n\t\t\t
list.push(process);
\n\t\t\t
findDepPids(newPids, process);
\n\t\t
}
\n\t
}
\n\t
return newPids;
\n
}
\n\n
function pageTemplate(tpl, options, version) {\n
\t
const params =
{
\n\t\tversion,\n\t
}
;
\n\t
for (let field of replaceFields) {\n
\t\t
params[field] = options[field];
\n\t
}
\n\t
fillTemplate(options.tpl, options, params);
\n
}
\n\n
function fillTemplate(tpl, options, params) {\n
\t
for (let field in params) {\n
\t\t
const pattern = decamelize(field).toUpperCase();
\n\t\t
tpl = tpl.replace(new RegExp(`
\\\\
$${pattern}
\\\\
$`, 'g'), params[field]);
\n\t
}
\n\n\t
options.newTpl = tpl;
\n
}
\n\n
function traverseNode(root, callback) {\n
\t
callback(root);
\n\t
if (root.children && root.children.length > 0) {\n
\t\t
for (let childNode of root.children) {\n
\t\t\t
traverseNode(childNode, callback);
\n\t\t
}
\n\t
}
\n
}
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O,CAAC,IAAI,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;EACtE;;CAED,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC;CACrB;;;;"
}
{
"version"
:
3
,
"file"
:
"index.es.js"
,
"sources"
:
[
"../src/code-process.js"
,
"../src/index.js"
],
"sourcesContent"
:
[
"/**
\n
* Created by rockyl on 2019-11-30.
\n
*/
\n\n
import babel from '@babel/core';
\n\n
const UglifyJS = require('uglify-js');
\n\n
export async function compile(source, debug = false) {\n
\t
const {code, map} = await babel.transformAsync(source, {\n
\t\t
presets: [
\n\t\t\t
['@babel/env', {}]
\n\t\t
],
\n\t\t
babelrc: false,
\n\t\t
sourceMaps: debug,
\n\t
});
\n\n\t
const result =
{
\n\t\tcode,\n\t
}
;
\n\t
if (map) {\n
\t\t
result.sourcemap = map.mappings;
\n\t
}
\n\t
return result;
\n
}
\n\n
export function uglify(source){\n
\t
const uglifyResult = UglifyJS.minify(source,
{
\n\t
}
);
\n\t
if (!uglifyResult.error) {\n
\t\t
return uglifyResult.code;
\n\t
}
\n
}"
,
"/**
\n
* Created by rockyl on 2019-11-13.
\n
*
\n
* 项目打包
\n
*/
\n\n
import decamelize from 'decamelize'
\n
import {uglify, compile} from
\"
./code-process
\"
;
\n
import
{
divideCode
}
from 'zeroing-code-divider';
\n\n
const replaceFields = ['pageTitle', 'containerId'];
\n
const TAG = 'zeroing-pack';
\n\n
export async function pack(data, options) {\n
\t
let version = Date.now() + Math.floor(Math.random() * 1000);
\n\t
pageTemplate(data, data.options, version);
\n\t
const newData = await packData(data, options);
\n\n\t
return {\n
\t\t
version,
\n\t\t
data: newData,
\n\t
}
\n
}
\n\n
export function fillTpl(data, params) {\n
\t
const
{
options
}
= data;
\n\t
fillTemplate(options.newTpl, options, params);
\n\n\t
const newTpl = options.newTpl;
\n\t
delete options.newTpl;
\n\t
return newTpl;
\n
}
\n\n
async function packData(data, {debug, packedAssets, getProcesses, getScripts, getCustoms}) {\n
\t
let newData = {};
\n\t
newData.options = data.options;
\n\t
newData.views = data.views;
\n\t
newData.assets = packedAssets || data.assets;
\n\t
newData.dataMapping = data.dataMapping;
\n\t
newData.processes = data.processes;
\n\t
newData.customs = data.customs;
\n\n\t
delete newData.options.tpl;
\n\t
deleteUnusedData(newData.processes);
\n\n\t
console.log(TAG, 'start');
\n\n\t
const
{
\n\t\tprocessScriptContent,\n\t\tscriptsContent,\n\t\tcustomScriptContent,\n\t
}
= await divideCode(newData, {\n
\t\t
debug,
\n\t\t
uglify, compile,
\n\t\t
getProcesses, getScripts, getCustoms,
\n\t
});
\n\n\t
return {\n
\t\t
data: JSON.stringify(newData),
\n\t\t
processScriptContent,
\n\t\t
scriptsContent,
\n\t\t
customScriptContent,
\n\t
};
\n
}
\n\n
const unusedFields = ['design'];
\n\n
function deleteUnusedData(processes) {\n
\t
for (let process of processes) {\n
\t\t
if (process.sub) {\n
\t\t\t
for (let uuid in process.sub) {\n
\t\t\t\t
let subProcess = process.sub[uuid];
\n\t\t\t\t
for (let field of unusedFields) {\n
\t\t\t\t\t
if (subProcess.hasOwnProperty(field)) {\n
\t\t\t\t\t\t
delete subProcess[field];
\n\t\t\t\t\t
}
\n\t\t\t\t
}
\n\t\t\t
}
\n\t\t
}
\n\t\t
if (process.metas && process.metas.length > 0)
{
\n\t\t\tdeleteUnusedData(process.metas);\n\t\t}\n\t}\n
}
\n\n
function pageTemplate(tpl, options, version) {\n
\t
const params =
{
\n\t\tversion,\n\t
}
;
\n\t
for (let field of replaceFields) {\n
\t\t
params[field] = options[field];
\n\t
}
\n\t
fillTemplate(options.tpl, options, params);
\n
}
\n\n
function fillTemplate(tpl, options, params) {\n
\t
for (let field in params) {\n
\t\t
const pattern = decamelize(field).toUpperCase();
\n\t\t
tpl = tpl.replace(new RegExp(`
\\\\
$${pattern}
\\\\
$`, 'g'), params[field]);
\n\t
}
\n\n\t
options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,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;EACtE;;CAED,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC;CACrB;;;;"
}
\ No newline at end of file
\ No newline at end of file
dist/index.js
View file @
4034ca64
...
@@ -76,6 +76,7 @@ async function packData(data, {debug, packedAssets, getProcesses, getScripts, ge
...
@@ -76,6 +76,7 @@ async function packData(data, {debug, packedAssets, getProcesses, getScripts, ge
newData
.
assets
=
packedAssets
||
data
.
assets
;
newData
.
assets
=
packedAssets
||
data
.
assets
;
newData
.
dataMapping
=
data
.
dataMapping
;
newData
.
dataMapping
=
data
.
dataMapping
;
newData
.
processes
=
data
.
processes
;
newData
.
processes
=
data
.
processes
;
newData
.
customs
=
data
.
customs
;
delete
newData
.
options
.
tpl
;
delete
newData
.
options
.
tpl
;
deleteUnusedData
(
newData
.
processes
);
deleteUnusedData
(
newData
.
processes
);
...
@@ -92,98 +93,6 @@ async function packData(data, {debug, packedAssets, getProcesses, getScripts, ge
...
@@ -92,98 +93,6 @@ async function packData(data, {debug, packedAssets, getProcesses, getScripts, ge
getProcesses
,
getScripts
,
getCustoms
,
getProcesses
,
getScripts
,
getCustoms
,
});
});
/*/!*=====START process =====*!/
console.log(TAG, 'start process');
let processIDs = [];
findDepPidsBat(processIDs, newData.processes);
let builtinProcesses = newData.builtinProcesses = [];
let bProcessIDs = processIDs;
while (true) {
let newPids = await addBuiltinProcesses(builtinProcesses, bProcessIDs, getProcesses);
bProcessIDs = [];
for (let id of newPids) {
if (!processIDs.includes(id)) {
bProcessIDs.push(id);
processIDs.push(id);
}
}
if (bProcessIDs.length === 0) {
break;
}
}
for (let process of newData.processes) {
processManager.deal(process);
}
console.log(TAG, 'processManager.generateCurrent()');
processManager.generateCurrent();
await processManager.compile(); //自定义过程先编译
for (let process of builtinProcesses) {
processManager.deal(process);
}
let processScriptContent = processManager.generate();
//console.log(processScriptContent);
if (!debug) {
processScriptContent = uglify(processScriptContent);
}
/!*=====END process =====*!/
/!*=====START script =====*!/
console.log(TAG, 'start script');
let scriptIDs = [];
for (let view of newData.views) {
traverseNode(view, (node) => {
if (node.scripts && node.scripts.length > 0) {
for (let {script} of node.scripts) {
if (!scriptIDs.includes(script)) {
scriptIDs.push(script);
}
}
}
});
}
//console.log('scriptIDs:', scriptIDs);
//let scriptsContainer = newData.scripts = {};
//let scriptsCode = '';
if (scriptIDs.length > 0) {
const scripts = await getScripts(scriptIDs);
for (let scriptData of scripts) {
let script = JSON.parse(scriptData);
//scriptsContainer[id] = code;
scriptManager.deal(script);
}
//console.log('scripts:', scriptsContainer);
}
let scriptsContent = scriptManager.generate();
//console.log(scriptsContent);
if (!debug) {
scriptsContent = uglify(scriptsContent);
}
/!*=====END script =====*!/
/!*=====START custom =====*!/
console.log(TAG, 'start custom');
//newData.customs = [];
if (data.customs && data.customs.length > 0) {
/!*newData.customs = *!/
(await getCustoms(data.customs)).map(item => {
customManager.deal(JSON.parse(item));
//return JSON.parse(item);
})
}
let customScriptContent = customManager.generate();
//console.log(customScriptContent);
if (!debug) {
customScriptContent = uglify(customScriptContent);
}
/!*=====END custom =====*!/*/
return
{
return
{
data
:
JSON
.
stringify
(
newData
),
data
:
JSON
.
stringify
(
newData
),
processScriptContent
,
processScriptContent
,
...
...
dist/index.js.map
View file @
4034ca64
{
"version"
:
3
,
"file"
:
"index.js"
,
"sources"
:
[
"../src/code-process.js"
,
"../src/index.js"
],
"sourcesContent"
:
[
"/**
\n
* Created by rockyl on 2019-11-30.
\n
*/
\n\n
import babel from '@babel/core';
\n\n
const UglifyJS = require('uglify-js');
\n\n
export async function compile(source, debug = false) {\n
\t
const {code, map} = await babel.transformAsync(source, {\n
\t\t
presets: [
\n\t\t\t
['@babel/env', {}]
\n\t\t
],
\n\t\t
babelrc: false,
\n\t\t
sourceMaps: debug,
\n\t
});
\n\n\t
const result =
{
\n\t\tcode,\n\t
}
;
\n\t
if (map) {\n
\t\t
result.sourcemap = map.mappings;
\n\t
}
\n\t
return result;
\n
}
\n\n
export function uglify(source){\n
\t
const uglifyResult = UglifyJS.minify(source,
{
\n\t
}
);
\n\t
if (!uglifyResult.error) {\n
\t\t
return uglifyResult.code;
\n\t
}
\n
}"
,
"/**
\n
* Created by rockyl on 2019-11-13.
\n
*
\n
* 项目打包
\n
*/
\n\n
import decamelize from 'decamelize'
\n
import {uglify, compile} from
\"
./code-process
\"
;
\n
import
{
divideCode
}
from 'zeroing-code-divider';
\n\n
const replaceFields = ['pageTitle', 'containerId'];
\n
const TAG = 'zeroing-pack';
\n\n
export async function pack(data, options) {\n
\t
let version = Date.now() + Math.floor(Math.random() * 1000);
\n\t
pageTemplate(data, data.options, version);
\n\t
const newData = await packData(data, options);
\n\n\t
return {\n
\t\t
version,
\n\t\t
data: newData,
\n\t
}
\n
}
\n\n
export function fillTpl(data, params) {\n
\t
const
{
options
}
= data;
\n\t
fillTemplate(options.newTpl, options, params);
\n\n\t
const newTpl = options.newTpl;
\n\t
delete options.newTpl;
\n\t
return newTpl;
\n
}
\n\n
async function packData(data, {debug, packedAssets, getProcesses, getScripts, getCustoms}) {\n
\t
let newData = {};
\n\t
newData.options = data.options;
\n\t
newData.views = data.views;
\n\t
newData.assets = packedAssets || data.assets;
\n\t
newData.dataMapping = data.dataMapping;
\n\t
newData.processes = data.processes;
\n\n\t
delete newData.options.tpl;
\n\t
deleteUnusedData(newData.processes);
\n\n\t
console.log(TAG, 'start');
\n\n\t
const
{
\n\t\tprocessScriptContent,\n\t\tscriptsContent,\n\t\tcustomScriptContent,\n\t
}
= await divideCode(newData, {\n
\t\t
debug,
\n\t\t
uglify, compile,
\n\t\t
getProcesses, getScripts, getCustoms,
\n\t
});
\n\n\t
/*/!*=====START process =====*!/
\n\t
console.log(TAG, 'start process');
\n\t
let processIDs = [];
\n\t
findDepPidsBat(processIDs, newData.processes);
\n\t
let builtinProcesses = newData.builtinProcesses = [];
\n\n\t
let bProcessIDs = processIDs;
\n\t
while (true) {\n
\t\t
let newPids = await addBuiltinProcesses(builtinProcesses, bProcessIDs, getProcesses);
\n\t\t
bProcessIDs = [];
\n\t\t
for (let id of newPids) {\n
\t\t\t
if (!processIDs.includes(id))
{
\n\t\t\t\tbProcessIDs.push(id);\n\t\t\t\tprocessIDs.push(id);\n\t\t\t}\n\t\t
}
\n\t\t
if (bProcessIDs.length === 0)
{
\n\t\t\tbreak;\n\t\t}\n\t
}
\n\n\t
for (let process of newData.processes)
{
\n\t\tprocessManager.deal(process);\n\t
}
\n\n\t
console.log(TAG, 'processManager.generateCurrent()');
\n\n\t
processManager.generateCurrent();
\n\t
await processManager.compile(); //自定义过程先编译
\n\n\t
for (let process of builtinProcesses)
{
\n\t\tprocessManager.deal(process);\n\t
}
\n\n\t
let processScriptContent = processManager.generate();
\n\t
//console.log(processScriptContent);
\n\t
if (!debug) {\n
\t\t
processScriptContent = uglify(processScriptContent);
\n\t
}
\n\t
/!*=====END process =====*!/
\n\n\t
/!*=====START script =====*!/
\n\t
console.log(TAG, 'start script');
\n\t
let scriptIDs = [];
\n\t
for (let view of newData.views) {\n
\t\t
traverseNode(view, (node) => {\n
\t\t\t
if (node.scripts && node.scripts.length > 0) {\n
\t\t\t\t
for (let
{
script
}
of node.scripts) {\n
\t\t\t\t\t
if (!scriptIDs.includes(script))
{
\n\t\t\t\t\t\tscriptIDs.push(script);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t
}
\n\t
//console.log('scriptIDs:', scriptIDs);
\n\t
//let scriptsContainer = newData.scripts = {};
\n\t
//let scriptsCode = '';
\n\t
if (scriptIDs.length > 0) {\n
\t\t
const scripts = await getScripts(scriptIDs);
\n\t\t
for (let scriptData of scripts) {\n
\t\t\t
let script = JSON.parse(scriptData);
\n\t\t\t
//scriptsContainer[id] = code;
\n\t\t\t
scriptManager.deal(script);
\n\t\t
}
\n\t\t
//console.log('scripts:', scriptsContainer);
\n\t
}
\n\n\t
let scriptsContent = scriptManager.generate();
\n\t
//console.log(scriptsContent);
\n\t
if (!debug) {\n
\t\t
scriptsContent = uglify(scriptsContent);
\n\t
}
\n\t
/!*=====END script =====*!/
\n\n\t
/!*=====START custom =====*!/
\n\t
console.log(TAG, 'start custom');
\n\t
//newData.customs = [];
\n\t
if (data.customs && data.customs.length > 0) {\n
\t\t
/!*newData.customs = *!/
\n\t\t
(await getCustoms(data.customs)).map(item => {\n
\t\t\t
customManager.deal(JSON.parse(item));
\n\t\t\t
//return JSON.parse(item);
\n\t\t
})
\n\t
}
\n\t
let customScriptContent = customManager.generate();
\n\t
//console.log(customScriptContent);
\n\t
if (!debug) {\n
\t\t
customScriptContent = uglify(customScriptContent);
\n\t
}
\n\t
/!*=====END custom =====*!/*/
\n\n\t
return {\n
\t\t
data: JSON.stringify(newData),
\n\t\t
processScriptContent,
\n\t\t
scriptsContent,
\n\t\t
customScriptContent,
\n\t
};
\n
}
\n\n
const unusedFields = ['design'];
\n\n
function deleteUnusedData(processes) {\n
\t
for (let process of processes) {\n
\t\t
if (process.sub) {\n
\t\t\t
for (let uuid in process.sub) {\n
\t\t\t\t
let subProcess = process.sub[uuid];
\n\t\t\t\t
for (let field of unusedFields) {\n
\t\t\t\t\t
if (subProcess.hasOwnProperty(field)) {\n
\t\t\t\t\t\t
delete subProcess[field];
\n\t\t\t\t\t
}
\n\t\t\t\t
}
\n\t\t\t
}
\n\t\t
}
\n\t\t
if (process.metas && process.metas.length > 0)
{
\n\t\t\tdeleteUnusedData(process.metas);\n\t\t}\n\t}\n
}
\n\n
function findDepPids(list, process) {\n
\t
if (process.sub) {\n
\t\t
for (let key in process.sub) {\n
\t\t\t
let p = process.sub[key];
\n\t\t\t
if (!list.includes(p.meta))
{
\n\t\t\t\tlist.push(p.meta);\n\t\t\t}\n\t\t}\n\t}\n
}
\n\n
function findDepPidsBat(list, processes) {\n
\t
for (let process of processes) {\n
\t\t
findDepPids(list, process);
\n\t
}
\n
}
\n\n
async function addBuiltinProcesses(list, ids, getProcesses) {\n
\t
let newPids = [];
\n\t
if (ids.length > 0) {\n
\t\t
let processes = await getProcesses(ids);
\n\t\t
for (let processData of processes) {\n
\t\t\t
let process = JSON.parse(processData);
\n\t\t\t
list.push(process);
\n\t\t\t
findDepPids(newPids, process);
\n\t\t
}
\n\t
}
\n\t
return newPids;
\n
}
\n\n
function pageTemplate(tpl, options, version) {\n
\t
const params =
{
\n\t\tversion,\n\t
}
;
\n\t
for (let field of replaceFields) {\n
\t\t
params[field] = options[field];
\n\t
}
\n\t
fillTemplate(options.tpl, options, params);
\n
}
\n\n
function fillTemplate(tpl, options, params) {\n
\t
for (let field in params) {\n
\t\t
const pattern = decamelize(field).toUpperCase();
\n\t\t
tpl = tpl.replace(new RegExp(`
\\\\
$${pattern}
\\\\
$`, 'g'), params[field]);
\n\t
}
\n\n\t
options.newTpl = tpl;
\n
}
\n\n
function traverseNode(root, callback) {\n
\t
callback(root);
\n\t
if (root.children && root.children.length > 0) {\n
\t\t
for (let childNode of root.children) {\n
\t\t\t
traverseNode(childNode, callback);
\n\t\t
}
\n\t
}
\n
}
\n
"
],
"names"
:
[
"divideCode"
],
"mappings"
:
";;;;;;;;;;AAAA;;;AAGA,AAEA;AACA,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;;AAEtC,AAAO,eAAe,OAAO,CAAC,MAAM,EAAE,KAAK,GAAG,KAAK,EAAE;CACpD,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,MAAM,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE;EACtD,OAAO,EAAE;GACR,CAAC,YAAY,EAAE,EAAE,CAAC;GAClB;EACD,OAAO,EAAE,KAAK;EACd,UAAU,EAAE,KAAK;EACjB,CAAC,CAAC;;CAEH,MAAM,MAAM,GAAG;EACd,IAAI;EACJ,CAAC;CACF,IAAI,GAAG,EAAE;EACR,MAAM,CAAC,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC;EAChC;CACD,OAAO,MAAM,CAAC;CACd;;AAED,AAAO,S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D;EACD,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;GAC9C,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;GAChC;EACD;CACD;AACD,AA8BA;AACA,SAAS,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE;CAC5C,MAAM,MAAM,GAAG;EACd,OAAO;EACP,CAAC;CACF,KAAK,IAAI,KAAK,IAAI,aAAa,EAAE;EAChC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;EAC/B;CACD,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;CAC3C;;AAED,SAAS,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE;CAC3C,KAAK,IAAI,KAAK,IAAI,MAAM,EAAE;EACzB,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;EAChD,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;EACtE;;CAED,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC;CACrB;;;;;"
}
{
"version"
:
3
,
"file"
:
"index.js"
,
"sources"
:
[
"../src/code-process.js"
,
"../src/index.js"
],
"sourcesContent"
:
[
"/**
\n
* Created by rockyl on 2019-11-30.
\n
*/
\n\n
import babel from '@babel/core';
\n\n
const UglifyJS = require('uglify-js');
\n\n
export async function compile(source, debug = false) {\n
\t
const {code, map} = await babel.transformAsync(source, {\n
\t\t
presets: [
\n\t\t\t
['@babel/env', {}]
\n\t\t
],
\n\t\t
babelrc: false,
\n\t\t
sourceMaps: debug,
\n\t
});
\n\n\t
const result =
{
\n\t\tcode,\n\t
}
;
\n\t
if (map) {\n
\t\t
result.sourcemap = map.mappings;
\n\t
}
\n\t
return result;
\n
}
\n\n
export function uglify(source){\n
\t
const uglifyResult = UglifyJS.minify(source,
{
\n\t
}
);
\n\t
if (!uglifyResult.error) {\n
\t\t
return uglifyResult.code;
\n\t
}
\n
}"
,
"/**
\n
* Created by rockyl on 2019-11-13.
\n
*
\n
* 项目打包
\n
*/
\n\n
import decamelize from 'decamelize'
\n
import {uglify, compile} from
\"
./code-process
\"
;
\n
import
{
divideCode
}
from 'zeroing-code-divider';
\n\n
const replaceFields = ['pageTitle', 'containerId'];
\n
const TAG = 'zeroing-pack';
\n\n
export async function pack(data, options) {\n
\t
let version = Date.now() + Math.floor(Math.random() * 1000);
\n\t
pageTemplate(data, data.options, version);
\n\t
const newData = await packData(data, options);
\n\n\t
return {\n
\t\t
version,
\n\t\t
data: newData,
\n\t
}
\n
}
\n\n
export function fillTpl(data, params) {\n
\t
const
{
options
}
= data;
\n\t
fillTemplate(options.newTpl, options, params);
\n\n\t
const newTpl = options.newTpl;
\n\t
delete options.newTpl;
\n\t
return newTpl;
\n
}
\n\n
async function packData(data, {debug, packedAssets, getProcesses, getScripts, getCustoms}) {\n
\t
let newData = {};
\n\t
newData.options = data.options;
\n\t
newData.views = data.views;
\n\t
newData.assets = packedAssets || data.assets;
\n\t
newData.dataMapping = data.dataMapping;
\n\t
newData.processes = data.processes;
\n\t
newData.customs = data.customs;
\n\n\t
delete newData.options.tpl;
\n\t
deleteUnusedData(newData.processes);
\n\n\t
console.log(TAG, 'start');
\n\n\t
const
{
\n\t\tprocessScriptContent,\n\t\tscriptsContent,\n\t\tcustomScriptContent,\n\t
}
= await divideCode(newData, {\n
\t\t
debug,
\n\t\t
uglify, compile,
\n\t\t
getProcesses, getScripts, getCustoms,
\n\t
});
\n\n\t
return {\n
\t\t
data: JSON.stringify(newData),
\n\t\t
processScriptContent,
\n\t\t
scriptsContent,
\n\t\t
customScriptContent,
\n\t
};
\n
}
\n\n
const unusedFields = ['design'];
\n\n
function deleteUnusedData(processes) {\n
\t
for (let process of processes) {\n
\t\t
if (process.sub) {\n
\t\t\t
for (let uuid in process.sub) {\n
\t\t\t\t
let subProcess = process.sub[uuid];
\n\t\t\t\t
for (let field of unusedFields) {\n
\t\t\t\t\t
if (subProcess.hasOwnProperty(field)) {\n
\t\t\t\t\t\t
delete subProcess[field];
\n\t\t\t\t\t
}
\n\t\t\t\t
}
\n\t\t\t
}
\n\t\t
}
\n\t\t
if (process.metas && process.metas.length > 0)
{
\n\t\t\tdeleteUnusedData(process.metas);\n\t\t}\n\t}\n
}
\n\n
function pageTemplate(tpl, options, version) {\n
\t
const params =
{
\n\t\tversion,\n\t
}
;
\n\t
for (let field of replaceFields) {\n
\t\t
params[field] = options[field];
\n\t
}
\n\t
fillTemplate(options.tpl, options, params);
\n
}
\n\n
function fillTemplate(tpl, options, params) {\n
\t
for (let field in params) {\n
\t\t
const pattern = decamelize(field).toUpperCase();
\n\t\t
tpl = tpl.replace(new RegExp(`
\\\\
$${pattern}
\\\\
$`, 'g'), params[field]);
\n\t
}
\n\n\t
options.newTpl = tpl;
\n
}
\n
"
],
"names"
:
[
"divideCode"
],
"mappings"
:
";;;;;;;;;;AAAA;;;AAGA,AAEA;AACA,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;;AAEtC,AAAO,eAAe,OAAO,CAAC,MAAM,EAAE,KAAK,GAAG,KAAK,EAAE;CACpD,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,MAAM,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE;EACtD,OAAO,EAAE;GACR,CAAC,YAAY,EAAE,EAAE,CAAC;GAClB;EACD,OAAO,EAAE,KAAK;EACd,UAAU,EAAE,KAAK;EACjB,CAAC,CAAC;;CAEH,MAAM,MAAM,GAAG;EACd,IAAI;EACJ,CAAC;CACF,IAAI,GAAG,EAAE;EACR,MAAM,CAAC,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC;EAChC;CACD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AAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;GAC9C,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;GAChC;EACD;CACD;;AAED,SAAS,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE;CAC5C,MAAM,MAAM,GAAG;EACd,OAAO;EACP,CAAC;CACF,KAAK,IAAI,KAAK,IAAI,aAAa,EAAE;EAChC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;EAC/B;CACD,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;CAC3C;;AAED,SAAS,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE;CAC3C,KAAK,IAAI,KAAK,IAAI,MAAM,EAAE;EACzB,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;EAChD,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;EACtE;;CAED,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC;CACrB;;;;;"
}
\ No newline at end of file
\ No newline at end of file
dist/index.umd.js
View file @
4034ca64
...
@@ -75,6 +75,7 @@
...
@@ -75,6 +75,7 @@
newData
.
assets
=
packedAssets
||
data
.
assets
;
newData
.
assets
=
packedAssets
||
data
.
assets
;
newData
.
dataMapping
=
data
.
dataMapping
;
newData
.
dataMapping
=
data
.
dataMapping
;
newData
.
processes
=
data
.
processes
;
newData
.
processes
=
data
.
processes
;
newData
.
customs
=
data
.
customs
;
delete
newData
.
options
.
tpl
;
delete
newData
.
options
.
tpl
;
deleteUnusedData
(
newData
.
processes
);
deleteUnusedData
(
newData
.
processes
);
...
@@ -91,98 +92,6 @@
...
@@ -91,98 +92,6 @@
getProcesses
,
getScripts
,
getCustoms
,
getProcesses
,
getScripts
,
getCustoms
,
});
});
/*/!*=====START process =====*!/
console.log(TAG, 'start process');
let processIDs = [];
findDepPidsBat(processIDs, newData.processes);
let builtinProcesses = newData.builtinProcesses = [];
let bProcessIDs = processIDs;
while (true) {
let newPids = await addBuiltinProcesses(builtinProcesses, bProcessIDs, getProcesses);
bProcessIDs = [];
for (let id of newPids) {
if (!processIDs.includes(id)) {
bProcessIDs.push(id);
processIDs.push(id);
}
}
if (bProcessIDs.length === 0) {
break;
}
}
for (let process of newData.processes) {
processManager.deal(process);
}
console.log(TAG, 'processManager.generateCurrent()');
processManager.generateCurrent();
await processManager.compile(); //自定义过程先编译
for (let process of builtinProcesses) {
processManager.deal(process);
}
let processScriptContent = processManager.generate();
//console.log(processScriptContent);
if (!debug) {
processScriptContent = uglify(processScriptContent);
}
/!*=====END process =====*!/
/!*=====START script =====*!/
console.log(TAG, 'start script');
let scriptIDs = [];
for (let view of newData.views) {
traverseNode(view, (node) => {
if (node.scripts && node.scripts.length > 0) {
for (let {script} of node.scripts) {
if (!scriptIDs.includes(script)) {
scriptIDs.push(script);
}
}
}
});
}
//console.log('scriptIDs:', scriptIDs);
//let scriptsContainer = newData.scripts = {};
//let scriptsCode = '';
if (scriptIDs.length > 0) {
const scripts = await getScripts(scriptIDs);
for (let scriptData of scripts) {
let script = JSON.parse(scriptData);
//scriptsContainer[id] = code;
scriptManager.deal(script);
}
//console.log('scripts:', scriptsContainer);
}
let scriptsContent = scriptManager.generate();
//console.log(scriptsContent);
if (!debug) {
scriptsContent = uglify(scriptsContent);
}
/!*=====END script =====*!/
/!*=====START custom =====*!/
console.log(TAG, 'start custom');
//newData.customs = [];
if (data.customs && data.customs.length > 0) {
/!*newData.customs = *!/
(await getCustoms(data.customs)).map(item => {
customManager.deal(JSON.parse(item));
//return JSON.parse(item);
})
}
let customScriptContent = customManager.generate();
//console.log(customScriptContent);
if (!debug) {
customScriptContent = uglify(customScriptContent);
}
/!*=====END custom =====*!/*/
return
{
return
{
data
:
JSON
.
stringify
(
newData
),
data
:
JSON
.
stringify
(
newData
),
processScriptContent
,
processScriptContent
,
...
...
dist/index.umd.js.map
View file @
4034ca64
{
"version"
:
3
,
"file"
:
"index.umd.js"
,
"sources"
:
[
"../src/code-process.js"
,
"../src/index.js"
],
"sourcesContent"
:
[
"/**
\n
* Created by rockyl on 2019-11-30.
\n
*/
\n\n
import babel from '@babel/core';
\n\n
const UglifyJS = require('uglify-js');
\n\n
export async function compile(source, debug = false) {\n
\t
const {code, map} = await babel.transformAsync(source, {\n
\t\t
presets: [
\n\t\t\t
['@babel/env', {}]
\n\t\t
],
\n\t\t
babelrc: false,
\n\t\t
sourceMaps: debug,
\n\t
});
\n\n\t
const result =
{
\n\t\tcode,\n\t
}
;
\n\t
if (map) {\n
\t\t
result.sourcemap = map.mappings;
\n\t
}
\n\t
return result;
\n
}
\n\n
export function uglify(source){\n
\t
const uglifyResult = UglifyJS.minify(source,
{
\n\t
}
);
\n\t
if (!uglifyResult.error) {\n
\t\t
return uglifyResult.code;
\n\t
}
\n
}"
,
"/**
\n
* Created by rockyl on 2019-11-13.
\n
*
\n
* 项目打包
\n
*/
\n\n
import decamelize from 'decamelize'
\n
import {uglify, compile} from
\"
./code-process
\"
;
\n
import
{
divideCode
}
from 'zeroing-code-divider';
\n\n
const replaceFields = ['pageTitle', 'containerId'];
\n
const TAG = 'zeroing-pack';
\n\n
export async function pack(data, options) {\n
\t
let version = Date.now() + Math.floor(Math.random() * 1000);
\n\t
pageTemplate(data, data.options, version);
\n\t
const newData = await packData(data, options);
\n\n\t
return {\n
\t\t
version,
\n\t\t
data: newData,
\n\t
}
\n
}
\n\n
export function fillTpl(data, params) {\n
\t
const
{
options
}
= data;
\n\t
fillTemplate(options.newTpl, options, params);
\n\n\t
const newTpl = options.newTpl;
\n\t
delete options.newTpl;
\n\t
return newTpl;
\n
}
\n\n
async function packData(data, {debug, packedAssets, getProcesses, getScripts, getCustoms}) {\n
\t
let newData = {};
\n\t
newData.options = data.options;
\n\t
newData.views = data.views;
\n\t
newData.assets = packedAssets || data.assets;
\n\t
newData.dataMapping = data.dataMapping;
\n\t
newData.processes = data.processes;
\n\n\t
delete newData.options.tpl;
\n\t
deleteUnusedData(newData.processes);
\n\n\t
console.log(TAG, 'start');
\n\n\t
const
{
\n\t\tprocessScriptContent,\n\t\tscriptsContent,\n\t\tcustomScriptContent,\n\t
}
= await divideCode(newData, {\n
\t\t
debug,
\n\t\t
uglify, compile,
\n\t\t
getProcesses, getScripts, getCustoms,
\n\t
});
\n\n\t
/*/!*=====START process =====*!/
\n\t
console.log(TAG, 'start process');
\n\t
let processIDs = [];
\n\t
findDepPidsBat(processIDs, newData.processes);
\n\t
let builtinProcesses = newData.builtinProcesses = [];
\n\n\t
let bProcessIDs = processIDs;
\n\t
while (true) {\n
\t\t
let newPids = await addBuiltinProcesses(builtinProcesses, bProcessIDs, getProcesses);
\n\t\t
bProcessIDs = [];
\n\t\t
for (let id of newPids) {\n
\t\t\t
if (!processIDs.includes(id))
{
\n\t\t\t\tbProcessIDs.push(id);\n\t\t\t\tprocessIDs.push(id);\n\t\t\t}\n\t\t
}
\n\t\t
if (bProcessIDs.length === 0)
{
\n\t\t\tbreak;\n\t\t}\n\t
}
\n\n\t
for (let process of newData.processes)
{
\n\t\tprocessManager.deal(process);\n\t
}
\n\n\t
console.log(TAG, 'processManager.generateCurrent()');
\n\n\t
processManager.generateCurrent();
\n\t
await processManager.compile(); //自定义过程先编译
\n\n\t
for (let process of builtinProcesses)
{
\n\t\tprocessManager.deal(process);\n\t
}
\n\n\t
let processScriptContent = processManager.generate();
\n\t
//console.log(processScriptContent);
\n\t
if (!debug) {\n
\t\t
processScriptContent = uglify(processScriptContent);
\n\t
}
\n\t
/!*=====END process =====*!/
\n\n\t
/!*=====START script =====*!/
\n\t
console.log(TAG, 'start script');
\n\t
let scriptIDs = [];
\n\t
for (let view of newData.views) {\n
\t\t
traverseNode(view, (node) => {\n
\t\t\t
if (node.scripts && node.scripts.length > 0) {\n
\t\t\t\t
for (let
{
script
}
of node.scripts) {\n
\t\t\t\t\t
if (!scriptIDs.includes(script))
{
\n\t\t\t\t\t\tscriptIDs.push(script);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t
}
\n\t
//console.log('scriptIDs:', scriptIDs);
\n\t
//let scriptsContainer = newData.scripts = {};
\n\t
//let scriptsCode = '';
\n\t
if (scriptIDs.length > 0) {\n
\t\t
const scripts = await getScripts(scriptIDs);
\n\t\t
for (let scriptData of scripts) {\n
\t\t\t
let script = JSON.parse(scriptData);
\n\t\t\t
//scriptsContainer[id] = code;
\n\t\t\t
scriptManager.deal(script);
\n\t\t
}
\n\t\t
//console.log('scripts:', scriptsContainer);
\n\t
}
\n\n\t
let scriptsContent = scriptManager.generate();
\n\t
//console.log(scriptsContent);
\n\t
if (!debug) {\n
\t\t
scriptsContent = uglify(scriptsContent);
\n\t
}
\n\t
/!*=====END script =====*!/
\n\n\t
/!*=====START custom =====*!/
\n\t
console.log(TAG, 'start custom');
\n\t
//newData.customs = [];
\n\t
if (data.customs && data.customs.length > 0) {\n
\t\t
/!*newData.customs = *!/
\n\t\t
(await getCustoms(data.customs)).map(item => {\n
\t\t\t
customManager.deal(JSON.parse(item));
\n\t\t\t
//return JSON.parse(item);
\n\t\t
})
\n\t
}
\n\t
let customScriptContent = customManager.generate();
\n\t
//console.log(customScriptContent);
\n\t
if (!debug) {\n
\t\t
customScriptContent = uglify(customScriptContent);
\n\t
}
\n\t
/!*=====END custom =====*!/*/
\n\n\t
return {\n
\t\t
data: JSON.stringify(newData),
\n\t\t
processScriptContent,
\n\t\t
scriptsContent,
\n\t\t
customScriptContent,
\n\t
};
\n
}
\n\n
const unusedFields = ['design'];
\n\n
function deleteUnusedData(processes) {\n
\t
for (let process of processes) {\n
\t\t
if (process.sub) {\n
\t\t\t
for (let uuid in process.sub) {\n
\t\t\t\t
let subProcess = process.sub[uuid];
\n\t\t\t\t
for (let field of unusedFields) {\n
\t\t\t\t\t
if (subProcess.hasOwnProperty(field)) {\n
\t\t\t\t\t\t
delete subProcess[field];
\n\t\t\t\t\t
}
\n\t\t\t\t
}
\n\t\t\t
}
\n\t\t
}
\n\t\t
if (process.metas && process.metas.length > 0)
{
\n\t\t\tdeleteUnusedData(process.metas);\n\t\t}\n\t}\n
}
\n\n
function findDepPids(list, process) {\n
\t
if (process.sub) {\n
\t\t
for (let key in process.sub) {\n
\t\t\t
let p = process.sub[key];
\n\t\t\t
if (!list.includes(p.meta))
{
\n\t\t\t\tlist.push(p.meta);\n\t\t\t}\n\t\t}\n\t}\n
}
\n\n
function findDepPidsBat(list, processes) {\n
\t
for (let process of processes) {\n
\t\t
findDepPids(list, process);
\n\t
}
\n
}
\n\n
async function addBuiltinProcesses(list, ids, getProcesses) {\n
\t
let newPids = [];
\n\t
if (ids.length > 0) {\n
\t\t
let processes = await getProcesses(ids);
\n\t\t
for (let processData of processes) {\n
\t\t\t
let process = JSON.parse(processData);
\n\t\t\t
list.push(process);
\n\t\t\t
findDepPids(newPids, process);
\n\t\t
}
\n\t
}
\n\t
return newPids;
\n
}
\n\n
function pageTemplate(tpl, options, version) {\n
\t
const params =
{
\n\t\tversion,\n\t
}
;
\n\t
for (let field of replaceFields) {\n
\t\t
params[field] = options[field];
\n\t
}
\n\t
fillTemplate(options.tpl, options, params);
\n
}
\n\n
function fillTemplate(tpl, options, params) {\n
\t
for (let field in params) {\n
\t\t
const pattern = decamelize(field).toUpperCase();
\n\t\t
tpl = tpl.replace(new RegExp(`
\\\\
$${pattern}
\\\\
$`, 'g'), params[field]);
\n\t
}
\n\n\t
options.newTpl = tpl;
\n
}
\n\n
function traverseNode(root, callback) {\n
\t
callback(root);
\n\t
if (root.children && root.children.length > 0) {\n
\t\t
for (let childNode of root.children) {\n
\t\t\t
traverseNode(childNode, callback);
\n\t\t
}
\n\t
}
\n
}
\n
"
],
"names"
:
[
"divideCode"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AAO,UAAU,CAAC,KAAK,CAAC,CAAC;CAC/B,MAAM;CACN,KAAK;CACL,IAAI;CACJ,GAAG;CACH,EAAE,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;CACjD,GAAG,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;CACnC,GAAG;CACH,EAAE;CACF,CAAC;AACD,AA8BA;CACA,SAAS,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE;CAC7C,CAAC,MAAM,MAAM,GAAG;CAChB,EAAE,OAAO;CACT,EAAE,CAAC;CACH,CAAC,KAAK,IAAI,KAAK,IAAI,aAAa,EAAE;CAClC,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CACjC,EAAE;CACF,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;CAC5C,CAAC;;CAED,SAAS,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE;CAC5C,CAAC,KAAK,IAAI,KAAK,IAAI,MAAM,EAAE;CAC3B,EAAE,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;CAClD,EAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;CACxE,EAAE;;CAEF,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC;CACtB,CAAC;;;;;;;;;;;;;"
}
{
"version"
:
3
,
"file"
:
"index.umd.js"
,
"sources"
:
[
"../src/code-process.js"
,
"../src/index.js"
],
"sourcesContent"
:
[
"/**
\n
* Created by rockyl on 2019-11-30.
\n
*/
\n\n
import babel from '@babel/core';
\n\n
const UglifyJS = require('uglify-js');
\n\n
export async function compile(source, debug = false) {\n
\t
const {code, map} = await babel.transformAsync(source, {\n
\t\t
presets: [
\n\t\t\t
['@babel/env', {}]
\n\t\t
],
\n\t\t
babelrc: false,
\n\t\t
sourceMaps: debug,
\n\t
});
\n\n\t
const result =
{
\n\t\tcode,\n\t
}
;
\n\t
if (map) {\n
\t\t
result.sourcemap = map.mappings;
\n\t
}
\n\t
return result;
\n
}
\n\n
export function uglify(source){\n
\t
const uglifyResult = UglifyJS.minify(source,
{
\n\t
}
);
\n\t
if (!uglifyResult.error) {\n
\t\t
return uglifyResult.code;
\n\t
}
\n
}"
,
"/**
\n
* Created by rockyl on 2019-11-13.
\n
*
\n
* 项目打包
\n
*/
\n\n
import decamelize from 'decamelize'
\n
import {uglify, compile} from
\"
./code-process
\"
;
\n
import
{
divideCode
}
from 'zeroing-code-divider';
\n\n
const replaceFields = ['pageTitle', 'containerId'];
\n
const TAG = 'zeroing-pack';
\n\n
export async function pack(data, options) {\n
\t
let version = Date.now() + Math.floor(Math.random() * 1000);
\n\t
pageTemplate(data, data.options, version);
\n\t
const newData = await packData(data, options);
\n\n\t
return {\n
\t\t
version,
\n\t\t
data: newData,
\n\t
}
\n
}
\n\n
export function fillTpl(data, params) {\n
\t
const
{
options
}
= data;
\n\t
fillTemplate(options.newTpl, options, params);
\n\n\t
const newTpl = options.newTpl;
\n\t
delete options.newTpl;
\n\t
return newTpl;
\n
}
\n\n
async function packData(data, {debug, packedAssets, getProcesses, getScripts, getCustoms}) {\n
\t
let newData = {};
\n\t
newData.options = data.options;
\n\t
newData.views = data.views;
\n\t
newData.assets = packedAssets || data.assets;
\n\t
newData.dataMapping = data.dataMapping;
\n\t
newData.processes = data.processes;
\n\t
newData.customs = data.customs;
\n\n\t
delete newData.options.tpl;
\n\t
deleteUnusedData(newData.processes);
\n\n\t
console.log(TAG, 'start');
\n\n\t
const
{
\n\t\tprocessScriptContent,\n\t\tscriptsContent,\n\t\tcustomScriptContent,\n\t
}
= await divideCode(newData, {\n
\t\t
debug,
\n\t\t
uglify, compile,
\n\t\t
getProcesses, getScripts, getCustoms,
\n\t
});
\n\n\t
return {\n
\t\t
data: JSON.stringify(newData),
\n\t\t
processScriptContent,
\n\t\t
scriptsContent,
\n\t\t
customScriptContent,
\n\t
};
\n
}
\n\n
const unusedFields = ['design'];
\n\n
function deleteUnusedData(processes) {\n
\t
for (let process of processes) {\n
\t\t
if (process.sub) {\n
\t\t\t
for (let uuid in process.sub) {\n
\t\t\t\t
let subProcess = process.sub[uuid];
\n\t\t\t\t
for (let field of unusedFields) {\n
\t\t\t\t\t
if (subProcess.hasOwnProperty(field)) {\n
\t\t\t\t\t\t
delete subProcess[field];
\n\t\t\t\t\t
}
\n\t\t\t\t
}
\n\t\t\t
}
\n\t\t
}
\n\t\t
if (process.metas && process.metas.length > 0)
{
\n\t\t\tdeleteUnusedData(process.metas);\n\t\t}\n\t}\n
}
\n\n
function pageTemplate(tpl, options, version) {\n
\t
const params =
{
\n\t\tversion,\n\t
}
;
\n\t
for (let field of replaceFields) {\n
\t\t
params[field] = options[field];
\n\t
}
\n\t
fillTemplate(options.tpl, options, params);
\n
}
\n\n
function fillTemplate(tpl, options, params) {\n
\t
for (let field in params) {\n
\t\t
const pattern = decamelize(field).toUpperCase();
\n\t\t
tpl = tpl.replace(new RegExp(`
\\\\
$${pattern}
\\\\
$`, 'g'), params[field]);
\n\t
}
\n\n\t
options.newTpl = tpl;
\n
}
\n
"
],
"names"
:
[
"divideCode"
],
"mappings"
:
";;;;;;;;;CAAA;CACA;CACA;AACA,AAEA;CACA,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;;AAEtC,CAAO,eAAe,OAAO,CAAC,MAAM,EAAE,KAAK,GAAG,KAAK,EAAE;CACrD,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,MAAM,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE;CACxD,EAAE,OAAO,EAAE;CACX,GAAG,CAA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E;CAC5C,CAAC,KAAK,IAAI,KAAK,IAAI,MAAM,EAAE;CAC3B,EAAE,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;CAClD,EAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;CACxE,EAAE;;CAEF,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC;CACtB,CAAC;;;;;;;;;;;;;"
}
\ No newline at end of file
\ No newline at end of file
src/index.js
View file @
4034ca64
...
@@ -38,6 +38,7 @@ async function packData(data, {debug, packedAssets, getProcesses, getScripts, ge
...
@@ -38,6 +38,7 @@ async function packData(data, {debug, packedAssets, getProcesses, getScripts, ge
newData
.
assets
=
packedAssets
||
data
.
assets
;
newData
.
assets
=
packedAssets
||
data
.
assets
;
newData
.
dataMapping
=
data
.
dataMapping
;
newData
.
dataMapping
=
data
.
dataMapping
;
newData
.
processes
=
data
.
processes
;
newData
.
processes
=
data
.
processes
;
newData
.
customs
=
data
.
customs
;
delete
newData
.
options
.
tpl
;
delete
newData
.
options
.
tpl
;
deleteUnusedData
(
newData
.
processes
);
deleteUnusedData
(
newData
.
processes
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment