export-table-pulgin-csharp 1.1.89 → 1.1.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"ExportCSPlugin.d.ts","sourceRoot":"","sources":["../src/ExportCSPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAAE,KAAK,EAAwB,UAAU,EAA0B,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGrI,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,GAAG,CAMpE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,GAAG,CA0CjE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM,CA0D5E;AAID,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAmSpE;AAED,qBAAa,YAAa,SAAQ,UAAU;IAC3C,IAAI,SAAW;IACf,IAAI,EAAE,MAAM,EAAE,CAAS;IAEvB,WAAW,CAAC,KAAK,EAAE,iBAAiB;CAOpC"}
1
+ {"version":3,"file":"ExportCSPlugin.d.ts","sourceRoot":"","sources":["../src/ExportCSPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAAE,KAAK,EAAwB,UAAU,EAA0B,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGrI,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,GAAG,CAWpE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,GAAG,CA0CjE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM,CA0D5E;AAID,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAmSpE;AAED,qBAAa,YAAa,SAAQ,UAAU;IAC3C,IAAI,SAAW;IACf,IAAI,EAAE,MAAM,EAAE,CAAS;IAEvB,WAAW,CAAC,KAAK,EAAE,iBAAiB;CAOpC"}
@@ -31,7 +31,13 @@ function TryConvValue(value, t, f) {
31
31
  return ConvValue(value, t, f);
32
32
  }
33
33
  catch (ex) {
34
- return null;
34
+ if (ex instanceof TypeError) {
35
+ console.error(ex);
36
+ return null;
37
+ }
38
+ else {
39
+ return null;
40
+ }
35
41
  }
36
42
  }
37
43
  exports.TryConvValue = TryConvValue;
@@ -86,12 +92,12 @@ function ConvValue(value, t, f) {
86
92
  }
87
93
  else if (t == "any") {
88
94
  console.log(f);
89
- throw new Error(`invalid type ${f.name}:<${f.rawType} => any>`);
95
+ throw new TypeError(`invalid type ${f.name}:<${f.rawType} => any>`);
90
96
  }
91
97
  else if (t == "key") {
92
98
  return JSON.parse(t);
93
99
  }
94
- throw new Error(`invalid type ${f.name}:<${f.rawType} => unkown>`);
100
+ throw new TypeError(`invalid unkown type ${f.name}:<${f.rawType} => ${t}>`);
95
101
  }
96
102
  exports.ConvValue = ConvValue;
