mirror of
https://gitee.com/onvia/ccc-tnt-psd2ui
synced 2025-05-20 20:14:06 +00:00
两个版本的插件
This commit is contained in:
parent
44bce05250
commit
68895155e5
@ -9,6 +9,7 @@
|
||||
插件文件夹提供了一个能够正确导出为预制体的的 psd 文件可以作为参考 `extensions\psd2ui\test\demo.psd`
|
||||
|
||||
支持的 CocosCreator 版本:`2.4.x`、 `3.4.+` ,截止到目前可以支持到 `3.7.x`
|
||||
如果无法拖放 psd 文件或文件夹,可能是 CocosCreator 的权限不够,尝试使用管理员方式打开 CocosCreator 或者使用 打开文件 功能
|
||||
|
||||
|
||||
### 工具特性
|
||||
@ -20,6 +21,12 @@
|
||||
工具在首次使用时会自动执行一次缓存项目所有资源 MD5 值
|
||||
美术导出的图片 MD5 值可能与本工具导出的图片 MD5 值不一致,所以当出现相同的图片时请考虑这种情况
|
||||
|
||||
### 特别注意
|
||||
工具只适用于新界面的首次导出,如果界面已经开发到一定程度,但是因需求变化,界面结构发生变化,想重新导出,需要谨慎使用。
|
||||
如果导出之后缺少某些图片,请确认是否写入了缓存,写入缓存的
|
||||
如果出现资源丢失的情况,请确认在项目中是否被手动删除了。
|
||||
不建议将输出目录设置为 项目的 `assets` 文件夹下,可能由于编辑器的权限导致不可预期的错误。
|
||||
|
||||
### 界面说明
|
||||
|
||||

