@needle-tools/needle-component-compiler 1.11.2 → 1.12.0

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.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@needle-tools/needle-component-compiler",
3
- "version": "1.11.2",
3
+ "version": "1.12.0",
4
4
  "description": "Compile mock unity components from typescript",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "tsc": "tsc",
8
8
  "dev": "npm-watch compile",
9
9
  "compile" : "tsc",
10
- "test": "mocha -r ts-node/register test/**.test.ts"
10
+ "test": "mocha -r ts-node/register test/**/*serializable.test.ts"
11
11
  },
12
12
  "dependencies": {
13
13
  "typescript": "^4.5.5"
@@ -38,5 +38,9 @@
38
38
  "repository": {
39
39
  "type": "git",
40
40
  "url": "git+https://github.com/needle-tools/needle-tiny-component-compiler.git"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public",
44
+ "registry": "https://registry.npmjs.org/"
41
45
  }
42
46
  }
@@ -443,6 +443,10 @@ function run(program, outputDir, sourceFile) {
443
443
  }
444
444
  }
445
445
  modifiers += " partial";
446
+ // If it's a custom class and decorated with @type object then we want to make it serializable
447
+ if (typeName_1 === "object") {
448
+ newContext.appendLine("[System.Serializable]");
449
+ }
446
450
  newContext.appendLine("public " + modifiers.trim() + " class " + name_2 + " : " + typeName_1);
447
451
  newContext.appendLine("{");
448
452
  newContext.indentLevel += 1;
@@ -473,6 +473,10 @@ export function run(program: ts.Program, outputDir: string | null, sourceFile: t
473
473
  }
474
474
  }
475
475
  modifiers += " partial";
476
+ // If it's a custom class and decorated with @type object then we want to make it serializable
477
+ if(typeName === "object") {
478
+ newContext.appendLine("[System.Serializable]")
479
+ }
476
480
  newContext.appendLine("public " + modifiers.trim() + " class " + name + " : " + typeName);
477
481
  newContext.appendLine("{");
478
482
  newContext.indentLevel += 1;