97
103
  function ConvValue2Literal(value, t, f) {
@@ -1 +1 @@
1
- {"version":3,"file":"ExportUnityCSJsonPlugin.d.ts","sourceRoot":"","sources":["../src/ExportUnityCSJsonPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAE,iBAAiB,EAAqC,MAAM,kBAAkB,CAAA;AAOxJ,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA0FnE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAuFzE;AAED,qBAAa,iBAAkB,SAAQ,UAAU;IAChD,IAAI,SAAU;IACd,IAAI,EAAE,MAAM,EAAE,CAAY;IAE1B,WAAW,CAAC,KAAK,EAAE,iBAAiB;IAmBpC,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;CAmC3C"}
1
+ {"version":3,"file":"ExportUnityCSJsonPlugin.d.ts","sourceRoot":"","sources":["../src/ExportUnityCSJsonPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAE,iBAAiB,EAAqC,MAAM,kBAAkB,CAAA;AAOxJ,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA6FnE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAuFzE;AAED,qBAAa,iBAAkB,SAAQ,UAAU;IAChD,IAAI,SAAU;IACd,IAAI,EAAE,MAAM,EAAE,CAAY;IAE1B,WAAW,CAAC,KAAK,EAAE,iBAAiB;IAmBpC,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;CAmC3C"}
@@ -55,6 +55,7 @@ function exportUJson(paras) {
55
55
  index2 = content.indexOf("|", index);
56
56
  let numStr = content.substring(index, index2);
57
57
  let t1 = m[1];
58
+ let v1 = (0, ExportCSPlugin_1.TryConvValue)(numStr, t1, f);
58
59
  index = content.indexOf(";;", index2);
59
60
  let posEnd = index;
60
61
  if (index == -1) {
@@ -65,10 +66,12 @@ function exportUJson(paras) {
65
66
  }
66
67
  let ssStr = content.substring(index2 + 1, posEnd);
67
68
  let t2 = m[2];
68
- console.log(`parseinfo: ${index2}, ${index}, ${numStr}, ${ssStr}, ${t1}, ${t2}`);
69
+ let v2 = (0, ExportCSPlugin_1.TryConvValue)(ssStr, t2, f);
70
+ console.log(`parseinfo1: ${content}, ${index2}, ${index}, ${numStr}, ${t1}, ${v1}`);
71
+ console.log(`parseinfo2: ${content}, ${index2}, ${index}, ${ssStr}, ${t2}, ${v2}`);
69
72
  objs.push({
70
- Item1: (0, ExportCSPlugin_1.TryConvValue)(numStr, t1, f),
71
- Item2: (0, ExportCSPlugin_1.TryConvValue)(ssStr, t2, f),
73
+ Item1: v1,
74
+ Item2: v2,
72
75
  });
73
76
  }
74
77
  let isArray = m[3] == "[]";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "export-table-pulgin-csharp",
3
- "version": "1.1.89",
3
+ "version": "1.1.91",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -13,7 +13,7 @@
13
13
  "license": "ISC",
14
14
  "dependencies": {
15
15
  "@types/node": "^17.0.18",
16
- "export-table-lib": "^1.0.58",
16
+ "export-table-lib": "^1.0.59",
17
17
  "fs": "^0.0.1-security",
18
18
  "fs-extra": "^10.0.0",
19
19
  "fse": "^4.0.1"
@@ -6,7 +6,12 @@ export function TryConvValue(value: any, t: FieldType, f: Field): any {
6
6
  try {
7
7
  return ConvValue(value, t, f)
8
8
  } catch (ex) {
9
- return null
9
+ if (ex instanceof TypeError) {
10
+ console.error(ex)
11
+ return null
12
+ } else {
13
+ return null
14
+ }
10
15
  }
11
16
  }
12
17
 
@@ -46,12 +51,12 @@ export function ConvValue(value: any, t: FieldType, f: Field): any {
46
51
  return value
47
52
  } else if (t == "any") {
48
53
  console.log(f)
49
- throw new Error(`invalid type ${f.name}:<${f.rawType} => any>`)
54
+ throw new TypeError(`invalid type ${f.name}:<${f.rawType} => any>`)
50
55
  } else if (t == "key") {
51
56
  return JSON.parse(t)
52
57
  }
53
58
 
54
- throw new Error(`invalid type ${f.name}:<${f.rawType} => unkown>`)
59
+ throw new TypeError(`invalid unkown type ${f.name}:<${f.rawType} => ${t}>`)
55
60
  }
56
61
 
57
62
  export function ConvValue2Literal(value: any, t: FieldType, f: Field): string {
@@ -41,6 +41,7 @@ export function exportUJson(paras: HandleSheetParams): string | null {
41
41
  index2 = content.indexOf("|", index)
42
42
  let numStr = content.substring(index, index2)
43
43
  let t1 = m[1]
44
+ let v1 = TryConvValue(numStr, t1 as any, f);
44
45
  index = content.indexOf(";;", index2)
45
46
  let posEnd = index
46
47
  if (index == -1) {
@@ -50,10 +51,12 @@ export function exportUJson(paras: HandleSheetParams): string | null {
50
51
  }
51
52
  let ssStr = content.substring(index2 + 1, posEnd)
52
53
  let t2 = m[2]
53
- console.log(`parseinfo: ${index2}, ${index}, ${numStr}, ${ssStr}, ${t1}, ${t2}`)
54
+ let v2 = TryConvValue(ssStr, t2 as any, f);
55
+ console.log(`parseinfo1: ${content}, ${index2}, ${index}, ${numStr}, ${t1}, ${v1}`)
56
+ console.log(`parseinfo2: ${content}, ${index2}, ${index}, ${ssStr}, ${t2}, ${v2}`)
54
57
  objs.push({
55
- Item1: TryConvValue(numStr, t1 as any, f),
56
- Item2: TryConvValue(ssStr, t2 as any, f),
58
+ Item1: v1,
59
+ Item2: v2,
57
60
  })
58
61
  }
59
62