|
||||
|
401
ccc-tnt-psd2ui-v2.4.x/PS脚本-图层重命名.jsx
Normal file
401
ccc-tnt-psd2ui-v2.4.x/PS脚本-图层重命名.jsx
Normal file
@ -0,0 +1,401 @@
|
||||
#target photoshop
|
||||
|
||||
|
||||
/**
|
||||
* 增加 批量替换名称如:
|
||||
* 头,身体,大手臂,小手臂,手掌,大腿,小腿
|
||||
* head,body,bigarm,forearm,palm,thigh,calf
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
var cacheValue = new Map ();
|
||||
var win;
|
||||
var res ="dialog { \
|
||||
text:'图层批量重命名 ',\
|
||||
group: Group{orientation: 'column',alignChildren:'left',\
|
||||
mode:Panel{orientation: 'row', text:'作用范围:',\
|
||||
selected:RadioButton {text:'选中图层' },\
|
||||
all:RadioButton {text:'所有图层' },\
|
||||
}\
|
||||
whichType:Panel{orientation: 'row', text:'类型:',\
|
||||
whole:RadioButton {text:'整体' },\
|
||||
rep:RadioButton {text:'替换' },\
|
||||
add_del:RadioButton {text:'添加/删除' },\
|
||||
}\
|
||||
allGroup:Panel {orientation:'stack', alignChildren:'top',text: '整体', \
|
||||
renameall: Group { orientation: 'column',alignChildren:'left',text: '命名规则',\
|
||||
name: Group { orientation: 'row', \
|
||||
txt: StaticText { text:'命名规则:' }, \
|
||||
edit: EditText { preferredSize: [240, 20] } ,\
|
||||
}, \
|
||||
helpTip: Group{orientation: 'column',alignChildren:'left',\
|
||||
txt1: StaticText{ text:'在此处输入“A_#” 则图层名为“A_<数字编号>'},\
|
||||
txt2: StaticText{ text:'使用 * 插入原始图层名称'},\
|
||||
txt3: StaticText{ text:'使用 # 以数字插入指定位置'},\
|
||||
}\
|
||||
paramGroup: Group{orientation: 'column',alignChildren:'left',\
|
||||
beginId: Group { orientation: 'row', \
|
||||
txt: StaticText { text:'开始于:' }, \
|
||||
edit: EditText { text:'0',preferredSize: [50, 20]} ,\
|
||||
}, \
|
||||
incremental: Group { orientation: 'row', \
|
||||
txt: StaticText { text:'增量: ' }, \
|
||||
edit: EditText { text:'1', preferredSize: [50, 20]} ,\
|
||||
}, \
|
||||
bits: Group { orientation: 'row', \
|
||||
txt: StaticText { text:'位数: ' }, \
|
||||
dropdownlist:DropDownList { alignment:'left', itemSize: [34,16] },\
|
||||
}, \
|
||||
}\
|
||||
}, \
|
||||
repGroup: Group { orientation: 'column',alignChildren:'left',text: '命名规则',\
|
||||
helpTip: Group{orientation: 'column',alignChildren:'left',\
|
||||
txt1: StaticText{ text:'替换文件名中的字符 '},\
|
||||
},\
|
||||
oldStr: Group { orientation: 'row', \
|
||||
txt: StaticText { text:'把: ' }, \
|
||||
edit: EditText { preferredSize: [160, 20] } ,\
|
||||
}, \
|
||||
newStr: Group { orientation: 'row', \
|
||||
txt: StaticText { text:'替换成:' }, \
|
||||
edit: EditText { preferredSize: [160, 20] } ,\
|
||||
}, \
|
||||
}, \
|
||||
add_del: Group { orientation: 'column',alignChildren:'left',text: '添加/删除',\
|
||||
frontadd: Group { orientation: 'row', \
|
||||
txt: StaticText { text:'文件名前添加: ' }, \
|
||||
edit: EditText { preferredSize: [200, 20] } ,\
|
||||
}, \
|
||||
backtoadd: Group{ orientation: 'row', \
|
||||
txt: StaticText { text:'文件名后添加: ' }, \
|
||||
edit: EditText { preferredSize: [200, 20] } ,\
|
||||
}, \
|
||||
del: Group{ orientation: 'row', \
|
||||
txt: StaticText { text:'删除文件名中的:' }, \
|
||||
edit: EditText { preferredSize: [200, 20] } ,\
|
||||
}, \
|
||||
extensionadd: Checkbox{text:'扩展添加'},\
|
||||
addGroup: Group{orientation: 'column',alignChildren:'left',\
|
||||
beginId: Group { orientation: 'row', \
|
||||
txt: StaticText { text:'从文件名第:' }, \
|
||||
edit: EditText { text:'0',preferredSize: [50, 20]} ,\
|
||||
txt: StaticText { text:'个字符开始' }, \
|
||||
}, \
|
||||
extensionaddStr: Group { orientation: 'row', \
|
||||
txt: StaticText { text:'添加字符串:' }, \
|
||||
edit: EditText { text:'', preferredSize: [80, 20]} ,\
|
||||
}, \
|
||||
}\
|
||||
extensiondel: Checkbox{text:'扩展删除'},\
|
||||
delGroup: Group{orientation: 'column',alignChildren:'left',\
|
||||
beginId: Group { orientation: 'row', \
|
||||
txt: StaticText { text:'从文件名第:' }, \
|
||||
edit: EditText { text:'0',preferredSize: [50, 20]} ,\
|
||||
txt: StaticText { text:'个字符开始' }, \
|
||||
}, \
|
||||
totalNum: Group { orientation: 'row', \
|
||||
txt: StaticText { text:'共删除:' }, \
|
||||
edit: EditText { text:'1', preferredSize: [50, 20]} ,\
|
||||
txt: StaticText { text:'字符' }, \
|
||||
}, \
|
||||
}\
|
||||
}, \
|
||||
}\
|
||||
},\
|
||||
buttons: Group { orientation: 'row', alignment: 'right',\
|
||||
btnOK: Button { text:'确定', properties:{name:'ok'} }, \
|
||||
btnCancel: Button { text:'取消', properties:{name:'cancel'} } \
|
||||
}, \
|
||||
}";
|
||||
|
||||
|
||||
|
||||
app.bringToFront();
|
||||
if (documents.length == 0) {
|
||||
alert("没有可处理的文档");
|
||||
}else {
|
||||
main();
|
||||
}
|
||||
|
||||
|
||||
function main(){
|
||||
initWin();
|
||||
}
|
||||
|
||||
function initWin(){
|
||||
win = new Window (res);
|
||||
var whichType = win.group.whichType;
|
||||
var repGroup = win.group.allGroup.repGroup;
|
||||
var add_del = win.group.allGroup.add_del;
|
||||
var renameall = win.group.allGroup.renameall;
|
||||
whichType.whole.value = true;
|
||||
add_del.visible = false;
|
||||
repGroup.visible = false;
|
||||
whichType.whole.onClick = function(){
|
||||
renameall.visible = true;
|
||||
add_del.visible = false;
|
||||
repGroup.visible = false;
|
||||
win.group.allGroup.text = "整体";
|
||||
}
|
||||
whichType.rep.onClick = function(){
|
||||
renameall.visible = false;
|
||||
add_del.visible = false;
|
||||
repGroup.visible = true;
|
||||
win.group.allGroup.text = "替换";
|
||||
}
|
||||
whichType.add_del.onClick = function(){
|
||||
renameall.visible = false;
|
||||
add_del.visible = true;
|
||||
repGroup.visible = false;
|
||||
win.group.allGroup.text = "添加/删除";
|
||||
}
|
||||
//整体
|
||||
checkNum(renameall.paramGroup.beginId.edit,0);
|
||||
checkNum(renameall.paramGroup.incremental.edit,1);
|
||||
//checkNum(renameall.paramGroup.bits.renameall,1);
|
||||
renameall.paramGroup.bits.enabled = false; // ====================================================暂时不能选择位数 等待补全====================================================
|
||||
win.group.mode.selected.value = true;
|
||||
|
||||
var dropDownList = renameall.paramGroup.bits.dropdownlist;
|
||||
for(var i = 0; i < 5; i++){//给下拉列表添加元素
|
||||
dropDownList.add("item",i+1);
|
||||
}
|
||||
dropDownList.items[0].selected=true;//使第一个被选中
|
||||
|
||||
|
||||
//添加/删除
|
||||
add_del.addGroup.enabled = false;
|
||||
add_del.delGroup.enabled = false;
|
||||
|
||||
checkNum(add_del.addGroup.beginId.edit,0);
|
||||
checkNum(add_del.delGroup.beginId.edit,0);
|
||||
checkNum(add_del.delGroup.totalNum.edit,1);
|
||||
|
||||
add_del.extensiondel.onClick = function(){
|
||||
add_del.delGroup.enabled = !add_del.delGroup.enabled;
|
||||
}
|
||||
add_del.extensionadd.onClick = function(){
|
||||
add_del.addGroup.enabled = !add_del.addGroup.enabled;
|
||||
}
|
||||
win.buttons.btnCancel.onClick = function () {
|
||||
win.close();
|
||||
}
|
||||
win.buttons.btnOK.onClick = function () {
|
||||
if(renameall.visible){
|
||||
exeRename();
|
||||
}else if(add_del.visible){
|
||||
exeAdd_Del();
|
||||
}else if(repGroup.visible){
|
||||
exeReplace();
|
||||
}
|
||||
win.close();
|
||||
}
|
||||
|
||||
win.center();
|
||||
win.show();
|
||||
}
|
||||
|
||||
function exeRename(){
|
||||
var layers = [];
|
||||
var renameall = win.group.allGroup.renameall;
|
||||
var name = renameall.name.edit.text;
|
||||
var beginIds = Number(renameall.paramGroup.beginId.edit.text);
|
||||
var incremental =Number(renameall.paramGroup.incremental.edit.text);
|
||||
var bits = Number(renameall.paramGroup.bits.dropdownlist.selection) + 1;
|
||||
|
||||
if(win.group.mode.selected.value){
|
||||
layers = getSelectedLayers();
|
||||
}else{
|
||||
getLayers(app.activeDocument, layers);
|
||||
}
|
||||
for (var i = 0; i < layers.length; i++) {
|
||||
//var reg1 = new RegExp("*","g");
|
||||
var reg2 = new RegExp("#","g");
|
||||
var reg3 = new RegExp(" ","g");
|
||||
var newname = name.replace ("*", layers[i].name);//替换 * 为原文件名
|
||||
newname = newname.replace ("*", layers[i].name);//替换 * 为原文件名
|
||||
newname = newname.replace ("*", layers[i].name);//替换 * 为原文件名
|
||||
newname = newname.replace ("*", layers[i].name);//替换 * 为原文件名
|
||||
newname = newname.replace (reg2,formatNum( beginIds+i*incremental,bits));//替换 # 为数字
|
||||
newname = newname.replace (reg3, "");//删除空格
|
||||
layers[i].name = newname ;
|
||||
}
|
||||
}
|
||||
function exeReplace(){
|
||||
var layers = [];
|
||||
var repGroup = win.group.allGroup.repGroup;
|
||||
var oldstr = repGroup.oldStr.edit.text;
|
||||
var newstr = repGroup.newStr.edit.text;
|
||||
|
||||
|
||||
if(win.group.mode.selected.value){
|
||||
layers = getSelectedLayers();
|
||||
}else{
|
||||
getLayers(app.activeDocument, layers);
|
||||
}
|
||||
var oldstrs= new Array(); //定义一数组
|
||||
oldstrs = oldstr.split (",");
|
||||
var newstrs= new Array(); //定义一数组
|
||||
newstrs = newstr.split (",");
|
||||
if(oldstrs.length != newstrs.length){
|
||||
alert ("新字符的数量必须和旧字符串的数量一致");
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < layers.length; i++) {
|
||||
var newname = layers[i].name;
|
||||
|
||||
|
||||
for(var j = 0;j <oldstrs.length;j++){
|
||||
var reg = new RegExp(oldstrs[j],"g");
|
||||
newname = newname.replace (reg, newstrs[j]);//替换 * 为原文件名
|
||||
}
|
||||
|
||||
//var reg = new RegExp(oldstr,"g");
|
||||
//newname = newname.replace (reg, newstr);//替换字符
|
||||
layers[i].name = newname ;
|
||||
}
|
||||
}
|
||||
function exeAdd_Del(){
|
||||
var layers = [];
|
||||
var add_del = win.group.allGroup.add_del;
|
||||
var frontaddstr = add_del.frontadd.edit.text;//文件名前添加的字符
|
||||
var backtoaddstr = add_del.backtoadd.edit.text;//文件名后添加的字符
|
||||
var delstr = add_del.del.edit.text;//删除的字符
|
||||
|
||||
var addbeginID = Number(add_del.addGroup.beginId.edit.text);
|
||||
var addStr = add_del.addGroup.extensionaddStr.edit.text;
|
||||
var delbeginID = Number(add_del.delGroup.beginId.edit.text);
|
||||
var deltotalNum = Number(add_del.delGroup.totalNum.edit.text);
|
||||
|
||||
|
||||
if(win.group.mode.selected.value){
|
||||
layers = getSelectedLayers();
|
||||
}else{
|
||||
getLayers(app.activeDocument, layers);
|
||||
}
|
||||
|
||||
for (var i = 0; i < layers.length; i++) {
|
||||
var newname = frontaddstr+layers[i].name;
|
||||
newname = newname+backtoaddstr;
|
||||
//扩展添加
|
||||
if(add_del.extensionadd.value){
|
||||
//插入字符
|
||||
newname = insert_flg(newname,addStr,addbeginID);
|
||||
}
|
||||
|
||||
var reg = new RegExp(delstr,"g");
|
||||
newname = newname.replace (reg, "");//删除字符
|
||||
//扩展删除
|
||||
if(add_del.extensiondel.value){
|
||||
newname = del_flg(newname,delbeginID,deltotalNum);
|
||||
}
|
||||
|
||||
|
||||
reg = new RegExp(" ","g");
|
||||
newname = newname.replace (reg, "");//删除空格
|
||||
|
||||
|
||||
|
||||
|
||||
layers[i].name = newname ;
|
||||
}
|
||||
}
|
||||
//插入字符
|
||||
//参数说明:str表示原字符串变量,flg表示要插入的字符串,sn表示要插入的位置
|
||||
function insert_flg(str,flg,sn){
|
||||
newstr = str.substring(0,sn) +flg+ str.substring(sn,str.length);
|
||||
return newstr;
|
||||
}
|
||||
|
||||
//删除指定位置的字符 x代表要删除的位置 代表删除字符的个数
|
||||
function del_flg(str,x,num){
|
||||
var newstr = str.substring(0,x) + str.substring(x+num,str.length);
|
||||
return newstr;
|
||||
}
|
||||
function formatNum(num,bits){
|
||||
if(bits > 1){
|
||||
var str = Number.toString (num);
|
||||
var form='';
|
||||
for(var i = 0;i < bits-1;i++){
|
||||
form+='0';
|
||||
}
|
||||
return form+num;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
function checkNum(editText,defaultNum){
|
||||
cacheValue.set(editText,defaultNum);
|
||||
editText.onChanging = function(){
|
||||
if(isNaN(editText.text)){//非数字
|
||||
editText.text = cacheValue.get(editText);
|
||||
}else{
|
||||
cacheValue.set(editText,editText.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
function getSelectedLayers(){
|
||||
var idGrp = stringIDToTypeID( "groupLayersEvent" );
|
||||
var descGrp = new ActionDescriptor();
|
||||
var refGrp = new ActionReference();
|
||||
refGrp.putEnumerated(charIDToTypeID( "Lyr " ),charIDToTypeID( "Ordn" ),charIDToTypeID( "Trgt" ));
|
||||
descGrp.putReference(charIDToTypeID( "null" ), refGrp );
|
||||
executeAction( idGrp, descGrp, DialogModes.ALL );
|
||||
var resultLayers=new Array();
|
||||
for (var ix=0;ix<app.activeDocument.activeLayer.layers.length;ix++){resultLayers.push(app.activeDocument.activeLayer.layers[ix])}
|
||||
var id8 = charIDToTypeID( "slct" );
|
||||
var desc5 = new ActionDescriptor();
|
||||
var id9 = charIDToTypeID( "null" );
|
||||
var ref2 = new ActionReference();
|
||||
var id10 = charIDToTypeID( "HstS" );
|
||||
var id11 = charIDToTypeID( "Ordn" );
|
||||
var id12 = charIDToTypeID( "Prvs" );
|
||||
ref2.putEnumerated( id10, id11, id12 );
|
||||
desc5.putReference( id9, ref2 );
|
||||
executeAction( id8, desc5, DialogModes.NO );
|
||||
return resultLayers;
|
||||
}
|
||||
function getLayers (layer, collect) {
|
||||
if (!layer.layers || layer.layers.length == 0) return layer;
|
||||
if(layer != app.activeDocument){
|
||||
collect.push(layer);
|
||||
}
|
||||
|
||||
for (var i = 0, n = layer.layers.length; i < n; i++) {
|
||||
// For checking if its an adjustment layer, but it also excludes
|
||||
// LayerSets so we need to find the different types needed.
|
||||
//if (layer.layers[i].kind == LayerKind.NORMAL) {
|
||||
//collect.push(layer.layers[i]);
|
||||
var child = getLayers(layer.layers[i], collect);
|
||||
if (child) collect.push(child);
|
||||
//}
|
||||
}
|
||||
}
|
||||
function Map() {
|
||||
this.keys = new Array();
|
||||
this.values= new Array();
|
||||
//添加键值对
|
||||
this.set = function (key, value) {
|
||||
if (this.values[key] == null) {//如键不存在则身【键】数组添加键名
|
||||
this.keys.push(value);
|
||||
}
|
||||
this.values[key] = value;//给键赋值
|
||||
};
|
||||
//获取键对应的值
|
||||
this.get = function (key) {
|
||||
return this.values[key];
|
||||
};
|
||||
//去除键值,(去除键数据中的键名及对应的值)
|
||||
this.remove = function (key) {
|
||||
this.keys.remove(key);
|
||||
this.values[key] = null;
|
||||
};
|
||||
//判断键值元素是否为空
|
||||
this.isEmpty = function () {
|
||||
return this.keys.length == 0;
|
||||
};
|
||||
//获取键值元素大小
|
||||
this.size = function () {
|
||||
return this.keys.length;
|
||||
};
|
||||
}
|
332
ccc-tnt-psd2ui-v2.4.x/README.md
Normal file
332
ccc-tnt-psd2ui-v2.4.x/README.md
Normal file
@ -0,0 +1,332 @@
|
||||
|
||||
# psd转预制体
|
||||
### 介绍
|
||||
将 psd 转为可以直接在 cocos 中使用的预制体,并导出图片资源。
|
||||
前提是需要在 Photoshop 中根据文档做好图层的处理。
|
||||
美术同学把效果做好,我们只需要调整一下图层就可以了。
|
||||
大大提升了预制体制作的效率
|
||||
|
||||
插件文件夹提供了一个能够正确导出为预制体的的 psd 文件可以作为参考 `extensions\psd2ui\test\demo.psd`
|
||||
|
||||
支持的 CocosCreator 版本:`2.4.x`
|
||||
如果无法拖放 psd 文件或文件夹,可能是 CocosCreator 的权限不够,尝试使用管理员方式打开 CocosCreator 或者使用 打开文件 功能
|
||||
|
||||
|
||||
|
||||
### 工具特性
|
||||
相同的图像只会导出一张图片
|
||||
如果是相同的图像但是大小不同,则可以使用 `bind` 功能进行绑定,具体使用可以字段说明和示例文件
|
||||
如果是相同的图像但是旋转角度不同,则会导出多张旋转角度不同的图片,需要手动去 Cocos 中处理旋转
|
||||
|
||||
工具在导出资源的时候会将图片的 MD5 值写入到缓存文件,当其他 psd 有相同 MD5 值的图片时,不再导出图片
|
||||
工具在首次使用时会自动执行一次缓存项目所有资源 MD5 值
|
||||
美术导出的图片 MD5 值可能与本工具导出的图片 MD5 值不一致,所以当出现相同的图片时请考虑这种情况
|
||||
|
||||
### 界面说明
|
||||
|
||||

|
||||
|
||||
1. 缓存资源按钮: 手动缓存资源MD5,当你不确定资源是否完全缓存的时候可以执行
|
||||
2. 强制导出图片选项: 勾选后,即使已经进行缓存的资源同样会导出图片
|
||||
3. 只导出图片选项: 可以把此工具只当做是切图工具,同时会将文本图层的字号及颜色输出到文件
|
||||
4. 输出路径输入框: 可以直接导出到指定路径,如果没有填写,默认为 psd 同级目录
|
||||
5. 红框区域:拖入 psd 文件夹或 psd 文件
|
||||
|
||||
## 属性
|
||||
|
||||
<a href="#Btn"> @Btn | @btn 按钮</a>
|
||||
|
||||
<a href="#ProgressBar"> @ProgressBar | @progressBar 进度条</a>
|
||||
|
||||
<a href="#Toggle"> @Toggle | @toggle 选项按钮</a>
|
||||
|
||||
<a href="#png9"> @.9 九宫格</a>
|
||||
|
||||
<a href="#ar"> @ar 锚点</a>
|
||||
|
||||
<a href="#size"> @size 尺寸</a>
|
||||
|
||||
<a href="#full"> @full 全屏</a>
|
||||
|
||||
<a href="#scale"> @scale 缩放</a>
|
||||
|
||||
<a href="#ignore"> @ignore | @ig 忽略导出图片和节点</a>
|
||||
|
||||
<a href="#ignorenode"> @ignorenode | @ignode 忽略导出节点</a>
|
||||
|
||||
<a href="#ignoreimg"> @ignoreimg | @igimg 忽略图片</a>
|
||||
|
||||
<a href="#img"> @img 图片选项</a>
|
||||
|
||||
<a href="#flip"> @flip 翻转图像</a>
|
||||
|
||||
<a href="#flipX"> @flipX 翻转图像 (flip 变种)</a>
|
||||
|
||||
<a href="#flipY"> @flipY 翻转图像 (flip 变种)</a>
|
||||
|
||||
|
||||
|
||||
### 组件
|
||||
|
||||
<a id="Btn"></a>
|
||||
```
|
||||
@Btn || @btn
|
||||
|
||||
作用图层: 所有图层
|
||||
```
|
||||
|
||||
<a id="ProgressBar"></a>
|
||||
```
|
||||
@ProgressBar || @progressBar
|
||||
作用图层: 组图层
|
||||
|
||||
@bar
|
||||
|
||||
bar 为 ProgressBar 的属性,类型为 Sprite
|
||||
作用图层: 图像图层
|
||||
```
|
||||
|
||||
<a id="Toggle"></a>
|
||||
```
|
||||
@Toggle || @toggle
|
||||
作用图层: 组图层
|
||||
|
||||
@check
|
||||
|
||||
check 为 Toggle 的属性,类型为 Sprite
|
||||
作用图层: 图像图层
|
||||
|
||||
|
||||
```
|
||||
|
||||
### Field
|
||||
|
||||
|
||||
<a id="png9"></a>
|
||||
```
|
||||
@.9{l:0,r:0,b:0,t:0}
|
||||
|
||||
九宫格
|
||||
作用图层: 图像图层
|
||||
|
||||
参数:
|
||||
l = left
|
||||
r = right
|
||||
b = bottom
|
||||
t = top
|
||||
ps:
|
||||
l r 只填写其中一项,则为对称
|
||||
b t 同上
|
||||
不填写则默认为 0
|
||||
```
|
||||
|
||||
```
|
||||
@ar{x:0,y:0}
|
||||
|
||||
锚点
|
||||
作用图层: 所有图层
|
||||
|
||||
参数:
|
||||
参数都为可选
|
||||
不填写则默认为 0.5
|
||||
|
||||
```
|
||||
|
||||
<a id="size"></a>
|
||||
```
|
||||
@size{w:100,h:100}
|
||||
|
||||
节点尺寸 非图片尺寸
|
||||
作用图层: 所有图层
|
||||
|
||||
参数:
|
||||
w?: 宽
|
||||
h?: 高
|
||||
只对填写的参数生效,未填写的则为计算到的值
|
||||
无参数不生效
|
||||
|
||||
```
|
||||
|
||||
<a id="full"></a>
|
||||
```
|
||||
@full
|
||||
|
||||
节点设置为全屏尺寸
|
||||
作用图层: 组图层
|
||||
|
||||
```
|
||||
|
||||
<a id="scale"></a>
|
||||
```
|
||||
@scale{x:1,y:1}
|
||||
|
||||
节点缩放
|
||||
作用图层: 所有图层
|
||||
|
||||
参数:
|
||||
x?: x 方向
|
||||
y?: y 方向
|
||||
只对填写的参数生效,未填写的则为 1
|
||||
|
||||
```
|
||||
|
||||
<a id="ignore"></a>
|
||||
```
|
||||
@ignore
|
||||
@ig
|
||||
|
||||
忽略导出图像和节点
|
||||
作用图层: 所有图层
|
||||
```
|
||||
|
||||
<a id="ignorenode"></a>
|
||||
```
|
||||
@ignorenode
|
||||
@ignode
|
||||
|
||||
忽略导出节点
|
||||
作用图层: 所有图层
|
||||
```
|
||||
|
||||
<a id="ignoreimg"></a>
|
||||
```
|
||||
@ignoreimg
|
||||
@igimg
|
||||
|
||||
忽略导出图像
|
||||
作用图层: 图像图层
|
||||
```
|
||||
|
||||
<a id="img"></a>
|
||||
```
|
||||
@img{name: string,id: 0,bind: 0}
|
||||
|
||||
定制图片
|
||||
作用图层:图像图层
|
||||
|
||||
参数:
|
||||
id: number 可选 当前文档中图片唯一 id
|
||||
name: string 可选 导出的图片名
|
||||
bind: number 可选 绑定 图像 id
|
||||
```
|
||||
|
||||
<a id="flip"></a>
|
||||
```
|
||||
@flip{bind: 0, x: 0, y: 0}
|
||||
|
||||
镜像图像
|
||||
作用图层:图像图层
|
||||
|
||||
参数:
|
||||
bind: number 必选 被绑定的图片 需要用 @img{id:number} 做标记
|
||||
x: 0 | 1, 可选, 1 为 进行 x 方向镜像
|
||||
y: 0 | 1, 可选, 1 为 进行 y 方向镜像
|
||||
x,y 都缺省时,默认 x 方向镜像
|
||||
|
||||
注意:
|
||||
@flip 的图层不会导出图像
|
||||
```
|
||||
|
||||
<a id="flipX"></a>
|
||||
```
|
||||
@flipX{bind: 0}
|
||||
|
||||
flip 的变种 x 方向镜像图像
|
||||
作用图层:图像图层
|
||||
|
||||
参数:
|
||||
bind: number 必选 被绑定的图片 需要用 @img{id:number} 做标记
|
||||
|
||||
注意:
|
||||
@flipX 的图层不会导出图像
|
||||
```
|
||||
|
||||
<a id="flipY"></a>
|
||||
```
|
||||
@flipY{bind: 0}
|
||||
|
||||
flip 的变种 y 方向镜像图像vv
|
||||
作用图层:图像图层
|
||||
|
||||
参数:
|
||||
bind: number 必选 被绑定的图片 需要用 @img{id:number} 做标记
|
||||
|
||||
注意:
|
||||
@flipY 的图层不会导出图像
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 说明
|
||||
多个字段可作用在同一个图层上,按需使用
|
||||
|
||||
|
||||
|
||||
### 例如
|
||||
```
|
||||
节点名@Btn@size{w:100,h:100}
|
||||
|
||||
节点名@ar{x:1,y:1}@full@img{name:bg}
|
||||
```
|
||||
|
||||
|
||||
## 注意事项
|
||||
### 美术
|
||||
- 智能图层 支持
|
||||
- 图层样式
|
||||
- 颜色叠加: 文本图层支持,图像图层不支持
|
||||
- 描边: 文本图层支持
|
||||
- 其他图层样式不支持
|
||||
|
||||
工具会把 画布外的图像也导出成图片,需要美术将 画布外 不需要导出的图像处理掉
|
||||
需要美术将多个碎图组合的图像合并成智能图层或栅格化后使用,除非它们是作为碎图使用
|
||||
|
||||
|
||||
|
||||
### 程序 配置
|
||||
如果想对指定组件进行统一定制,可以修改 `psd2ui/config/psd.config.json` 文件
|
||||
key 为组件名,val 为 预制体参数,你可以对任意组件的任意属性进行定制
|
||||
|
||||
例如当你想在导出时默认使用指定字体:
|
||||
```
|
||||
cc2.4.x 可以配置为
|
||||
{
|
||||
"cc.Label": {
|
||||
"_N$file":{
|
||||
"__uuid__": "7ecfa26a-27ec-4e2c-9815-d7c4c744d53f"
|
||||
},
|
||||
"_isSystemFontUsed": false
|
||||
}
|
||||
}
|
||||
|
||||
cc3.7.x 可以配置为
|
||||
"cc.Label": {
|
||||
"_font": {
|
||||
"__uuid__": "7ecfa26a-27ec-4e2c-9815-d7c4c744d53f",
|
||||
"__expectedType__": "cc.TTFFont"
|
||||
},
|
||||
"_isSystemFontUsed": false
|
||||
}
|
||||
// 以上这些配置会覆盖正常的属性数据,没有其他属性不受影响。
|
||||
|
||||
|
||||
// 特殊配置
|
||||
"textOffsetY":{
|
||||
"default": 0,
|
||||
"36": 0
|
||||
},
|
||||
"textLineHeightOffset": 0
|
||||
```
|
||||
|
||||
// textOffsetY: Label节点 Y 偏移,当你使用了定制的字体的时候,可能在 PS 中与 CocosCreator 中表现不一致,可以使用这个参数进行处理,字号为 key,偏移量为值
|
||||
|
||||
// textLineHeightOffset: Label节点行高增量,默认没有增量,行高默认为字体大小,当你想将行高统一高n个像素的时候可以使用这个配置
|
||||
|
||||
以字号为 key ,偏移值 为 val
|
||||
如果没有配置 某些字号,则 使用 default 默认偏移值,如果没有配置 default, 偏移为 0
|
||||
|
||||
```
|
||||
|
||||
## 已知bug
|
||||
使用 强制导出图片选项时,输入为多个 psd 或含有多个 psd 文件的文件夹时,如果在不同 psd 含有相同 md5 的图像,则会在各自目录下生成相同 uuid 的图片
|
||||
|
7
ccc-tnt-psd2ui-v2.4.x/config/psd.config.json
Normal file
7
ccc-tnt-psd2ui-v2.4.x/config/psd.config.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"textOffsetY":{
|
||||
"default": 0,
|
||||
"36": 0
|
||||
},
|
||||
"textLineHeightOffset": 0
|
||||
}
|
1
ccc-tnt-psd2ui-v2.4.x/jsconfig.json
Normal file
1
ccc-tnt-psd2ui-v2.4.x/jsconfig.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "$PREFB_UUID",
|
||||
"importer": "prefab",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false,
|
||||
"subMetas": {}
|
||||
}
|
13
ccc-tnt-psd2ui-v2.4.x/libs/assets/cc/meta/CCPrefab.meta.v342
Normal file
13
ccc-tnt-psd2ui-v2.4.x/libs/assets/cc/meta/CCPrefab.meta.v342
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.35",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "$PREFB_UUID",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "$NODE_NAME"
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "$SPRITE_FRAME_UUID",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": $WIDTH,
|
||||
"height": $HEIGHT,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"$FILE_NAME": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "$TEXTURE_UUID",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "$SPRITE_FRAME_UUID",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": $WIDTH,
|
||||
"height": $HEIGHT,
|
||||
"rawWidth": $WIDTH,
|
||||
"rawHeight": $HEIGHT,
|
||||
"borderTop": $BORDER_TOP,
|
||||
"borderBottom": $BORDER_BOTTOM,
|
||||
"borderLeft": $BORDER_LEFT,
|
||||
"borderRight": $BORDER_RIGHT,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
{
|
||||
"ver": "1.0.22",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "$TEXTURE_UUID",
|
||||
"files": [
|
||||
".png",
|
||||
".json"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "$TEXTURE_UUID@6c48a",
|
||||
"displayName": "$FILE_NAME",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "$TEXTURE_UUID",
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0,
|
||||
"isUuid": true
|
||||
},
|
||||
"ver": "1.0.21",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
},
|
||||
"f9941": {
|
||||
"importer": "sprite-frame",
|
||||
"uuid": "$TEXTURE_UUID@f9941",
|
||||
"displayName": "$FILE_NAME",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": $WIDTH,
|
||||
"height": $HEIGHT,
|
||||
"rawWidth": $WIDTH,
|
||||
"rawHeight": $HEIGHT,
|
||||
"borderTop": $BORDER_TOP,
|
||||
"borderBottom": $BORDER_BOTTOM,
|
||||
"borderLeft": $BORDER_LEFT,
|
||||
"borderRight": $BORDER_RIGHT,
|
||||
"packable": true,
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "$TEXTURE_UUID@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.9",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": true,
|
||||
"redirect": "$TEXTURE_UUID@f9941"
|
||||
}
|
||||
}
|
10
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/EditorVersion.js
Normal file
10
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/EditorVersion.js
Normal file
@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.EditorVersion = void 0;
|
||||
var EditorVersion;
|
||||
(function (EditorVersion) {
|
||||
EditorVersion[EditorVersion["all"] = 0] = "all";
|
||||
EditorVersion[EditorVersion["v249"] = 1] = "v249";
|
||||
EditorVersion[EditorVersion["v342"] = 2] = "v342";
|
||||
EditorVersion[EditorVersion["v362"] = 3] = "v362";
|
||||
})(EditorVersion = exports.EditorVersion || (exports.EditorVersion = {}));
|
180
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/ExportImageMgr.js
Normal file
180
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/ExportImageMgr.js
Normal file
@ -0,0 +1,180 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.exportImageMgr = void 0;
|
||||
require("ag-psd/initialize-canvas"); // only needed for reading image data and thumbnails
|
||||
const psd = __importStar(require("ag-psd"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const ImageMgr_1 = require("./assets-manager/ImageMgr");
|
||||
const FileUtils_1 = require("./utils/FileUtils");
|
||||
const Parser_1 = require("./Parser");
|
||||
const PsdGroup_1 = require("./psd/PsdGroup");
|
||||
const PsdText_1 = require("./psd/PsdText");
|
||||
class ExportImageMgr {
|
||||
constructor() {
|
||||
this.textObjects = [];
|
||||
}
|
||||
test() {
|
||||
const outDir = path_1.default.join(__dirname, "..", "out");
|
||||
let psdPath = "./test-img-only/境界奖励-优化.psd";
|
||||
this.parsePsd(psdPath, outDir);
|
||||
}
|
||||
exec(args) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// 检查参数
|
||||
if (!this.checkArgs(args)) {
|
||||
return;
|
||||
}
|
||||
// 判断输入是文件夹还是文件
|
||||
let stat = fs_extra_1.default.lstatSync(args.input);
|
||||
let isDirectory = stat.isDirectory();
|
||||
if (isDirectory) {
|
||||
if (!args.output) {
|
||||
args.output = path_1.default.join(args.input, "psd2ui");
|
||||
}
|
||||
this.parsePsdDir(args.input, args.output);
|
||||
}
|
||||
else {
|
||||
if (!args.output) {
|
||||
let input_dir = path_1.default.dirname(args.input);
|
||||
args.output = path_1.default.join(input_dir, "psd2ui");
|
||||
}
|
||||
this.parsePsd(args.input, args.output);
|
||||
}
|
||||
});
|
||||
}
|
||||
// 检查参数
|
||||
checkArgs(args) {
|
||||
if (!args.input) {
|
||||
console.error(`请设置 --input`);
|
||||
return false;
|
||||
}
|
||||
if (!fs_extra_1.default.existsSync(args.input)) {
|
||||
console.error(`输入路径不存在: ${args.input}`);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
parsePsdDir(dir, outDir) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// 清空目录
|
||||
fs_extra_1.default.emptyDirSync(outDir);
|
||||
let psds = FileUtils_1.fileUtils.filterFile(dir, (fileName) => {
|
||||
let extname = path_1.default.extname(fileName);
|
||||
if (extname == ".psd") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
for (let i = 0; i < psds.length; i++) {
|
||||
const element = psds[i];
|
||||
yield this.parsePsd(element, outDir);
|
||||
}
|
||||
});
|
||||
}
|
||||
parsePsd(psdPath, outDir) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// 每开始一个新的 psd 清理掉上一个 psd 的图
|
||||
ImageMgr_1.imageMgr.clear();
|
||||
this.textObjects.length = 0;
|
||||
console.log(`=========================================`);
|
||||
console.log(`处理 ${psdPath} 文件`);
|
||||
let psdName = path_1.default.basename(psdPath, ".psd");
|
||||
let buffer = fs_extra_1.default.readFileSync(psdPath);
|
||||
const psdFile = psd.readPsd(buffer);
|
||||
let psdRoot = Parser_1.parser.parseLayer(psdFile);
|
||||
psdRoot.name = psdName;
|
||||
let prefabDir = path_1.default.join(outDir, psdName);
|
||||
let textureDir = path_1.default.join(prefabDir, "textures");
|
||||
fs_extra_1.default.mkdirsSync(prefabDir); // 创建预制体根目录
|
||||
fs_extra_1.default.emptyDirSync(prefabDir);
|
||||
fs_extra_1.default.mkdirsSync(textureDir); //创建 图片目录
|
||||
yield this.saveImage(textureDir);
|
||||
yield this.saveTextFile(psdRoot, prefabDir);
|
||||
console.log(`psd2ui ${psdPath} 处理完成`);
|
||||
});
|
||||
}
|
||||
saveImage(out) {
|
||||
let images = ImageMgr_1.imageMgr.getAllImage();
|
||||
let idx = 0;
|
||||
images.forEach((psdImage, k) => {
|
||||
// 查找镜像
|
||||
let _layer = ImageMgr_1.imageMgr.getSerialNumberImage(psdImage);
|
||||
let name = `${_layer.imgName}_${idx}`;
|
||||
console.log(`保存图片 [${_layer.imgName}] 重命名为 [${name}] md5: ${_layer.md5}`);
|
||||
let fullpath = path_1.default.join(out, `${name}.png`);
|
||||
fs_extra_1.default.writeFileSync(fullpath, _layer.imgBuffer);
|
||||
idx++;
|
||||
});
|
||||
}
|
||||
saveTextFile(psdRoot, out) {
|
||||
this.scanText(psdRoot, psdRoot);
|
||||
let textContent = JSON.stringify(this.textObjects, null, 2);
|
||||
let fullpath = path_1.default.join(out, `text.txt`);
|
||||
fs_extra_1.default.writeFileSync(fullpath, textContent, { encoding: "utf-8" });
|
||||
}
|
||||
scanText(layer, psdRoot) {
|
||||
if (layer instanceof PsdGroup_1.PsdGroup) {
|
||||
for (let i = 0; i < layer.children.length; i++) {
|
||||
const childLayer = layer.children[i];
|
||||
this.scanText(childLayer, psdRoot);
|
||||
}
|
||||
}
|
||||
else if (layer instanceof PsdText_1.PsdText) {
|
||||
let textObj = {
|
||||
text: layer.text,
|
||||
fontSize: layer.fontSize,
|
||||
color: `#${layer.color.toHEX()}`
|
||||
};
|
||||
// 有描边
|
||||
if (layer.outline) {
|
||||
textObj.outlineWidth = layer.outline.width;
|
||||
textObj.outlineColor = `#${layer.outline.color.toHEX()}`;
|
||||
}
|
||||
this.textObjects.push(textObj);
|
||||
}
|
||||
}
|
||||
static getInstance() {
|
||||
if (!this._instance) {
|
||||
this._instance = new ExportImageMgr();
|
||||
}
|
||||
return this._instance;
|
||||
}
|
||||
}
|
||||
ExportImageMgr._instance = null;
|
||||
exports.exportImageMgr = ExportImageMgr.getInstance();
|
507
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/Main.js
Normal file
507
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/Main.js
Normal file
@ -0,0 +1,507 @@
|
||||
"use strict";
|
||||
//ag-psd 使用 参考 https://github.com/Agamnentzar/ag-psd/blob/HEAD/README_PSD.md
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Main = void 0;
|
||||
require("ag-psd/initialize-canvas"); // only needed for reading image data and thumbnails
|
||||
const psd = __importStar(require("ag-psd"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const Parser_1 = require("./Parser");
|
||||
const PsdGroup_1 = require("./psd/PsdGroup");
|
||||
const CCNode_1 = require("./engine/cc/CCNode");
|
||||
const PsdImage_1 = require("./psd/PsdImage");
|
||||
const PsdText_1 = require("./psd/PsdText");
|
||||
const CCSprite_1 = require("./engine/cc/CCSprite");
|
||||
const CCPrefabInfo_1 = require("./engine/cc/CCPrefabInfo");
|
||||
const CCPrefab_1 = require("./engine/cc/CCPrefab");
|
||||
const CCSize_1 = require("./engine/cc/values/CCSize");
|
||||
const CCVec2_1 = require("./engine/cc/values/CCVec2");
|
||||
const CCLabel_1 = require("./engine/cc/CCLabel");
|
||||
const CCLabelOutline_1 = require("./engine/cc/CCLabelOutline");
|
||||
const ImageCacheMgr_1 = require("./assets-manager/ImageCacheMgr");
|
||||
const EditorVersion_1 = require("./EditorVersion");
|
||||
const config_1 = require("./config");
|
||||
const FileUtils_1 = require("./utils/FileUtils");
|
||||
const ImageMgr_1 = require("./assets-manager/ImageMgr");
|
||||
const ExportImageMgr_1 = require("./ExportImageMgr");
|
||||
const CCUIOpacity_1 = require("./engine/cc/CCUIOpacity");
|
||||
const CCUITransform_1 = require("./engine/cc/CCUITransform");
|
||||
const CCVec3_1 = require("./engine/cc/values/CCVec3");
|
||||
/***
|
||||
* 执行流程
|
||||
* - 首次运行,先读取项目文件夹下所有图片资源,进行 md5 缓存
|
||||
*
|
||||
* - 加载缓存文件
|
||||
* - 处理 psd
|
||||
* - 通过 md5 判断是否已经存在资源,如果存在, 则不再导出,预制体中使用已存在的资源的 uuid
|
||||
*
|
||||
*/
|
||||
console.log(`当前目录: `, __dirname);
|
||||
class Main {
|
||||
constructor() {
|
||||
this.spriteFrameMetaContent = "";
|
||||
this.prefabMetaContent = "";
|
||||
this.psdConfig = null;
|
||||
// 强制导出图片
|
||||
this.isForceImg = false;
|
||||
}
|
||||
test() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// config.editorVersion = EditorVersion.v342;
|
||||
// // 首次运行需要读取所有图片
|
||||
// await imageCacheMgr.loadImages("E:\\Demo\\CC249JSTest\\assets");
|
||||
// // await imageCacheMgr.loadImages("E:\\YQ\\Code\\trunk\\assets");
|
||||
// await imageCacheMgr.saveImageMap("E:\\Git\\ccc-framework-3d\\tools\\psd2ui\\cache\\cache.json");
|
||||
const outDir = path_1.default.join(__dirname, "..", "out");
|
||||
// // 加载测试配置
|
||||
this.loadPsdConfig(path_1.default.join(__dirname, "../test/test.config.json"));
|
||||
// // 首先加载缓存文件
|
||||
yield ImageCacheMgr_1.imageCacheMgr.initWithPath("E:\\Git\\ccc-framework-3d\\tools\\psd2ui\\cache\\cache.json");
|
||||
yield this.loadMetaTemplete();
|
||||
let psdPath = "./test/demo.psd";
|
||||
// // let psdPath = "E:\\YQ\\Meishu\\D_巅峰对决\\竞猜\\guild_PeakBetMainWindow.psd"
|
||||
// psdPath = "./test/对战动画-切.psd";
|
||||
psdPath = "./test/活动icon.psd";
|
||||
this.parsePsd(psdPath, outDir);
|
||||
// let psdPath = "./test";
|
||||
// let psdPath = "E:\\YQ\\Meishu\\D_巅峰对决\\竞猜\\guild_PeakBetMainWindow.psd"
|
||||
// psdPath = "./test/test.psd";
|
||||
// this.parsePsdDir(psdPath, outDir);
|
||||
yield ImageCacheMgr_1.imageCacheMgr.saveImageMap();
|
||||
console.log(`psd2ui 导出完成`);
|
||||
});
|
||||
}
|
||||
// 首先加载 meta 模板
|
||||
loadMetaTemplete() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
this.spriteFrameMetaContent = fs_extra_1.default.readFileSync(path_1.default.join(__dirname, `../assets/cc/meta/CCSpriteFrame.meta.${EditorVersion_1.EditorVersion[config_1.config.editorVersion]}`), "utf-8");
|
||||
this.prefabMetaContent = fs_extra_1.default.readFileSync(path_1.default.join(__dirname, `../assets/cc/meta/CCPrefab.meta.${EditorVersion_1.EditorVersion[config_1.config.editorVersion]}`), "utf-8");
|
||||
});
|
||||
}
|
||||
// 加载配置
|
||||
loadPsdConfig(filepath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!fs_extra_1.default.existsSync(filepath)) {
|
||||
console.log(`Main-> 配置 ${filepath} 不存在`);
|
||||
return;
|
||||
}
|
||||
// console.log(`Main-> 读取配置 ${filepath}`);
|
||||
let psdConfig = fs_extra_1.default.readFileSync(filepath, "utf-8");
|
||||
this.psdConfig = JSON.parse(psdConfig);
|
||||
// // 合并 文本偏移配置
|
||||
// if (this.psdConfig.textOffsetY) {
|
||||
// config.textOffsetY = Object.assign({}, config.textOffsetY, this.psdConfig.textOffsetY);
|
||||
// }
|
||||
// // 合并 行高配置
|
||||
// if (this.psdConfig.textLineHeightOffset) {
|
||||
// config.textLineHeightOffset = Object.assign({}, config.textLineHeightOffset, this.psdConfig.textLineHeightOffset);
|
||||
// }
|
||||
// 合并配置
|
||||
for (const key in this.psdConfig) {
|
||||
if (key in config_1.config) {
|
||||
if (typeof this.psdConfig[key] === 'object') {
|
||||
config_1.config[key] = Object.assign({}, config_1.config[key], this.psdConfig[key]);
|
||||
}
|
||||
else {
|
||||
config_1.config[key] = this.psdConfig[key] || config_1.config[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
// console.log(`Main-> `,JSON.stringify(config,null,2));
|
||||
});
|
||||
}
|
||||
exec(args) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
args = mergeAlias(args);
|
||||
if (args.help) {
|
||||
console.log(`help:\n`, config_1.config.help);
|
||||
return false;
|
||||
}
|
||||
// 只导出图片
|
||||
if (args["img-only"]) {
|
||||
ExportImageMgr_1.exportImageMgr.exec(args);
|
||||
return true;
|
||||
}
|
||||
let writeCache = () => __awaiter(this, void 0, void 0, function* () {
|
||||
// 写入缓存
|
||||
if (args.cache) {
|
||||
fs_extra_1.default.mkdirsSync(path_1.default.dirname(args.cache));
|
||||
yield ImageCacheMgr_1.imageCacheMgr.saveImageMap(args.cache);
|
||||
}
|
||||
});
|
||||
// 设置引擎版本
|
||||
if (args["engine-version"]) {
|
||||
config_1.config.editorVersion = EditorVersion_1.EditorVersion[args["engine-version"]];
|
||||
}
|
||||
if (args.init && (!args["project-assets"] || !args.cache)) {
|
||||
console.log(`psd2ui --init 无法处理,请设置 --project-assets`);
|
||||
return;
|
||||
}
|
||||
// 在没有缓存文件或者 指定重新缓存的时候,读取项目资源
|
||||
if (args["project-assets"] && (!fs_extra_1.default.existsSync(args.cache) || args["cache-remake"] || args.init)) {
|
||||
yield ImageCacheMgr_1.imageCacheMgr.loadImages(args["project-assets"]);
|
||||
// 先写入一次
|
||||
writeCache();
|
||||
if (args.init) {
|
||||
console.log(`psd2ui 缓存完成`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 检查参数
|
||||
if (!this.checkArgs(args)) {
|
||||
return;
|
||||
}
|
||||
if (args.cache) {
|
||||
yield ImageCacheMgr_1.imageCacheMgr.initWithPath(args.cache);
|
||||
}
|
||||
// 加载 meta 文件模板
|
||||
yield this.loadMetaTemplete();
|
||||
if (args.config) {
|
||||
yield this.loadPsdConfig(args.config);
|
||||
}
|
||||
this.isForceImg = !!args["force-img"];
|
||||
// 判断输入是文件夹还是文件
|
||||
let stat = fs_extra_1.default.lstatSync(args.input);
|
||||
let isDirectory = stat.isDirectory();
|
||||
if (isDirectory) {
|
||||
if (!args.output) {
|
||||
args.output = path_1.default.join(args.input, "psd2ui");
|
||||
}
|
||||
this.parsePsdDir(args.input, args.output);
|
||||
}
|
||||
else {
|
||||
if (!args.output) {
|
||||
let input_dir = path_1.default.dirname(args.input);
|
||||
args.output = path_1.default.join(input_dir, "psd2ui");
|
||||
}
|
||||
this.parsePsd(args.input, args.output);
|
||||
}
|
||||
// 写入缓存
|
||||
yield writeCache();
|
||||
console.log(`psd2ui 导出完成`);
|
||||
});
|
||||
}
|
||||
// 检查参数
|
||||
checkArgs(args) {
|
||||
if (!args.input) {
|
||||
console.error(`请设置 --input`);
|
||||
return false;
|
||||
}
|
||||
// 没有输出目录的时候用 输入目录
|
||||
// if (!args.output) {
|
||||
// console.error(`请设置 --output`);
|
||||
// return false;
|
||||
// }
|
||||
if (!fs_extra_1.default.existsSync(args.input)) {
|
||||
console.error(`输入路径不存在: ${args.input}`);
|
||||
return false;
|
||||
}
|
||||
if (args["engine-version"]) {
|
||||
let editorVersion = EditorVersion_1.EditorVersion[args["engine-version"]];
|
||||
switch (editorVersion) {
|
||||
case EditorVersion_1.EditorVersion.v249:
|
||||
case EditorVersion_1.EditorVersion.v342:
|
||||
break;
|
||||
default:
|
||||
console.log(`暂未实现该引擎版本 ${args["engine-version"]}`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
parsePsdDir(dir, outDir) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// 清空目录
|
||||
// fs.emptyDirSync(outDir);
|
||||
let psds = FileUtils_1.fileUtils.filterFile(dir, (fileName) => {
|
||||
let extname = path_1.default.extname(fileName);
|
||||
if (extname == ".psd") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
for (let i = 0; i < psds.length; i++) {
|
||||
const element = psds[i];
|
||||
yield this.parsePsd(element, outDir);
|
||||
}
|
||||
});
|
||||
}
|
||||
parsePsd(psdPath, outDir) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// 每开始一个新的 psd 清理掉上一个 psd 的图
|
||||
ImageMgr_1.imageMgr.clear();
|
||||
console.log(`=========================================`);
|
||||
console.log(`处理 ${psdPath} 文件`);
|
||||
let psdName = path_1.default.basename(psdPath, ".psd");
|
||||
let buffer = fs_extra_1.default.readFileSync(psdPath);
|
||||
const psdFile = psd.readPsd(buffer);
|
||||
let psdRoot = Parser_1.parser.parseLayer(psdFile);
|
||||
psdRoot.name = psdName;
|
||||
let prefabDir = path_1.default.join(outDir, psdName);
|
||||
let textureDir = path_1.default.join(prefabDir, "textures");
|
||||
fs_extra_1.default.mkdirsSync(prefabDir); // 创建预制体根目录
|
||||
// fs.emptyDirSync(prefabDir);
|
||||
fs_extra_1.default.mkdirsSync(textureDir); //创建 图片目录
|
||||
yield this.saveImage(textureDir);
|
||||
yield this.buildPrefab(psdRoot);
|
||||
yield this.savePrefab(psdRoot, prefabDir);
|
||||
console.log(`psd2ui ${psdPath} 处理完成`);
|
||||
});
|
||||
}
|
||||
buildPrefab(psdRoot) {
|
||||
let prefab = new CCPrefab_1.CCPrefab();
|
||||
psdRoot.pushObject(prefab);
|
||||
let data = this.createCCNode(psdRoot, psdRoot);
|
||||
prefab.data = { __id__: data.idx };
|
||||
// 后期处理
|
||||
this.postUIObject(psdRoot, psdRoot);
|
||||
}
|
||||
createCCNode(layer, psdRoot) {
|
||||
var _a, _b, _c, _d;
|
||||
let node = new CCNode_1.CCNode(psdRoot);
|
||||
layer.uiObject = node;
|
||||
node._name = ((_a = layer.attr) === null || _a === void 0 ? void 0 : _a.name) || layer.name;
|
||||
node._active = !layer.hidden;
|
||||
node._opacity = layer.opacity;
|
||||
if (config_1.config.editorVersion >= EditorVersion_1.EditorVersion.v342) {
|
||||
// 3.4.x
|
||||
if (layer.opacity !== 255) {
|
||||
let uiOpacity = new CCUIOpacity_1.CCUIOpacity();
|
||||
uiOpacity._opacity = layer.opacity;
|
||||
uiOpacity.updateWithLayer(layer);
|
||||
node.addComponent(uiOpacity);
|
||||
}
|
||||
}
|
||||
// 劫持尺寸设置,使用 psd 中配置的尺寸,这里不对原数据进行修改
|
||||
let size = new CCSize_1.CCSize(layer.size.width, layer.size.height);
|
||||
if ((_b = layer.attr) === null || _b === void 0 ? void 0 : _b.comps.size) {
|
||||
let _attrSize = layer.attr.comps.size;
|
||||
size.width = (_c = _attrSize.w) !== null && _c !== void 0 ? _c : size.width;
|
||||
size.height = (_d = _attrSize.h) !== null && _d !== void 0 ? _d : size.height;
|
||||
}
|
||||
// 对缩放进行处理
|
||||
size.width = Math.round(Math.abs(size.width / layer.scale.x));
|
||||
size.height = Math.round(Math.abs(size.height / layer.scale.y));
|
||||
// 配置的位置 Y 偏移
|
||||
let offsetY = 0;
|
||||
if (layer instanceof PsdText_1.PsdText) {
|
||||
offsetY = layer.offsetY;
|
||||
}
|
||||
node._contentSize = size;
|
||||
// 更新一下位置 // 根据图层名字设置 锚点,位置, 因为没有对原始数据进行修改,所以这里不考虑 缩放
|
||||
layer.updatePositionWithAR();
|
||||
// 2.4.9
|
||||
node._trs.setPosition(layer.position.x, layer.position.y + offsetY, 0);
|
||||
node._trs.setRotation(0, 0, 0, 1);
|
||||
node._trs.setScale(layer.scale.x, layer.scale.y, layer.scale.z);
|
||||
node._anchorPoint = new CCVec2_1.CCVec2(layer.anchorPoint.x, layer.anchorPoint.y);
|
||||
if (config_1.config.editorVersion >= EditorVersion_1.EditorVersion.v342) {
|
||||
// 3.4.x
|
||||
node._lpos = new CCVec3_1.CCVec3(layer.position.x, layer.position.y + offsetY, 0);
|
||||
node._lrot = new CCVec3_1.CCVec3(0, 0, 0);
|
||||
node._lscale = new CCVec3_1.CCVec3(layer.scale.x, layer.scale.y, layer.scale.z);
|
||||
node._euler = new CCVec3_1.CCVec3();
|
||||
// 3.4.x
|
||||
let uiTransform = new CCUITransform_1.CCUITransform();
|
||||
uiTransform._contentSize = size;
|
||||
uiTransform._anchorPoint = node._anchorPoint;
|
||||
uiTransform.updateWithLayer(layer);
|
||||
node.addComponent(uiTransform);
|
||||
}
|
||||
//
|
||||
if (layer instanceof PsdGroup_1.PsdGroup) {
|
||||
for (let i = 0; i < layer.children.length; i++) {
|
||||
const childLayer = layer.children[i];
|
||||
let childNode = this.createCCNode(childLayer, psdRoot);
|
||||
childNode && node.addChild(childNode);
|
||||
}
|
||||
}
|
||||
else if (layer instanceof PsdImage_1.PsdImage) {
|
||||
let sprite = new CCSprite_1.CCSprite();
|
||||
node.addComponent(sprite);
|
||||
sprite._materials.push({
|
||||
__uuid__: config_1.config.SpriteFrame_Material
|
||||
});
|
||||
sprite.updateWithLayer(layer);
|
||||
if (layer.isIgnore()) {
|
||||
// 忽略图像
|
||||
}
|
||||
else {
|
||||
// 查找绑定的图像
|
||||
let _layer = ImageMgr_1.imageMgr.getSerialNumberImage(layer);
|
||||
// 使用已缓存的 图片 的 uuid
|
||||
let imageWarp = ImageCacheMgr_1.imageCacheMgr.get(_layer.md5);
|
||||
sprite.setSpriteFrame(imageWarp ? imageWarp.textureUuid : _layer.textureUuid);
|
||||
}
|
||||
this.applyConfig(sprite);
|
||||
}
|
||||
else if (layer instanceof PsdText_1.PsdText) {
|
||||
let label = new CCLabel_1.CCLabel();
|
||||
node.addComponent(label);
|
||||
node._color.set(layer.color);
|
||||
label._color.set(layer.color);
|
||||
label._materials.push({
|
||||
__uuid__: config_1.config.Label_Material
|
||||
});
|
||||
label.updateWithLayer(layer);
|
||||
this.applyConfig(label);
|
||||
// 有描边
|
||||
if (layer.outline) {
|
||||
let labelOutline = new CCLabelOutline_1.CCLabelOutline();
|
||||
node.addComponent(labelOutline);
|
||||
labelOutline.updateWithLayer(layer);
|
||||
this.applyConfig(labelOutline);
|
||||
}
|
||||
}
|
||||
// Button / Toggle / ProgressBar
|
||||
if (layer.attr) {
|
||||
for (const key in layer.attr.comps) {
|
||||
if (Object.prototype.hasOwnProperty.call(layer.attr.comps, key) && layer.attr.comps[key]) {
|
||||
let ctor = config_1.config.CompMippings[key];
|
||||
if (ctor) {
|
||||
let comp = new ctor();
|
||||
node.addComponent(comp);
|
||||
comp.updateWithLayer(layer);
|
||||
this.applyConfig(comp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.createPrefabInfo(layer, psdRoot);
|
||||
return node;
|
||||
}
|
||||
createPrefabInfo(layer, psdRoot) {
|
||||
let node = layer.uiObject;
|
||||
let prefabInfo = new CCPrefabInfo_1.CCPrefabInfo();
|
||||
let idx = psdRoot.pushObject(prefabInfo);
|
||||
node._prefab = { __id__: idx };
|
||||
}
|
||||
// 后处理
|
||||
postUIObject(layer, psdRoot) {
|
||||
}
|
||||
saveImage(out) {
|
||||
let images = ImageMgr_1.imageMgr.getAllImage();
|
||||
images.forEach((psdImage, k) => {
|
||||
// 查找镜像
|
||||
let _layer = ImageMgr_1.imageMgr.getSerialNumberImage(psdImage);
|
||||
// 查找已缓存的相同图像
|
||||
let imageWarp = ImageCacheMgr_1.imageCacheMgr.get(_layer.md5);
|
||||
// 不是强制导出的话,判断是否已经导出过
|
||||
if (!this.isForceImg) {
|
||||
// 判断是否已经导出过相同 md5 的资源,不再重复导出
|
||||
if (imageWarp === null || imageWarp === void 0 ? void 0 : imageWarp.isOutput) {
|
||||
console.log(`已有相同资源,不再导出 [${psdImage.imgName}] md5: ${psdImage.md5}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
console.log(`保存图片 [${_layer.imgName}] md5: ${_layer.md5}`);
|
||||
imageWarp && (imageWarp.isOutput = true);
|
||||
let fullpath = path_1.default.join(out, `${_layer.imgName}.png`);
|
||||
fs_extra_1.default.writeFileSync(fullpath, _layer.imgBuffer);
|
||||
this.saveImageMeta(_layer, fullpath);
|
||||
});
|
||||
}
|
||||
saveImageMeta(layer, fullpath) {
|
||||
let _layer = ImageMgr_1.imageMgr.getSerialNumberImage(layer);
|
||||
let imageWarp = ImageCacheMgr_1.imageCacheMgr.get(_layer.md5);
|
||||
if (!imageWarp) {
|
||||
imageWarp = _layer;
|
||||
}
|
||||
// 2.4.9 =-> SPRITE_FRAME_UUID
|
||||
let meta = this.spriteFrameMetaContent.replace(/\$SPRITE_FRAME_UUID/g, imageWarp.uuid);
|
||||
meta = meta.replace(/\$TEXTURE_UUID/g, imageWarp.textureUuid);
|
||||
meta = meta.replace(/\$FILE_NAME/g, _layer.imgName);
|
||||
meta = meta.replace(/\$WIDTH/g, _layer.textureSize.width);
|
||||
meta = meta.replace(/\$HEIGHT/g, _layer.textureSize.height);
|
||||
let s9 = _layer.s9 || {
|
||||
b: 0, t: 0, l: 0, r: 0,
|
||||
};
|
||||
meta = meta.replace(/\$BORDER_TOP/g, s9.t);
|
||||
meta = meta.replace(/\$BORDER_BOTTOM/g, s9.b);
|
||||
meta = meta.replace(/\$BORDER_LEFT/g, s9.l);
|
||||
meta = meta.replace(/\$BORDER_RIGHT/g, s9.r);
|
||||
fs_extra_1.default.writeFileSync(fullpath + `.meta`, meta);
|
||||
}
|
||||
savePrefab(psdDoc, out) {
|
||||
let fullpath = path_1.default.join(out, `${psdDoc.name}.prefab`);
|
||||
fs_extra_1.default.writeFileSync(fullpath, JSON.stringify(psdDoc.objectArray, null, 2));
|
||||
this.savePrefabMeta(psdDoc, fullpath);
|
||||
}
|
||||
savePrefabMeta(psdDoc, fullpath) {
|
||||
let meta = this.prefabMetaContent.replace(/\$PREFB_UUID/g, psdDoc.uuid);
|
||||
fs_extra_1.default.writeFileSync(fullpath + `.meta`, meta);
|
||||
}
|
||||
applyConfig(comp) {
|
||||
if (!this.psdConfig) {
|
||||
return;
|
||||
}
|
||||
if (comp.__type__ in this.psdConfig) {
|
||||
let compConfig = this.psdConfig[comp.__type__];
|
||||
for (const key in compConfig) {
|
||||
if (Object.prototype.hasOwnProperty.call(compConfig, key)) {
|
||||
const element = compConfig[key];
|
||||
comp[key] = element;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Main = Main;
|
||||
/** 合并别名 */
|
||||
function mergeAlias(args) {
|
||||
// 如果是 json 对象参数
|
||||
if (args.json) {
|
||||
let base64 = args.json;
|
||||
// 解码 json
|
||||
args = JSON.parse(Buffer.from(base64, "base64").toString());
|
||||
// // 编码
|
||||
// let jsonContent = JSON.stringify(args);
|
||||
// let base64 = Buffer.from(jsonContent).toString("base64");
|
||||
}
|
||||
args.help = args.help || args.h;
|
||||
args.input = args.input || args.in;
|
||||
args.output = args.output || args.out;
|
||||
args["engine-version"] = args["engine-version"] || args.ev;
|
||||
args["project-assets"] = args["project-assets"] || args.p;
|
||||
args["cache-remake"] = args["cache-remake"] || args.crm;
|
||||
args["force-img"] = args["force-img"] || args.fimg;
|
||||
args.cache = args.cache || args.c;
|
||||
args.init = args.init || args.i;
|
||||
args.config = args.config;
|
||||
return args;
|
||||
}
|
105
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/Parser.js
Normal file
105
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/Parser.js
Normal file
@ -0,0 +1,105 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parser = exports.Parser = void 0;
|
||||
const ImageCacheMgr_1 = require("./assets-manager/ImageCacheMgr");
|
||||
const ImageMgr_1 = require("./assets-manager/ImageMgr");
|
||||
const LayerType_1 = require("./psd/LayerType");
|
||||
const PsdDocument_1 = require("./psd/PsdDocument");
|
||||
const PsdGroup_1 = require("./psd/PsdGroup");
|
||||
const PsdImage_1 = require("./psd/PsdImage");
|
||||
const PsdText_1 = require("./psd/PsdText");
|
||||
class Parser {
|
||||
/** 解析图层类型 */
|
||||
parseLayerType(source) {
|
||||
if ("children" in source) {
|
||||
if ("width" in source && "height" in source) {
|
||||
// Document
|
||||
return LayerType_1.LayerType.Doc;
|
||||
}
|
||||
else {
|
||||
// Group
|
||||
return LayerType_1.LayerType.Group;
|
||||
}
|
||||
}
|
||||
else if ("text" in source) {
|
||||
// Text
|
||||
return LayerType_1.LayerType.Text;
|
||||
}
|
||||
// else if ('placedLayer' in layer) {
|
||||
// // 智能对象
|
||||
// }
|
||||
return LayerType_1.LayerType.Image;
|
||||
}
|
||||
parseLayer(source, parent, rootDoc) {
|
||||
let layer = null;
|
||||
let layerType = this.parseLayerType(source);
|
||||
switch (layerType) {
|
||||
case LayerType_1.LayerType.Doc:
|
||||
case LayerType_1.LayerType.Group:
|
||||
{
|
||||
let group = null;
|
||||
// Group
|
||||
if (layerType == LayerType_1.LayerType.Group) {
|
||||
group = new PsdGroup_1.PsdGroup(source, parent, rootDoc);
|
||||
if (group.attr.comps.ignorenode || group.attr.comps.ignore) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Document
|
||||
group = new PsdDocument_1.PsdDocument(source);
|
||||
}
|
||||
for (let i = 0; i < source.children.length; i++) {
|
||||
const childSource = source.children[i];
|
||||
let child = this.parseLayer(childSource, group, rootDoc || group);
|
||||
if (child) {
|
||||
if (!child.attr.comps.ignorenode && !child.attr.comps.ignore) {
|
||||
// 没有进行忽略节点的时候才放入列表
|
||||
group.children.push(child);
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.error(`图层解析错误`);
|
||||
}
|
||||
}
|
||||
layer = group;
|
||||
}
|
||||
break;
|
||||
case LayerType_1.LayerType.Image:
|
||||
{
|
||||
//
|
||||
if (!source.canvas) {
|
||||
console.error(`Parser-> 空图层 ${source === null || source === void 0 ? void 0 : source.name}`);
|
||||
return null;
|
||||
}
|
||||
// Image
|
||||
let image = layer = new PsdImage_1.PsdImage(source, parent, rootDoc);
|
||||
ImageMgr_1.imageMgr.add(image);
|
||||
// 没有设置忽略且不说镜像的情况下才进行缓存
|
||||
if (!image.isIgnore() && !image.isBind()) {
|
||||
if (!ImageCacheMgr_1.imageCacheMgr.has(image.md5)) {
|
||||
ImageCacheMgr_1.imageCacheMgr.set(image.md5, {
|
||||
uuid: image.uuid,
|
||||
textureUuid: image.textureUuid,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LayerType_1.LayerType.Text:
|
||||
{
|
||||
// Text
|
||||
layer = new PsdText_1.PsdText(source, parent, rootDoc);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
layer.layerType = layerType;
|
||||
layer.parseSource();
|
||||
layer.onCtor();
|
||||
return layer;
|
||||
}
|
||||
}
|
||||
exports.Parser = Parser;
|
||||
exports.parser = new Parser();
|
2
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/_declare.js
Normal file
2
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/_declare.js
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
123
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/_decorator.js
Normal file
123
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/_decorator.js
Normal file
@ -0,0 +1,123 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ccversion = exports.cctype = exports.nonserialization = void 0;
|
||||
const EditorVersion_1 = require("./EditorVersion");
|
||||
/** 禁止序列化 */
|
||||
let nonserialization = (target, propertyKey) => {
|
||||
if (!target.__unserialization) {
|
||||
target.__unserialization = [];
|
||||
}
|
||||
target.__unserialization.push(propertyKey);
|
||||
// if(!target.toJSON){
|
||||
// // JSON.stringify 自动调用
|
||||
// target.toJSON = function(){
|
||||
// let data:Record<any,any> = {};
|
||||
// for (const key in this) {
|
||||
// if (Object.prototype.hasOwnProperty.call(this, key)) {
|
||||
// // @ts-ignore
|
||||
// if(this.__unserialization.indexOf(key) !== -1){
|
||||
// continue;
|
||||
// }
|
||||
// // 判断编辑器版本
|
||||
// if(this._version && !this._version[key][EditorVersion[config.editorVersion]]){
|
||||
// continue;
|
||||
// }
|
||||
// const value = this[key];
|
||||
// data[key] = value;
|
||||
// }
|
||||
// }
|
||||
// return data;
|
||||
// }
|
||||
// }
|
||||
};
|
||||
exports.nonserialization = nonserialization;
|
||||
function cctype(type) {
|
||||
return (target) => {
|
||||
Object.defineProperty(target.prototype, "$__type__", {
|
||||
value: type,
|
||||
enumerable: true,
|
||||
});
|
||||
};
|
||||
}
|
||||
exports.cctype = cctype;
|
||||
let _extends = {};
|
||||
let _class_attrs = {};
|
||||
let _target_map_ = {};
|
||||
let __verIdx = 0;
|
||||
let _printID = -1;
|
||||
function checkTag(target) {
|
||||
if (target.constructor.__ver_tag_id__ === undefined || _target_map_[target.constructor.__ver_tag_id__] != target) {
|
||||
target.constructor.__ver_tag_id__ = `${__verIdx}`;
|
||||
_target_map_[target.constructor.__ver_tag_id__] = target;
|
||||
__verIdx++;
|
||||
}
|
||||
return target.constructor.__ver_tag_id__;
|
||||
}
|
||||
function _assign(target, source) {
|
||||
for (const key in source) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||
if (key in target) {
|
||||
continue;
|
||||
}
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
function assign(target, ...sources) {
|
||||
for (let i = 0; i < sources.length; i++) {
|
||||
_assign(target, sources[i]);
|
||||
}
|
||||
}
|
||||
function ccversion(version) {
|
||||
return (target, propertyKey) => {
|
||||
let _class_name_ = target.constructor.name;
|
||||
_class_name_ = checkTag(target);
|
||||
!_class_attrs[_class_name_] && (_class_attrs[_class_name_] = {});
|
||||
let _class_obj = _class_attrs[_class_name_];
|
||||
if (!_class_obj[propertyKey]) {
|
||||
_class_obj[propertyKey] = {};
|
||||
}
|
||||
if (EditorVersion_1.EditorVersion.all === version) {
|
||||
for (const key in EditorVersion_1.EditorVersion) {
|
||||
_class_obj[propertyKey][EditorVersion_1.EditorVersion[key]] = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_class_obj[propertyKey][EditorVersion_1.EditorVersion[version]] = true;
|
||||
}
|
||||
var base = getSuper(target.constructor);
|
||||
// (base === Object || base === UIObject) && (base = null);
|
||||
if (base) {
|
||||
let parent = checkTag(base.prototype);
|
||||
!_extends[_class_name_] && (_extends[_class_name_] = parent);
|
||||
var _super = getSuper(base);
|
||||
let superIdx = 1;
|
||||
while (_super) {
|
||||
// if(_super === Object || _super === UIObject) {
|
||||
// // _super = null;
|
||||
// break;
|
||||
// }
|
||||
let super_tag = checkTag(_super.prototype);
|
||||
!_extends[parent] && (_extends[parent] = super_tag);
|
||||
_super = getSuper(_super);
|
||||
superIdx++;
|
||||
}
|
||||
while (parent) {
|
||||
if (parent in _class_attrs) {
|
||||
assign(_class_obj, _class_attrs[parent]);
|
||||
}
|
||||
parent = _extends[parent];
|
||||
}
|
||||
}
|
||||
if (!target._version) {
|
||||
target._version = {};
|
||||
}
|
||||
target._version[_class_name_] = _class_attrs[_class_name_] = _class_obj;
|
||||
};
|
||||
}
|
||||
exports.ccversion = ccversion;
|
||||
function getSuper(ctor) {
|
||||
var proto = ctor.prototype; // binded function do not have prototype
|
||||
var dunderProto = proto && Object.getPrototypeOf(proto);
|
||||
return dunderProto && dunderProto.constructor;
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.imageCacheMgr = exports.ImageCacheMgr = void 0;
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const config_1 = require("../config");
|
||||
const EditorVersion_1 = require("../EditorVersion");
|
||||
const FileUtils_1 = require("../utils/FileUtils");
|
||||
class ImageCacheMgr {
|
||||
constructor() {
|
||||
this._imageMap = new Map();
|
||||
this._cachePath = null;
|
||||
}
|
||||
initWithPath(_path) {
|
||||
if (!fs_extra_1.default.existsSync(_path)) {
|
||||
console.log(`ImageCacheMgr-> 文件不存在: ${_path}`);
|
||||
return;
|
||||
}
|
||||
this._cachePath = _path;
|
||||
let content = fs_extra_1.default.readFileSync(_path, "utf-8");
|
||||
this.initWithFile(content);
|
||||
}
|
||||
initWithFile(file) {
|
||||
let json = JSON.parse(file);
|
||||
this.initWithJson(json);
|
||||
}
|
||||
initWithJson(json) {
|
||||
for (const key in json) {
|
||||
if (Object.prototype.hasOwnProperty.call(json, key)) {
|
||||
this._imageMap.set(key, json[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
set(md5, warp) {
|
||||
this._imageMap.set(md5, warp);
|
||||
}
|
||||
has(md5) {
|
||||
return this._imageMap.has(md5);
|
||||
}
|
||||
get(md5) {
|
||||
return this._imageMap.get(md5);
|
||||
}
|
||||
saveImageMap(_path) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!_path) {
|
||||
_path = this._cachePath;
|
||||
}
|
||||
if (!_path) {
|
||||
console.log(`ImageCacheMgr-> 缓存路径 [${_path}] 不存在,无法保存 `);
|
||||
return;
|
||||
}
|
||||
let obj = Object.create(null);
|
||||
this._imageMap.forEach((v, k) => {
|
||||
obj[k] = v;
|
||||
});
|
||||
let content = JSON.stringify(obj, null, 2);
|
||||
yield FileUtils_1.fileUtils.writeFile(_path, content);
|
||||
});
|
||||
}
|
||||
// 获取已存在的图片,生成 md5: uuid 映射,
|
||||
loadImages(dir) {
|
||||
if (this._imageMap.size > 0) {
|
||||
console.error(`ImageCacheMgr-> 暂时只能在 启动时加载`);
|
||||
return;
|
||||
}
|
||||
let pngs = FileUtils_1.fileUtils.filterFile(dir, (fileName) => {
|
||||
let extname = path_1.default.extname(fileName);
|
||||
if (extname == ".png") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
for (let i = 0; i < pngs.length; i++) {
|
||||
const png = pngs[i];
|
||||
let md5 = FileUtils_1.fileUtils.getMD5(png);
|
||||
console.log(`ImageCacheMgr->缓存 `, png);
|
||||
let imageWarp = this._loadImageMetaWarp(`${png}.meta`);
|
||||
if (imageWarp) {
|
||||
this.set(md5, imageWarp);
|
||||
}
|
||||
}
|
||||
}
|
||||
_loadImageMetaWarp(_path) {
|
||||
let content = fs_extra_1.default.readFileSync(_path, { encoding: "utf-8" });
|
||||
let imageWarp = null;
|
||||
switch (config_1.config.editorVersion) {
|
||||
case EditorVersion_1.EditorVersion.v249:
|
||||
imageWarp = this._loadImageMeta249(content, _path);
|
||||
break;
|
||||
case EditorVersion_1.EditorVersion.v342:
|
||||
imageWarp = this._loadImageMeta34x(content, _path);
|
||||
break;
|
||||
default:
|
||||
console.log(`ImageCacheMgr-> 暂未实现 ${EditorVersion_1.EditorVersion[config_1.config.editorVersion]} 版本`);
|
||||
break;
|
||||
}
|
||||
return imageWarp;
|
||||
}
|
||||
_loadImageMeta249(metaContent, _path) {
|
||||
var _a;
|
||||
let filename = path_1.default.basename(_path, ".png.meta");
|
||||
let fullpath = path_1.default.join(path_1.default.dirname(_path), `${filename}.png`);
|
||||
let metaJson = JSON.parse(metaContent);
|
||||
if (!((_a = metaJson === null || metaJson === void 0 ? void 0 : metaJson.subMetas) === null || _a === void 0 ? void 0 : _a[filename])) {
|
||||
return null;
|
||||
}
|
||||
let imageWarp = {
|
||||
path: fullpath,
|
||||
textureUuid: metaJson.subMetas[filename].uuid,
|
||||
uuid: metaJson.uuid,
|
||||
isOutput: true,
|
||||
};
|
||||
return imageWarp;
|
||||
}
|
||||
_loadImageMeta34x(metaContent, _path) {
|
||||
var _a;
|
||||
let filename = path_1.default.basename(_path, ".png.meta");
|
||||
let fullpath = path_1.default.join(path_1.default.dirname(_path), `${filename}.png`);
|
||||
let metaJson = JSON.parse(metaContent);
|
||||
if (!((_a = metaJson === null || metaJson === void 0 ? void 0 : metaJson.subMetas) === null || _a === void 0 ? void 0 : _a["6c48a"])) {
|
||||
return null;
|
||||
}
|
||||
let uuid = metaJson.subMetas["6c48a"].uuid.replace("@6c48a", "");
|
||||
let imageWarp = {
|
||||
path: fullpath,
|
||||
textureUuid: uuid,
|
||||
uuid: uuid,
|
||||
isOutput: true,
|
||||
};
|
||||
return imageWarp;
|
||||
}
|
||||
static getInstance() {
|
||||
if (!this._instance) {
|
||||
this._instance = new ImageCacheMgr();
|
||||
}
|
||||
return this._instance;
|
||||
}
|
||||
}
|
||||
exports.ImageCacheMgr = ImageCacheMgr;
|
||||
ImageCacheMgr._instance = null;
|
||||
exports.imageCacheMgr = ImageCacheMgr.getInstance();
|
56
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/assets-manager/ImageMgr.js
Normal file
56
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/assets-manager/ImageMgr.js
Normal file
@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.imageMgr = void 0;
|
||||
class ImageMgr {
|
||||
constructor() {
|
||||
// 镜像图像管理
|
||||
this._imageIdKeyMap = new Map();
|
||||
// 当前 psd 所有的图片
|
||||
this._imageArray = new Map();
|
||||
}
|
||||
add(psdImage) {
|
||||
var _a;
|
||||
// 不忽略导出图片
|
||||
if (!psdImage.isIgnore() && !psdImage.isBind()) {
|
||||
if (!this._imageArray.has(psdImage.md5)) {
|
||||
this._imageArray.set(psdImage.md5, psdImage);
|
||||
}
|
||||
}
|
||||
if (typeof ((_a = psdImage.attr.comps.img) === null || _a === void 0 ? void 0 : _a.id) != "undefined") {
|
||||
let id = psdImage.attr.comps.img.id;
|
||||
if (this._imageIdKeyMap.has(id)) {
|
||||
console.warn(`ImageMgr-> ${psdImage.source.name} 已有相同 @img{id:${id}},请检查 psd 图层`);
|
||||
}
|
||||
this._imageIdKeyMap.set(id, psdImage);
|
||||
}
|
||||
}
|
||||
getAllImage() {
|
||||
return this._imageArray;
|
||||
}
|
||||
/** 尝试获取有编号的图像图层 */
|
||||
getSerialNumberImage(psdImage) {
|
||||
var _a, _b, _c;
|
||||
let bind = (_b = (_a = psdImage.attr.comps.flip) === null || _a === void 0 ? void 0 : _a.bind) !== null && _b !== void 0 ? _b : (_c = psdImage.attr.comps.img) === null || _c === void 0 ? void 0 : _c.bind;
|
||||
if (typeof bind != 'undefined') {
|
||||
if (this._imageIdKeyMap.has(bind)) {
|
||||
return this._imageIdKeyMap.get(bind);
|
||||
}
|
||||
else {
|
||||
console.warn(`ImageMgr-> ${psdImage.source.name} 未找到绑定的图像 {${bind}},请检查 psd 图层`);
|
||||
}
|
||||
}
|
||||
return psdImage;
|
||||
}
|
||||
clear() {
|
||||
this._imageIdKeyMap.clear();
|
||||
this._imageArray.clear();
|
||||
}
|
||||
static getInstance() {
|
||||
if (!this._instance) {
|
||||
this._instance = new ImageMgr();
|
||||
}
|
||||
return this._instance;
|
||||
}
|
||||
}
|
||||
ImageMgr._instance = null;
|
||||
exports.imageMgr = ImageMgr.getInstance();
|
11
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/command.bat
Normal file
11
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/command.bat
Normal file
@ -0,0 +1,11 @@
|
||||
@echo off
|
||||
|
||||
set input1=%1%
|
||||
set input2=%2%
|
||||
|
||||
cd /d %~dp0
|
||||
|
||||
node ./index.js %input1% %input2%
|
||||
|
||||
pause
|
||||
exit
|
56
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/config.js
Normal file
56
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/config.js
Normal file
@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.config = exports.Config = void 0;
|
||||
const EditorVersion_1 = require("./EditorVersion");
|
||||
const CCButton_1 = require("./engine/cc/CCButton");
|
||||
const CCProgressBar_1 = require("./engine/cc/CCProgressBar");
|
||||
const CCToggle_1 = require("./engine/cc/CCToggle");
|
||||
class Config {
|
||||
constructor() {
|
||||
this.help = `
|
||||
--help | --h 帮助信息
|
||||
--init | --i 初始化缓存文件 必须设置 --project-assets --cache 两项
|
||||
--force-img | --fimg 强制导出图片 即使在有缓存的情况下也要导出
|
||||
--input | --in 输入目录或者 psd 文件 非 init 时 必选 [dir or psd]
|
||||
--output | --out 输出目录 可选 缺省时为 --input [dir]
|
||||
--engine-version | --ev 引擎版本 可选 [v249 | v342 | v362]
|
||||
--project-assets | --p 指定项目文件夹 可选 [dir]
|
||||
--cache-remake | --crm 重新创建缓存文件 可选
|
||||
--cache | --c 缓存文件全路径 可选 [file-full-path]
|
||||
--config | 预制体配置 可选 [file-full-path]
|
||||
--img-only | 只导出图片 可选
|
||||
--json | json 对象参数 插件工具使用 将所有参数用对象的形式编码成 base64 字符串
|
||||
`;
|
||||
this.editorVersion = EditorVersion_1.EditorVersion.v249;
|
||||
this.DEFAULT_SPRITEFRAME_MATERIAL = {
|
||||
[EditorVersion_1.EditorVersion.v249]: "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432",
|
||||
[EditorVersion_1.EditorVersion.v342]: "",
|
||||
[EditorVersion_1.EditorVersion.v362]: "",
|
||||
};
|
||||
this.DEFAULT_LABEL_MATERIAL = {
|
||||
[EditorVersion_1.EditorVersion.v249]: "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432",
|
||||
[EditorVersion_1.EditorVersion.v342]: "",
|
||||
[EditorVersion_1.EditorVersion.v362]: "",
|
||||
};
|
||||
this.CompMippings = {
|
||||
"Btn": CCButton_1.CCButton,
|
||||
"ProgressBar": CCProgressBar_1.CCProgressBar,
|
||||
"Toggle": CCToggle_1.CCToggle,
|
||||
};
|
||||
// text 文本 Y 偏移
|
||||
this.textOffsetY = {
|
||||
default: 0,
|
||||
"36": 0,
|
||||
};
|
||||
// text 文本 行高偏移,默认为 0 ,行高默认为 字体大小
|
||||
this.textLineHeightOffset = 0;
|
||||
}
|
||||
get SpriteFrame_Material() {
|
||||
return this.DEFAULT_SPRITEFRAME_MATERIAL[exports.config.editorVersion];
|
||||
}
|
||||
get Label_Material() {
|
||||
return this.DEFAULT_LABEL_MATERIAL[exports.config.editorVersion];
|
||||
}
|
||||
}
|
||||
exports.Config = Config;
|
||||
exports.config = new Config();
|
52
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/UIObject.js
Normal file
52
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/UIObject.js
Normal file
@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.UIObject = void 0;
|
||||
const config_1 = require("../config");
|
||||
const EditorVersion_1 = require("../EditorVersion");
|
||||
const Utils_1 = require("../utils/Utils");
|
||||
const _decorator_1 = require("../_decorator");
|
||||
class UIObject {
|
||||
constructor() {
|
||||
this.uuid = "";
|
||||
this.idx = 0;
|
||||
this.uuid = Utils_1.utils.uuid();
|
||||
}
|
||||
toJSON() {
|
||||
var _a;
|
||||
let data = {};
|
||||
for (const key in this) {
|
||||
if (Object.prototype.hasOwnProperty.call(this, key)) {
|
||||
// @ts-ignore
|
||||
if (this.__unserialization && this.__unserialization.indexOf(key) !== -1) {
|
||||
continue;
|
||||
}
|
||||
// @ts-ignore
|
||||
let ver_tag = this.constructor.__ver_tag_id__;
|
||||
// 判断编辑器版本
|
||||
// @ts-ignore
|
||||
if (this._version && ((_a = this._version[ver_tag]) === null || _a === void 0 ? void 0 : _a[key])) {
|
||||
// @ts-ignore
|
||||
if (!this._version[ver_tag][key][EditorVersion_1.EditorVersion[config_1.config.editorVersion]]) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
const value = this[key];
|
||||
data[key] = value;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
_decorator_1.nonserialization
|
||||
], UIObject.prototype, "uuid", void 0);
|
||||
__decorate([
|
||||
_decorator_1.nonserialization
|
||||
], UIObject.prototype, "idx", void 0);
|
||||
exports.UIObject = UIObject;
|
87
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCButton.js
Normal file
87
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCButton.js
Normal file
@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCButton = void 0;
|
||||
const EditorVersion_1 = require("../../EditorVersion");
|
||||
const _decorator_1 = require("../../_decorator");
|
||||
const CCComponent_1 = require("./CCComponent");
|
||||
let CCButton = class CCButton extends CCComponent_1.CCComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
// 2.4.x
|
||||
this.duration = 0.1;
|
||||
// 2.4.x
|
||||
this.zoomScale = 1.2;
|
||||
this.clickEvents = [];
|
||||
// 2.4.x
|
||||
this._N$interactable = true;
|
||||
// 2.4.x
|
||||
this._N$enableAutoGrayEffect = false;
|
||||
// 2.4.x
|
||||
this._N$transition = 3;
|
||||
// 2.4.x
|
||||
this.transition = 3;
|
||||
// 2.4.x
|
||||
this._N$target = null;
|
||||
// 3.4.x
|
||||
this._interactable = true;
|
||||
// 3.4.x
|
||||
this._transition = 3;
|
||||
// 3.4.x
|
||||
this._duration = 0.1;
|
||||
// 3.4.x
|
||||
this._zoomScale = 1.2;
|
||||
// 3.4.x
|
||||
this._target = null;
|
||||
}
|
||||
updateWithLayer(psdLayer) {
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCButton.prototype, "duration", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCButton.prototype, "zoomScale", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCButton.prototype, "clickEvents", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCButton.prototype, "_N$interactable", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCButton.prototype, "_N$enableAutoGrayEffect", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCButton.prototype, "_N$transition", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCButton.prototype, "transition", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCButton.prototype, "_N$target", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCButton.prototype, "_interactable", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCButton.prototype, "_transition", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCButton.prototype, "_duration", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCButton.prototype, "_zoomScale", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCButton.prototype, "_target", void 0);
|
||||
CCButton = __decorate([
|
||||
(0, _decorator_1.cctype)("cc.Button")
|
||||
], CCButton);
|
||||
exports.CCButton = CCButton;
|
@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCCompPrefabInfo = void 0;
|
||||
const Utils_1 = require("../../utils/Utils");
|
||||
const UIObject_1 = require("../UIObject");
|
||||
// @cctype("cc.CompPrefabInfo")
|
||||
class CCCompPrefabInfo extends UIObject_1.UIObject {
|
||||
constructor() {
|
||||
super();
|
||||
this.__type__ = "cc.CompPrefabInfo";
|
||||
this.fileId = "";
|
||||
this.fileId = Utils_1.utils.compressUuid(this.uuid);
|
||||
}
|
||||
}
|
||||
exports.CCCompPrefabInfo = CCCompPrefabInfo;
|
35
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCComponent.js
Normal file
35
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCComponent.js
Normal file
@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCComponent = void 0;
|
||||
const EditorVersion_1 = require("../../EditorVersion");
|
||||
const _decorator_1 = require("../../_decorator");
|
||||
const CCObject_1 = require("./CCObject");
|
||||
class CCComponent extends CCObject_1.CCObject {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._enabled = true;
|
||||
this.node = null;
|
||||
this._id = "";
|
||||
// 3.4.x
|
||||
this.__prefab = null;
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCComponent.prototype, "_enabled", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCComponent.prototype, "node", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCComponent.prototype, "_id", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCComponent.prototype, "__prefab", void 0);
|
||||
exports.CCComponent = CCComponent;
|
167
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCLabel.js
Normal file
167
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCLabel.js
Normal file
@ -0,0 +1,167 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCLabel = void 0;
|
||||
const config_1 = require("../../config");
|
||||
const EditorVersion_1 = require("../../EditorVersion");
|
||||
const _decorator_1 = require("../../_decorator");
|
||||
const CCComponent_1 = require("./CCComponent");
|
||||
const CCColor_1 = require("./values/CCColor");
|
||||
let CCLabel = class CCLabel extends CCComponent_1.CCComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._srcBlendFactor = 770; // 3.4.x = 2
|
||||
this._dstBlendFactor = 771; // 3.4.x = 4
|
||||
this._string = "";
|
||||
this._fontSize = 0;
|
||||
this._lineHeight = 0;
|
||||
this._enableWrapText = true;
|
||||
this._isSystemFontUsed = true;
|
||||
this._spacingX = 0;
|
||||
this._underlineHeight = 0;
|
||||
this._materials = [];
|
||||
// 2.4.x
|
||||
this._N$string = "";
|
||||
// 2.4.x
|
||||
this._N$file = null;
|
||||
// 2.4.x
|
||||
this._batchAsBitmap = false;
|
||||
// 2.4.x
|
||||
this._styleFlags = 0;
|
||||
// 2.4.x
|
||||
this._N$horizontalAlign = 1;
|
||||
// 2.4.x
|
||||
this._N$verticalAlign = 1;
|
||||
// 2.4.x
|
||||
this._N$fontFamily = "Arial";
|
||||
// 2.4.x
|
||||
this._N$overflow = 0;
|
||||
// 2.4.x
|
||||
this._N$cacheMode = 0;
|
||||
// 3.4.x
|
||||
this._visFlags = 0;
|
||||
// 3.4.x
|
||||
this._customMaterial = null;
|
||||
// 3.4.x
|
||||
this._color = new CCColor_1.CCColor(255, 255, 255, 255);
|
||||
// 3.4.x
|
||||
this._overflow = 0;
|
||||
// // 3.4.x
|
||||
this._cacheMode = 0;
|
||||
this._horizontalAlign = 1;
|
||||
this._verticalAlign = 1;
|
||||
this._actualFontSize = 0;
|
||||
this._isItalic = false;
|
||||
this._isBold = false;
|
||||
this._isUnderline = false;
|
||||
}
|
||||
updateWithLayer(psdLayer) {
|
||||
this._fontSize = psdLayer.fontSize;
|
||||
// this._actualFontSize = this._fontSize;
|
||||
this._string = this._N$string = psdLayer.text;
|
||||
this._lineHeight = this._fontSize + config_1.config.textLineHeightOffset;
|
||||
if (config_1.config.editorVersion >= EditorVersion_1.EditorVersion.v342) {
|
||||
this._srcBlendFactor = 2;
|
||||
this._dstBlendFactor = 4;
|
||||
}
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCLabel.prototype, "_srcBlendFactor", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCLabel.prototype, "_dstBlendFactor", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCLabel.prototype, "_string", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCLabel.prototype, "_fontSize", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCLabel.prototype, "_lineHeight", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCLabel.prototype, "_enableWrapText", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCLabel.prototype, "_isSystemFontUsed", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCLabel.prototype, "_spacingX", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCLabel.prototype, "_underlineHeight", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCLabel.prototype, "_materials", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCLabel.prototype, "_N$string", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCLabel.prototype, "_N$file", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCLabel.prototype, "_batchAsBitmap", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCLabel.prototype, "_styleFlags", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCLabel.prototype, "_N$horizontalAlign", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCLabel.prototype, "_N$verticalAlign", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCLabel.prototype, "_N$fontFamily", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCLabel.prototype, "_N$overflow", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCLabel.prototype, "_N$cacheMode", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCLabel.prototype, "_visFlags", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCLabel.prototype, "_customMaterial", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCLabel.prototype, "_color", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCLabel.prototype, "_overflow", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCLabel.prototype, "_cacheMode", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCLabel.prototype, "_horizontalAlign", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCLabel.prototype, "_verticalAlign", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCLabel.prototype, "_actualFontSize", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCLabel.prototype, "_isItalic", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCLabel.prototype, "_isBold", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCLabel.prototype, "_isUnderline", void 0);
|
||||
CCLabel = __decorate([
|
||||
(0, _decorator_1.cctype)("cc.Label")
|
||||
], CCLabel);
|
||||
exports.CCLabel = CCLabel;
|
@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCLabelOutline = void 0;
|
||||
const EditorVersion_1 = require("../../EditorVersion");
|
||||
const _decorator_1 = require("../../_decorator");
|
||||
const CCComponent_1 = require("./CCComponent");
|
||||
const CCColor_1 = require("./values/CCColor");
|
||||
let CCLabelOutline = class CCLabelOutline extends CCComponent_1.CCComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._color = new CCColor_1.CCColor(255, 255, 255, 255);
|
||||
this._width = 1;
|
||||
}
|
||||
updateWithLayer(psdLayer) {
|
||||
this._width = psdLayer.outline.width;
|
||||
this._color.set(psdLayer.outline.color);
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCLabelOutline.prototype, "_color", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCLabelOutline.prototype, "_width", void 0);
|
||||
CCLabelOutline = __decorate([
|
||||
(0, _decorator_1.cctype)("cc.LabelOutline")
|
||||
], CCLabelOutline);
|
||||
exports.CCLabelOutline = CCLabelOutline;
|
177
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCNode.js
Normal file
177
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCNode.js
Normal file
@ -0,0 +1,177 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCNode = void 0;
|
||||
const config_1 = require("../../config");
|
||||
const EditorVersion_1 = require("../../EditorVersion");
|
||||
const _decorator_1 = require("../../_decorator");
|
||||
const CCCompPrefabInfo_1 = require("./CCCompPrefabInfo");
|
||||
const CCObject_1 = require("./CCObject");
|
||||
const CCColor_1 = require("./values/CCColor");
|
||||
const CCSize_1 = require("./values/CCSize");
|
||||
const CCTypedArray_1 = require("./values/CCTypedArray");
|
||||
const CCVec2_1 = require("./values/CCVec2");
|
||||
const CCVec3_1 = require("./values/CCVec3");
|
||||
let CCNode = class CCNode extends CCObject_1.CCObject {
|
||||
constructor(psdDoc) {
|
||||
super();
|
||||
this._parent = null;
|
||||
this._children = [];
|
||||
this._active = true;
|
||||
this._components = [];
|
||||
this._prefab = null;
|
||||
this._id = "";
|
||||
// 2.4.x
|
||||
this._opacity = 255;
|
||||
// 2.4.x
|
||||
this._color = new CCColor_1.CCColor(255, 255, 255, 255);
|
||||
// 2.4.x
|
||||
this._contentSize = new CCSize_1.CCSize();
|
||||
// 2.4.x
|
||||
this._anchorPoint = new CCVec2_1.CCVec2(0, 0);
|
||||
// 2.4.x
|
||||
this._trs = new CCTypedArray_1.CCTypedArray();
|
||||
// 2.4.x
|
||||
this._eulerAngles = new CCVec3_1.CCVec3();
|
||||
// 2.4.x
|
||||
this._skewX = 0;
|
||||
// 2.4.x
|
||||
this._skewY = 0;
|
||||
// 2.4.x
|
||||
this._is3DNode = false;
|
||||
// 2.4.x
|
||||
this._groupIndex = 0;
|
||||
// 2.4.x
|
||||
this.groupIndex = 0;
|
||||
// 2.4.x
|
||||
this._renderEnable = false;
|
||||
// 2.4.x
|
||||
this._bfsRenderFlag = false;
|
||||
// 3.4.x
|
||||
this._lpos = new CCVec3_1.CCVec3();
|
||||
// 3.4.x
|
||||
this._lrot = new CCVec3_1.CCVec3();
|
||||
// 3.4.x
|
||||
this._lscale = new CCVec3_1.CCVec3();
|
||||
// 3.4.x
|
||||
this._euler = new CCVec3_1.CCVec3();
|
||||
// 3.4.x
|
||||
this._layer = 33554432;
|
||||
this.psdDoc = null;
|
||||
this.components = [];
|
||||
this.children = [];
|
||||
if (psdDoc) {
|
||||
this.psdDoc = psdDoc;
|
||||
psdDoc.pushObject(this);
|
||||
}
|
||||
}
|
||||
addComponent(comp) {
|
||||
comp.node = { __id__: this.idx };
|
||||
let compIdx = this.psdDoc.pushObject(comp);
|
||||
this._components.push({ __id__: compIdx });
|
||||
this.components.push(comp);
|
||||
if (config_1.config.editorVersion >= EditorVersion_1.EditorVersion.v342) {
|
||||
this.addCompPrefabInfo(comp);
|
||||
}
|
||||
}
|
||||
addCompPrefabInfo(comp) {
|
||||
let compInfo = new CCCompPrefabInfo_1.CCCompPrefabInfo();
|
||||
let compIdx = this.psdDoc.pushObject(compInfo);
|
||||
comp.__prefab = { __id__: compIdx };
|
||||
}
|
||||
addChild(child) {
|
||||
this._children.push({ __id__: child.idx });
|
||||
child._parent = { __id__: this.idx };
|
||||
this.children.push(child);
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCNode.prototype, "_parent", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCNode.prototype, "_children", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCNode.prototype, "_active", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCNode.prototype, "_components", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCNode.prototype, "_prefab", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCNode.prototype, "_id", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCNode.prototype, "_opacity", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCNode.prototype, "_color", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCNode.prototype, "_contentSize", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCNode.prototype, "_anchorPoint", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCNode.prototype, "_trs", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCNode.prototype, "_eulerAngles", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCNode.prototype, "_skewX", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCNode.prototype, "_skewY", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCNode.prototype, "_is3DNode", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCNode.prototype, "_groupIndex", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCNode.prototype, "groupIndex", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCNode.prototype, "_renderEnable", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCNode.prototype, "_bfsRenderFlag", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCNode.prototype, "_lpos", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCNode.prototype, "_lrot", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCNode.prototype, "_lscale", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCNode.prototype, "_euler", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCNode.prototype, "_layer", void 0);
|
||||
__decorate([
|
||||
_decorator_1.nonserialization
|
||||
], CCNode.prototype, "psdDoc", void 0);
|
||||
__decorate([
|
||||
_decorator_1.nonserialization
|
||||
], CCNode.prototype, "components", void 0);
|
||||
__decorate([
|
||||
_decorator_1.nonserialization
|
||||
], CCNode.prototype, "children", void 0);
|
||||
CCNode = __decorate([
|
||||
(0, _decorator_1.cctype)("cc.Node")
|
||||
], CCNode);
|
||||
exports.CCNode = CCNode;
|
31
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCObject.js
Normal file
31
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCObject.js
Normal file
@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCObject = void 0;
|
||||
const EditorVersion_1 = require("../../EditorVersion");
|
||||
const _decorator_1 = require("../../_decorator");
|
||||
const UIObject_1 = require("../UIObject");
|
||||
class CCObject extends UIObject_1.UIObject {
|
||||
constructor() {
|
||||
super();
|
||||
this._name = "";
|
||||
this._objFlags = 0;
|
||||
// @ts-ignore
|
||||
this.__type__ = this.$__type__;
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCObject.prototype, "__type__", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCObject.prototype, "_name", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCObject.prototype, "_objFlags", void 0);
|
||||
exports.CCObject = CCObject;
|
47
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCPrefab.js
Normal file
47
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCPrefab.js
Normal file
@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCPrefab = void 0;
|
||||
const EditorVersion_1 = require("../../EditorVersion");
|
||||
const _decorator_1 = require("../../_decorator");
|
||||
const CCObject_1 = require("./CCObject");
|
||||
let CCPrefab = class CCPrefab extends CCObject_1.CCObject {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._native = "";
|
||||
this.data = null;
|
||||
this.optimizationPolicy = 0;
|
||||
this.asyncLoadAssets = false;
|
||||
// 2.4.x
|
||||
this.readonly = false;
|
||||
// // 3.4.x
|
||||
this.persistent = false;
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCPrefab.prototype, "_native", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCPrefab.prototype, "data", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCPrefab.prototype, "optimizationPolicy", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCPrefab.prototype, "asyncLoadAssets", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCPrefab.prototype, "readonly", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCPrefab.prototype, "persistent", void 0);
|
||||
CCPrefab = __decorate([
|
||||
(0, _decorator_1.cctype)("cc.Prefab")
|
||||
], CCPrefab);
|
||||
exports.CCPrefab = CCPrefab;
|
41
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCPrefabInfo.js
Normal file
41
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCPrefabInfo.js
Normal file
@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCPrefabInfo = void 0;
|
||||
const EditorVersion_1 = require("../../EditorVersion");
|
||||
const Utils_1 = require("../../utils/Utils");
|
||||
const _decorator_1 = require("../../_decorator");
|
||||
const UIObject_1 = require("../UIObject");
|
||||
// @cctype("cc.PrefabInfo")
|
||||
class CCPrefabInfo extends UIObject_1.UIObject {
|
||||
constructor() {
|
||||
super();
|
||||
this.__type__ = "cc.PrefabInfo";
|
||||
this.root = { __id__: 1 };
|
||||
this.asset = { __id__: 0 };
|
||||
this.fileId = "";
|
||||
this.sync = false;
|
||||
this.fileId = Utils_1.utils.compressUuid(this.uuid);
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCPrefabInfo.prototype, "__type__", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCPrefabInfo.prototype, "root", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCPrefabInfo.prototype, "asset", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCPrefabInfo.prototype, "fileId", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCPrefabInfo.prototype, "sync", void 0);
|
||||
exports.CCPrefabInfo = CCPrefabInfo;
|
98
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCProgressBar.js
Normal file
98
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCProgressBar.js
Normal file
@ -0,0 +1,98 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCProgressBar = void 0;
|
||||
const EditorVersion_1 = require("../../EditorVersion");
|
||||
const _decorator_1 = require("../../_decorator");
|
||||
const CCComponent_1 = require("./CCComponent");
|
||||
const CCSprite_1 = require("./CCSprite");
|
||||
let CCProgressBar = class CCProgressBar extends CCComponent_1.CCComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
// 2.4.x
|
||||
this._N$totalLength = 0;
|
||||
// 2.4.x
|
||||
this._N$barSprite = null;
|
||||
// 2.4.x
|
||||
this._N$mode = 0;
|
||||
// 2.4.x
|
||||
this._N$progress = 1;
|
||||
// 2.4.x
|
||||
this._N$reverse = false;
|
||||
// 3.4.x
|
||||
this._barSprite = null;
|
||||
// 3.4.x
|
||||
this._mode = 0;
|
||||
// 3.4.x
|
||||
this._totalLength = 0;
|
||||
// 3.4.x
|
||||
this._progress = 1;
|
||||
// 3.4.x
|
||||
this._reverse = false;
|
||||
}
|
||||
setBar(sprite) {
|
||||
this._barSprite = this._N$barSprite = {
|
||||
__id__: sprite.idx
|
||||
};
|
||||
}
|
||||
updateWithLayer(psdLayer) {
|
||||
if (!psdLayer.children) {
|
||||
console.error(`CCProgressBar-> 只能作用在 组图层 上`);
|
||||
return;
|
||||
}
|
||||
outer: for (let i = 0; i < psdLayer.children.length; i++) {
|
||||
const child = psdLayer.children[i];
|
||||
if (child.attr.comps.bar) {
|
||||
let node = child.uiObject;
|
||||
// 暂时只有横向进度条
|
||||
this._totalLength = this._N$totalLength = node._contentSize.width;
|
||||
for (let j = 0; j < node.components.length; j++) {
|
||||
const comp = node.components[j];
|
||||
if (comp instanceof CCSprite_1.CCSprite) {
|
||||
this.setBar(comp);
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCProgressBar.prototype, "_N$totalLength", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCProgressBar.prototype, "_N$barSprite", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCProgressBar.prototype, "_N$mode", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCProgressBar.prototype, "_N$progress", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCProgressBar.prototype, "_N$reverse", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCProgressBar.prototype, "_barSprite", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCProgressBar.prototype, "_mode", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCProgressBar.prototype, "_totalLength", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCProgressBar.prototype, "_progress", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCProgressBar.prototype, "_reverse", void 0);
|
||||
CCProgressBar = __decorate([
|
||||
(0, _decorator_1.cctype)("cc.ProgressBar")
|
||||
], CCProgressBar);
|
||||
exports.CCProgressBar = CCProgressBar;
|
117
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCSprite.js
Normal file
117
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCSprite.js
Normal file
@ -0,0 +1,117 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCSprite = void 0;
|
||||
const config_1 = require("../../config");
|
||||
const EditorVersion_1 = require("../../EditorVersion");
|
||||
const _decorator_1 = require("../../_decorator");
|
||||
const CCComponent_1 = require("./CCComponent");
|
||||
const CCColor_1 = require("./values/CCColor");
|
||||
const CCVec2_1 = require("./values/CCVec2");
|
||||
let CCSprite = class CCSprite extends CCComponent_1.CCComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
// 2.4.x
|
||||
this._materials = [];
|
||||
this._srcBlendFactor = 770; // 3.4.x = 2
|
||||
this._dstBlendFactor = 771; // 3.4.x = 4
|
||||
this._spriteFrame = null;
|
||||
this._type = 0;
|
||||
this._sizeMode = 1;
|
||||
this._fillType = 0;
|
||||
this._fillCenter = new CCVec2_1.CCVec2();
|
||||
this._fillStart = 0;
|
||||
this._fillRange = 0;
|
||||
this._isTrimmedMode = true;
|
||||
this._atlas = null;
|
||||
// 3.4.x
|
||||
this._visFlags = 0;
|
||||
// 3.4.x
|
||||
this._customMaterial = null;
|
||||
// 3.4.x
|
||||
this._color = new CCColor_1.CCColor(255, 255, 255, 255);
|
||||
// 3.4.x
|
||||
this._useGrayscale = false;
|
||||
}
|
||||
use9() {
|
||||
this._type = 1;
|
||||
this._sizeMode = 0;
|
||||
}
|
||||
updateWithLayer(psdLayer) {
|
||||
if (psdLayer.s9) {
|
||||
this.use9();
|
||||
}
|
||||
if (Math.abs(psdLayer.scale.x) != 1 || Math.abs(psdLayer.scale.y) != 1) {
|
||||
this._sizeMode = 0;
|
||||
}
|
||||
if (config_1.config.editorVersion >= EditorVersion_1.EditorVersion.v342) {
|
||||
this._srcBlendFactor = 2;
|
||||
this._dstBlendFactor = 4;
|
||||
}
|
||||
}
|
||||
setSpriteFrame(uuid) {
|
||||
if (config_1.config.editorVersion >= EditorVersion_1.EditorVersion.v342) {
|
||||
this._spriteFrame = { __uuid__: `${uuid}@f9941`, __expectedType__: "cc.SpriteFrame" };
|
||||
}
|
||||
else {
|
||||
this._spriteFrame = { __uuid__: uuid };
|
||||
}
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCSprite.prototype, "_materials", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCSprite.prototype, "_srcBlendFactor", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCSprite.prototype, "_dstBlendFactor", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCSprite.prototype, "_spriteFrame", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCSprite.prototype, "_type", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCSprite.prototype, "_sizeMode", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCSprite.prototype, "_fillType", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCSprite.prototype, "_fillCenter", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCSprite.prototype, "_fillStart", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCSprite.prototype, "_fillRange", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCSprite.prototype, "_isTrimmedMode", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCSprite.prototype, "_atlas", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCSprite.prototype, "_visFlags", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCSprite.prototype, "_customMaterial", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCSprite.prototype, "_color", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCSprite.prototype, "_useGrayscale", void 0);
|
||||
CCSprite = __decorate([
|
||||
(0, _decorator_1.cctype)("cc.Sprite")
|
||||
], CCSprite);
|
||||
exports.CCSprite = CCSprite;
|
75
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCToggle.js
Normal file
75
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCToggle.js
Normal file
@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCToggle = void 0;
|
||||
const EditorVersion_1 = require("../../EditorVersion");
|
||||
const _decorator_1 = require("../../_decorator");
|
||||
const CCButton_1 = require("./CCButton");
|
||||
const CCSprite_1 = require("./CCSprite");
|
||||
let CCToggle = class CCToggle extends CCButton_1.CCButton {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
// 2.4.x
|
||||
this._N$isChecked = true;
|
||||
// 2.4.x
|
||||
this.toggleGroup = null;
|
||||
// 2.4.x
|
||||
this.checkMark = null;
|
||||
this.checkEvents = [];
|
||||
// 3.4.x
|
||||
this._isChecked = true;
|
||||
// 3.4.x
|
||||
this._checkMark = null;
|
||||
}
|
||||
setCheckMark(sprite) {
|
||||
this._checkMark = this.checkMark = {
|
||||
__id__: sprite.idx
|
||||
};
|
||||
}
|
||||
updateWithLayer(psdLayer) {
|
||||
if (!psdLayer.children) {
|
||||
console.error(`CCToggle-> 只能作用在 组图层 上`);
|
||||
return;
|
||||
}
|
||||
outer: for (let i = 0; i < psdLayer.children.length; i++) {
|
||||
const child = psdLayer.children[i];
|
||||
if (child.attr.comps.check) {
|
||||
let node = child.uiObject;
|
||||
for (let j = 0; j < node.components.length; j++) {
|
||||
const comp = node.components[j];
|
||||
if (comp instanceof CCSprite_1.CCSprite) {
|
||||
this.setCheckMark(comp);
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCToggle.prototype, "_N$isChecked", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCToggle.prototype, "toggleGroup", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v249)
|
||||
], CCToggle.prototype, "checkMark", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.all)
|
||||
], CCToggle.prototype, "checkEvents", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCToggle.prototype, "_isChecked", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCToggle.prototype, "_checkMark", void 0);
|
||||
CCToggle = __decorate([
|
||||
(0, _decorator_1.cctype)("cc.Toggle")
|
||||
], CCToggle);
|
||||
exports.CCToggle = CCToggle;
|
28
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCUIOpacity.js
Normal file
28
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCUIOpacity.js
Normal file
@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCUIOpacity = void 0;
|
||||
const EditorVersion_1 = require("../../EditorVersion");
|
||||
const _decorator_1 = require("../../_decorator");
|
||||
const CCComponent_1 = require("./CCComponent");
|
||||
// 3.4.x
|
||||
let CCUIOpacity = class CCUIOpacity extends CCComponent_1.CCComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._opacity = 255;
|
||||
}
|
||||
updateWithLayer(psdLayer) {
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCUIOpacity.prototype, "_opacity", void 0);
|
||||
CCUIOpacity = __decorate([
|
||||
(0, _decorator_1.cctype)("cc.UIOpacity")
|
||||
], CCUIOpacity);
|
||||
exports.CCUIOpacity = CCUIOpacity;
|
34
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCUITransform.js
Normal file
34
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/CCUITransform.js
Normal file
@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCUITransform = void 0;
|
||||
const EditorVersion_1 = require("../../EditorVersion");
|
||||
const _decorator_1 = require("../../_decorator");
|
||||
const CCComponent_1 = require("./CCComponent");
|
||||
const CCSize_1 = require("./values/CCSize");
|
||||
const CCVec2_1 = require("./values/CCVec2");
|
||||
// 3.4.x
|
||||
let CCUITransform = class CCUITransform extends CCComponent_1.CCComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._contentSize = new CCSize_1.CCSize();
|
||||
this._anchorPoint = new CCVec2_1.CCVec2(0, 0);
|
||||
}
|
||||
updateWithLayer(psdLayer) {
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCUITransform.prototype, "_contentSize", void 0);
|
||||
__decorate([
|
||||
(0, _decorator_1.ccversion)(EditorVersion_1.EditorVersion.v342)
|
||||
], CCUITransform.prototype, "_anchorPoint", void 0);
|
||||
CCUITransform = __decorate([
|
||||
(0, _decorator_1.cctype)("cc.UITransform")
|
||||
], CCUITransform);
|
||||
exports.CCUITransform = CCUITransform;
|
@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCColor = void 0;
|
||||
const Color_1 = require("../../../values/Color");
|
||||
class CCColor extends Color_1.Color {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.__type__ = "cc.Color";
|
||||
}
|
||||
}
|
||||
exports.CCColor = CCColor;
|
21
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/values/CCSize.js
Normal file
21
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/values/CCSize.js
Normal file
@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCSize = void 0;
|
||||
const Size_1 = require("../../../values/Size");
|
||||
const _decorator_1 = require("../../../_decorator");
|
||||
let CCSize = class CCSize extends Size_1.Size {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.__type__ = "cc.Size";
|
||||
}
|
||||
};
|
||||
CCSize = __decorate([
|
||||
(0, _decorator_1.cctype)("cc.Size")
|
||||
], CCSize);
|
||||
exports.CCSize = CCSize;
|
@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCTypedArray = void 0;
|
||||
const _decorator_1 = require("../../../_decorator");
|
||||
let CCTypedArray = class CCTypedArray {
|
||||
constructor() {
|
||||
this.__type__ = "TypedArray";
|
||||
this.ctor = "Float64Array";
|
||||
this.array = [];
|
||||
}
|
||||
setPosition(x, y, z) {
|
||||
this.array[0] = x;
|
||||
this.array[1] = y;
|
||||
this.array[2] = z;
|
||||
}
|
||||
setRotation(x, y, z, w) {
|
||||
this.array[3] = x;
|
||||
this.array[4] = y;
|
||||
this.array[5] = z;
|
||||
this.array[6] = w;
|
||||
}
|
||||
setScale(x, y, z) {
|
||||
this.array[7] = x;
|
||||
this.array[8] = y;
|
||||
this.array[9] = z;
|
||||
}
|
||||
};
|
||||
CCTypedArray = __decorate([
|
||||
(0, _decorator_1.cctype)("TypedArray")
|
||||
], CCTypedArray);
|
||||
exports.CCTypedArray = CCTypedArray;
|
21
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/values/CCVec2.js
Normal file
21
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/values/CCVec2.js
Normal file
@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCVec2 = void 0;
|
||||
const Vec2_1 = require("../../../values/Vec2");
|
||||
const _decorator_1 = require("../../../_decorator");
|
||||
let CCVec2 = class CCVec2 extends Vec2_1.Vec2 {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.__type__ = "cc.Vec2";
|
||||
}
|
||||
};
|
||||
CCVec2 = __decorate([
|
||||
(0, _decorator_1.cctype)("cc.Vec2")
|
||||
], CCVec2);
|
||||
exports.CCVec2 = CCVec2;
|
11
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/values/CCVec3.js
Normal file
11
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/engine/cc/values/CCVec3.js
Normal file
@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CCVec3 = void 0;
|
||||
const Vec3_1 = require("../../../values/Vec3");
|
||||
class CCVec3 extends Vec3_1.Vec3 {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.__type__ = "cc.Vec3";
|
||||
}
|
||||
}
|
||||
exports.CCVec3 = CCVec3;
|
20
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/index.js
Normal file
20
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/index.js
Normal file
@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const minimist_1 = __importDefault(require("minimist"));
|
||||
const Main_1 = require("./Main");
|
||||
// ##################
|
||||
// 输入
|
||||
const oargs = process.argv.slice(2);
|
||||
const args = (0, minimist_1.default)(oargs);
|
||||
let main = new Main_1.Main();
|
||||
if (oargs.length) {
|
||||
main.exec(args);
|
||||
}
|
||||
else {
|
||||
// 测试
|
||||
main.test();
|
||||
}
|
||||
// ##################
|
10
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/psd/LayerType.js
Normal file
10
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/psd/LayerType.js
Normal file
@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LayerType = void 0;
|
||||
var LayerType;
|
||||
(function (LayerType) {
|
||||
LayerType[LayerType["Doc"] = 0] = "Doc";
|
||||
LayerType[LayerType["Group"] = 1] = "Group";
|
||||
LayerType[LayerType["Text"] = 2] = "Text";
|
||||
LayerType[LayerType["Image"] = 3] = "Image";
|
||||
})(LayerType = exports.LayerType || (exports.LayerType = {}));
|
39
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/psd/PsdDocument.js
Normal file
39
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/psd/PsdDocument.js
Normal file
@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PsdDocument = void 0;
|
||||
const Rect_1 = require("../values/Rect");
|
||||
const Size_1 = require("../values/Size");
|
||||
const PsdGroup_1 = require("./PsdGroup");
|
||||
class PsdDocument extends PsdGroup_1.PsdGroup {
|
||||
constructor(source) {
|
||||
super(source, null, null);
|
||||
/** 当前文档所有的图片 */
|
||||
this.images = new Map();
|
||||
this.objectMap = new Map();
|
||||
this.objectArray = [];
|
||||
this.size = new Size_1.Size(source.width, source.height);
|
||||
this.rect = new Rect_1.Rect(0, this.size.width, 0, this.size.height);
|
||||
}
|
||||
pushObject(uiObject) {
|
||||
let idx = this.objectArray.length;
|
||||
uiObject.idx = idx;
|
||||
this.objectMap.set(uiObject.uuid, idx);
|
||||
this.objectArray.push(uiObject);
|
||||
return idx;
|
||||
}
|
||||
getObjectIdx(uuid) {
|
||||
let idx = this.objectMap.get(uuid);
|
||||
return idx;
|
||||
}
|
||||
getObject(uuid) {
|
||||
let idx = this.objectMap.get(uuid);
|
||||
if (idx < this.objectArray.length) {
|
||||
return this.objectArray[idx];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
onCtor() {
|
||||
super.onCtor();
|
||||
}
|
||||
}
|
||||
exports.PsdDocument = PsdDocument;
|
44
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/psd/PsdGroup.js
Normal file
44
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/psd/PsdGroup.js
Normal file
@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PsdGroup = void 0;
|
||||
const Rect_1 = require("../values/Rect");
|
||||
const PsdLayer_1 = require("./PsdLayer");
|
||||
class PsdGroup extends PsdLayer_1.PsdLayer {
|
||||
constructor(source, parent, rootDoc) {
|
||||
super(source, parent, rootDoc);
|
||||
this.children = [];
|
||||
if (rootDoc) {
|
||||
this.rect = new Rect_1.Rect(0, rootDoc.size.width, 0, rootDoc.size.height);
|
||||
}
|
||||
}
|
||||
parseSource() {
|
||||
var _a;
|
||||
super.parseSource();
|
||||
if (!((_a = this.attr) === null || _a === void 0 ? void 0 : _a.comps.full)) {
|
||||
this.resize();
|
||||
this.computeBasePosition();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
resize() {
|
||||
let left = Number.MAX_SAFE_INTEGER;
|
||||
let right = Number.MIN_SAFE_INTEGER;
|
||||
let top = Number.MAX_SAFE_INTEGER;
|
||||
let bottom = Number.MIN_SAFE_INTEGER;
|
||||
for (let i = 0; i < this.children.length; i++) {
|
||||
const element = this.children[i];
|
||||
let _rect = element.rect;
|
||||
left = Math.min(_rect.left, left);
|
||||
right = Math.max(_rect.right, right);
|
||||
top = Math.min(_rect.top, top);
|
||||
bottom = Math.max(_rect.bottom, bottom);
|
||||
}
|
||||
this.rect.left = left;
|
||||
this.rect.right = right;
|
||||
this.rect.top = top;
|
||||
this.rect.bottom = bottom;
|
||||
}
|
||||
onCtor() {
|
||||
}
|
||||
}
|
||||
exports.PsdGroup = PsdGroup;
|
75
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/psd/PsdImage.js
Normal file
75
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/psd/PsdImage.js
Normal file
@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PsdImage = void 0;
|
||||
const PsdLayer_1 = require("./PsdLayer");
|
||||
const Utils_1 = require("../utils/Utils");
|
||||
const Texture9Utils_1 = require("../utils/Texture9Utils");
|
||||
const Size_1 = require("../values/Size");
|
||||
const FileUtils_1 = require("../utils/FileUtils");
|
||||
const Vec3_1 = require("../values/Vec3");
|
||||
class PsdImage extends PsdLayer_1.PsdLayer {
|
||||
constructor(source, parent, rootDoc) {
|
||||
var _a;
|
||||
super(source, parent, rootDoc);
|
||||
this.textureUuid = Utils_1.utils.uuid();
|
||||
// img name
|
||||
this.imgName = ((_a = this.attr.comps.img) === null || _a === void 0 ? void 0 : _a.name) || this.name;
|
||||
// .9
|
||||
if (this.attr.comps['.9']) {
|
||||
let s9 = this.attr.comps['.9'];
|
||||
this.s9 = Texture9Utils_1.Texture9Utils.safeBorder(s9);
|
||||
let newCanvas = Texture9Utils_1.Texture9Utils.split(this.source.canvas, s9);
|
||||
this.source.canvas = newCanvas;
|
||||
}
|
||||
let canvas = this.source.canvas;
|
||||
this.imgBuffer = canvas.toBuffer('image/png');
|
||||
this.md5 = FileUtils_1.fileUtils.getMD5(this.imgBuffer);
|
||||
this.textureSize = new Size_1.Size(canvas.width, canvas.height);
|
||||
this.scale = new Vec3_1.Vec3((this.isFilpX() ? -1 : 1) * this.scale.x, (this.isFilpY() ? -1 : 1) * this.scale.y, 1);
|
||||
}
|
||||
onCtor() {
|
||||
}
|
||||
isIgnore() {
|
||||
//
|
||||
if (this.attr.comps.ignore || this.attr.comps.ignoreimg) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/** 是否是镜像图片 */
|
||||
isBind() {
|
||||
var _a, _b;
|
||||
return typeof ((_a = this.attr.comps.flip) === null || _a === void 0 ? void 0 : _a.bind) !== 'undefined'
|
||||
|| typeof ((_b = this.attr.comps.img) === null || _b === void 0 ? void 0 : _b.bind) !== 'undefined';
|
||||
}
|
||||
/** 是否是 x 方向镜像图片 */
|
||||
isFilpX() {
|
||||
var _a;
|
||||
return typeof ((_a = this.attr.comps.flipX) === null || _a === void 0 ? void 0 : _a.bind) !== 'undefined';
|
||||
}
|
||||
/** 是否是 y 方向镜像图片 */
|
||||
isFilpY() {
|
||||
var _a;
|
||||
return typeof ((_a = this.attr.comps.flipY) === null || _a === void 0 ? void 0 : _a.bind) !== 'undefined';
|
||||
}
|
||||
// 根据锚点计算坐标
|
||||
updatePositionWithAR() {
|
||||
if (!this.parent) {
|
||||
return;
|
||||
}
|
||||
let parent = this.parent;
|
||||
while (parent) {
|
||||
this.position.x -= parent.position.x;
|
||||
this.position.y -= parent.position.y;
|
||||
parent = parent.parent;
|
||||
}
|
||||
// this.position.x = this.position.x - this.parent.size.width * this.parent.anchorPoint.x + this.size.width * this.anchorPoint.x;
|
||||
// this.position.y = this.position.y - this.parent.size.height * this.parent.anchorPoint.y + this.size.height * this.anchorPoint.y;
|
||||
// 如果是镜像图片,则特殊处理
|
||||
let arX = (this.isFilpX() ? (1 - this.anchorPoint.x) : this.anchorPoint.x);
|
||||
let arY = (this.isFilpY() ? (1 - this.anchorPoint.y) : this.anchorPoint.y);
|
||||
this.position.x = this.position.x - this.rootDoc.size.width * this.rootDoc.anchorPoint.x + this.size.width * arX;
|
||||
this.position.y = this.position.y - this.rootDoc.size.height * this.rootDoc.anchorPoint.y + this.size.height * arY;
|
||||
}
|
||||
}
|
||||
exports.PsdImage = PsdImage;
|
185
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/psd/PsdLayer.js
Normal file
185
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/psd/PsdLayer.js
Normal file
@ -0,0 +1,185 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PsdLayer = void 0;
|
||||
const Size_1 = require("../values/Size");
|
||||
const Vec2_1 = require("../values/Vec2");
|
||||
const Utils_1 = require("../utils/Utils");
|
||||
const Rect_1 = require("../values/Rect");
|
||||
const Color_1 = require("../values/Color");
|
||||
const Vec3_1 = require("../values/Vec3");
|
||||
class PsdLayer {
|
||||
constructor(source, parent, rootDoc) {
|
||||
var _a, _b, _c, _d;
|
||||
this.uuid = Utils_1.utils.uuid();
|
||||
this.source = source;
|
||||
this.parent = parent;
|
||||
this.rootDoc = rootDoc;
|
||||
this.name = source.name;
|
||||
this.position = new Vec2_1.Vec2();
|
||||
this.size = new Size_1.Size();
|
||||
this.rect = new Rect_1.Rect(source);
|
||||
// this.anchorPoint = new Vec2();
|
||||
this.anchorPoint = new Vec2_1.Vec2(0.5, 0.5);
|
||||
this.hidden = false;
|
||||
this.opacity = 255;
|
||||
this.color = new Color_1.Color(255, 255, 255, 255);
|
||||
console.log(`PsdLayer->解析到图层 `, this.name);
|
||||
this.attr = this.parseNameRule(this.name);
|
||||
// // 更新名字
|
||||
this.name = ((_a = this.attr) === null || _a === void 0 ? void 0 : _a.name) || this.name;
|
||||
// 使用配置的缩放系数
|
||||
let _scale = (_b = this.attr) === null || _b === void 0 ? void 0 : _b.comps.scale;
|
||||
this.scale = new Vec3_1.Vec3((_c = _scale === null || _scale === void 0 ? void 0 : _scale.x) !== null && _c !== void 0 ? _c : 1, (_d = _scale === null || _scale === void 0 ? void 0 : _scale.y) !== null && _d !== void 0 ? _d : 1, 1);
|
||||
}
|
||||
parseNameRule(name) {
|
||||
var _a, _b;
|
||||
if (!name) {
|
||||
return;
|
||||
}
|
||||
name = name.trim();
|
||||
let fragments = name.split("@");
|
||||
if (fragments.length === 0) {
|
||||
console.error(`PsdLayer-> 名字解析错误`);
|
||||
return;
|
||||
}
|
||||
let obj = {
|
||||
name: (_b = (_a = fragments[0]) === null || _a === void 0 ? void 0 : _a.replace(/\.|>|\/|\ /g, "_")) !== null && _b !== void 0 ? _b : "unknow",
|
||||
comps: {},
|
||||
};
|
||||
for (let i = 1; i < fragments.length; i++) {
|
||||
const fragment = fragments[i].trim();
|
||||
let attr = {};
|
||||
let startIdx = fragment.indexOf("{");
|
||||
let comp = fragment;
|
||||
if (startIdx != -1) {
|
||||
let endIdx = fragment.indexOf("}");
|
||||
if (endIdx == -1) {
|
||||
console.log(`PsdLayer->${name} 属性 解析错误`);
|
||||
continue;
|
||||
}
|
||||
let attrStr = fragment.substring(startIdx + 1, endIdx);
|
||||
comp = fragment.substr(0, startIdx);
|
||||
attrStr = attrStr.trim();
|
||||
let attrs = attrStr.split(",");
|
||||
attrs.forEach((str) => {
|
||||
str = str.trim();
|
||||
let strs = str.split(":");
|
||||
if (!strs.length) {
|
||||
console.log(`PsdLayer->${name} 属性 解析错误`);
|
||||
return;
|
||||
}
|
||||
strs.map((v) => {
|
||||
return v.trim();
|
||||
});
|
||||
attr[strs[0]] = Utils_1.utils.isNumber(strs[1]) ? parseFloat(strs[1]) : strs[1];
|
||||
});
|
||||
}
|
||||
comp = comp.trim();
|
||||
comp = comp.replace(":", ""); // 防呆,删除 key 中的冒号,
|
||||
obj.comps[comp] = attr;
|
||||
}
|
||||
// 获取别名的值
|
||||
obj.comps.ignore = obj.comps.ignore || obj.comps.ig;
|
||||
obj.comps.ignorenode = obj.comps.ignorenode || obj.comps.ignode;
|
||||
obj.comps.ignoreimg = obj.comps.ignoreimg || obj.comps.igimg;
|
||||
obj.comps.Btn = obj.comps.Btn || obj.comps.btn;
|
||||
obj.comps.ProgressBar = obj.comps.ProgressBar || obj.comps.progressBar;
|
||||
obj.comps.Toggle = obj.comps.Toggle || obj.comps.toggle;
|
||||
// obj.comps.position = obj.comps.position || obj.comps.pos;
|
||||
// 将mirror filpX filpY 进行合并
|
||||
if (obj.comps.flip || obj.comps.flipX || obj.comps.flipY) {
|
||||
obj.comps.flip = Object.assign({}, obj.comps.flip, obj.comps.flipX, obj.comps.flipY);
|
||||
if (obj.comps.flipX) {
|
||||
obj.comps.flip.x = 1;
|
||||
}
|
||||
if (obj.comps.flipY) {
|
||||
obj.comps.flip.y = 1;
|
||||
}
|
||||
// x,y 都缺省时,默认 x 方向镜像
|
||||
if (typeof obj.comps.flip.bind !== 'undefined') {
|
||||
if (!obj.comps.flip.y) {
|
||||
obj.comps.flip.x = 1;
|
||||
}
|
||||
// 只有作为镜像图片使用的时候才反向赋值
|
||||
// 反向赋值,防止使用的时候值错误
|
||||
if (obj.comps.flip.x) {
|
||||
obj.comps.flipX = Object.assign({}, obj.comps.flipX, obj.comps.flip);
|
||||
}
|
||||
if (obj.comps.flip.y) {
|
||||
obj.comps.flipY = Object.assign({}, obj.comps.flipY, obj.comps.flip);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 检查冲突
|
||||
if (obj.comps.full && obj.comps.size) {
|
||||
console.warn(`PsdLayer->${obj.name} 同时存在 @full 和 @size`);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
/** 解析数据 */
|
||||
parseSource() {
|
||||
var _a, _b;
|
||||
let _source = this.source;
|
||||
// psd文档
|
||||
if (!this.parent) {
|
||||
return false;
|
||||
}
|
||||
this.hidden = _source.hidden;
|
||||
this.opacity = Math.round(_source.opacity * 255);
|
||||
// 获取锚点
|
||||
let ar = this.attr.comps.ar;
|
||||
if (ar) {
|
||||
this.anchorPoint.x = (_a = ar.x) !== null && _a !== void 0 ? _a : this.anchorPoint.x;
|
||||
this.anchorPoint.y = (_b = ar.y) !== null && _b !== void 0 ? _b : this.anchorPoint.y;
|
||||
}
|
||||
this.computeBasePosition();
|
||||
return true;
|
||||
}
|
||||
/** 解析 effect */
|
||||
parseEffects() {
|
||||
// 颜色叠加 暂时搞不定
|
||||
// if(this.source.effects?.solidFill){
|
||||
// let solidFills = this.source.effects?.solidFill;
|
||||
// for (let i = 0; i < solidFills.length; i++) {
|
||||
// const solidFill = solidFills[i];
|
||||
// if(solidFill.enabled){
|
||||
// let color = solidFill.color;
|
||||
// this.color = new Color(color.r,color.g,color.b,solidFill.opacity * 255);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
// 计算初始坐标 左下角 0,0 为锚点
|
||||
computeBasePosition() {
|
||||
if (!this.rootDoc) {
|
||||
return;
|
||||
}
|
||||
let _rect = this.rect;
|
||||
let width = (_rect.right - _rect.left);
|
||||
let height = (_rect.bottom - _rect.top);
|
||||
this.size.width = width;
|
||||
this.size.height = height;
|
||||
// 位置 左下角为锚点
|
||||
let x = _rect.left;
|
||||
let y = (this.rootDoc.size.height - _rect.bottom);
|
||||
this.position.x = x;
|
||||
this.position.y = y;
|
||||
}
|
||||
// 根据锚点计算坐标
|
||||
updatePositionWithAR() {
|
||||
if (!this.parent) {
|
||||
return;
|
||||
}
|
||||
let parent = this.parent;
|
||||
while (parent) {
|
||||
this.position.x -= parent.position.x;
|
||||
this.position.y -= parent.position.y;
|
||||
parent = parent.parent;
|
||||
}
|
||||
// this.position.x = this.position.x - this.parent.size.width * this.parent.anchorPoint.x + this.size.width * this.anchorPoint.x;
|
||||
// this.position.y = this.position.y - this.parent.size.height * this.parent.anchorPoint.y + this.size.height * this.anchorPoint.y;
|
||||
this.position.x = this.position.x - this.rootDoc.size.width * this.rootDoc.anchorPoint.x + this.size.width * this.anchorPoint.x;
|
||||
this.position.y = this.position.y - this.rootDoc.size.height * this.rootDoc.anchorPoint.y + this.size.height * this.anchorPoint.y;
|
||||
}
|
||||
}
|
||||
exports.PsdLayer = PsdLayer;
|
57
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/psd/PsdText.js
Normal file
57
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/psd/PsdText.js
Normal file
@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PsdText = void 0;
|
||||
const config_1 = require("../config");
|
||||
const Color_1 = require("../values/Color");
|
||||
const PsdLayer_1 = require("./PsdLayer");
|
||||
class PsdText extends PsdLayer_1.PsdLayer {
|
||||
parseSource() {
|
||||
super.parseSource();
|
||||
let textSource = this.source.text;
|
||||
let style = textSource.style;
|
||||
if (style) {
|
||||
let fillColor = style.fillColor;
|
||||
if (fillColor) {
|
||||
this.color = new Color_1.Color(fillColor.r, fillColor.g, fillColor.b, fillColor.a * 255);
|
||||
}
|
||||
}
|
||||
this.text = textSource.text;
|
||||
this.fontSize = style.fontSize;
|
||||
this.offsetY = config_1.config.textOffsetY[this.fontSize] || config_1.config.textOffsetY["default"] || 0;
|
||||
this.parseSolidFill();
|
||||
this.parseStroke();
|
||||
return true;
|
||||
}
|
||||
onCtor() {
|
||||
}
|
||||
/** 描边 */
|
||||
parseStroke() {
|
||||
var _a, _b;
|
||||
if ((_a = this.source.effects) === null || _a === void 0 ? void 0 : _a.stroke) {
|
||||
let stroke = (_b = this.source.effects) === null || _b === void 0 ? void 0 : _b.stroke[0];
|
||||
// 外描边
|
||||
if ((stroke === null || stroke === void 0 ? void 0 : stroke.enabled) && (stroke === null || stroke === void 0 ? void 0 : stroke.position) === "outside") {
|
||||
let color = stroke.color;
|
||||
this.outline = {
|
||||
width: stroke.size.value,
|
||||
color: new Color_1.Color(color.r, color.g, color.b, stroke.opacity * 255)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
/** 解析 颜色叠加 */
|
||||
parseSolidFill() {
|
||||
var _a, _b;
|
||||
if ((_a = this.source.effects) === null || _a === void 0 ? void 0 : _a.solidFill) {
|
||||
let solidFills = (_b = this.source.effects) === null || _b === void 0 ? void 0 : _b.solidFill;
|
||||
for (let i = 0; i < solidFills.length; i++) {
|
||||
const solidFill = solidFills[i];
|
||||
if (solidFill.enabled) {
|
||||
let color = solidFill.color;
|
||||
this.color = new Color_1.Color(color.r, color.g, color.b, solidFill.opacity * 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.PsdText = PsdText;
|
122
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/utils/FileUtils.js
Normal file
122
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/utils/FileUtils.js
Normal file
@ -0,0 +1,122 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fileUtils = void 0;
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const crypto_1 = __importDefault(require("crypto"));
|
||||
class FileUtils {
|
||||
// 深度遍历
|
||||
DFS(root, callback, depth = 0) {
|
||||
let exists = fs_extra_1.default.existsSync(root);
|
||||
if (!exists) {
|
||||
console.log(`FileUtils-> ${root} is not exists`);
|
||||
return;
|
||||
}
|
||||
let files = fs_extra_1.default.readdirSync(root);
|
||||
let _cacheDepth = depth;
|
||||
depth++;
|
||||
files.forEach((file) => {
|
||||
let fullPath = path_1.default.join(root, file);
|
||||
let stat = fs_extra_1.default.lstatSync(fullPath);
|
||||
let isDirectory = stat.isDirectory();
|
||||
callback === null || callback === void 0 ? void 0 : callback({ isDirectory, fullPath, fileName: file, depth: _cacheDepth });
|
||||
if (!isDirectory) {
|
||||
}
|
||||
else {
|
||||
this.DFS(fullPath, callback, depth);
|
||||
}
|
||||
});
|
||||
}
|
||||
filterFile(root, filter) {
|
||||
let exists = fs_extra_1.default.existsSync(root);
|
||||
if (!exists) {
|
||||
console.log(`FileUtils-> ${root} is not exists`);
|
||||
return;
|
||||
}
|
||||
var res = [];
|
||||
let files = fs_extra_1.default.readdirSync(root);
|
||||
files.forEach((file) => {
|
||||
let pathName = path_1.default.join(root, file);
|
||||
let stat = fs_extra_1.default.lstatSync(pathName);
|
||||
let isDirectory = stat.isDirectory();
|
||||
// 只对文件进行判断
|
||||
if (!isDirectory) {
|
||||
let isPass = filter(file);
|
||||
if (!isPass) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!isDirectory) {
|
||||
res.push(pathName);
|
||||
}
|
||||
else {
|
||||
res = res.concat(this.filterFile(pathName, filter));
|
||||
}
|
||||
});
|
||||
return res;
|
||||
}
|
||||
getFolderFiles(dir, type) {
|
||||
let exists = fs_extra_1.default.existsSync(dir);
|
||||
if (!exists) {
|
||||
console.log(`FileUtils-> ${dir} is not exists`);
|
||||
return;
|
||||
}
|
||||
let res = [];
|
||||
let files = fs_extra_1.default.readdirSync(dir);
|
||||
files.forEach((file) => {
|
||||
let fullPath = path_1.default.join(dir, file);
|
||||
let stat = fs_extra_1.default.lstatSync(fullPath);
|
||||
let isDirectory = stat.isDirectory();
|
||||
if (isDirectory) {
|
||||
if (type === 'folder') {
|
||||
res.push({ fullPath, basename: file });
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (type === 'file') {
|
||||
res.push({ fullPath, basename: file });
|
||||
}
|
||||
}
|
||||
});
|
||||
return res;
|
||||
}
|
||||
writeFile(fullPath, data) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof data !== 'string') {
|
||||
try {
|
||||
data = JSON.stringify(data, null, 2);
|
||||
}
|
||||
catch (error) {
|
||||
console.log(`FileUtils->writeFile `, error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
console.log(`写入文件 ${fullPath}`);
|
||||
let dir = path_1.default.dirname(fullPath);
|
||||
yield fs_extra_1.default.mkdirp(dir);
|
||||
yield fs_extra_1.default.writeFile(fullPath, data);
|
||||
console.log(`写入完成 ${fullPath} `);
|
||||
});
|
||||
}
|
||||
/** 获取文件的 md5 */
|
||||
getMD5(buffer) {
|
||||
if (typeof buffer === 'string') {
|
||||
buffer = fs_extra_1.default.readFileSync(buffer);
|
||||
}
|
||||
let md5 = crypto_1.default.createHash("md5").update(buffer).digest("hex");
|
||||
return md5;
|
||||
}
|
||||
}
|
||||
exports.fileUtils = new FileUtils();
|
37
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/utils/Texture9Utils.js
Normal file
37
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/utils/Texture9Utils.js
Normal file
@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Texture9Utils = void 0;
|
||||
const canvas_1 = __importDefault(require("canvas"));
|
||||
class Texture9Utils {
|
||||
static safeBorder(border) {
|
||||
border.l = border.l || border.r || 0;
|
||||
border.r = border.r || border.l || 0;
|
||||
border.t = border.t || border.b || 0;
|
||||
border.b = border.b || border.t || 0;
|
||||
return border;
|
||||
}
|
||||
static split(_canvas, border) {
|
||||
this.safeBorder(border);
|
||||
let cw = _canvas.width;
|
||||
let ch = _canvas.height;
|
||||
let left = border.l || cw;
|
||||
let right = border.r || cw;
|
||||
let top = border.t || ch;
|
||||
let bottom = border.b || ch;
|
||||
let newCanvas = canvas_1.default.createCanvas((border.l + border.r) || cw, (border.b + border.t) || ch);
|
||||
let ctx = newCanvas.getContext("2d");
|
||||
// 左上
|
||||
ctx.drawImage(_canvas, 0, 0, left, top, 0, 0, left, top);
|
||||
// 左下
|
||||
ctx.drawImage(_canvas, 0, ch - top, left, bottom, 0, top, left, bottom);
|
||||
// 右上
|
||||
ctx.drawImage(_canvas, cw - left, 0, right, top, left, 0, right, top);
|
||||
// 右下
|
||||
ctx.drawImage(_canvas, cw - left, ch - top, right, bottom, left, top, right, bottom);
|
||||
return newCanvas;
|
||||
}
|
||||
}
|
||||
exports.Texture9Utils = Texture9Utils;
|
80
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/utils/Utils.js
Normal file
80
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/utils/Utils.js
Normal file
@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.utils = void 0;
|
||||
// ------------decode-uuid
|
||||
const BASE64_KEYS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||
const values = new Array(123); // max char code in base64Keys
|
||||
for (let i = 0; i < 123; ++i) {
|
||||
values[i] = 64;
|
||||
} // fill with placeholder('=') index
|
||||
for (let i = 0; i < 64; ++i) {
|
||||
values[BASE64_KEYS.charCodeAt(i)] = i;
|
||||
}
|
||||
// decoded value indexed by base64 char code
|
||||
const BASE64_VALUES = values;
|
||||
const HexChars = '0123456789abcdef'.split('');
|
||||
const _t = ['', '', '', ''];
|
||||
const UuidTemplate = _t.concat(_t, '-', _t, '-', _t, '-', _t, '-', _t, _t, _t);
|
||||
const Indices = UuidTemplate.map((x, i) => x === '-' ? NaN : i).filter(isFinite);
|
||||
let HexMap = {};
|
||||
{
|
||||
for (let i = 0; i < HexChars.length; i++) {
|
||||
let char = HexChars[i];
|
||||
HexMap[char] = i;
|
||||
}
|
||||
}
|
||||
class Utils {
|
||||
uuid() {
|
||||
var d = new Date().getTime();
|
||||
if (globalThis.performance && typeof globalThis.performance.now === "function") {
|
||||
d += performance.now(); //use high-precision timer if available
|
||||
}
|
||||
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
var r = (d + Math.random() * 16) % 16 | 0;
|
||||
d = Math.floor(d / 16);
|
||||
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
|
||||
});
|
||||
return uuid;
|
||||
}
|
||||
decodeUuid(base64) {
|
||||
const strs = base64.split('@');
|
||||
const uuid = strs[0];
|
||||
if (uuid.length !== 22) {
|
||||
return base64;
|
||||
}
|
||||
UuidTemplate[0] = base64[0];
|
||||
UuidTemplate[1] = base64[1];
|
||||
for (let i = 2, j = 2; i < 22; i += 2) {
|
||||
const lhs = BASE64_VALUES[base64.charCodeAt(i)];
|
||||
const rhs = BASE64_VALUES[base64.charCodeAt(i + 1)];
|
||||
UuidTemplate[Indices[j++]] = HexChars[lhs >> 2];
|
||||
UuidTemplate[Indices[j++]] = HexChars[((lhs & 3) << 2) | rhs >> 4];
|
||||
UuidTemplate[Indices[j++]] = HexChars[rhs & 0xF];
|
||||
}
|
||||
return base64.replace(uuid, UuidTemplate.join(''));
|
||||
}
|
||||
// 压缩uuid
|
||||
compressUuid(fullUuid) {
|
||||
const strs = fullUuid.split('@');
|
||||
const uuid = strs[0];
|
||||
if (uuid.length !== 36) {
|
||||
return fullUuid;
|
||||
}
|
||||
let zipUuid = [];
|
||||
zipUuid[0] = uuid[0];
|
||||
zipUuid[1] = uuid[1];
|
||||
let cleanUuid = uuid.replace('-', '').replace('-', '').replace('-', '').replace('-', '');
|
||||
for (let i = 2, j = 2; i < 32; i += 3) {
|
||||
const left = HexMap[String.fromCharCode(cleanUuid.charCodeAt(i))];
|
||||
const mid = HexMap[String.fromCharCode(cleanUuid.charCodeAt(i + 1))];
|
||||
const right = HexMap[String.fromCharCode(cleanUuid.charCodeAt(i + 2))];
|
||||
zipUuid[j++] = BASE64_KEYS[(left << 2) + (mid >> 2)];
|
||||
zipUuid[j++] = BASE64_KEYS[((mid & 3) << 4) + right];
|
||||
}
|
||||
return fullUuid.replace(uuid, zipUuid.join(''));
|
||||
}
|
||||
isNumber(val) {
|
||||
return (!isNaN(parseFloat(val)) && isFinite(val));
|
||||
}
|
||||
}
|
||||
exports.utils = new Utils();
|
95
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/utils/UuidUtils.js
Normal file
95
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/utils/UuidUtils.js
Normal file
@ -0,0 +1,95 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.UuidUtils = void 0;
|
||||
var Uuid = require('node-uuid');
|
||||
var Base64KeyChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
var AsciiTo64 = new Array(128);
|
||||
for (var i = 0; i < 128; ++i) {
|
||||
AsciiTo64[i] = 0;
|
||||
}
|
||||
for (i = 0; i < 64; ++i) {
|
||||
AsciiTo64[Base64KeyChars.charCodeAt(i)] = i;
|
||||
}
|
||||
var Reg_Dash = /-/g;
|
||||
var Reg_Uuid = /^[0-9a-fA-F-]{36}$/;
|
||||
var Reg_NormalizedUuid = /^[0-9a-fA-F]{32}$/;
|
||||
var Reg_CompressedUuid = /^[0-9a-zA-Z+/]{22,23}$/;
|
||||
class UuidUtils {
|
||||
// 压缩后的 uuid 可以减小保存时的尺寸,但不能做为文件名(因为无法区分大小写并且包含非法字符)。
|
||||
// 默认将 uuid 的后面 27 位压缩成 18 位,前 5 位保留下来,方便调试。
|
||||
// fc991dd7-0033-4b80-9d41-c8a86a702e59 -> fc9913XADNLgJ1ByKhqcC5Z
|
||||
// 如果启用 min 则将 uuid 的后面 30 位压缩成 20 位,前 2 位保留不变。
|
||||
// fc991dd7-0033-4b80-9d41-c8a86a702e59 -> fcmR3XADNLgJ1ByKhqcC5Z
|
||||
/*
|
||||
* @param {Boolean} [min=false]
|
||||
*/
|
||||
static compressUuid(uuid, min) {
|
||||
if (Reg_Uuid.test(uuid)) {
|
||||
uuid = uuid.replace(Reg_Dash, '');
|
||||
}
|
||||
else if (!Reg_NormalizedUuid.test(uuid)) {
|
||||
return uuid;
|
||||
}
|
||||
var reserved = (min === true) ? 2 : 5;
|
||||
return UuidUtils.compressHex(uuid, reserved);
|
||||
}
|
||||
static compressHex(hexString, reservedHeadLength) {
|
||||
var length = hexString.length;
|
||||
var i;
|
||||
if (typeof reservedHeadLength !== 'undefined') {
|
||||
i = reservedHeadLength;
|
||||
}
|
||||
else {
|
||||
i = length % 3;
|
||||
}
|
||||
var head = hexString.slice(0, i);
|
||||
var base64Chars = [];
|
||||
while (i < length) {
|
||||
var hexVal1 = parseInt(hexString[i], 16);
|
||||
var hexVal2 = parseInt(hexString[i + 1], 16);
|
||||
var hexVal3 = parseInt(hexString[i + 2], 16);
|
||||
base64Chars.push(Base64KeyChars[(hexVal1 << 2) | (hexVal2 >> 2)]);
|
||||
base64Chars.push(Base64KeyChars[((hexVal2 & 3) << 4) | hexVal3]);
|
||||
i += 3;
|
||||
}
|
||||
return head + base64Chars.join('');
|
||||
}
|
||||
static decompressUuid(str) {
|
||||
if (str.length === 23) {
|
||||
// decode base64
|
||||
var hexChars = [];
|
||||
for (var i = 5; i < 23; i += 2) {
|
||||
var lhs = AsciiTo64[str.charCodeAt(i)];
|
||||
var rhs = AsciiTo64[str.charCodeAt(i + 1)];
|
||||
hexChars.push((lhs >> 2).toString(16));
|
||||
hexChars.push((((lhs & 3) << 2) | rhs >> 4).toString(16));
|
||||
hexChars.push((rhs & 0xF).toString(16));
|
||||
}
|
||||
//
|
||||
str = str.slice(0, 5) + hexChars.join('');
|
||||
}
|
||||
else if (str.length === 22) {
|
||||
// decode base64
|
||||
var hexChars = [];
|
||||
for (var i = 2; i < 22; i += 2) {
|
||||
var lhs = AsciiTo64[str.charCodeAt(i)];
|
||||
var rhs = AsciiTo64[str.charCodeAt(i + 1)];
|
||||
hexChars.push((lhs >> 2).toString(16));
|
||||
hexChars.push((((lhs & 3) << 2) | rhs >> 4).toString(16));
|
||||
hexChars.push((rhs & 0xF).toString(16));
|
||||
}
|
||||
//
|
||||
str = str.slice(0, 2) + hexChars.join('');
|
||||
}
|
||||
return [str.slice(0, 8), str.slice(8, 12), str.slice(12, 16), str.slice(16, 20), str.slice(20)].join('-');
|
||||
}
|
||||
static isUuid(str) {
|
||||
return Reg_CompressedUuid.test(str) || Reg_NormalizedUuid.test(str) || Reg_Uuid.test(str);
|
||||
}
|
||||
static uuid() {
|
||||
var uuid = Uuid.v4();
|
||||
return UuidUtils.compressUuid(uuid, true);
|
||||
}
|
||||
}
|
||||
exports.UuidUtils = UuidUtils;
|
||||
;
|
37
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Color.js
Normal file
37
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Color.js
Normal file
@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Color = void 0;
|
||||
class Color {
|
||||
constructor(r, g, b, a) {
|
||||
this.r = Math.ceil(r || 0);
|
||||
this.g = Math.ceil(g || 0);
|
||||
this.b = Math.ceil(b || 0);
|
||||
this.a = Math.ceil(a || 0);
|
||||
}
|
||||
set(color) {
|
||||
this.r = Math.ceil(color.r || 0);
|
||||
this.g = Math.ceil(color.g || 0);
|
||||
this.b = Math.ceil(color.b || 0);
|
||||
this.a = Math.ceil(color.a || 0);
|
||||
}
|
||||
toHEX(fmt = '#rrggbb') {
|
||||
const prefix = '0';
|
||||
// #rrggbb
|
||||
const hex = [
|
||||
(this.r < 16 ? prefix : '') + (this.r).toString(16),
|
||||
(this.g < 16 ? prefix : '') + (this.g).toString(16),
|
||||
(this.b < 16 ? prefix : '') + (this.b).toString(16),
|
||||
];
|
||||
const i = -1;
|
||||
if (fmt === '#rgb') {
|
||||
hex[0] = hex[0][0];
|
||||
hex[1] = hex[1][0];
|
||||
hex[2] = hex[2][0];
|
||||
}
|
||||
else if (fmt === '#rrggbbaa') {
|
||||
hex.push((this.a < 16 ? prefix : '') + (this.a).toString(16));
|
||||
}
|
||||
return hex.join('');
|
||||
}
|
||||
}
|
||||
exports.Color = Color;
|
22
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Rect.js
Normal file
22
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Rect.js
Normal file
@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Rect = void 0;
|
||||
class Rect {
|
||||
constructor(left = 0, right = 0, top = 0, bottom = 0) {
|
||||
if (typeof left == 'object') {
|
||||
this.set(left);
|
||||
return;
|
||||
}
|
||||
this.left = left || 0;
|
||||
this.right = right || 0;
|
||||
this.top = top || 0;
|
||||
this.bottom = bottom || 0;
|
||||
}
|
||||
set(rect) {
|
||||
this.left = rect.left;
|
||||
this.right = rect.right;
|
||||
this.top = rect.top;
|
||||
this.bottom = rect.bottom;
|
||||
}
|
||||
}
|
||||
exports.Rect = Rect;
|
10
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Size.js
Normal file
10
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Size.js
Normal file
@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Size = void 0;
|
||||
class Size {
|
||||
constructor(width = 0, height = 0) {
|
||||
this.width = width || 0;
|
||||
this.height = height || 0;
|
||||
}
|
||||
}
|
||||
exports.Size = Size;
|
10
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Vec2.js
Normal file
10
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Vec2.js
Normal file
@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Vec2 = void 0;
|
||||
class Vec2 {
|
||||
constructor(x = 0, y = 0) {
|
||||
this.x = x || 0;
|
||||
this.y = y || 0;
|
||||
}
|
||||
}
|
||||
exports.Vec2 = Vec2;
|
11
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Vec3.js
Normal file
11
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Vec3.js
Normal file
@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Vec3 = void 0;
|
||||
class Vec3 {
|
||||
constructor(x = 0, y = 0, z = 0) {
|
||||
this.x = x || 0;
|
||||
this.y = y || 0;
|
||||
this.z = z || 0;
|
||||
}
|
||||
}
|
||||
exports.Vec3 = Vec3;
|
173
ccc-tnt-psd2ui-v2.4.x/main.js
Normal file
173
ccc-tnt-psd2ui-v2.4.x/main.js
Normal file
@ -0,0 +1,173 @@
|
||||
'use strict';
|
||||
const Electron = require('electron');
|
||||
let fs = require('fs');
|
||||
const path = require("path")
|
||||
const packageJSON = require('./package.json');
|
||||
let child_process = require('child_process');
|
||||
let exec = child_process.exec;
|
||||
let spawn = child_process.spawn;
|
||||
|
||||
|
||||
|
||||
const ENGINE_VER = "v249"; // 参数超过了 10 个,这里暂时省略掉 版本号参数
|
||||
const projectAssets = path.join(Editor.Project.path, "assets");
|
||||
const cacheFile = path.join(Editor.Project.path, "local", "psd-to-prefab-cache.json");
|
||||
const commandBat = path.join(Editor.Project.path, `packages\\${packageJSON.name}\\libs\\psd2ui\\command.bat`);
|
||||
const configFile = path.join(Editor.Project.path, `packages\\${packageJSON.name}\\config\\psd.config.json`);
|
||||
let uuid2md5 = new Map();
|
||||
let cacheFileJson = {};
|
||||
|
||||
|
||||
function _exec(options, tasks) {
|
||||
let jsonContent = JSON.stringify(options);
|
||||
|
||||
console.log("批处理命令参数:" + jsonContent);
|
||||
let base64 = Buffer.from(jsonContent).toString("base64");
|
||||
|
||||
console.log('start ' + commandBat + ' ' + `--json ${base64}`);
|
||||
tasks.push(new Promise((rs) => {
|
||||
exec('start ' + commandBat + ' ' + `--json ${base64}`, { windowsHide: false }, (err, stdout, stderr) => {
|
||||
rs();
|
||||
})
|
||||
}));
|
||||
return tasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源删除的监听
|
||||
*
|
||||
* @param {*} event
|
||||
*/
|
||||
function onAssetDeletedListener(event, args) {
|
||||
if (!args) {
|
||||
return;
|
||||
}
|
||||
|
||||
let array = args.filter((element) => {
|
||||
return element.type == "texture";
|
||||
});
|
||||
if (!array.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
let rewrite = false;
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
const element = array[i];
|
||||
let uuid = element.uuid;
|
||||
if (uuid2md5.has(uuid)) {
|
||||
rewrite = true;
|
||||
let md5 = uuid2md5.get(uuid);
|
||||
Editor.log(`[ccc-tnt-psd2ui] 删除资源 md5: ${md5}, uuid: ${uuid}`);
|
||||
delete cacheFileJson[`${md5}`];
|
||||
}
|
||||
}
|
||||
|
||||
if(rewrite){
|
||||
fs.writeFileSync(cacheFile, JSON.stringify(cacheFileJson, null, 2));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成 uuid 转 MD5 的映射
|
||||
*
|
||||
*/
|
||||
function genUUID2MD5Mapping() {
|
||||
if (!fs.existsSync(cacheFile)) {
|
||||
return;
|
||||
}
|
||||
let content = fs.readFileSync(cacheFile, 'utf-8');
|
||||
let obj = JSON.parse(content);
|
||||
cacheFileJson = obj;
|
||||
for (const key in obj) {
|
||||
const element = obj[key];
|
||||
uuid2md5.set(element.uuid, key);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
load() {
|
||||
genUUID2MD5Mapping();
|
||||
// Electron.ipcMain.on('asset-db:assets-deleted', onAssetDeletedListener);
|
||||
},
|
||||
|
||||
unload() {
|
||||
// Electron.ipcMain.removeListener('asset-db:assets-deleted', onAssetDeletedListener);
|
||||
},
|
||||
|
||||
messages: {
|
||||
'on-drop-file': async (event, param) => {
|
||||
|
||||
let files = param.files;
|
||||
let isForceImg = param.isForceImg;
|
||||
let isImgOnly = param.isImgOnly;
|
||||
let output = param.output
|
||||
|
||||
let options = {
|
||||
"project-assets": projectAssets,
|
||||
"cache": cacheFile,
|
||||
"engine-version": ENGINE_VER,
|
||||
}
|
||||
|
||||
let tasks = [];
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i];
|
||||
let stat = fs.statSync(file);
|
||||
if (stat.isFile()) {
|
||||
let ext = path.extname(file);
|
||||
if (ext != '.psd') {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
let args = JSON.parse(JSON.stringify(options));
|
||||
args["input"] = file;
|
||||
if (output) {
|
||||
args["output"] = output;
|
||||
}
|
||||
if (isImgOnly) {
|
||||
|
||||
// 只导出图片
|
||||
args["img-only"] = true;
|
||||
} else {
|
||||
|
||||
// 强制导出图片
|
||||
if (isForceImg) {
|
||||
args["force-img"] = true;
|
||||
}
|
||||
args["config"] = configFile;
|
||||
}
|
||||
|
||||
_exec(args, tasks)
|
||||
}
|
||||
|
||||
await Promise.all(tasks);
|
||||
genUUID2MD5Mapping();
|
||||
Editor.log("[ccc-tnt-psd2ui] psd 导出完成,输出位置为:", output ? output : "psd 同级目录");
|
||||
event.reply(null, true);
|
||||
},
|
||||
|
||||
'open'() {
|
||||
Editor.Panel.open('ccc-tnt-psd2ui');
|
||||
},
|
||||
|
||||
'onClickCache': (event) => {
|
||||
let options = {
|
||||
"project-assets": projectAssets,
|
||||
"cache": cacheFile,
|
||||
"init": true,
|
||||
}
|
||||
Promise.all(_exec(options, [])).then(() => {
|
||||
console.log("[ccc-tnt-psd2ui] 执行缓存结束");
|
||||
event.reply(null, true);
|
||||
});
|
||||
},
|
||||
'save-config': async (event, config) => {
|
||||
Editor.log('[ccc-tnt-psd2ui]', '调起命令行');
|
||||
event.reply(null, true);
|
||||
},
|
||||
|
||||
"read-cache"(event, config) {
|
||||
|
||||
},
|
||||
"asset-db:assets-deleted": onAssetDeletedListener
|
||||
},
|
||||
};
|
12
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/color-support
generated
vendored
Normal file
12
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/color-support
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../color-support/bin.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../color-support/bin.js" "$@"
|
||||
fi
|
17
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/color-support.cmd
generated
vendored
Normal file
17
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/color-support.cmd
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\color-support\bin.js" %*
|
28
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/color-support.ps1
generated
vendored
Normal file
28
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/color-support.ps1
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../color-support/bin.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../color-support/bin.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../color-support/bin.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../color-support/bin.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/mkdirp
generated
vendored
Normal file
12
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/mkdirp
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||
fi
|
17
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/mkdirp.cmd
generated
vendored
Normal file
17
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/mkdirp.cmd
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mkdirp\bin\cmd.js" %*
|
28
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/mkdirp.ps1
generated
vendored
Normal file
28
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/mkdirp.ps1
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/node-pre-gyp
generated
vendored
Normal file
12
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/node-pre-gyp
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../@mapbox/node-pre-gyp/bin/node-pre-gyp" "$@"
|
||||
else
|
||||
exec node "$basedir/../@mapbox/node-pre-gyp/bin/node-pre-gyp" "$@"
|
||||
fi
|
17
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/node-pre-gyp.cmd
generated
vendored
Normal file
17
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/node-pre-gyp.cmd
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@mapbox\node-pre-gyp\bin\node-pre-gyp" %*
|
28
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/node-pre-gyp.ps1
generated
vendored
Normal file
28
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/node-pre-gyp.ps1
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../@mapbox/node-pre-gyp/bin/node-pre-gyp" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../@mapbox/node-pre-gyp/bin/node-pre-gyp" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../@mapbox/node-pre-gyp/bin/node-pre-gyp" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../@mapbox/node-pre-gyp/bin/node-pre-gyp" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/nopt
generated
vendored
Normal file
12
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/nopt
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../nopt/bin/nopt.js" "$@"
|
||||
fi
|
17
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/nopt.cmd
generated
vendored
Normal file
17
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/nopt.cmd
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nopt\bin\nopt.js" %*
|
28
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/nopt.ps1
generated
vendored
Normal file
28
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/nopt.ps1
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../nopt/bin/nopt.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../nopt/bin/nopt.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/rimraf
generated
vendored
Normal file
12
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/rimraf
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../rimraf/bin.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../rimraf/bin.js" "$@"
|
||||
fi
|
17
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/rimraf.cmd
generated
vendored
Normal file
17
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/rimraf.cmd
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\rimraf\bin.js" %*
|
28
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/rimraf.ps1
generated
vendored
Normal file
28
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/rimraf.ps1
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/semver
generated
vendored
Normal file
12
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/semver
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../semver/bin/semver.js" "$@"
|
||||
fi
|
17
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/semver.cmd
generated
vendored
Normal file
17
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/semver.cmd
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver.js" %*
|
28
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/semver.ps1
generated
vendored
Normal file
28
ccc-tnt-psd2ui-v2.4.x/node_modules/.bin/semver.ps1
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../semver/bin/semver.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../semver/bin/semver.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
649
ccc-tnt-psd2ui-v2.4.x/node_modules/.package-lock.json
generated
vendored
Normal file
649
ccc-tnt-psd2ui-v2.4.x/node_modules/.package-lock.json
generated
vendored
Normal file
@ -0,0 +1,649 @@
|
||||
{
|
||||
"name": "psd2prefab",
|
||||
"version": "0.0.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@mapbox/node-pre-gyp": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmmirror.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.10.tgz",
|
||||
"integrity": "sha512-4ySo4CjzStuprMwk35H5pPbkymjv1SF3jGLj6rAHp/xT/RF7TL7bd9CTm1xDY49K2qF7jmR/g7k+SkLETP6opA==",
|
||||
"dependencies": {
|
||||
"detect-libc": "^2.0.0",
|
||||
"https-proxy-agent": "^5.0.0",
|
||||
"make-dir": "^3.1.0",
|
||||
"node-fetch": "^2.6.7",
|
||||
"nopt": "^5.0.0",
|
||||
"npmlog": "^5.0.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"semver": "^7.3.5",
|
||||
"tar": "^6.1.11"
|
||||
},
|
||||
"bin": {
|
||||
"node-pre-gyp": "bin/node-pre-gyp"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/base64-js": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/@types/base64-js/-/base64-js-1.3.0.tgz",
|
||||
"integrity": "sha512-ZmI0sZGAUNXUfMWboWwi4LcfpoVUYldyN6Oe0oJ5cCsHDU/LlRq8nQKPXhYLOx36QYSW9bNIb1vvRrD6K7Llgw=="
|
||||
},
|
||||
"node_modules/@types/pako": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/@types/pako/-/pako-2.0.0.tgz",
|
||||
"integrity": "sha512-10+iaz93qR5WYxTo+PMifD5TSxiOtdRaxBf7INGGXMQgTCu8Z/7GYWYFUOS3q/G0nE5boj1r4FEB+WSy7s5gbA=="
|
||||
},
|
||||
"node_modules/abbrev": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/abbrev/-/abbrev-1.1.1.tgz",
|
||||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
||||
},
|
||||
"node_modules/ag-psd": {
|
||||
"version": "15.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/ag-psd/-/ag-psd-15.0.1.tgz",
|
||||
"integrity": "sha512-uKogYrQz6Tv/9mfSUlJPIZFySWU/KuCdmM6VAUpOdLmM98yQPkEtLz5R4W7aq/DHbumxASrkznJwrX2Tp+KMrA==",
|
||||
"dependencies": {
|
||||
"@types/base64-js": "^1.3.0",
|
||||
"@types/pako": "^2.0.0",
|
||||
"base64-js": "^1.5.1",
|
||||
"pako": "^2.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/agent-base": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/agent-base/-/agent-base-6.0.2.tgz",
|
||||
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
|
||||
"dependencies": {
|
||||
"debug": "4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-regex": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/aproba": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/aproba/-/aproba-2.0.0.tgz",
|
||||
"integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ=="
|
||||
},
|
||||
"node_modules/are-we-there-yet": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz",
|
||||
"integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==",
|
||||
"dependencies": {
|
||||
"delegates": "^1.0.0",
|
||||
"readable-stream": "^3.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmmirror.com/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||
},
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/canvas": {
|
||||
"version": "2.10.2",
|
||||
"resolved": "https://registry.npmmirror.com/canvas/-/canvas-2.10.2.tgz",
|
||||
"integrity": "sha512-FSmlsip0nZ0U4Zcfht0qBJqDhlfGuevTZKE8h+dBOYrJjGvY3iqMGSzzbvkaFhvMXiVxfcMaPHS/kge++T5SKg==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@mapbox/node-pre-gyp": "^1.0.0",
|
||||
"nan": "^2.17.0",
|
||||
"simple-get": "^3.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/chownr": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/chownr/-/chownr-2.0.0.tgz",
|
||||
"integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/color-support": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmmirror.com/color-support/-/color-support-1.1.3.tgz",
|
||||
"integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==",
|
||||
"bin": {
|
||||
"color-support": "bin.js"
|
||||
}
|
||||
},
|
||||
"node_modules/concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
|
||||
},
|
||||
"node_modules/console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/console-control-strings/-/console-control-strings-1.1.0.tgz",
|
||||
"integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ=="
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmmirror.com/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/decompress-response": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/decompress-response/-/decompress-response-4.2.1.tgz",
|
||||
"integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==",
|
||||
"dependencies": {
|
||||
"mimic-response": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/delegates": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/delegates/-/delegates-1.0.0.tgz",
|
||||
"integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ=="
|
||||
},
|
||||
"node_modules/detect-libc": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-2.0.1.tgz",
|
||||
"integrity": "sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/emoji-regex": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
|
||||
},
|
||||
"node_modules/fs-extra": {
|
||||
"version": "10.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-10.1.0.tgz",
|
||||
"integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.2.0",
|
||||
"jsonfile": "^6.0.1",
|
||||
"universalify": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/fs-minipass": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/fs-minipass/-/fs-minipass-2.1.0.tgz",
|
||||
"integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
|
||||
"dependencies": {
|
||||
"minipass": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
|
||||
},
|
||||
"node_modules/gauge": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/gauge/-/gauge-3.0.2.tgz",
|
||||
"integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==",
|
||||
"dependencies": {
|
||||
"aproba": "^1.0.3 || ^2.0.0",
|
||||
"color-support": "^1.1.2",
|
||||
"console-control-strings": "^1.0.0",
|
||||
"has-unicode": "^2.0.1",
|
||||
"object-assign": "^4.1.1",
|
||||
"signal-exit": "^3.0.0",
|
||||
"string-width": "^4.2.3",
|
||||
"strip-ansi": "^6.0.1",
|
||||
"wide-align": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/glob": {
|
||||
"version": "7.2.3",
|
||||
"resolved": "https://registry.npmmirror.com/glob/-/glob-7.2.3.tgz",
|
||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
||||
"dependencies": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.1.1",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/graceful-fs": {
|
||||
"version": "4.2.10",
|
||||
"resolved": "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.10.tgz",
|
||||
"integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA=="
|
||||
},
|
||||
"node_modules/has-unicode": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/has-unicode/-/has-unicode-2.0.1.tgz",
|
||||
"integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ=="
|
||||
},
|
||||
"node_modules/https-proxy-agent": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
|
||||
"integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
|
||||
"dependencies": {
|
||||
"agent-base": "6",
|
||||
"debug": "4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmmirror.com/inflight/-/inflight-1.0.6.tgz",
|
||||
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
|
||||
"dependencies": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"node_modules/is-fullwidth-code-point": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/jsonfile": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/jsonfile/-/jsonfile-6.1.0.tgz",
|
||||
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
|
||||
"dependencies": {
|
||||
"universalify": "^2.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"graceful-fs": "^4.1.6"
|
||||
}
|
||||
},
|
||||
"node_modules/lru-cache": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||
"dependencies": {
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/make-dir": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/make-dir/-/make-dir-3.1.0.tgz",
|
||||
"integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
|
||||
"dependencies": {
|
||||
"semver": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/make-dir/node_modules/semver": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
}
|
||||
},
|
||||
"node_modules/mimic-response": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/mimic-response/-/mimic-response-2.1.0.tgz",
|
||||
"integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmmirror.com/minimist/-/minimist-1.2.7.tgz",
|
||||
"integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g=="
|
||||
},
|
||||
"node_modules/minipass": {
|
||||
"version": "3.3.4",
|
||||
"resolved": "https://registry.npmmirror.com/minipass/-/minipass-3.3.4.tgz",
|
||||
"integrity": "sha512-I9WPbWHCGu8W+6k1ZiGpPu0GkoKBeorkfKNuAFBNS1HNFJvke82sxvI5bzcCNpWPorkOO5QQ+zomzzwRxejXiw==",
|
||||
"dependencies": {
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/minizlib": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/minizlib/-/minizlib-2.1.2.tgz",
|
||||
"integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
|
||||
"dependencies": {
|
||||
"minipass": "^3.0.0",
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/mkdirp": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/mkdirp/-/mkdirp-1.0.4.tgz",
|
||||
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
|
||||
"bin": {
|
||||
"mkdirp": "bin/cmd.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"node_modules/nan": {
|
||||
"version": "2.17.0",
|
||||
"resolved": "https://registry.npmmirror.com/nan/-/nan-2.17.0.tgz",
|
||||
"integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ=="
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "2.6.7",
|
||||
"resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.7.tgz",
|
||||
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/nopt": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/nopt/-/nopt-5.0.0.tgz",
|
||||
"integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",
|
||||
"dependencies": {
|
||||
"abbrev": "1"
|
||||
},
|
||||
"bin": {
|
||||
"nopt": "bin/nopt.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/npmlog": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/npmlog/-/npmlog-5.0.1.tgz",
|
||||
"integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==",
|
||||
"dependencies": {
|
||||
"are-we-there-yet": "^2.0.0",
|
||||
"console-control-strings": "^1.1.0",
|
||||
"gauge": "^3.0.0",
|
||||
"set-blocking": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/object-assign": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/object-assign/-/object-assign-4.1.1.tgz",
|
||||
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmmirror.com/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/pako": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/pako/-/pako-2.1.0.tgz",
|
||||
"integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug=="
|
||||
},
|
||||
"node_modules/path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/rimraf": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/rimraf/-/rimraf-3.0.2.tgz",
|
||||
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
||||
"dependencies": {
|
||||
"glob": "^7.1.3"
|
||||
},
|
||||
"bin": {
|
||||
"rimraf": "bin.js"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.3.8",
|
||||
"resolved": "https://registry.npmmirror.com/semver/-/semver-7.3.8.tgz",
|
||||
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
|
||||
"dependencies": {
|
||||
"lru-cache": "^6.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/set-blocking": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw=="
|
||||
},
|
||||
"node_modules/signal-exit": {
|
||||
"version": "3.0.7",
|
||||
"resolved": "https://registry.npmmirror.com/signal-exit/-/signal-exit-3.0.7.tgz",
|
||||
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="
|
||||
},
|
||||
"node_modules/simple-concat": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/simple-concat/-/simple-concat-1.0.1.tgz",
|
||||
"integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q=="
|
||||
},
|
||||
"node_modules/simple-get": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/simple-get/-/simple-get-3.1.1.tgz",
|
||||
"integrity": "sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==",
|
||||
"dependencies": {
|
||||
"decompress-response": "^4.2.0",
|
||||
"once": "^1.3.1",
|
||||
"simple-concat": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/string-width": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz",
|
||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||
"dependencies": {
|
||||
"emoji-regex": "^8.0.0",
|
||||
"is-fullwidth-code-point": "^3.0.0",
|
||||
"strip-ansi": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-ansi": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/tar": {
|
||||
"version": "6.1.12",
|
||||
"resolved": "https://registry.npmmirror.com/tar/-/tar-6.1.12.tgz",
|
||||
"integrity": "sha512-jU4TdemS31uABHd+Lt5WEYJuzn+TJTCBLljvIAHZOz6M9Os5pJ4dD+vRFLxPa/n3T0iEFzpi+0x1UfuDZYbRMw==",
|
||||
"dependencies": {
|
||||
"chownr": "^2.0.0",
|
||||
"fs-minipass": "^2.0.0",
|
||||
"minipass": "^3.0.0",
|
||||
"minizlib": "^2.1.1",
|
||||
"mkdirp": "^1.0.3",
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
||||
},
|
||||
"node_modules/universalify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/universalify/-/universalify-2.0.0.tgz",
|
||||
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
||||
},
|
||||
"node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
|
||||
},
|
||||
"node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/wide-align": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmmirror.com/wide-align/-/wide-align-1.1.5.tgz",
|
||||
"integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==",
|
||||
"dependencies": {
|
||||
"string-width": "^1.0.2 || 2 || 3 || 4"
|
||||
}
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||
},
|
||||
"node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||
}
|
||||
}
|
||||
}
|
507
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/CHANGELOG.md
generated
vendored
Normal file
507
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,507 @@
|
||||
# node-pre-gyp changelog
|
||||
|
||||
## 1.0.10
|
||||
- Upgraded minimist to 1.2.6 to address dependabot alert [CVE-2021-44906](https://nvd.nist.gov/vuln/detail/CVE-2021-44906)
|
||||
|
||||
## 1.0.9
|
||||
- Upgraded node-fetch to 2.6.7 to address [CVE-2022-0235](https://www.cve.org/CVERecord?id=CVE-2022-0235)
|
||||
- Upgraded detect-libc to 2.0.0 to use non-blocking NodeJS(>=12) Report API
|
||||
|
||||
## 1.0.8
|
||||
- Downgraded npmlog to maintain node v10 and v8 support (https://github.com/mapbox/node-pre-gyp/pull/624)
|
||||
|
||||
## 1.0.7
|
||||
- Upgraded nyc and npmlog to address https://github.com/advisories/GHSA-93q8-gq69-wqmw
|
||||
|
||||
## 1.0.6
|
||||
- Added node v17 to the internal node releases listing
|
||||
- Upgraded various dependencies declared in package.json to latest major versions (node-fetch from 2.6.1 to 2.6.5, npmlog from 4.1.2 to 5.01, semver from 7.3.4 to 7.3.5, and tar from 6.1.0 to 6.1.11)
|
||||
- Fixed bug in `staging_host` parameter (https://github.com/mapbox/node-pre-gyp/pull/590)
|
||||
|
||||
|
||||
## 1.0.5
|
||||
- Fix circular reference warning with node >= v14
|
||||
|
||||
## 1.0.4
|
||||
- Added node v16 to the internal node releases listing
|
||||
|
||||
## 1.0.3
|
||||
- Improved support configuring s3 uploads (solves https://github.com/mapbox/node-pre-gyp/issues/571)
|
||||
- New options added in https://github.com/mapbox/node-pre-gyp/pull/576: 'bucket', 'region', and `s3ForcePathStyle`
|
||||
|
||||
## 1.0.2
|
||||
- Fixed regression in proxy support (https://github.com/mapbox/node-pre-gyp/issues/572)
|
||||
|
||||
## 1.0.1
|
||||
- Switched from mkdirp@1.0.4 to make-dir@3.1.0 to avoid this bug: https://github.com/isaacs/node-mkdirp/issues/31
|
||||
|
||||
## 1.0.0
|
||||
- Module is now name-spaced at `@mapbox/node-pre-gyp` and the original `node-pre-gyp` is deprecated.
|
||||
- New: support for staging and production s3 targets (see README.md)
|
||||
- BREAKING: no longer supporting `node_pre_gyp_accessKeyId` & `node_pre_gyp_secretAccessKey`, use `AWS_ACCESS_KEY_ID` & `AWS_SECRET_ACCESS_KEY` instead to authenticate against s3 for `info`, `publish`, and `unpublish` commands.
|
||||
- Dropped node v6 support, added node v14 support
|
||||
- Switched tests to use mapbox-owned bucket for testing
|
||||
- Added coverage tracking and linting with eslint
|
||||
- Added back support for symlinks inside the tarball
|
||||
- Upgraded all test apps to N-API/node-addon-api
|
||||
- New: support for staging and production s3 targets (see README.md)
|
||||
- Added `node_pre_gyp_s3_host` env var which has priority over the `--s3_host` option or default.
|
||||
- Replaced needle with node-fetch
|
||||
- Added proxy support for node-fetch
|
||||
- Upgraded to mkdirp@1.x
|
||||
|
||||
## 0.17.0
|
||||
- Got travis + appveyor green again
|
||||
- Added support for more node versions
|
||||
|
||||
## 0.16.0
|
||||
|
||||
- Added Node 15 support in the local database (https://github.com/mapbox/node-pre-gyp/pull/520)
|
||||
|
||||
## 0.15.0
|
||||
|
||||
- Bump dependency on `mkdirp` from `^0.5.1` to `^0.5.3` (https://github.com/mapbox/node-pre-gyp/pull/492)
|
||||
- Bump dependency on `needle` from `^2.2.1` to `^2.5.0` (https://github.com/mapbox/node-pre-gyp/pull/502)
|
||||
- Added Node 14 support in the local database (https://github.com/mapbox/node-pre-gyp/pull/501)
|
||||
|
||||
## 0.14.0
|
||||
|
||||
- Defer modules requires in napi.js (https://github.com/mapbox/node-pre-gyp/pull/434)
|
||||
- Bump dependency on `tar` from `^4` to `^4.4.2` (https://github.com/mapbox/node-pre-gyp/pull/454)
|
||||
- Support extracting compiled binary from local offline mirror (https://github.com/mapbox/node-pre-gyp/pull/459)
|
||||
- Added Node 13 support in the local database (https://github.com/mapbox/node-pre-gyp/pull/483)
|
||||
|
||||
## 0.13.0
|
||||
|
||||
- Added Node 12 support in the local database (https://github.com/mapbox/node-pre-gyp/pull/449)
|
||||
|
||||
## 0.12.0
|
||||
|
||||
- Fixed double-build problem with node v10 (https://github.com/mapbox/node-pre-gyp/pull/428)
|
||||
- Added node 11 support in the local database (https://github.com/mapbox/node-pre-gyp/pull/422)
|
||||
|
||||
## 0.11.0
|
||||
|
||||
- Fixed double-install problem with node v10
|
||||
- Significant N-API improvements (https://github.com/mapbox/node-pre-gyp/pull/405)
|
||||
|
||||
## 0.10.3
|
||||
|
||||
- Now will use `request` over `needle` if request is installed. By default `needle` is used for `https`. This should unbreak proxy support that regressed in v0.9.0
|
||||
|
||||
## 0.10.2
|
||||
|
||||
- Fixed rc/deep-extent security vulnerability
|
||||
- Fixed broken reinstall script do to incorrectly named get_best_napi_version
|
||||
|
||||
## 0.10.1
|
||||
|
||||
- Fix needle error event (@medns)
|
||||
|
||||
## 0.10.0
|
||||
|
||||
- Allow for a single-level module path when packing @allenluce (https://github.com/mapbox/node-pre-gyp/pull/371)
|
||||
- Log warnings instead of errors when falling back @xzyfer (https://github.com/mapbox/node-pre-gyp/pull/366)
|
||||
- Add Node.js v10 support to tests (https://github.com/mapbox/node-pre-gyp/pull/372)
|
||||
- Remove retire.js from CI (https://github.com/mapbox/node-pre-gyp/pull/372)
|
||||
- Remove support for Node.js v4 due to [EOL on April 30th, 2018](https://github.com/nodejs/Release/blob/7dd52354049cae99eed0e9fe01345b0722a86fde/schedule.json#L14)
|
||||
- Update appveyor tests to install default NPM version instead of NPM v2.x for all Windows builds (https://github.com/mapbox/node-pre-gyp/pull/375)
|
||||
|
||||
## 0.9.1
|
||||
|
||||
- Fixed regression (in v0.9.0) with support for http redirects @allenluce (https://github.com/mapbox/node-pre-gyp/pull/361)
|
||||
|
||||
## 0.9.0
|
||||
|
||||
- Switched from using `request` to `needle` to reduce size of module deps (https://github.com/mapbox/node-pre-gyp/pull/350)
|
||||
|
||||
## 0.8.0
|
||||
|
||||
- N-API support (@inspiredware)
|
||||
|
||||
## 0.7.1
|
||||
|
||||
- Upgraded to tar v4.x
|
||||
|
||||
## 0.7.0
|
||||
|
||||
- Updated request and hawk (#347)
|
||||
- Dropped node v0.10.x support
|
||||
|
||||
## 0.6.40
|
||||
|
||||
- Improved error reporting if an install fails
|
||||
|
||||
## 0.6.39
|
||||
|
||||
- Support for node v9
|
||||
- Support for versioning on `{libc}` to allow binaries to work on non-glic linux systems like alpine linux
|
||||
|
||||
|
||||
## 0.6.38
|
||||
|
||||
- Maintaining compatibility (for v0.6.x series) with node v0.10.x
|
||||
|
||||
## 0.6.37
|
||||
|
||||
- Solved one part of #276: now now deduce the node ABI from the major version for node >= 2 even when not stored in the abi_crosswalk.json
|
||||
- Fixed docs to avoid mentioning the deprecated and dangerous `prepublish` in package.json (#291)
|
||||
- Add new node versions to crosswalk
|
||||
- Ported tests to use tape instead of mocha
|
||||
- Got appveyor tests passing by downgrading npm and node-gyp
|
||||
|
||||
## 0.6.36
|
||||
|
||||
- Removed the running of `testbinary` during install. Because this was regressed for so long, it is too dangerous to re-enable by default. Developers needing validation can call `node-pre-gyp testbinary` directory.
|
||||
- Fixed regression in v0.6.35 for electron installs (now skipping binary validation which is not yet supported for electron)
|
||||
|
||||
## 0.6.35
|
||||
|
||||
- No longer recommending `npm ls` in `prepublish` (#291)
|
||||
- Fixed testbinary command (#283) @szdavid92
|
||||
|
||||
## 0.6.34
|
||||
|
||||
- Added new node versions to crosswalk, including v8
|
||||
- Upgraded deps to latest versions, started using `^` instead of `~` for all deps.
|
||||
|
||||
## 0.6.33
|
||||
|
||||
- Improved support for yarn
|
||||
|
||||
## 0.6.32
|
||||
|
||||
- Honor npm configuration for CA bundles (@heikkipora)
|
||||
- Add node-pre-gyp and npm versions to user agent (@addaleax)
|
||||
- Updated various deps
|
||||
- Add known node version for v7.x
|
||||
|
||||
## 0.6.31
|
||||
|
||||
- Updated various deps
|
||||
|
||||
## 0.6.30
|
||||
|
||||
- Update to npmlog@4.x and semver@5.3.x
|
||||
- Add known node version for v6.5.0
|
||||
|
||||
## 0.6.29
|
||||
|
||||
- Add known node versions for v0.10.45, v0.12.14, v4.4.4, v5.11.1, and v6.1.0
|
||||
|
||||
## 0.6.28
|
||||
|
||||
- Now more verbose when remote binaries are not available. This is needed since npm is increasingly more quiet by default
|
||||
and users need to know why builds are falling back to source compiles that might then error out.
|
||||
|
||||
## 0.6.27
|
||||
|
||||
- Add known node version for node v6
|
||||
- Stopped bundling dependencies
|
||||
- Documented method for module authors to avoid bundling node-pre-gyp
|
||||
- See https://github.com/mapbox/node-pre-gyp/tree/master#configuring for details
|
||||
|
||||
## 0.6.26
|
||||
|
||||
- Skip validation for nw runtime (https://github.com/mapbox/node-pre-gyp/pull/181) via @fleg
|
||||
|
||||
## 0.6.25
|
||||
|
||||
- Improved support for auto-detection of electron runtime in `node-pre-gyp.find()`
|
||||
- Pull request from @enlight - https://github.com/mapbox/node-pre-gyp/pull/187
|
||||
- Add known node version for 4.4.1 and 5.9.1
|
||||
|
||||
## 0.6.24
|
||||
|
||||
- Add known node version for 5.8.0, 5.9.0, and 4.4.0.
|
||||
|
||||
## 0.6.23
|
||||
|
||||
- Add known node version for 0.10.43, 0.12.11, 4.3.2, and 5.7.1.
|
||||
|
||||
## 0.6.22
|
||||
|
||||
- Add known node version for 4.3.1, and 5.7.0.
|
||||
|
||||
## 0.6.21
|
||||
|
||||
- Add known node version for 0.10.42, 0.12.10, 4.3.0, and 5.6.0.
|
||||
|
||||
## 0.6.20
|
||||
|
||||
- Add known node version for 4.2.5, 4.2.6, 5.4.0, 5.4.1,and 5.5.0.
|
||||
|
||||
## 0.6.19
|
||||
|
||||
- Add known node version for 4.2.4
|
||||
|
||||
## 0.6.18
|
||||
|
||||
- Add new known node versions for 0.10.x, 0.12.x, 4.x, and 5.x
|
||||
|
||||
## 0.6.17
|
||||
|
||||
- Re-tagged to fix packaging problem of `Error: Cannot find module 'isarray'`
|
||||
|
||||
## 0.6.16
|
||||
|
||||
- Added known version in crosswalk for 5.1.0.
|
||||
|
||||
## 0.6.15
|
||||
|
||||
- Upgraded tar-pack (https://github.com/mapbox/node-pre-gyp/issues/182)
|
||||
- Support custom binary hosting mirror (https://github.com/mapbox/node-pre-gyp/pull/170)
|
||||
- Added known version in crosswalk for 4.2.2.
|
||||
|
||||
## 0.6.14
|
||||
|
||||
- Added node 5.x version
|
||||
|
||||
## 0.6.13
|
||||
|
||||
- Added more known node 4.x versions
|
||||
|
||||
## 0.6.12
|
||||
|
||||
- Added support for [Electron](http://electron.atom.io/). Just pass the `--runtime=electron` flag when building/installing. Thanks @zcbenz
|
||||
|
||||
## 0.6.11
|
||||
|
||||
- Added known node and io.js versions including more 3.x and 4.x versions
|
||||
|
||||
## 0.6.10
|
||||
|
||||
- Added known node and io.js versions including 3.x and 4.x versions
|
||||
- Upgraded `tar` dep
|
||||
|
||||
## 0.6.9
|
||||
|
||||
- Upgraded `rc` dep
|
||||
- Updated known io.js version: v2.4.0
|
||||
|
||||
## 0.6.8
|
||||
|
||||
- Upgraded `semver` and `rimraf` deps
|
||||
- Updated known node and io.js versions
|
||||
|
||||
## 0.6.7
|
||||
|
||||
- Fixed `node_abi` versions for io.js 1.1.x -> 1.8.x (should be 43, but was stored as 42) (refs https://github.com/iojs/build/issues/94)
|
||||
|
||||
## 0.6.6
|
||||
|
||||
- Updated with known io.js 2.0.0 version
|
||||
|
||||
## 0.6.5
|
||||
|
||||
- Now respecting `npm_config_node_gyp` (https://github.com/npm/npm/pull/4887)
|
||||
- Updated to semver@4.3.2
|
||||
- Updated known node v0.12.x versions and io.js 1.x versions.
|
||||
|
||||
## 0.6.4
|
||||
|
||||
- Improved support for `io.js` (@fengmk2)
|
||||
- Test coverage improvements (@mikemorris)
|
||||
- Fixed support for `--dist-url` that regressed in 0.6.3
|
||||
|
||||
## 0.6.3
|
||||
|
||||
- Added support for passing raw options to node-gyp using `--` separator. Flags passed after
|
||||
the `--` to `node-pre-gyp configure` will be passed directly to gyp while flags passed
|
||||
after the `--` will be passed directly to make/visual studio.
|
||||
- Added `node-pre-gyp configure` command to be able to call `node-gyp configure` directly
|
||||
- Fix issue with require validation not working on windows 7 (@edgarsilva)
|
||||
|
||||
## 0.6.2
|
||||
|
||||
- Support for io.js >= v1.0.2
|
||||
- Deferred require of `request` and `tar` to help speed up command line usage of `node-pre-gyp`.
|
||||
|
||||
## 0.6.1
|
||||
|
||||
- Fixed bundled `tar` version
|
||||
|
||||
## 0.6.0
|
||||
|
||||
- BREAKING: node odd releases like v0.11.x now use `major.minor.patch` for `{node_abi}` instead of `NODE_MODULE_VERSION` (#124)
|
||||
- Added support for `toolset` option in versioning. By default is an empty string but `--toolset` can be passed to publish or install to select alternative binaries that target a custom toolset like C++11. For example to target Visual Studio 2014 modules like node-sqlite3 use `--toolset=v140`.
|
||||
- Added support for `--no-rollback` option to request that a failed binary test does not remove the binary module leaves it in place.
|
||||
- Added support for `--update-binary` option to request an existing binary be re-installed and the check for a valid local module be skipped.
|
||||
- Added support for passing build options from `npm` through `node-pre-gyp` to `node-gyp`: `--nodedir`, `--disturl`, `--python`, and `--msvs_version`
|
||||
|
||||
## 0.5.31
|
||||
|
||||
- Added support for deducing node_abi for node.js runtime from previous release if the series is even
|
||||
- Added support for --target=0.10.33
|
||||
|
||||
## 0.5.30
|
||||
|
||||
- Repackaged with latest bundled deps
|
||||
|
||||
## 0.5.29
|
||||
|
||||
- Added support for semver `build`.
|
||||
- Fixed support for downloading from urls that include `+`.
|
||||
|
||||
## 0.5.28
|
||||
|
||||
- Now reporting unix style paths only in reveal command
|
||||
|
||||
## 0.5.27
|
||||
|
||||
- Fixed support for auto-detecting s3 bucket name when it contains `.` - @taavo
|
||||
- Fixed support for installing when path contains a `'` - @halfdan
|
||||
- Ported tests to mocha
|
||||
|
||||
## 0.5.26
|
||||
|
||||
- Fix node-webkit support when `--target` option is not provided
|
||||
|
||||
## 0.5.25
|
||||
|
||||
- Fix bundling of deps
|
||||
|
||||
## 0.5.24
|
||||
|
||||
- Updated ABI crosswalk to incldue node v0.10.30 and v0.10.31
|
||||
|
||||
## 0.5.23
|
||||
|
||||
- Added `reveal` command. Pass no options to get all versioning data as json. Pass a second arg to grab a single versioned property value
|
||||
- Added support for `--silent` (shortcut for `--loglevel=silent`)
|
||||
|
||||
## 0.5.22
|
||||
|
||||
- Fixed node-webkit versioning name (NOTE: node-webkit support still experimental)
|
||||
|
||||
## 0.5.21
|
||||
|
||||
- New package to fix `shasum check failed` error with v0.5.20
|
||||
|
||||
## 0.5.20
|
||||
|
||||
- Now versioning node-webkit binaries based on major.minor.patch - assuming no compatible ABI across versions (#90)
|
||||
|
||||
## 0.5.19
|
||||
|
||||
- Updated to know about more node-webkit releases
|
||||
|
||||
## 0.5.18
|
||||
|
||||
- Updated to know about more node-webkit releases
|
||||
|
||||
## 0.5.17
|
||||
|
||||
- Updated to know about node v0.10.29 release
|
||||
|
||||
## 0.5.16
|
||||
|
||||
- Now supporting all aws-sdk configuration parameters (http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html) (#86)
|
||||
|
||||
## 0.5.15
|
||||
|
||||
- Fixed installation of windows packages sub directories on unix systems (#84)
|
||||
|
||||
## 0.5.14
|
||||
|
||||
- Finished support for cross building using `--target_platform` option (#82)
|
||||
- Now skipping binary validation on install if target arch/platform do not match the host.
|
||||
- Removed multi-arch validing for OS X since it required a FAT node.js binary
|
||||
|
||||
## 0.5.13
|
||||
|
||||
- Fix problem in 0.5.12 whereby the wrong versions of mkdirp and semver where bundled.
|
||||
|
||||
## 0.5.12
|
||||
|
||||
- Improved support for node-webkit (@Mithgol)
|
||||
|
||||
## 0.5.11
|
||||
|
||||
- Updated target versions listing
|
||||
|
||||
## 0.5.10
|
||||
|
||||
- Fixed handling of `-debug` flag passed directory to node-pre-gyp (#72)
|
||||
- Added optional second arg to `node_pre_gyp.find` to customize the default versioning options used to locate the runtime binary
|
||||
- Failed install due to `testbinary` check failure no longer leaves behind binary (#70)
|
||||
|
||||
## 0.5.9
|
||||
|
||||
- Fixed regression in `testbinary` command causing installs to fail on windows with 0.5.7 (#60)
|
||||
|
||||
## 0.5.8
|
||||
|
||||
- Started bundling deps
|
||||
|
||||
## 0.5.7
|
||||
|
||||
- Fixed the `testbinary` check, which is used to determine whether to re-download or source compile, to work even in complex dependency situations (#63)
|
||||
- Exposed the internal `testbinary` command in node-pre-gyp command line tool
|
||||
- Fixed minor bug so that `fallback_to_build` option is always respected
|
||||
|
||||
## 0.5.6
|
||||
|
||||
- Added support for versioning on the `name` value in `package.json` (#57).
|
||||
- Moved to using streams for reading tarball when publishing (#52)
|
||||
|
||||
## 0.5.5
|
||||
|
||||
- Improved binary validation that also now works with node-webkit (@Mithgol)
|
||||
- Upgraded test apps to work with node v0.11.x
|
||||
- Improved test coverage
|
||||
|
||||
## 0.5.4
|
||||
|
||||
- No longer depends on external install of node-gyp for compiling builds.
|
||||
|
||||
## 0.5.3
|
||||
|
||||
- Reverted fix for debian/nodejs since it broke windows (#45)
|
||||
|
||||
## 0.5.2
|
||||
|
||||
- Support for debian systems where the node binary is named `nodejs` (#45)
|
||||
- Added `bin/node-pre-gyp.cmd` to be able to run command on windows locally (npm creates an .npm automatically when globally installed)
|
||||
- Updated abi-crosswalk with node v0.10.26 entry.
|
||||
|
||||
## 0.5.1
|
||||
|
||||
- Various minor bug fixes, several improving windows support for publishing.
|
||||
|
||||
## 0.5.0
|
||||
|
||||
- Changed property names in `binary` object: now required are `module_name`, `module_path`, and `host`.
|
||||
- Now `module_path` supports versioning, which allows developers to opt-in to using a versioned install path (#18).
|
||||
- Added `remote_path` which also supports versioning.
|
||||
- Changed `remote_uri` to `host`.
|
||||
|
||||
## 0.4.2
|
||||
|
||||
- Added support for `--target` flag to request cross-compile against a specific node/node-webkit version.
|
||||
- Added preliminary support for node-webkit
|
||||
- Fixed support for `--target_arch` option being respected in all cases.
|
||||
|
||||
## 0.4.1
|
||||
|
||||
- Fixed exception when only stderr is available in binary test (@bendi / #31)
|
||||
|
||||
## 0.4.0
|
||||
|
||||
- Enforce only `https:` based remote publishing access.
|
||||
- Added `node-pre-gyp info` command to display listing of published binaries
|
||||
- Added support for changing the directory node-pre-gyp should build in with the `-C/--directory` option.
|
||||
- Added support for S3 prefixes.
|
||||
|
||||
## 0.3.1
|
||||
|
||||
- Added `unpublish` command.
|
||||
- Fixed module path construction in tests.
|
||||
- Added ability to disable falling back to build behavior via `npm install --fallback-to-build=false` which overrides setting in a depedencies package.json `install` target.
|
||||
|
||||
## 0.3.0
|
||||
|
||||
- Support for packaging all files in `module_path` directory - see `app4` for example
|
||||
- Added `testpackage` command.
|
||||
- Changed `clean` command to only delete `.node` not entire `build` directory since node-gyp will handle that.
|
||||
- `.node` modules must be in a folder of there own since tar-pack will remove everything when it unpacks.
|
27
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/LICENSE
generated
vendored
Normal file
27
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/LICENSE
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
Copyright (c), Mapbox
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of node-pre-gyp nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
742
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/README.md
generated
vendored
Normal file
742
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/README.md
generated
vendored
Normal file
@ -0,0 +1,742 @@
|
||||
# @mapbox/node-pre-gyp
|
||||
|
||||
#### @mapbox/node-pre-gyp makes it easy to publish and install Node.js C++ addons from binaries
|
||||
|
||||
[](https://travis-ci.com/mapbox/node-pre-gyp)
|
||||
[](https://ci.appveyor.com/project/Mapbox/node-pre-gyp)
|
||||
|
||||
`@mapbox/node-pre-gyp` stands between [npm](https://github.com/npm/npm) and [node-gyp](https://github.com/Tootallnate/node-gyp) and offers a cross-platform method of binary deployment.
|
||||
|
||||
### Special note on previous package
|
||||
|
||||
On Feb 9th, 2021 `@mapbox/node-pre-gyp@1.0.0` was [released](./CHANGELOG.md). Older, unscoped versions that are not part of the `@mapbox` org are deprecated and only `@mapbox/node-pre-gyp` will see updates going forward. To upgrade to the new package do:
|
||||
|
||||
```
|
||||
npm uninstall node-pre-gyp --save
|
||||
npm install @mapbox/node-pre-gyp --save
|
||||
```
|
||||
|
||||
### Features
|
||||
|
||||
- A command line tool called `node-pre-gyp` that can install your package's C++ module from a binary.
|
||||
- A variety of developer targeted commands for packaging, testing, and publishing binaries.
|
||||
- A JavaScript module that can dynamically require your installed binary: `require('@mapbox/node-pre-gyp').find`
|
||||
|
||||
For a hello world example of a module packaged with `node-pre-gyp` see <https://github.com/springmeyer/node-addon-example> and [the wiki ](https://github.com/mapbox/node-pre-gyp/wiki/Modules-using-node-pre-gyp) for real world examples.
|
||||
|
||||
## Credits
|
||||
|
||||
- The module is modeled after [node-gyp](https://github.com/Tootallnate/node-gyp) by [@Tootallnate](https://github.com/Tootallnate)
|
||||
- Motivation for initial development came from [@ErisDS](https://github.com/ErisDS) and the [Ghost Project](https://github.com/TryGhost/Ghost).
|
||||
- Development is sponsored by [Mapbox](https://www.mapbox.com/)
|
||||
|
||||
## FAQ
|
||||
|
||||
See the [Frequently Ask Questions](https://github.com/mapbox/node-pre-gyp/wiki/FAQ).
|
||||
|
||||
## Depends
|
||||
|
||||
- Node.js >= node v8.x
|
||||
|
||||
## Install
|
||||
|
||||
`node-pre-gyp` is designed to be installed as a local dependency of your Node.js C++ addon and accessed like:
|
||||
|
||||
./node_modules/.bin/node-pre-gyp --help
|
||||
|
||||
But you can also install it globally:
|
||||
|
||||
npm install @mapbox/node-pre-gyp -g
|
||||
|
||||
## Usage
|
||||
|
||||
### Commands
|
||||
|
||||
View all possible commands:
|
||||
|
||||
node-pre-gyp --help
|
||||
|
||||
- clean - Remove the entire folder containing the compiled .node module
|
||||
- install - Install pre-built binary for module
|
||||
- reinstall - Run "clean" and "install" at once
|
||||
- build - Compile the module by dispatching to node-gyp or nw-gyp
|
||||
- rebuild - Run "clean" and "build" at once
|
||||
- package - Pack binary into tarball
|
||||
- testpackage - Test that the staged package is valid
|
||||
- publish - Publish pre-built binary
|
||||
- unpublish - Unpublish pre-built binary
|
||||
- info - Fetch info on published binaries
|
||||
|
||||
You can also chain commands:
|
||||
|
||||
node-pre-gyp clean build unpublish publish info
|
||||
|
||||
### Options
|
||||
|
||||
Options include:
|
||||
|
||||
- `-C/--directory`: run the command in this directory
|
||||
- `--build-from-source`: build from source instead of using pre-built binary
|
||||
- `--update-binary`: reinstall by replacing previously installed local binary with remote binary
|
||||
- `--runtime=node-webkit`: customize the runtime: `node`, `electron` and `node-webkit` are the valid options
|
||||
- `--fallback-to-build`: fallback to building from source if pre-built binary is not available
|
||||
- `--target=0.4.0`: Pass the target node or node-webkit version to compile against
|
||||
- `--target_arch=ia32`: Pass the target arch and override the host `arch`. Any value that is [supported by Node.js](https://nodejs.org/api/os.html#osarch) is valid.
|
||||
- `--target_platform=win32`: Pass the target platform and override the host `platform`. Valid values are `linux`, `darwin`, `win32`, `sunos`, `freebsd`, `openbsd`, and `aix`.
|
||||
|
||||
Both `--build-from-source` and `--fallback-to-build` can be passed alone or they can provide values. You can pass `--fallback-to-build=false` to override the option as declared in package.json. In addition to being able to pass `--build-from-source` you can also pass `--build-from-source=myapp` where `myapp` is the name of your module.
|
||||
|
||||
For example: `npm install --build-from-source=myapp`. This is useful if:
|
||||
|
||||
- `myapp` is referenced in the package.json of a larger app and therefore `myapp` is being installed as a dependency with `npm install`.
|
||||
- The larger app also depends on other modules installed with `node-pre-gyp`
|
||||
- You only want to trigger a source compile for `myapp` and the other modules.
|
||||
|
||||
### Configuring
|
||||
|
||||
This is a guide to configuring your module to use node-pre-gyp.
|
||||
|
||||
#### 1) Add new entries to your `package.json`
|
||||
|
||||
- Add `@mapbox/node-pre-gyp` to `dependencies`
|
||||
- Add `aws-sdk` as a `devDependency`
|
||||
- Add a custom `install` script
|
||||
- Declare a `binary` object
|
||||
|
||||
This looks like:
|
||||
|
||||
```js
|
||||
"dependencies" : {
|
||||
"@mapbox/node-pre-gyp": "1.x"
|
||||
},
|
||||
"devDependencies": {
|
||||
"aws-sdk": "2.x"
|
||||
}
|
||||
"scripts": {
|
||||
"install": "node-pre-gyp install --fallback-to-build"
|
||||
},
|
||||
"binary": {
|
||||
"module_name": "your_module",
|
||||
"module_path": "./lib/binding/",
|
||||
"host": "https://your_module.s3-us-west-1.amazonaws.com"
|
||||
}
|
||||
```
|
||||
|
||||
For a full example see [node-addon-examples's package.json](https://github.com/springmeyer/node-addon-example/blob/master/package.json).
|
||||
|
||||
Let's break this down:
|
||||
|
||||
- Dependencies need to list `node-pre-gyp`
|
||||
- Your devDependencies should list `aws-sdk` so that you can run `node-pre-gyp publish` locally or a CI system. We recommend using `devDependencies` only since `aws-sdk` is large and not needed for `node-pre-gyp install` since it only uses http to fetch binaries
|
||||
- Your `scripts` section should override the `install` target with `"install": "node-pre-gyp install --fallback-to-build"`. This allows node-pre-gyp to be used instead of the default npm behavior of always source compiling with `node-gyp` directly.
|
||||
- Your package.json should contain a `binary` section describing key properties you provide to allow node-pre-gyp to package optimally. They are detailed below.
|
||||
|
||||
Note: in the past we recommended putting `@mapbox/node-pre-gyp` in the `bundledDependencies`, but we no longer recommend this. In the past there were npm bugs (with node versions 0.10.x) that could lead to node-pre-gyp not being available at the right time during install (unless we bundled). This should no longer be the case. Also, for a time we recommended using `"preinstall": "npm install @mapbox/node-pre-gyp"` as an alternative method to avoid needing to bundle. But this did not behave predictably across all npm versions - see https://github.com/mapbox/node-pre-gyp/issues/260 for the details. So we do not recommend using `preinstall` to install `@mapbox/node-pre-gyp`. More history on this at https://github.com/strongloop/fsevents/issues/157#issuecomment-265545908.
|
||||
|
||||
##### The `binary` object has three required properties
|
||||
|
||||
###### module_name
|
||||
|
||||
The name of your native node module. This value must:
|
||||
|
||||
- Match the name passed to [the NODE_MODULE macro](http://nodejs.org/api/addons.html#addons_hello_world)
|
||||
- Must be a valid C variable name (e.g. it cannot contain `-`)
|
||||
- Should not include the `.node` extension.
|
||||
|
||||
###### module_path
|
||||
|
||||
The location your native module is placed after a build. This should be an empty directory without other Javascript files. This entire directory will be packaged in the binary tarball. When installing from a remote package this directory will be overwritten with the contents of the tarball.
|
||||
|
||||
Note: This property supports variables based on [Versioning](#versioning).
|
||||
|
||||
###### host
|
||||
|
||||
A url to the remote location where you've published tarball binaries (must be `https` not `http`).
|
||||
|
||||
It is highly recommended that you use Amazon S3. The reasons are:
|
||||
|
||||
- Various node-pre-gyp commands like `publish` and `info` only work with an S3 host.
|
||||
- S3 is a very solid hosting platform for distributing large files.
|
||||
- We provide detail documentation for using [S3 hosting](#s3-hosting) with node-pre-gyp.
|
||||
|
||||
Why then not require S3? Because while some applications using node-pre-gyp need to distribute binaries as large as 20-30 MB, others might have very small binaries and might wish to store them in a GitHub repo. This is not recommended, but if an author really wants to host in a non-S3 location then it should be possible.
|
||||
|
||||
It should also be mentioned that there is an optional and entirely separate npm module called [node-pre-gyp-github](https://github.com/bchr02/node-pre-gyp-github) which is intended to complement node-pre-gyp and be installed along with it. It provides the ability to store and publish your binaries within your repositories GitHub Releases if you would rather not use S3 directly. Installation and usage instructions can be found [here](https://github.com/bchr02/node-pre-gyp-github), but the basic premise is that instead of using the ```node-pre-gyp publish``` command you would use ```node-pre-gyp-github publish```.
|
||||
|
||||
##### The `binary` object other optional S3 properties
|
||||
|
||||
If you are not using a standard s3 path like `bucket_name.s3(.-)region.amazonaws.com`, you might get an error on `publish` because node-pre-gyp extracts the region and bucket from the `host` url. For example, you may have an on-premises s3-compatible storage server, or may have configured a specific dns redirecting to an s3 endpoint. In these cases, you can explicitly set the `region` and `bucket` properties to tell node-pre-gyp to use these values instead of guessing from the `host` property. The following values can be used in the `binary` section:
|
||||
|
||||
###### host
|
||||
|
||||
The url to the remote server root location (must be `https` not `http`).
|
||||
|
||||
###### bucket
|
||||
|
||||
The bucket name where your tarball binaries should be located.
|
||||
|
||||
###### region
|
||||
|
||||
Your S3 server region.
|
||||
|
||||
###### s3ForcePathStyle
|
||||
|
||||
Set `s3ForcePathStyle` to true if the endpoint url should not be prefixed with the bucket name. If false (default), the server endpoint would be constructed as `bucket_name.your_server.com`.
|
||||
|
||||
##### The `binary` object has optional properties
|
||||
|
||||
###### remote_path
|
||||
|
||||
It **is recommended** that you customize this property. This is an extra path to use for publishing and finding remote tarballs. The default value for `remote_path` is `""` meaning that if you do not provide it then all packages will be published at the base of the `host`. It is recommended to provide a value like `./{name}/v{version}` to help organize remote packages in the case that you choose to publish multiple node addons to the same `host`.
|
||||
|
||||
Note: This property supports variables based on [Versioning](#versioning).
|
||||
|
||||
###### package_name
|
||||
|
||||
It is **not recommended** to override this property unless you are also overriding the `remote_path`. This is the versioned name of the remote tarball containing the binary `.node` module and any supporting files you've placed inside the `module_path` directory. Unless you specify `package_name` in your `package.json` then it defaults to `{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz` which allows your binary to work across node versions, platforms, and architectures. If you are using `remote_path` that is also versioned by `./{module_name}/v{version}` then you could remove these variables from the `package_name` and just use: `{node_abi}-{platform}-{arch}.tar.gz`. Then your remote tarball will be looked up at, for example, `https://example.com/your-module/v0.1.0/node-v11-linux-x64.tar.gz`.
|
||||
|
||||
Avoiding the version of your module in the `package_name` and instead only embedding in a directory name can be useful when you want to make a quick tag of your module that does not change any C++ code. In this case you can just copy binaries to the new version behind the scenes like:
|
||||
|
||||
```sh
|
||||
aws s3 sync --acl public-read s3://mapbox-node-binary/sqlite3/v3.0.3/ s3://mapbox-node-binary/sqlite3/v3.0.4/
|
||||
```
|
||||
|
||||
Note: This property supports variables based on [Versioning](#versioning).
|
||||
|
||||
#### 2) Add a new target to binding.gyp
|
||||
|
||||
`node-pre-gyp` calls out to `node-gyp` to compile the module and passes variables along like [module_name](#module_name) and [module_path](#module_path).
|
||||
|
||||
A new target must be added to `binding.gyp` that moves the compiled `.node` module from `./build/Release/module_name.node` into the directory specified by `module_path`.
|
||||
|
||||
Add a target like this at the end of your `targets` list:
|
||||
|
||||
```js
|
||||
{
|
||||
"target_name": "action_after_build",
|
||||
"type": "none",
|
||||
"dependencies": [ "<(module_name)" ],
|
||||
"copies": [
|
||||
{
|
||||
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
|
||||
"destination": "<(module_path)"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
For a full example see [node-addon-example's binding.gyp](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/binding.gyp).
|
||||
|
||||
#### 3) Dynamically require your `.node`
|
||||
|
||||
Inside the main js file that requires your addon module you are likely currently doing:
|
||||
|
||||
```js
|
||||
var binding = require('../build/Release/binding.node');
|
||||
```
|
||||
|
||||
or:
|
||||
|
||||
```js
|
||||
var bindings = require('./bindings')
|
||||
```
|
||||
|
||||
Change those lines to:
|
||||
|
||||
```js
|
||||
var binary = require('@mapbox/node-pre-gyp');
|
||||
var path = require('path');
|
||||
var binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json')));
|
||||
var binding = require(binding_path);
|
||||
```
|
||||
|
||||
For a full example see [node-addon-example's index.js](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/index.js#L1-L4)
|
||||
|
||||
#### 4) Build and package your app
|
||||
|
||||
Now build your module from source:
|
||||
|
||||
npm install --build-from-source
|
||||
|
||||
The `--build-from-source` tells `node-pre-gyp` to not look for a remote package and instead dispatch to node-gyp to build.
|
||||
|
||||
Now `node-pre-gyp` should now also be installed as a local dependency so the command line tool it offers can be found at `./node_modules/.bin/node-pre-gyp`.
|
||||
|
||||
#### 5) Test
|
||||
|
||||
Now `npm test` should work just as it did before.
|
||||
|
||||
#### 6) Publish the tarball
|
||||
|
||||
Then package your app:
|
||||
|
||||
./node_modules/.bin/node-pre-gyp package
|
||||
|
||||
Once packaged, now you can publish:
|
||||
|
||||
./node_modules/.bin/node-pre-gyp publish
|
||||
|
||||
Currently the `publish` command pushes your binary to S3. This requires:
|
||||
|
||||
- You have installed `aws-sdk` with `npm install aws-sdk`
|
||||
- You have created a bucket already.
|
||||
- The `host` points to an S3 http or https endpoint.
|
||||
- You have configured node-pre-gyp to read your S3 credentials (see [S3 hosting](#s3-hosting) for details).
|
||||
|
||||
You can also host your binaries elsewhere. To do this requires:
|
||||
|
||||
- You manually publish the binary created by the `package` command to an `https` endpoint
|
||||
- Ensure that the `host` value points to your custom `https` endpoint.
|
||||
|
||||
#### 7) Automate builds
|
||||
|
||||
Now you need to publish builds for all the platforms and node versions you wish to support. This is best automated.
|
||||
|
||||
- See [Appveyor Automation](#appveyor-automation) for how to auto-publish builds on Windows.
|
||||
- See [Travis Automation](#travis-automation) for how to auto-publish builds on OS X and Linux.
|
||||
|
||||
#### 8) You're done!
|
||||
|
||||
Now publish your module to the npm registry. Users will now be able to install your module from a binary.
|
||||
|
||||
What will happen is this:
|
||||
|
||||
1. `npm install <your package>` will pull from the npm registry
|
||||
2. npm will run the `install` script which will call out to `node-pre-gyp`
|
||||
3. `node-pre-gyp` will fetch the binary `.node` module and unpack in the right place
|
||||
4. Assuming that all worked, you are done
|
||||
|
||||
If a a binary was not available for a given platform and `--fallback-to-build` was used then `node-gyp rebuild` will be called to try to source compile the module.
|
||||
|
||||
#### 9) One more option
|
||||
|
||||
It may be that you want to work with two s3 buckets, one for staging and one for production; this
|
||||
arrangement makes it less likely to accidentally overwrite a production binary. It also allows the production
|
||||
environment to have more restrictive permissions than staging while still enabling publishing when
|
||||
developing and testing.
|
||||
|
||||
The binary.host property can be set at execution time. In order to do so all of the following conditions
|
||||
must be true.
|
||||
|
||||
- binary.host is falsey or not present
|
||||
- binary.staging_host is not empty
|
||||
- binary.production_host is not empty
|
||||
|
||||
If any of these checks fail then the operation will not perform execution time determination of the s3 target.
|
||||
|
||||
If the command being executed is either "publish" or "unpublish" then the default is set to `binary.staging_host`. In all other cases
|
||||
the default is `binary.production_host`.
|
||||
|
||||
The command-line options `--s3_host=staging` or `--s3_host=production` override the default. If `s3_host`
|
||||
is present and not `staging` or `production` an exception is thrown.
|
||||
|
||||
This allows installing from staging by specifying `--s3_host=staging`. And it requires specifying
|
||||
`--s3_option=production` in order to publish to, or unpublish from, production, making accidental errors less likely.
|
||||
|
||||
## Node-API Considerations
|
||||
|
||||
[Node-API](https://nodejs.org/api/n-api.html#n_api_node_api), which was previously known as N-API, is an ABI-stable alternative to previous technologies such as [nan](https://github.com/nodejs/nan) which are tied to a specific Node runtime engine. Node-API is Node runtime engine agnostic and guarantees modules created today will continue to run, without changes, into the future.
|
||||
|
||||
Using `node-pre-gyp` with Node-API projects requires a handful of additional configuration values and imposes some additional requirements.
|
||||
|
||||
The most significant difference is that an Node-API module can be coded to target multiple Node-API versions. Therefore, an Node-API module must declare in its `package.json` file which Node-API versions the module is designed to run against. In addition, since multiple builds may be required for a single module, path and file names must be specified in way that avoids naming conflicts.
|
||||
|
||||
### The `napi_versions` array property
|
||||
|
||||
A Node-API module must declare in its `package.json` file, the Node-API versions the module is intended to support. This is accomplished by including an `napi-versions` array property in the `binary` object. For example:
|
||||
|
||||
```js
|
||||
"binary": {
|
||||
"module_name": "your_module",
|
||||
"module_path": "your_module_path",
|
||||
"host": "https://your_bucket.s3-us-west-1.amazonaws.com",
|
||||
"napi_versions": [1,3]
|
||||
}
|
||||
```
|
||||
|
||||
If the `napi_versions` array property is *not* present, `node-pre-gyp` operates as it always has. Including the `napi_versions` array property instructs `node-pre-gyp` that this is a Node-API module build.
|
||||
|
||||
When the `napi_versions` array property is present, `node-pre-gyp` fires off multiple operations, one for each of the Node-API versions in the array. In the example above, two operations are initiated, one for Node-API version 1 and second for Node-API version 3. How this version number is communicated is described next.
|
||||
|
||||
### The `napi_build_version` value
|
||||
|
||||
For each of the Node-API module operations `node-pre-gyp` initiates, it ensures that the `napi_build_version` is set appropriately.
|
||||
|
||||
This value is of importance in two areas:
|
||||
|
||||
1. The C/C++ code which needs to know against which Node-API version it should compile.
|
||||
2. `node-pre-gyp` itself which must assign appropriate path and file names to avoid collisions.
|
||||
|
||||
### Defining `NAPI_VERSION` for the C/C++ code
|
||||
|
||||
The `napi_build_version` value is communicated to the C/C++ code by adding this code to the `binding.gyp` file:
|
||||
|
||||
```
|
||||
"defines": [
|
||||
"NAPI_VERSION=<(napi_build_version)",
|
||||
]
|
||||
```
|
||||
|
||||
This ensures that `NAPI_VERSION`, an integer value, is declared appropriately to the C/C++ code for each build.
|
||||
|
||||
> Note that earlier versions of this document recommended defining the symbol `NAPI_BUILD_VERSION`. `NAPI_VERSION` is preferred because it used by the Node-API C/C++ headers to configure the specific Node-API versions being requested.
|
||||
|
||||
### Path and file naming requirements in `package.json`
|
||||
|
||||
Since `node-pre-gyp` fires off multiple operations for each request, it is essential that path and file names be created in such a way as to avoid collisions. This is accomplished by imposing additional path and file naming requirements.
|
||||
|
||||
Specifically, when performing Node-API builds, the `{napi_build_version}` text configuration value *must* be present in the `module_path` property. In addition, the `{napi_build_version}` text configuration value *must* be present in either the `remote_path` or `package_name` property. (No problem if it's in both.)
|
||||
|
||||
Here's an example:
|
||||
|
||||
```js
|
||||
"binary": {
|
||||
"module_name": "your_module",
|
||||
"module_path": "./lib/binding/napi-v{napi_build_version}",
|
||||
"remote_path": "./{module_name}/v{version}/{configuration}/",
|
||||
"package_name": "{platform}-{arch}-napi-v{napi_build_version}.tar.gz",
|
||||
"host": "https://your_bucket.s3-us-west-1.amazonaws.com",
|
||||
"napi_versions": [1,3]
|
||||
}
|
||||
```
|
||||
|
||||
## Supporting both Node-API and NAN builds
|
||||
|
||||
You may have a legacy native add-on that you wish to continue supporting for those versions of Node that do not support Node-API, as you add Node-API support for later Node versions. This can be accomplished by specifying the `node_napi_label` configuration value in the package.json `binary.package_name` property.
|
||||
|
||||
Placing the configuration value `node_napi_label` in the package.json `binary.package_name` property instructs `node-pre-gyp` to build all viable Node-API binaries supported by the current Node instance. If the current Node instance does not support Node-API, `node-pre-gyp` will request a traditional, non-Node-API build.
|
||||
|
||||
The configuration value `node_napi_label` is set by `node-pre-gyp` to the type of build created, `napi` or `node`, and the version number. For Node-API builds, the string contains the Node-API version nad has values like `napi-v3`. For traditional, non-Node-API builds, the string contains the ABI version with values like `node-v46`.
|
||||
|
||||
Here's how the `binary` configuration above might be changed to support both Node-API and NAN builds:
|
||||
|
||||
```js
|
||||
"binary": {
|
||||
"module_name": "your_module",
|
||||
"module_path": "./lib/binding/{node_napi_label}",
|
||||
"remote_path": "./{module_name}/v{version}/{configuration}/",
|
||||
"package_name": "{platform}-{arch}-{node_napi_label}.tar.gz",
|
||||
"host": "https://your_bucket.s3-us-west-1.amazonaws.com",
|
||||
"napi_versions": [1,3]
|
||||
}
|
||||
```
|
||||
|
||||
The C/C++ symbol `NAPI_VERSION` can be used to distinguish Node-API and non-Node-API builds. The value of `NAPI_VERSION` is set to the integer Node-API version for Node-API builds and is set to `0` for non-Node-API builds.
|
||||
|
||||
For example:
|
||||
|
||||
```C
|
||||
#if NAPI_VERSION
|
||||
// Node-API code goes here
|
||||
#else
|
||||
// NAN code goes here
|
||||
#endif
|
||||
```
|
||||
|
||||
### Two additional configuration values
|
||||
|
||||
The following two configuration values, which were implemented in previous versions of `node-pre-gyp`, continue to exist, but have been replaced by the `node_napi_label` configuration value described above.
|
||||
|
||||
1. `napi_version` If Node-API is supported by the currently executing Node instance, this value is the Node-API version number supported by Node. If Node-API is not supported, this value is an empty string.
|
||||
|
||||
2. `node_abi_napi` If the value returned for `napi_version` is non empty, this value is `'napi'`. If the value returned for `napi_version` is empty, this value is the value returned for `node_abi`.
|
||||
|
||||
These values are present for use in the `binding.gyp` file and may be used as `{napi_version}` and `{node_abi_napi}` for text substituion in the `binary` properties of the `package.json` file.
|
||||
|
||||
## S3 Hosting
|
||||
|
||||
You can host wherever you choose but S3 is cheap, `node-pre-gyp publish` expects it, and S3 can be integrated well with [Travis.ci](http://travis-ci.org) to automate builds for OS X and Ubuntu, and with [Appveyor](http://appveyor.com) to automate builds for Windows. Here is an approach to do this:
|
||||
|
||||
First, get setup locally and test the workflow:
|
||||
|
||||
#### 1) Create an S3 bucket
|
||||
|
||||
And have your **key** and **secret key** ready for writing to the bucket.
|
||||
|
||||
It is recommended to create a IAM user with a policy that only gives permissions to the specific bucket you plan to publish to. This can be done in the [IAM console](https://console.aws.amazon.com/iam/) by: 1) adding a new user, 2) choosing `Attach User Policy`, 3) Using the `Policy Generator`, 4) selecting `Amazon S3` for the service, 5) adding the actions: `DeleteObject`, `GetObject`, `GetObjectAcl`, `ListBucket`, `HeadBucket`, `PutObject`, `PutObjectAcl`, 6) adding an ARN of `arn:aws:s3:::bucket/*` (replacing `bucket` with your bucket name), and finally 7) clicking `Add Statement` and saving the policy. It should generate a policy like:
|
||||
|
||||
```js
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "objects",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:PutObject",
|
||||
"s3:GetObjectAcl",
|
||||
"s3:GetObject",
|
||||
"s3:DeleteObject",
|
||||
"s3:PutObjectAcl"
|
||||
],
|
||||
"Resource": "arn:aws:s3:::your-bucket-name/*"
|
||||
},
|
||||
{
|
||||
"Sid": "bucket",
|
||||
"Effect": "Allow",
|
||||
"Action": "s3:ListBucket",
|
||||
"Resource": "arn:aws:s3:::your-bucket-name"
|
||||
},
|
||||
{
|
||||
"Sid": "buckets",
|
||||
"Effect": "Allow",
|
||||
"Action": "s3:HeadBucket",
|
||||
"Resource": "*"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### 2) Install node-pre-gyp
|
||||
|
||||
Either install it globally:
|
||||
|
||||
npm install node-pre-gyp -g
|
||||
|
||||
Or put the local version on your PATH
|
||||
|
||||
export PATH=`pwd`/node_modules/.bin/:$PATH
|
||||
|
||||
#### 3) Configure AWS credentials
|
||||
|
||||
It is recommended to configure the AWS JS SDK v2 used internally by `node-pre-gyp` by setting these environment variables:
|
||||
|
||||
- AWS_ACCESS_KEY_ID
|
||||
- AWS_SECRET_ACCESS_KEY
|
||||
|
||||
But also you can also use the `Shared Config File` mentioned [in the AWS JS SDK v2 docs](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/configuring-the-jssdk.html)
|
||||
|
||||
#### 4) Package and publish your build
|
||||
|
||||
Install the `aws-sdk`:
|
||||
|
||||
npm install aws-sdk
|
||||
|
||||
Then publish:
|
||||
|
||||
node-pre-gyp package publish
|
||||
|
||||
Note: if you hit an error like `Hostname/IP doesn't match certificate's altnames` it may mean that you need to provide the `region` option in your config.
|
||||
|
||||
## Appveyor Automation
|
||||
|
||||
[Appveyor](http://www.appveyor.com/) can build binaries and publish the results per commit and supports:
|
||||
|
||||
- Windows Visual Studio 2013 and related compilers
|
||||
- Both 64 bit (x64) and 32 bit (x86) build configurations
|
||||
- Multiple Node.js versions
|
||||
|
||||
For an example of doing this see [node-sqlite3's appveyor.yml](https://github.com/mapbox/node-sqlite3/blob/master/appveyor.yml).
|
||||
|
||||
Below is a guide to getting set up:
|
||||
|
||||
#### 1) Create a free Appveyor account
|
||||
|
||||
Go to https://ci.appveyor.com/signup/free and sign in with your GitHub account.
|
||||
|
||||
#### 2) Create a new project
|
||||
|
||||
Go to https://ci.appveyor.com/projects/new and select the GitHub repo for your module
|
||||
|
||||
#### 3) Add appveyor.yml and push it
|
||||
|
||||
Once you have committed an `appveyor.yml` ([appveyor.yml reference](http://www.appveyor.com/docs/appveyor-yml)) to your GitHub repo and pushed it AppVeyor should automatically start building your project.
|
||||
|
||||
#### 4) Create secure variables
|
||||
|
||||
Encrypt your S3 AWS keys by going to <https://ci.appveyor.com/tools/encrypt> and hitting the `encrypt` button.
|
||||
|
||||
Then paste the result into your `appveyor.yml`
|
||||
|
||||
```yml
|
||||
environment:
|
||||
AWS_ACCESS_KEY_ID:
|
||||
secure: Dn9HKdLNYvDgPdQOzRq/DqZ/MPhjknRHB1o+/lVU8MA=
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
secure: W1rwNoSnOku1r+28gnoufO8UA8iWADmL1LiiwH9IOkIVhDTNGdGPJqAlLjNqwLnL
|
||||
```
|
||||
|
||||
NOTE: keys are per account but not per repo (this is difference than Travis where keys are per repo but not related to the account used to encrypt them).
|
||||
|
||||
#### 5) Hook up publishing
|
||||
|
||||
Just put `node-pre-gyp package publish` in your `appveyor.yml` after `npm install`.
|
||||
|
||||
#### 6) Publish when you want
|
||||
|
||||
You might wish to publish binaries only on a specific commit. To do this you could borrow from the [Travis CI idea of commit keywords](http://about.travis-ci.org/docs/user/how-to-skip-a-build/) and add special handling for commit messages with `[publish binary]`:
|
||||
|
||||
SET CM=%APPVEYOR_REPO_COMMIT_MESSAGE%
|
||||
if not "%CM%" == "%CM:[publish binary]=%" node-pre-gyp --msvs_version=2013 publish
|
||||
|
||||
If your commit message contains special characters (e.g. `&`) this method might fail. An alternative is to use PowerShell, which gives you additional possibilities, like ignoring case by using `ToLower()`:
|
||||
|
||||
ps: if($env:APPVEYOR_REPO_COMMIT_MESSAGE.ToLower().Contains('[publish binary]')) { node-pre-gyp --msvs_version=2013 publish }
|
||||
|
||||
Remember this publishing is not the same as `npm publish`. We're just talking about the binary module here and not your entire npm package.
|
||||
|
||||
## Travis Automation
|
||||
|
||||
[Travis](https://travis-ci.org/) can push to S3 after a successful build and supports both:
|
||||
|
||||
- Ubuntu Precise and OS X (64 bit)
|
||||
- Multiple Node.js versions
|
||||
|
||||
For an example of doing this see [node-add-example's .travis.yml](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/.travis.yml).
|
||||
|
||||
Note: if you need 32 bit binaries, this can be done from a 64 bit Travis machine. See [the node-sqlite3 scripts for an example of doing this](https://github.com/mapbox/node-sqlite3/blob/bae122aa6a2b8a45f6b717fab24e207740e32b5d/scripts/build_against_node.sh#L54-L74).
|
||||
|
||||
Below is a guide to getting set up:
|
||||
|
||||
#### 1) Install the Travis gem
|
||||
|
||||
gem install travis
|
||||
|
||||
#### 2) Create secure variables
|
||||
|
||||
Make sure you run this command from within the directory of your module.
|
||||
|
||||
Use `travis-encrypt` like:
|
||||
|
||||
travis encrypt AWS_ACCESS_KEY_ID=${node_pre_gyp_accessKeyId}
|
||||
travis encrypt AWS_SECRET_ACCESS_KEY=${node_pre_gyp_secretAccessKey}
|
||||
|
||||
Then put those values in your `.travis.yml` like:
|
||||
|
||||
```yaml
|
||||
env:
|
||||
global:
|
||||
- secure: F+sEL/v56CzHqmCSSES4pEyC9NeQlkoR0Gs/ZuZxX1ytrj8SKtp3MKqBj7zhIclSdXBz4Ev966Da5ctmcTd410p0b240MV6BVOkLUtkjZJyErMBOkeb8n8yVfSoeMx8RiIhBmIvEn+rlQq+bSFis61/JkE9rxsjkGRZi14hHr4M=
|
||||
- secure: o2nkUQIiABD139XS6L8pxq3XO5gch27hvm/gOdV+dzNKc/s2KomVPWcOyXNxtJGhtecAkABzaW8KHDDi5QL1kNEFx6BxFVMLO8rjFPsMVaBG9Ks6JiDQkkmrGNcnVdxI/6EKTLHTH5WLsz8+J7caDBzvKbEfTux5EamEhxIWgrI=
|
||||
```
|
||||
|
||||
More details on Travis encryption at http://about.travis-ci.org/docs/user/encryption-keys/.
|
||||
|
||||
#### 3) Hook up publishing
|
||||
|
||||
Just put `node-pre-gyp package publish` in your `.travis.yml` after `npm install`.
|
||||
|
||||
##### OS X publishing
|
||||
|
||||
If you want binaries for OS X in addition to linux you can enable [multi-os for Travis](http://docs.travis-ci.com/user/multi-os/#Setting-.travis.yml)
|
||||
|
||||
Use a configuration like:
|
||||
|
||||
```yml
|
||||
|
||||
language: cpp
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- NODE_VERSION="4"
|
||||
- NODE_VERSION="6"
|
||||
|
||||
before_install:
|
||||
- rm -rf ~/.nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm
|
||||
- source ~/.nvm/nvm.sh
|
||||
- nvm install $NODE_VERSION
|
||||
- nvm use $NODE_VERSION
|
||||
```
|
||||
|
||||
See [Travis OS X Gotchas](#travis-os-x-gotchas) for why we replace `language: node_js` and `node_js:` sections with `language: cpp` and a custom matrix.
|
||||
|
||||
Also create platform specific sections for any deps that need install. For example if you need libpng:
|
||||
|
||||
```yml
|
||||
- if [ $(uname -s) == 'Linux' ]; then apt-get install libpng-dev; fi;
|
||||
- if [ $(uname -s) == 'Darwin' ]; then brew install libpng; fi;
|
||||
```
|
||||
|
||||
For detailed multi-OS examples see [node-mapnik](https://github.com/mapnik/node-mapnik/blob/master/.travis.yml) and [node-sqlite3](https://github.com/mapbox/node-sqlite3/blob/master/.travis.yml).
|
||||
|
||||
##### Travis OS X Gotchas
|
||||
|
||||
First, unlike the Travis Linux machines, the OS X machines do not put `node-pre-gyp` on PATH by default. To do so you will need to:
|
||||
|
||||
```sh
|
||||
export PATH=$(pwd)/node_modules/.bin:${PATH}
|
||||
```
|
||||
|
||||
Second, the OS X machines do not support using a matrix for installing different Node.js versions. So you need to bootstrap the installation of Node.js in a cross platform way.
|
||||
|
||||
By doing:
|
||||
|
||||
```yml
|
||||
env:
|
||||
matrix:
|
||||
- NODE_VERSION="4"
|
||||
- NODE_VERSION="6"
|
||||
|
||||
before_install:
|
||||
- rm -rf ~/.nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm
|
||||
- source ~/.nvm/nvm.sh
|
||||
- nvm install $NODE_VERSION
|
||||
- nvm use $NODE_VERSION
|
||||
```
|
||||
|
||||
You can easily recreate the previous behavior of this matrix:
|
||||
|
||||
```yml
|
||||
node_js:
|
||||
- "4"
|
||||
- "6"
|
||||
```
|
||||
|
||||
#### 4) Publish when you want
|
||||
|
||||
You might wish to publish binaries only on a specific commit. To do this you could borrow from the [Travis CI idea of commit keywords](http://about.travis-ci.org/docs/user/how-to-skip-a-build/) and add special handling for commit messages with `[publish binary]`:
|
||||
|
||||
COMMIT_MESSAGE=$(git log --format=%B --no-merges -n 1 | tr -d '\n')
|
||||
if [[ ${COMMIT_MESSAGE} =~ "[publish binary]" ]]; then node-pre-gyp publish; fi;
|
||||
|
||||
Then you can trigger new binaries to be built like:
|
||||
|
||||
git commit -a -m "[publish binary]"
|
||||
|
||||
Or, if you don't have any changes to make simply run:
|
||||
|
||||
git commit --allow-empty -m "[publish binary]"
|
||||
|
||||
WARNING: if you are working in a pull request and publishing binaries from there then you will want to avoid double publishing when Travis CI builds both the `push` and `pr`. You only want to run the publish on the `push` commit. See https://github.com/Project-OSRM/node-osrm/blob/8eb837abe2e2e30e595093d16e5354bc5c573575/scripts/is_pr_merge.sh which is called from https://github.com/Project-OSRM/node-osrm/blob/8eb837abe2e2e30e595093d16e5354bc5c573575/scripts/publish.sh for an example of how to do this.
|
||||
|
||||
Remember this publishing is not the same as `npm publish`. We're just talking about the binary module here and not your entire npm package. To automate the publishing of your entire package to npm on Travis see http://about.travis-ci.org/docs/user/deployment/npm/
|
||||
|
||||
# Versioning
|
||||
|
||||
The `binary` properties of `module_path`, `remote_path`, and `package_name` support variable substitution. The strings are evaluated by `node-pre-gyp` depending on your system and any custom build flags you passed.
|
||||
|
||||
- `node_abi`: The node C++ `ABI` number. This value is available in Javascript as `process.versions.modules` as of [`>= v0.10.4 >= v0.11.7`](https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e) and in C++ as the `NODE_MODULE_VERSION` define much earlier. For versions of Node before this was available we fallback to the V8 major and minor version.
|
||||
- `platform` matches node's `process.platform` like `linux`, `darwin`, and `win32` unless the user passed the `--target_platform` option to override.
|
||||
- `arch` matches node's `process.arch` like `x64` or `ia32` unless the user passes the `--target_arch` option to override.
|
||||
- `libc` matches `require('detect-libc').family` like `glibc` or `musl` unless the user passes the `--target_libc` option to override.
|
||||
- `configuration` - Either 'Release' or 'Debug' depending on if `--debug` is passed during the build.
|
||||
- `module_name` - the `binary.module_name` attribute from `package.json`.
|
||||
- `version` - the semver `version` value for your module from `package.json` (NOTE: ignores the `semver.build` property).
|
||||
- `major`, `minor`, `patch`, and `prelease` match the individual semver values for your module's `version`
|
||||
- `build` - the sevmer `build` value. For example it would be `this.that` if your package.json `version` was `v1.0.0+this.that`
|
||||
- `prerelease` - the semver `prerelease` value. For example it would be `alpha.beta` if your package.json `version` was `v1.0.0-alpha.beta`
|
||||
|
||||
|
||||
The options are visible in the code at <https://github.com/mapbox/node-pre-gyp/blob/612b7bca2604508d881e1187614870ba19a7f0c5/lib/util/versioning.js#L114-L127>
|
||||
|
||||
# Download binary files from a mirror
|
||||
|
||||
S3 is broken in China for the well known reason.
|
||||
|
||||
Using the `npm` config argument: `--{module_name}_binary_host_mirror` can download binary files through a mirror, `-` in `module_name` will be replaced with `_`.
|
||||
|
||||
e.g.: Install [v8-profiler](https://www.npmjs.com/package/v8-profiler) from `npm`.
|
||||
|
||||
```bash
|
||||
$ npm install v8-profiler --profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/
|
||||
```
|
||||
|
||||
e.g.: Install [canvas-prebuilt](https://www.npmjs.com/package/canvas-prebuilt) from `npm`.
|
||||
|
||||
```bash
|
||||
$ npm install canvas-prebuilt --canvas_prebuilt_binary_host_mirror=https://npm.taobao.org/mirrors/canvas-prebuilt/
|
||||
```
|
4
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp
generated
vendored
Normal file
4
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
require('../lib/main');
|
2
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp.cmd
generated
vendored
Normal file
2
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp.cmd
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
node "%~dp0\node-pre-gyp" %*
|
10
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/contributing.md
generated
vendored
Normal file
10
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/contributing.md
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# Contributing
|
||||
|
||||
|
||||
### Releasing a new version:
|
||||
|
||||
- Ensure tests are passing on travis and appveyor
|
||||
- Run `node scripts/abi_crosswalk.js` and commit any changes
|
||||
- Update the changelog
|
||||
- Tag a new release like: `git tag -a v0.6.34 -m "tagging v0.6.34" && git push --tags`
|
||||
- Run `npm publish`
|
51
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/build.js
generated
vendored
Normal file
51
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/build.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = exports = build;
|
||||
|
||||
exports.usage = 'Attempts to compile the module by dispatching to node-gyp or nw-gyp';
|
||||
|
||||
const napi = require('./util/napi.js');
|
||||
const compile = require('./util/compile.js');
|
||||
const handle_gyp_opts = require('./util/handle_gyp_opts.js');
|
||||
const configure = require('./configure.js');
|
||||
|
||||
function do_build(gyp, argv, callback) {
|
||||
handle_gyp_opts(gyp, argv, (err, result) => {
|
||||
let final_args = ['build'].concat(result.gyp).concat(result.pre);
|
||||
if (result.unparsed.length > 0) {
|
||||
final_args = final_args.
|
||||
concat(['--']).
|
||||
concat(result.unparsed);
|
||||
}
|
||||
if (!err && result.opts.napi_build_version) {
|
||||
napi.swap_build_dir_in(result.opts.napi_build_version);
|
||||
}
|
||||
compile.run_gyp(final_args, result.opts, (err2) => {
|
||||
if (result.opts.napi_build_version) {
|
||||
napi.swap_build_dir_out(result.opts.napi_build_version);
|
||||
}
|
||||
return callback(err2);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function build(gyp, argv, callback) {
|
||||
|
||||
// Form up commands to pass to node-gyp:
|
||||
// We map `node-pre-gyp build` to `node-gyp configure build` so that we do not
|
||||
// trigger a clean and therefore do not pay the penalty of a full recompile
|
||||
if (argv.length && (argv.indexOf('rebuild') > -1)) {
|
||||
argv.shift(); // remove `rebuild`
|
||||
// here we map `node-pre-gyp rebuild` to `node-gyp rebuild` which internally means
|
||||
// "clean + configure + build" and triggers a full recompile
|
||||
compile.run_gyp(['clean'], {}, (err3) => {
|
||||
if (err3) return callback(err3);
|
||||
configure(gyp, argv, (err4) => {
|
||||
if (err4) return callback(err4);
|
||||
return do_build(gyp, argv, callback);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
return do_build(gyp, argv, callback);
|
||||
}
|
||||
}
|
31
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/clean.js
generated
vendored
Normal file
31
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/clean.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = exports = clean;
|
||||
|
||||
exports.usage = 'Removes the entire folder containing the compiled .node module';
|
||||
|
||||
const rm = require('rimraf');
|
||||
const exists = require('fs').exists || require('path').exists;
|
||||
const versioning = require('./util/versioning.js');
|
||||
const napi = require('./util/napi.js');
|
||||
const path = require('path');
|
||||
|
||||
function clean(gyp, argv, callback) {
|
||||
const package_json = gyp.package_json;
|
||||
const napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
const to_delete = opts.module_path;
|
||||
if (!to_delete) {
|
||||
return callback(new Error('module_path is empty, refusing to delete'));
|
||||
} else if (path.normalize(to_delete) === path.normalize(process.cwd())) {
|
||||
return callback(new Error('module_path is not set, refusing to delete'));
|
||||
} else {
|
||||
exists(to_delete, (found) => {
|
||||
if (found) {
|
||||
if (!gyp.opts.silent_clean) console.log('[' + package_json.name + '] Removing "%s"', to_delete);
|
||||
return rm(to_delete, callback);
|
||||
}
|
||||
return callback();
|
||||
});
|
||||
}
|
||||
}
|
52
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/configure.js
generated
vendored
Normal file
52
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/configure.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = exports = configure;
|
||||
|
||||
exports.usage = 'Attempts to configure node-gyp or nw-gyp build';
|
||||
|
||||
const napi = require('./util/napi.js');
|
||||
const compile = require('./util/compile.js');
|
||||
const handle_gyp_opts = require('./util/handle_gyp_opts.js');
|
||||
|
||||
function configure(gyp, argv, callback) {
|
||||
handle_gyp_opts(gyp, argv, (err, result) => {
|
||||
let final_args = result.gyp.concat(result.pre);
|
||||
// pull select node-gyp configure options out of the npm environ
|
||||
const known_gyp_args = ['dist-url', 'python', 'nodedir', 'msvs_version'];
|
||||
known_gyp_args.forEach((key) => {
|
||||
const val = gyp.opts[key] || gyp.opts[key.replace('-', '_')];
|
||||
if (val) {
|
||||
final_args.push('--' + key + '=' + val);
|
||||
}
|
||||
});
|
||||
// --ensure=false tell node-gyp to re-install node development headers
|
||||
// but it is only respected by node-gyp install, so we have to call install
|
||||
// as a separate step if the user passes it
|
||||
if (gyp.opts.ensure === false) {
|
||||
const install_args = final_args.concat(['install', '--ensure=false']);
|
||||
compile.run_gyp(install_args, result.opts, (err2) => {
|
||||
if (err2) return callback(err2);
|
||||
if (result.unparsed.length > 0) {
|
||||
final_args = final_args.
|
||||
concat(['--']).
|
||||
concat(result.unparsed);
|
||||
}
|
||||
compile.run_gyp(['configure'].concat(final_args), result.opts, (err3) => {
|
||||
return callback(err3);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
if (result.unparsed.length > 0) {
|
||||
final_args = final_args.
|
||||
concat(['--']).
|
||||
concat(result.unparsed);
|
||||
}
|
||||
compile.run_gyp(['configure'].concat(final_args), result.opts, (err4) => {
|
||||
if (!err4 && result.opts.napi_build_version) {
|
||||
napi.swap_build_dir_out(result.opts.napi_build_version);
|
||||
}
|
||||
return callback(err4);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
38
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/info.js
generated
vendored
Normal file
38
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/info.js
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = exports = info;
|
||||
|
||||
exports.usage = 'Lists all published binaries (requires aws-sdk)';
|
||||
|
||||
const log = require('npmlog');
|
||||
const versioning = require('./util/versioning.js');
|
||||
const s3_setup = require('./util/s3_setup.js');
|
||||
|
||||
function info(gyp, argv, callback) {
|
||||
const package_json = gyp.package_json;
|
||||
const opts = versioning.evaluate(package_json, gyp.opts);
|
||||
const config = {};
|
||||
s3_setup.detect(opts, config);
|
||||
const s3 = s3_setup.get_s3(config);
|
||||
const s3_opts = {
|
||||
Bucket: config.bucket,
|
||||
Prefix: config.prefix
|
||||
};
|
||||
s3.listObjects(s3_opts, (err, meta) => {
|
||||
if (err && err.code === 'NotFound') {
|
||||
return callback(new Error('[' + package_json.name + '] Not found: https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + config.prefix));
|
||||
} else if (err) {
|
||||
return callback(err);
|
||||
} else {
|
||||
log.verbose(JSON.stringify(meta, null, 1));
|
||||
if (meta && meta.Contents) {
|
||||
meta.Contents.forEach((obj) => {
|
||||
console.log(obj.Key);
|
||||
});
|
||||
} else {
|
||||
console.error('[' + package_json.name + '] No objects found at https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + config.prefix);
|
||||
}
|
||||
return callback();
|
||||
}
|
||||
});
|
||||
}
|
235
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/install.js
generated
vendored
Normal file
235
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/install.js
generated
vendored
Normal file
@ -0,0 +1,235 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = exports = install;
|
||||
|
||||
exports.usage = 'Attempts to install pre-built binary for module';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const log = require('npmlog');
|
||||
const existsAsync = fs.exists || path.exists;
|
||||
const versioning = require('./util/versioning.js');
|
||||
const napi = require('./util/napi.js');
|
||||
const makeDir = require('make-dir');
|
||||
// for fetching binaries
|
||||
const fetch = require('node-fetch');
|
||||
const tar = require('tar');
|
||||
|
||||
let npgVersion = 'unknown';
|
||||
try {
|
||||
// Read own package.json to get the current node-pre-pyp version.
|
||||
const ownPackageJSON = fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8');
|
||||
npgVersion = JSON.parse(ownPackageJSON).version;
|
||||
} catch (e) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
function place_binary(uri, targetDir, opts, callback) {
|
||||
log.http('GET', uri);
|
||||
|
||||
// Try getting version info from the currently running npm.
|
||||
const envVersionInfo = process.env.npm_config_user_agent ||
|
||||
'node ' + process.version;
|
||||
|
||||
const sanitized = uri.replace('+', '%2B');
|
||||
const requestOpts = {
|
||||
uri: sanitized,
|
||||
headers: {
|
||||
'User-Agent': 'node-pre-gyp (v' + npgVersion + ', ' + envVersionInfo + ')'
|
||||
},
|
||||
follow_max: 10
|
||||
};
|
||||
|
||||
if (opts.cafile) {
|
||||
try {
|
||||
requestOpts.ca = fs.readFileSync(opts.cafile);
|
||||
} catch (e) {
|
||||
return callback(e);
|
||||
}
|
||||
} else if (opts.ca) {
|
||||
requestOpts.ca = opts.ca;
|
||||
}
|
||||
|
||||
const proxyUrl = opts.proxy ||
|
||||
process.env.http_proxy ||
|
||||
process.env.HTTP_PROXY ||
|
||||
process.env.npm_config_proxy;
|
||||
let agent;
|
||||
if (proxyUrl) {
|
||||
const ProxyAgent = require('https-proxy-agent');
|
||||
agent = new ProxyAgent(proxyUrl);
|
||||
log.http('download', 'proxy agent configured using: "%s"', proxyUrl);
|
||||
}
|
||||
|
||||
fetch(sanitized, { agent })
|
||||
.then((res) => {
|
||||
if (!res.ok) {
|
||||
throw new Error(`response status ${res.status} ${res.statusText} on ${sanitized}`);
|
||||
}
|
||||
const dataStream = res.body;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
let extractions = 0;
|
||||
const countExtractions = (entry) => {
|
||||
extractions += 1;
|
||||
log.info('install', 'unpacking %s', entry.path);
|
||||
};
|
||||
|
||||
dataStream.pipe(extract(targetDir, countExtractions))
|
||||
.on('error', (e) => {
|
||||
reject(e);
|
||||
});
|
||||
dataStream.on('end', () => {
|
||||
resolve(`extracted file count: ${extractions}`);
|
||||
});
|
||||
dataStream.on('error', (e) => {
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
})
|
||||
.then((text) => {
|
||||
log.info(text);
|
||||
callback();
|
||||
})
|
||||
.catch((e) => {
|
||||
log.error(`install ${e.message}`);
|
||||
callback(e);
|
||||
});
|
||||
}
|
||||
|
||||
function extract(to, onentry) {
|
||||
return tar.extract({
|
||||
cwd: to,
|
||||
strip: 1,
|
||||
onentry
|
||||
});
|
||||
}
|
||||
|
||||
function extract_from_local(from, targetDir, callback) {
|
||||
if (!fs.existsSync(from)) {
|
||||
return callback(new Error('Cannot find file ' + from));
|
||||
}
|
||||
log.info('Found local file to extract from ' + from);
|
||||
|
||||
// extract helpers
|
||||
let extractCount = 0;
|
||||
function countExtractions(entry) {
|
||||
extractCount += 1;
|
||||
log.info('install', 'unpacking ' + entry.path);
|
||||
}
|
||||
function afterExtract(err) {
|
||||
if (err) return callback(err);
|
||||
if (extractCount === 0) {
|
||||
return callback(new Error('There was a fatal problem while extracting the tarball'));
|
||||
}
|
||||
log.info('tarball', 'done parsing tarball');
|
||||
callback();
|
||||
}
|
||||
|
||||
fs.createReadStream(from).pipe(extract(targetDir, countExtractions))
|
||||
.on('close', afterExtract)
|
||||
.on('error', afterExtract);
|
||||
}
|
||||
|
||||
function do_build(gyp, argv, callback) {
|
||||
const args = ['rebuild'].concat(argv);
|
||||
gyp.todo.push({ name: 'build', args: args });
|
||||
process.nextTick(callback);
|
||||
}
|
||||
|
||||
function print_fallback_error(err, opts, package_json) {
|
||||
const fallback_message = ' (falling back to source compile with node-gyp)';
|
||||
let full_message = '';
|
||||
if (err.statusCode !== undefined) {
|
||||
// If we got a network response it but failed to download
|
||||
// it means remote binaries are not available, so let's try to help
|
||||
// the user/developer with the info to debug why
|
||||
full_message = 'Pre-built binaries not found for ' + package_json.name + '@' + package_json.version;
|
||||
full_message += ' and ' + opts.runtime + '@' + (opts.target || process.versions.node) + ' (' + opts.node_abi + ' ABI, ' + opts.libc + ')';
|
||||
full_message += fallback_message;
|
||||
log.warn('Tried to download(' + err.statusCode + '): ' + opts.hosted_tarball);
|
||||
log.warn(full_message);
|
||||
log.http(err.message);
|
||||
} else {
|
||||
// If we do not have a statusCode that means an unexpected error
|
||||
// happened and prevented an http response, so we output the exact error
|
||||
full_message = 'Pre-built binaries not installable for ' + package_json.name + '@' + package_json.version;
|
||||
full_message += ' and ' + opts.runtime + '@' + (opts.target || process.versions.node) + ' (' + opts.node_abi + ' ABI, ' + opts.libc + ')';
|
||||
full_message += fallback_message;
|
||||
log.warn(full_message);
|
||||
log.warn('Hit error ' + err.message);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// install
|
||||
//
|
||||
function install(gyp, argv, callback) {
|
||||
const package_json = gyp.package_json;
|
||||
const napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
const source_build = gyp.opts['build-from-source'] || gyp.opts.build_from_source;
|
||||
const update_binary = gyp.opts['update-binary'] || gyp.opts.update_binary;
|
||||
const should_do_source_build = source_build === package_json.name || (source_build === true || source_build === 'true');
|
||||
if (should_do_source_build) {
|
||||
log.info('build', 'requesting source compile');
|
||||
return do_build(gyp, argv, callback);
|
||||
} else {
|
||||
const fallback_to_build = gyp.opts['fallback-to-build'] || gyp.opts.fallback_to_build;
|
||||
let should_do_fallback_build = fallback_to_build === package_json.name || (fallback_to_build === true || fallback_to_build === 'true');
|
||||
// but allow override from npm
|
||||
if (process.env.npm_config_argv) {
|
||||
const cooked = JSON.parse(process.env.npm_config_argv).cooked;
|
||||
const match = cooked.indexOf('--fallback-to-build');
|
||||
if (match > -1 && cooked.length > match && cooked[match + 1] === 'false') {
|
||||
should_do_fallback_build = false;
|
||||
log.info('install', 'Build fallback disabled via npm flag: --fallback-to-build=false');
|
||||
}
|
||||
}
|
||||
let opts;
|
||||
try {
|
||||
opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
} catch (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
opts.ca = gyp.opts.ca;
|
||||
opts.cafile = gyp.opts.cafile;
|
||||
|
||||
const from = opts.hosted_tarball;
|
||||
const to = opts.module_path;
|
||||
const binary_module = path.join(to, opts.module_name + '.node');
|
||||
existsAsync(binary_module, (found) => {
|
||||
if (!update_binary) {
|
||||
if (found) {
|
||||
console.log('[' + package_json.name + '] Success: "' + binary_module + '" already installed');
|
||||
console.log('Pass --update-binary to reinstall or --build-from-source to recompile');
|
||||
return callback();
|
||||
}
|
||||
log.info('check', 'checked for "' + binary_module + '" (not found)');
|
||||
}
|
||||
|
||||
makeDir(to).then(() => {
|
||||
const fileName = from.startsWith('file://') && from.slice('file://'.length);
|
||||
if (fileName) {
|
||||
extract_from_local(fileName, to, after_place);
|
||||
} else {
|
||||
place_binary(from, to, opts, after_place);
|
||||
}
|
||||
}).catch((err) => {
|
||||
after_place(err);
|
||||
});
|
||||
|
||||
function after_place(err) {
|
||||
if (err && should_do_fallback_build) {
|
||||
print_fallback_error(err, opts, package_json);
|
||||
return do_build(gyp, argv, callback);
|
||||
} else if (err) {
|
||||
return callback(err);
|
||||
} else {
|
||||
console.log('[' + package_json.name + '] Success: "' + binary_module + '" is installed via remote');
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
125
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/main.js
generated
vendored
Normal file
125
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/main.js
generated
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Set the title.
|
||||
*/
|
||||
|
||||
process.title = 'node-pre-gyp';
|
||||
|
||||
const node_pre_gyp = require('../');
|
||||
const log = require('npmlog');
|
||||
|
||||
/**
|
||||
* Process and execute the selected commands.
|
||||
*/
|
||||
|
||||
const prog = new node_pre_gyp.Run({ argv: process.argv });
|
||||
let completed = false;
|
||||
|
||||
if (prog.todo.length === 0) {
|
||||
if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) {
|
||||
console.log('v%s', prog.version);
|
||||
process.exit(0);
|
||||
} else if (~process.argv.indexOf('-h') || ~process.argv.indexOf('--help')) {
|
||||
console.log('%s', prog.usage());
|
||||
process.exit(0);
|
||||
}
|
||||
console.log('%s', prog.usage());
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// if --no-color is passed
|
||||
if (prog.opts && Object.hasOwnProperty.call(prog, 'color') && !prog.opts.color) {
|
||||
log.disableColor();
|
||||
}
|
||||
|
||||
log.info('it worked if it ends with', 'ok');
|
||||
log.verbose('cli', process.argv);
|
||||
log.info('using', process.title + '@%s', prog.version);
|
||||
log.info('using', 'node@%s | %s | %s', process.versions.node, process.platform, process.arch);
|
||||
|
||||
|
||||
/**
|
||||
* Change dir if -C/--directory was passed.
|
||||
*/
|
||||
|
||||
const dir = prog.opts.directory;
|
||||
if (dir) {
|
||||
const fs = require('fs');
|
||||
try {
|
||||
const stat = fs.statSync(dir);
|
||||
if (stat.isDirectory()) {
|
||||
log.info('chdir', dir);
|
||||
process.chdir(dir);
|
||||
} else {
|
||||
log.warn('chdir', dir + ' is not a directory');
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.code === 'ENOENT') {
|
||||
log.warn('chdir', dir + ' is not a directory');
|
||||
} else {
|
||||
log.warn('chdir', 'error during chdir() "%s"', e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function run() {
|
||||
const command = prog.todo.shift();
|
||||
if (!command) {
|
||||
// done!
|
||||
completed = true;
|
||||
log.info('ok');
|
||||
return;
|
||||
}
|
||||
|
||||
// set binary.host when appropriate. host determines the s3 target bucket.
|
||||
const target = prog.setBinaryHostProperty(command.name);
|
||||
if (target && ['install', 'publish', 'unpublish', 'info'].indexOf(command.name) >= 0) {
|
||||
log.info('using binary.host: ' + prog.package_json.binary.host);
|
||||
}
|
||||
|
||||
prog.commands[command.name](command.args, function(err) {
|
||||
if (err) {
|
||||
log.error(command.name + ' error');
|
||||
log.error('stack', err.stack);
|
||||
errorMessage();
|
||||
log.error('not ok');
|
||||
console.log(err.message);
|
||||
return process.exit(1);
|
||||
}
|
||||
const args_array = [].slice.call(arguments, 1);
|
||||
if (args_array.length) {
|
||||
console.log.apply(console, args_array);
|
||||
}
|
||||
// now run the next command in the queue
|
||||
process.nextTick(run);
|
||||
});
|
||||
}
|
||||
|
||||
process.on('exit', (code) => {
|
||||
if (!completed && !code) {
|
||||
log.error('Completion callback never invoked!');
|
||||
errorMessage();
|
||||
process.exit(6);
|
||||
}
|
||||
});
|
||||
|
||||
process.on('uncaughtException', (err) => {
|
||||
log.error('UNCAUGHT EXCEPTION');
|
||||
log.error('stack', err.stack);
|
||||
errorMessage();
|
||||
process.exit(7);
|
||||
});
|
||||
|
||||
function errorMessage() {
|
||||
// copied from npm's lib/util/error-handler.js
|
||||
const os = require('os');
|
||||
log.error('System', os.type() + ' ' + os.release());
|
||||
log.error('command', process.argv.map(JSON.stringify).join(' '));
|
||||
log.error('cwd', process.cwd());
|
||||
log.error('node -v', process.version);
|
||||
log.error(process.title + ' -v', 'v' + prog.package.version);
|
||||
}
|
||||
|
||||
// start running the given commands!
|
||||
run();
|
309
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js
generated
vendored
Normal file
309
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js
generated
vendored
Normal file
@ -0,0 +1,309 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = exports;
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
// load mocking control function for accessing s3 via https. the function is a noop always returning
|
||||
// false if not mocking.
|
||||
exports.mockS3Http = require('./util/s3_setup').get_mockS3Http();
|
||||
exports.mockS3Http('on');
|
||||
const mocking = exports.mockS3Http('get');
|
||||
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const nopt = require('nopt');
|
||||
const log = require('npmlog');
|
||||
log.disableProgress();
|
||||
const napi = require('./util/napi.js');
|
||||
|
||||
const EE = require('events').EventEmitter;
|
||||
const inherits = require('util').inherits;
|
||||
const cli_commands = [
|
||||
'clean',
|
||||
'install',
|
||||
'reinstall',
|
||||
'build',
|
||||
'rebuild',
|
||||
'package',
|
||||
'testpackage',
|
||||
'publish',
|
||||
'unpublish',
|
||||
'info',
|
||||
'testbinary',
|
||||
'reveal',
|
||||
'configure'
|
||||
];
|
||||
const aliases = {};
|
||||
|
||||
// differentiate node-pre-gyp's logs from npm's
|
||||
log.heading = 'node-pre-gyp';
|
||||
|
||||
if (mocking) {
|
||||
log.warn(`mocking s3 to ${process.env.node_pre_gyp_mock_s3}`);
|
||||
}
|
||||
|
||||
// this is a getter to avoid circular reference warnings with node v14.
|
||||
Object.defineProperty(exports, 'find', {
|
||||
get: function() {
|
||||
return require('./pre-binding').find;
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
// in the following, "my_module" is using node-pre-gyp to
|
||||
// prebuild and install pre-built binaries. "main_module"
|
||||
// is using "my_module".
|
||||
//
|
||||
// "bin/node-pre-gyp" invokes Run() without a path. the
|
||||
// expectation is that the working directory is the package
|
||||
// root "my_module". this is true because in all cases npm is
|
||||
// executing a script in the context of "my_module".
|
||||
//
|
||||
// "pre-binding.find()" is executed by "my_module" but in the
|
||||
// context of "main_module". this is because "main_module" is
|
||||
// executing and requires "my_module" which is then executing
|
||||
// "pre-binding.find()" via "node-pre-gyp.find()", so the working
|
||||
// directory is that of "main_module".
|
||||
//
|
||||
// that's why "find()" must pass the path to package.json.
|
||||
//
|
||||
function Run({ package_json_path = './package.json', argv }) {
|
||||
this.package_json_path = package_json_path;
|
||||
this.commands = {};
|
||||
|
||||
const self = this;
|
||||
cli_commands.forEach((command) => {
|
||||
self.commands[command] = function(argvx, callback) {
|
||||
log.verbose('command', command, argvx);
|
||||
return require('./' + command)(self, argvx, callback);
|
||||
};
|
||||
});
|
||||
|
||||
this.parseArgv(argv);
|
||||
|
||||
// this is set to true after the binary.host property was set to
|
||||
// either staging_host or production_host.
|
||||
this.binaryHostSet = false;
|
||||
}
|
||||
inherits(Run, EE);
|
||||
exports.Run = Run;
|
||||
const proto = Run.prototype;
|
||||
|
||||
/**
|
||||
* Export the contents of the package.json.
|
||||
*/
|
||||
|
||||
proto.package = require('../package.json');
|
||||
|
||||
/**
|
||||
* nopt configuration definitions
|
||||
*/
|
||||
|
||||
proto.configDefs = {
|
||||
help: Boolean, // everywhere
|
||||
arch: String, // 'configure'
|
||||
debug: Boolean, // 'build'
|
||||
directory: String, // bin
|
||||
proxy: String, // 'install'
|
||||
loglevel: String // everywhere
|
||||
};
|
||||
|
||||
/**
|
||||
* nopt shorthands
|
||||
*/
|
||||
|
||||
proto.shorthands = {
|
||||
release: '--no-debug',
|
||||
C: '--directory',
|
||||
debug: '--debug',
|
||||
j: '--jobs',
|
||||
silent: '--loglevel=silent',
|
||||
silly: '--loglevel=silly',
|
||||
verbose: '--loglevel=verbose'
|
||||
};
|
||||
|
||||
/**
|
||||
* expose the command aliases for the bin file to use.
|
||||
*/
|
||||
|
||||
proto.aliases = aliases;
|
||||
|
||||
/**
|
||||
* Parses the given argv array and sets the 'opts', 'argv',
|
||||
* 'command', and 'package_json' properties.
|
||||
*/
|
||||
|
||||
proto.parseArgv = function parseOpts(argv) {
|
||||
this.opts = nopt(this.configDefs, this.shorthands, argv);
|
||||
this.argv = this.opts.argv.remain.slice();
|
||||
const commands = this.todo = [];
|
||||
|
||||
// create a copy of the argv array with aliases mapped
|
||||
argv = this.argv.map((arg) => {
|
||||
// is this an alias?
|
||||
if (arg in this.aliases) {
|
||||
arg = this.aliases[arg];
|
||||
}
|
||||
return arg;
|
||||
});
|
||||
|
||||
// process the mapped args into "command" objects ("name" and "args" props)
|
||||
argv.slice().forEach((arg) => {
|
||||
if (arg in this.commands) {
|
||||
const args = argv.splice(0, argv.indexOf(arg));
|
||||
argv.shift();
|
||||
if (commands.length > 0) {
|
||||
commands[commands.length - 1].args = args;
|
||||
}
|
||||
commands.push({ name: arg, args: [] });
|
||||
}
|
||||
});
|
||||
if (commands.length > 0) {
|
||||
commands[commands.length - 1].args = argv.splice(0);
|
||||
}
|
||||
|
||||
|
||||
// if a directory was specified package.json is assumed to be relative
|
||||
// to it.
|
||||
let package_json_path = this.package_json_path;
|
||||
if (this.opts.directory) {
|
||||
package_json_path = path.join(this.opts.directory, package_json_path);
|
||||
}
|
||||
|
||||
this.package_json = JSON.parse(fs.readFileSync(package_json_path));
|
||||
|
||||
// expand commands entries for multiple napi builds
|
||||
this.todo = napi.expand_commands(this.package_json, this.opts, commands);
|
||||
|
||||
// support for inheriting config env variables from npm
|
||||
const npm_config_prefix = 'npm_config_';
|
||||
Object.keys(process.env).forEach((name) => {
|
||||
if (name.indexOf(npm_config_prefix) !== 0) return;
|
||||
const val = process.env[name];
|
||||
if (name === npm_config_prefix + 'loglevel') {
|
||||
log.level = val;
|
||||
} else {
|
||||
// add the user-defined options to the config
|
||||
name = name.substring(npm_config_prefix.length);
|
||||
// avoid npm argv clobber already present args
|
||||
// which avoids problem of 'npm test' calling
|
||||
// script that runs unique npm install commands
|
||||
if (name === 'argv') {
|
||||
if (this.opts.argv &&
|
||||
this.opts.argv.remain &&
|
||||
this.opts.argv.remain.length) {
|
||||
// do nothing
|
||||
} else {
|
||||
this.opts[name] = val;
|
||||
}
|
||||
} else {
|
||||
this.opts[name] = val;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (this.opts.loglevel) {
|
||||
log.level = this.opts.loglevel;
|
||||
}
|
||||
log.resume();
|
||||
};
|
||||
|
||||
/**
|
||||
* allow the binary.host property to be set at execution time.
|
||||
*
|
||||
* for this to take effect requires all the following to be true.
|
||||
* - binary is a property in package.json
|
||||
* - binary.host is falsey
|
||||
* - binary.staging_host is not empty
|
||||
* - binary.production_host is not empty
|
||||
*
|
||||
* if any of the previous checks fail then the function returns an empty string
|
||||
* and makes no changes to package.json's binary property.
|
||||
*
|
||||
*
|
||||
* if command is "publish" then the default is set to "binary.staging_host"
|
||||
* if command is not "publish" the the default is set to "binary.production_host"
|
||||
*
|
||||
* if the command-line option '--s3_host' is set to "staging" or "production" then
|
||||
* "binary.host" is set to the specified "staging_host" or "production_host". if
|
||||
* '--s3_host' is any other value an exception is thrown.
|
||||
*
|
||||
* if '--s3_host' is not present then "binary.host" is set to the default as above.
|
||||
*
|
||||
* this strategy was chosen so that any command other than "publish" or "unpublish" uses "production"
|
||||
* as the default without requiring any command-line options but that "publish" and "unpublish" require
|
||||
* '--s3_host production_host' to be specified in order to *really* publish (or unpublish). publishing
|
||||
* to staging can be done freely without worrying about disturbing any production releases.
|
||||
*/
|
||||
proto.setBinaryHostProperty = function(command) {
|
||||
if (this.binaryHostSet) {
|
||||
return this.package_json.binary.host;
|
||||
}
|
||||
const p = this.package_json;
|
||||
// don't set anything if host is present. it must be left blank to trigger this.
|
||||
if (!p || !p.binary || p.binary.host) {
|
||||
return '';
|
||||
}
|
||||
// and both staging and production must be present. errors will be reported later.
|
||||
if (!p.binary.staging_host || !p.binary.production_host) {
|
||||
return '';
|
||||
}
|
||||
let target = 'production_host';
|
||||
if (command === 'publish' || command === 'unpublish') {
|
||||
target = 'staging_host';
|
||||
}
|
||||
// the environment variable has priority over the default or the command line. if
|
||||
// either the env var or the command line option are invalid throw an error.
|
||||
const npg_s3_host = process.env.node_pre_gyp_s3_host;
|
||||
if (npg_s3_host === 'staging' || npg_s3_host === 'production') {
|
||||
target = `${npg_s3_host}_host`;
|
||||
} else if (this.opts['s3_host'] === 'staging' || this.opts['s3_host'] === 'production') {
|
||||
target = `${this.opts['s3_host']}_host`;
|
||||
} else if (this.opts['s3_host'] || npg_s3_host) {
|
||||
throw new Error(`invalid s3_host ${this.opts['s3_host'] || npg_s3_host}`);
|
||||
}
|
||||
|
||||
p.binary.host = p.binary[target];
|
||||
this.binaryHostSet = true;
|
||||
|
||||
return p.binary.host;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the usage instructions for node-pre-gyp.
|
||||
*/
|
||||
|
||||
proto.usage = function usage() {
|
||||
const str = [
|
||||
'',
|
||||
' Usage: node-pre-gyp <command> [options]',
|
||||
'',
|
||||
' where <command> is one of:',
|
||||
cli_commands.map((c) => {
|
||||
return ' - ' + c + ' - ' + require('./' + c).usage;
|
||||
}).join('\n'),
|
||||
'',
|
||||
'node-pre-gyp@' + this.version + ' ' + path.resolve(__dirname, '..'),
|
||||
'node@' + process.versions.node
|
||||
].join('\n');
|
||||
return str;
|
||||
};
|
||||
|
||||
/**
|
||||
* Version number getter.
|
||||
*/
|
||||
|
||||
Object.defineProperty(proto, 'version', {
|
||||
get: function() {
|
||||
return this.package.version;
|
||||
},
|
||||
enumerable: true
|
||||
});
|
73
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/package.js
generated
vendored
Normal file
73
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/package.js
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = exports = _package;
|
||||
|
||||
exports.usage = 'Packs binary (and enclosing directory) into locally staged tarball';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const log = require('npmlog');
|
||||
const versioning = require('./util/versioning.js');
|
||||
const napi = require('./util/napi.js');
|
||||
const existsAsync = fs.exists || path.exists;
|
||||
const makeDir = require('make-dir');
|
||||
const tar = require('tar');
|
||||
|
||||
function readdirSync(dir) {
|
||||
let list = [];
|
||||
const files = fs.readdirSync(dir);
|
||||
|
||||
files.forEach((file) => {
|
||||
const stats = fs.lstatSync(path.join(dir, file));
|
||||
if (stats.isDirectory()) {
|
||||
list = list.concat(readdirSync(path.join(dir, file)));
|
||||
} else {
|
||||
list.push(path.join(dir, file));
|
||||
}
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
function _package(gyp, argv, callback) {
|
||||
const package_json = gyp.package_json;
|
||||
const napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
const from = opts.module_path;
|
||||
const binary_module = path.join(from, opts.module_name + '.node');
|
||||
existsAsync(binary_module, (found) => {
|
||||
if (!found) {
|
||||
return callback(new Error('Cannot package because ' + binary_module + ' missing: run `node-pre-gyp rebuild` first'));
|
||||
}
|
||||
const tarball = opts.staged_tarball;
|
||||
const filter_func = function(entry) {
|
||||
const basename = path.basename(entry);
|
||||
if (basename.length && basename[0] !== '.') {
|
||||
console.log('packing ' + entry);
|
||||
return true;
|
||||
} else {
|
||||
console.log('skipping ' + entry);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
makeDir(path.dirname(tarball)).then(() => {
|
||||
let files = readdirSync(from);
|
||||
const base = path.basename(from);
|
||||
files = files.map((file) => {
|
||||
return path.join(base, path.relative(from, file));
|
||||
});
|
||||
tar.create({
|
||||
portable: false,
|
||||
gzip: true,
|
||||
filter: filter_func,
|
||||
file: tarball,
|
||||
cwd: path.dirname(from)
|
||||
}, files, (err2) => {
|
||||
if (err2) console.error('[' + package_json.name + '] ' + err2.message);
|
||||
else log.info('package', 'Binary staged at "' + tarball + '"');
|
||||
return callback(err2);
|
||||
});
|
||||
}).catch((err) => {
|
||||
return callback(err);
|
||||
});
|
||||
});
|
||||
}
|
34
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/pre-binding.js
generated
vendored
Normal file
34
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/pre-binding.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
const npg = require('..');
|
||||
const versioning = require('../lib/util/versioning.js');
|
||||
const napi = require('../lib/util/napi.js');
|
||||
const existsSync = require('fs').existsSync || require('path').existsSync;
|
||||
const path = require('path');
|
||||
|
||||
module.exports = exports;
|
||||
|
||||
exports.usage = 'Finds the require path for the node-pre-gyp installed module';
|
||||
|
||||
exports.validate = function(package_json, opts) {
|
||||
versioning.validate_config(package_json, opts);
|
||||
};
|
||||
|
||||
exports.find = function(package_json_path, opts) {
|
||||
if (!existsSync(package_json_path)) {
|
||||
throw new Error(package_json_path + 'does not exist');
|
||||
}
|
||||
const prog = new npg.Run({ package_json_path, argv: process.argv });
|
||||
prog.setBinaryHostProperty();
|
||||
const package_json = prog.package_json;
|
||||
|
||||
versioning.validate_config(package_json, opts);
|
||||
let napi_build_version;
|
||||
if (napi.get_napi_build_versions(package_json, opts)) {
|
||||
napi_build_version = napi.get_best_napi_build_version(package_json, opts);
|
||||
}
|
||||
opts = opts || {};
|
||||
if (!opts.module_root) opts.module_root = path.dirname(package_json_path);
|
||||
const meta = versioning.evaluate(package_json, opts, napi_build_version);
|
||||
return meta.module;
|
||||
};
|
81
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/publish.js
generated
vendored
Normal file
81
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/publish.js
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = exports = publish;
|
||||
|
||||
exports.usage = 'Publishes pre-built binary (requires aws-sdk)';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const log = require('npmlog');
|
||||
const versioning = require('./util/versioning.js');
|
||||
const napi = require('./util/napi.js');
|
||||
const s3_setup = require('./util/s3_setup.js');
|
||||
const existsAsync = fs.exists || path.exists;
|
||||
const url = require('url');
|
||||
|
||||
function publish(gyp, argv, callback) {
|
||||
const package_json = gyp.package_json;
|
||||
const napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
const tarball = opts.staged_tarball;
|
||||
existsAsync(tarball, (found) => {
|
||||
if (!found) {
|
||||
return callback(new Error('Cannot publish because ' + tarball + ' missing: run `node-pre-gyp package` first'));
|
||||
}
|
||||
|
||||
log.info('publish', 'Detecting s3 credentials');
|
||||
const config = {};
|
||||
s3_setup.detect(opts, config);
|
||||
const s3 = s3_setup.get_s3(config);
|
||||
|
||||
const key_name = url.resolve(config.prefix, opts.package_name);
|
||||
const s3_opts = {
|
||||
Bucket: config.bucket,
|
||||
Key: key_name
|
||||
};
|
||||
log.info('publish', 'Authenticating with s3');
|
||||
log.info('publish', config);
|
||||
|
||||
log.info('publish', 'Checking for existing binary at ' + opts.hosted_path);
|
||||
s3.headObject(s3_opts, (err, meta) => {
|
||||
if (meta) log.info('publish', JSON.stringify(meta));
|
||||
if (err && err.code === 'NotFound') {
|
||||
// we are safe to publish because
|
||||
// the object does not already exist
|
||||
log.info('publish', 'Preparing to put object');
|
||||
const s3_put_opts = {
|
||||
ACL: 'public-read',
|
||||
Body: fs.createReadStream(tarball),
|
||||
Key: key_name,
|
||||
Bucket: config.bucket
|
||||
};
|
||||
log.info('publish', 'Putting object', s3_put_opts.ACL, s3_put_opts.Bucket, s3_put_opts.Key);
|
||||
try {
|
||||
s3.putObject(s3_put_opts, (err2, resp) => {
|
||||
log.info('publish', 'returned from putting object');
|
||||
if (err2) {
|
||||
log.info('publish', 's3 putObject error: "' + err2 + '"');
|
||||
return callback(err2);
|
||||
}
|
||||
if (resp) log.info('publish', 's3 putObject response: "' + JSON.stringify(resp) + '"');
|
||||
log.info('publish', 'successfully put object');
|
||||
console.log('[' + package_json.name + '] published to ' + opts.hosted_path);
|
||||
return callback();
|
||||
});
|
||||
} catch (err3) {
|
||||
log.info('publish', 's3 putObject error: "' + err3 + '"');
|
||||
return callback(err3);
|
||||
}
|
||||
} else if (err) {
|
||||
log.info('publish', 's3 headObject error: "' + err + '"');
|
||||
return callback(err);
|
||||
} else {
|
||||
log.error('publish', 'Cannot publish over existing version');
|
||||
log.error('publish', "Update the 'version' field in package.json and try again");
|
||||
log.error('publish', 'If the previous version was published in error see:');
|
||||
log.error('publish', '\t node-pre-gyp unpublish');
|
||||
return callback(new Error('Failed publishing to ' + opts.hosted_path));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
20
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/rebuild.js
generated
vendored
Normal file
20
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/rebuild.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = exports = rebuild;
|
||||
|
||||
exports.usage = 'Runs "clean" and "build" at once';
|
||||
|
||||
const napi = require('./util/napi.js');
|
||||
|
||||
function rebuild(gyp, argv, callback) {
|
||||
const package_json = gyp.package_json;
|
||||
let commands = [
|
||||
{ name: 'clean', args: [] },
|
||||
{ name: 'build', args: ['rebuild'] }
|
||||
];
|
||||
commands = napi.expand_commands(package_json, gyp.opts, commands);
|
||||
for (let i = commands.length; i !== 0; i--) {
|
||||
gyp.todo.unshift(commands[i - 1]);
|
||||
}
|
||||
process.nextTick(callback);
|
||||
}
|
19
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/reinstall.js
generated
vendored
Normal file
19
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/reinstall.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = exports = rebuild;
|
||||
|
||||
exports.usage = 'Runs "clean" and "install" at once';
|
||||
|
||||
const napi = require('./util/napi.js');
|
||||
|
||||
function rebuild(gyp, argv, callback) {
|
||||
const package_json = gyp.package_json;
|
||||
let installArgs = [];
|
||||
const napi_build_version = napi.get_best_napi_build_version(package_json, gyp.opts);
|
||||
if (napi_build_version != null) installArgs = [napi.get_command_arg(napi_build_version)];
|
||||
gyp.todo.unshift(
|
||||
{ name: 'clean', args: [] },
|
||||
{ name: 'install', args: installArgs }
|
||||
);
|
||||
process.nextTick(callback);
|
||||
}
|
32
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/reveal.js
generated
vendored
Normal file
32
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/reveal.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = exports = reveal;
|
||||
|
||||
exports.usage = 'Reveals data on the versioned binary';
|
||||
|
||||
const versioning = require('./util/versioning.js');
|
||||
const napi = require('./util/napi.js');
|
||||
|
||||
function unix_paths(key, val) {
|
||||
return val && val.replace ? val.replace(/\\/g, '/') : val;
|
||||
}
|
||||
|
||||
function reveal(gyp, argv, callback) {
|
||||
const package_json = gyp.package_json;
|
||||
const napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
let hit = false;
|
||||
// if a second arg is passed look to see
|
||||
// if it is a known option
|
||||
// console.log(JSON.stringify(gyp.opts,null,1))
|
||||
const remain = gyp.opts.argv.remain[gyp.opts.argv.remain.length - 1];
|
||||
if (remain && Object.hasOwnProperty.call(opts, remain)) {
|
||||
console.log(opts[remain].replace(/\\/g, '/'));
|
||||
hit = true;
|
||||
}
|
||||
// otherwise return all options as json
|
||||
if (!hit) {
|
||||
console.log(JSON.stringify(opts, unix_paths, 2));
|
||||
}
|
||||
return callback();
|
||||
}
|
79
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/testbinary.js
generated
vendored
Normal file
79
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/testbinary.js
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = exports = testbinary;
|
||||
|
||||
exports.usage = 'Tests that the binary.node can be required';
|
||||
|
||||
const path = require('path');
|
||||
const log = require('npmlog');
|
||||
const cp = require('child_process');
|
||||
const versioning = require('./util/versioning.js');
|
||||
const napi = require('./util/napi.js');
|
||||
|
||||
function testbinary(gyp, argv, callback) {
|
||||
const args = [];
|
||||
const options = {};
|
||||
let shell_cmd = process.execPath;
|
||||
const package_json = gyp.package_json;
|
||||
const napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
// skip validation for runtimes we don't explicitly support (like electron)
|
||||
if (opts.runtime &&
|
||||
opts.runtime !== 'node-webkit' &&
|
||||
opts.runtime !== 'node') {
|
||||
return callback();
|
||||
}
|
||||
const nw = (opts.runtime && opts.runtime === 'node-webkit');
|
||||
// ensure on windows that / are used for require path
|
||||
const binary_module = opts.module.replace(/\\/g, '/');
|
||||
if ((process.arch !== opts.target_arch) ||
|
||||
(process.platform !== opts.target_platform)) {
|
||||
let msg = 'skipping validation since host platform/arch (';
|
||||
msg += process.platform + '/' + process.arch + ')';
|
||||
msg += ' does not match target (';
|
||||
msg += opts.target_platform + '/' + opts.target_arch + ')';
|
||||
log.info('validate', msg);
|
||||
return callback();
|
||||
}
|
||||
if (nw) {
|
||||
options.timeout = 5000;
|
||||
if (process.platform === 'darwin') {
|
||||
shell_cmd = 'node-webkit';
|
||||
} else if (process.platform === 'win32') {
|
||||
shell_cmd = 'nw.exe';
|
||||
} else {
|
||||
shell_cmd = 'nw';
|
||||
}
|
||||
const modulePath = path.resolve(binary_module);
|
||||
const appDir = path.join(__dirname, 'util', 'nw-pre-gyp');
|
||||
args.push(appDir);
|
||||
args.push(modulePath);
|
||||
log.info('validate', "Running test command: '" + shell_cmd + ' ' + args.join(' ') + "'");
|
||||
cp.execFile(shell_cmd, args, options, (err, stdout, stderr) => {
|
||||
// check for normal timeout for node-webkit
|
||||
if (err) {
|
||||
if (err.killed === true && err.signal && err.signal.indexOf('SIG') > -1) {
|
||||
return callback();
|
||||
}
|
||||
const stderrLog = stderr.toString();
|
||||
log.info('stderr', stderrLog);
|
||||
if (/^\s*Xlib:\s*extension\s*"RANDR"\s*missing\s*on\s*display\s*":\d+\.\d+"\.\s*$/.test(stderrLog)) {
|
||||
log.info('RANDR', 'stderr contains only RANDR error, ignored');
|
||||
return callback();
|
||||
}
|
||||
return callback(err);
|
||||
}
|
||||
return callback();
|
||||
});
|
||||
return;
|
||||
}
|
||||
args.push('--eval');
|
||||
args.push("require('" + binary_module.replace(/'/g, '\'') + "')");
|
||||
log.info('validate', "Running test command: '" + shell_cmd + ' ' + args.join(' ') + "'");
|
||||
cp.execFile(shell_cmd, args, options, (err, stdout, stderr) => {
|
||||
if (err) {
|
||||
return callback(err, { stdout: stdout, stderr: stderr });
|
||||
}
|
||||
return callback();
|
||||
});
|
||||
}
|
53
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/testpackage.js
generated
vendored
Normal file
53
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/testpackage.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = exports = testpackage;
|
||||
|
||||
exports.usage = 'Tests that the staged package is valid';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const log = require('npmlog');
|
||||
const existsAsync = fs.exists || path.exists;
|
||||
const versioning = require('./util/versioning.js');
|
||||
const napi = require('./util/napi.js');
|
||||
const testbinary = require('./testbinary.js');
|
||||
const tar = require('tar');
|
||||
const makeDir = require('make-dir');
|
||||
|
||||
function testpackage(gyp, argv, callback) {
|
||||
const package_json = gyp.package_json;
|
||||
const napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
const tarball = opts.staged_tarball;
|
||||
existsAsync(tarball, (found) => {
|
||||
if (!found) {
|
||||
return callback(new Error('Cannot test package because ' + tarball + ' missing: run `node-pre-gyp package` first'));
|
||||
}
|
||||
const to = opts.module_path;
|
||||
function filter_func(entry) {
|
||||
log.info('install', 'unpacking [' + entry.path + ']');
|
||||
}
|
||||
|
||||
makeDir(to).then(() => {
|
||||
tar.extract({
|
||||
file: tarball,
|
||||
cwd: to,
|
||||
strip: 1,
|
||||
onentry: filter_func
|
||||
}).then(after_extract, callback);
|
||||
}).catch((err) => {
|
||||
return callback(err);
|
||||
});
|
||||
|
||||
function after_extract() {
|
||||
testbinary(gyp, argv, (err) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
} else {
|
||||
console.log('[' + package_json.name + '] Package appears valid');
|
||||
return callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
41
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/unpublish.js
generated
vendored
Normal file
41
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/unpublish.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = exports = unpublish;
|
||||
|
||||
exports.usage = 'Unpublishes pre-built binary (requires aws-sdk)';
|
||||
|
||||
const log = require('npmlog');
|
||||
const versioning = require('./util/versioning.js');
|
||||
const napi = require('./util/napi.js');
|
||||
const s3_setup = require('./util/s3_setup.js');
|
||||
const url = require('url');
|
||||
|
||||
function unpublish(gyp, argv, callback) {
|
||||
const package_json = gyp.package_json;
|
||||
const napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
const config = {};
|
||||
s3_setup.detect(opts, config);
|
||||
const s3 = s3_setup.get_s3(config);
|
||||
const key_name = url.resolve(config.prefix, opts.package_name);
|
||||
const s3_opts = {
|
||||
Bucket: config.bucket,
|
||||
Key: key_name
|
||||
};
|
||||
s3.headObject(s3_opts, (err, meta) => {
|
||||
if (err && err.code === 'NotFound') {
|
||||
console.log('[' + package_json.name + '] Not found: https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key);
|
||||
return callback();
|
||||
} else if (err) {
|
||||
return callback(err);
|
||||
} else {
|
||||
log.info('unpublish', JSON.stringify(meta));
|
||||
s3.deleteObject(s3_opts, (err2, resp) => {
|
||||
if (err2) return callback(err2);
|
||||
log.info(JSON.stringify(resp));
|
||||
console.log('[' + package_json.name + '] Success: removed https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key);
|
||||
return callback();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
2602
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/util/abi_crosswalk.json
generated
vendored
Normal file
2602
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/util/abi_crosswalk.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
93
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js
generated
vendored
Normal file
93
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = exports;
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const win = process.platform === 'win32';
|
||||
const existsSync = fs.existsSync || path.existsSync;
|
||||
const cp = require('child_process');
|
||||
|
||||
// try to build up the complete path to node-gyp
|
||||
/* priority:
|
||||
- node-gyp on ENV:npm_config_node_gyp (https://github.com/npm/npm/pull/4887)
|
||||
- node-gyp on NODE_PATH
|
||||
- node-gyp inside npm on NODE_PATH (ignore on iojs)
|
||||
- node-gyp inside npm beside node exe
|
||||
*/
|
||||
function which_node_gyp() {
|
||||
let node_gyp_bin;
|
||||
if (process.env.npm_config_node_gyp) {
|
||||
try {
|
||||
node_gyp_bin = process.env.npm_config_node_gyp;
|
||||
if (existsSync(node_gyp_bin)) {
|
||||
return node_gyp_bin;
|
||||
}
|
||||
} catch (err) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
try {
|
||||
const node_gyp_main = require.resolve('node-gyp'); // eslint-disable-line node/no-missing-require
|
||||
node_gyp_bin = path.join(path.dirname(
|
||||
path.dirname(node_gyp_main)),
|
||||
'bin/node-gyp.js');
|
||||
if (existsSync(node_gyp_bin)) {
|
||||
return node_gyp_bin;
|
||||
}
|
||||
} catch (err) {
|
||||
// do nothing
|
||||
}
|
||||
if (process.execPath.indexOf('iojs') === -1) {
|
||||
try {
|
||||
const npm_main = require.resolve('npm'); // eslint-disable-line node/no-missing-require
|
||||
node_gyp_bin = path.join(path.dirname(
|
||||
path.dirname(npm_main)),
|
||||
'node_modules/node-gyp/bin/node-gyp.js');
|
||||
if (existsSync(node_gyp_bin)) {
|
||||
return node_gyp_bin;
|
||||
}
|
||||
} catch (err) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
const npm_base = path.join(path.dirname(
|
||||
path.dirname(process.execPath)),
|
||||
'lib/node_modules/npm/');
|
||||
node_gyp_bin = path.join(npm_base, 'node_modules/node-gyp/bin/node-gyp.js');
|
||||
if (existsSync(node_gyp_bin)) {
|
||||
return node_gyp_bin;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.run_gyp = function(args, opts, callback) {
|
||||
let shell_cmd = '';
|
||||
const cmd_args = [];
|
||||
if (opts.runtime && opts.runtime === 'node-webkit') {
|
||||
shell_cmd = 'nw-gyp';
|
||||
if (win) shell_cmd += '.cmd';
|
||||
} else {
|
||||
const node_gyp_path = which_node_gyp();
|
||||
if (node_gyp_path) {
|
||||
shell_cmd = process.execPath;
|
||||
cmd_args.push(node_gyp_path);
|
||||
} else {
|
||||
shell_cmd = 'node-gyp';
|
||||
if (win) shell_cmd += '.cmd';
|
||||
}
|
||||
}
|
||||
const final_args = cmd_args.concat(args);
|
||||
const cmd = cp.spawn(shell_cmd, final_args, { cwd: undefined, env: process.env, stdio: [0, 1, 2] });
|
||||
cmd.on('error', (err) => {
|
||||
if (err) {
|
||||
return callback(new Error("Failed to execute '" + shell_cmd + ' ' + final_args.join(' ') + "' (" + err + ')'));
|
||||
}
|
||||
callback(null, opts);
|
||||
});
|
||||
cmd.on('close', (code) => {
|
||||
if (code && code !== 0) {
|
||||
return callback(new Error("Failed to execute '" + shell_cmd + ' ' + final_args.join(' ') + "' (" + code + ')'));
|
||||
}
|
||||
callback(null, opts);
|
||||
});
|
||||
};
|
102
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/util/handle_gyp_opts.js
generated
vendored
Normal file
102
ccc-tnt-psd2ui-v2.4.x/node_modules/@mapbox/node-pre-gyp/lib/util/handle_gyp_opts.js
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = exports = handle_gyp_opts;
|
||||
|
||||
const versioning = require('./versioning.js');
|
||||
const napi = require('./napi.js');
|
||||
|
||||
/*
|
||||
|
||||
Here we gather node-pre-gyp generated options (from versioning) and pass them along to node-gyp.
|
||||
|
||||
We massage the args and options slightly to account for differences in what commands mean between
|
||||
node-pre-gyp and node-gyp (e.g. see the difference between "build" and "rebuild" below)
|
||||
|
||||
Keep in mind: the values inside `argv` and `gyp.opts` below are different depending on whether
|
||||
node-pre-gyp is called directory, or if it is called in a `run-script` phase of npm.
|
||||
|
||||
We also try to preserve any command line options that might have been passed to npm or node-pre-gyp.
|
||||
But this is fairly difficult without passing way to much through. For example `gyp.opts` contains all
|
||||
the process.env and npm pushes a lot of variables into process.env which node-pre-gyp inherits. So we have
|
||||
to be very selective about what we pass through.
|
||||
|
||||
For example:
|
||||
|
||||
`npm install --build-from-source` will give:
|
||||
|
||||
argv == [ 'rebuild' ]
|
||||
gyp.opts.argv == { remain: [ 'install' ],
|
||||
cooked: [ 'install', '--fallback-to-build' ],
|
||||
original: [ 'install', '--fallback-to-build' ] }
|
||||
|
||||
`./bin/node-pre-gyp build` will give:
|
||||
|
||||
argv == []
|
||||
gyp.opts.argv == { remain: [ 'build' ],
|
||||
cooked: [ 'build' ],
|
||||
original: [ '-C', 'test/app1', 'build' ] }
|
||||
|
||||
*/
|
||||
|
||||
// select set of node-pre-gyp versioning info
|
||||
// to share with node-gyp
|
||||
const share_with_node_gyp = [
|
||||
'module',
|
||||
'module_name',
|
||||
'module_path',
|
||||
'napi_version',
|
||||
'node_abi_napi',
|
||||
'napi_build_version',
|
||||
'node_napi_label'
|
||||
];
|
||||
|
||||
function handle_gyp_opts(gyp, argv, callback) {
|
||||
|
||||
// Collect node-pre-gyp specific variables to pass to node-gyp
|
||||
const node_pre_gyp_options = [];
|
||||
// generate custom node-pre-gyp versioning info
|
||||
const napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
const opts = versioning.evaluate(gyp.package_json, gyp.opts, napi_build_version);
|
||||
share_with_node_gyp.forEach((key) => {
|
||||
const val = opts[key];
|
||||
if (val) {
|
||||
node_pre_gyp_options.push('--' + key + '=' + val);
|
||||
} else if (key === 'napi_build_version') {
|
||||
node_pre_gyp_options.push('--' + key + '=0');
|
||||
} else {
|
||||
if (key !== 'napi_version' && key !== 'node_abi_napi')
|
||||
return callback(new Error('Option ' + key + ' required but not found by node-pre-gyp'));
|
||||
}
|
||||
});
|
||||
|
||||
// Collect options that follow the special -- which disables nopt parsing
|
||||
const unparsed_options = [];
|
||||
let double_hyphen_found = false;
|
||||
gyp.opts.argv.original.forEach((opt) => {
|
||||
if (double_hyphen_found) {
|
||||
unparsed_options.push(opt);
|
||||
}
|
||||
if (opt === '--') {
|
||||
double_hyphen_found = true;
|
||||
}
|
||||
});
|
||||
|
||||
// We try respect and pass through remaining command
|
||||
// line options (like --foo=bar) to node-gyp
|
||||
const cooked = gyp.opts.argv.cooked;
|
||||
const node_gyp_options = [];
|
||||
cooked.forEach((value) => {
|
||||
if (value.length > 2 && value.slice(0, 2) === '--') {
|
||||
const key = value.slice(2);
|
||||
const val = cooked[cooked.indexOf(value) + 1];
|
||||
if (val && val.indexOf('--') === -1) { // handle '--foo=bar' or ['--foo','bar']
|
||||
node_gyp_options.push('--' + key + '=' + val);
|
||||
} else { // pass through --foo
|
||||
node_gyp_options.push(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const result = { 'opts': opts, 'gyp': node_gyp_options, 'pre': node_pre_gyp_options, 'unparsed': unparsed_options };
|
||||
return callback(null, result);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user