@needle-tools/needle-component-compiler 3.0.0-alpha → 3.0.0-alpha.1.999f08a

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,20 +1,20 @@
1
- import { IWriter, Visibility } from "../base-compiler";
2
- import { TypeSourceInformation } from "../register-types";
3
- export declare class ReactThreeFiberCompiler implements IWriter {
4
- get outputInfo(): TypeSourceInformation;
5
- private readonly _typeSourceInformation;
6
- constructor();
7
- resolveCSharpTypeName(typescriptTypeName: string): string | void;
8
- begin(filePath: string): void;
9
- end(filePath: string): void;
10
- startNewType(filePath: string, typeName: string, baseType: string[], comments?: string[]): boolean | void;
11
- endNewType(filePath: string, typeName: string): void;
12
- writeMember(visibility: Visibility, name: string, isArray: boolean, type: string, initialValue?: string, comments?: string[]): void;
13
- writeMethod(visibility: Visibility, name: string, returnType: string, args: {
14
- name: string;
15
- type: string;
16
- defaultValue?: string;
17
- }[], comments: string[]): void;
18
- writeNewTypeExpression(typeName: string, args?: string[]): void;
19
- registerEnum(name: string, members: import("../base-compiler").EnumMember[]): void;
20
- }
1
+ import { IWriter, Visibility } from "../base-compiler";
2
+ import { TypeSourceInformation } from "../register-types";
3
+ export declare class ReactThreeFiberCompiler implements IWriter {
4
+ get outputInfo(): TypeSourceInformation;
5
+ private readonly _typeSourceInformation;
6
+ constructor();
7
+ resolveCSharpTypeName(typescriptTypeName: string): string | void;
8
+ begin(filePath: string): void;
9
+ end(filePath: string): void;
10
+ startNewType(filePath: string, typeName: string, baseType: string[], comments?: string[]): boolean | void;
11
+ endNewType(filePath: string, typeName: string): void;
12
+ writeMember(visibility: Visibility, name: string, isArray: boolean, type: string, initialValue?: string, comments?: string[]): void;
13
+ writeMethod(visibility: Visibility, name: string, returnType: string, args: {
14
+ name: string;
15
+ type: string;
16
+ defaultValue?: string;
17
+ }[], comments: string[]): void;
18
+ writeNewTypeExpression(typeName: string, args?: string[]): void;
19
+ registerEnum(name: string, members: import("../base-compiler").EnumMember[]): void;
20
+ }
@@ -1,36 +1,36 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReactThreeFiberCompiler = void 0;
4
- var ReactThreeFiberCompiler = /** @class */ (function () {
5
- function ReactThreeFiberCompiler() {
6
- this._typeSourceInformation = {};
7
- }
8
- Object.defineProperty(ReactThreeFiberCompiler.prototype, "outputInfo", {
9
- get: function () {
10
- return this._typeSourceInformation;
11
- },
12
- enumerable: false,
13
- configurable: true
14
- });
15
- ReactThreeFiberCompiler.prototype.resolveCSharpTypeName = function (typescriptTypeName) {
16
- return typescriptTypeName;
17
- };
18
- ReactThreeFiberCompiler.prototype.begin = function (filePath) {
19
- };
20
- ReactThreeFiberCompiler.prototype.end = function (filePath) {
21
- };
22
- ReactThreeFiberCompiler.prototype.startNewType = function (filePath, typeName, baseType, comments) {
23
- };
24
- ReactThreeFiberCompiler.prototype.endNewType = function (filePath, typeName) {
25
- };
26
- ReactThreeFiberCompiler.prototype.writeMember = function (visibility, name, isArray, type, initialValue, comments) {
27
- };
28
- ReactThreeFiberCompiler.prototype.writeMethod = function (visibility, name, returnType, args, comments) {
29
- };
30
- ReactThreeFiberCompiler.prototype.writeNewTypeExpression = function (typeName, args) {
31
- };
32
- ReactThreeFiberCompiler.prototype.registerEnum = function (name, members) {
33
- };
34
- return ReactThreeFiberCompiler;
35
- }());
36
- exports.ReactThreeFiberCompiler = ReactThreeFiberCompiler;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReactThreeFiberCompiler = void 0;
4
+ var ReactThreeFiberCompiler = /** @class */ (function () {
5
+ function ReactThreeFiberCompiler() {
6
+ this._typeSourceInformation = {};
7
+ }
8
+ Object.defineProperty(ReactThreeFiberCompiler.prototype, "outputInfo", {
9
+ get: function () {
10
+ return this._typeSourceInformation;
11
+ },
12
+ enumerable: false,
13
+ configurable: true
14
+ });
15
+ ReactThreeFiberCompiler.prototype.resolveCSharpTypeName = function (typescriptTypeName) {
16
+ return typescriptTypeName;
17
+ };
18
+ ReactThreeFiberCompiler.prototype.begin = function (filePath) {
19
+ };
20
+ ReactThreeFiberCompiler.prototype.end = function (filePath) {
21
+ };
22
+ ReactThreeFiberCompiler.prototype.startNewType = function (filePath, typeName, baseType, comments) {
23
+ };
24
+ ReactThreeFiberCompiler.prototype.endNewType = function (filePath, typeName) {
25
+ };
26
+ ReactThreeFiberCompiler.prototype.writeMember = function (visibility, name, isArray, type, initialValue, comments) {
27
+ };
28
+ ReactThreeFiberCompiler.prototype.writeMethod = function (visibility, name, returnType, args, comments) {
29
+ };
30
+ ReactThreeFiberCompiler.prototype.writeNewTypeExpression = function (typeName, args) {
31
+ };
32
+ ReactThreeFiberCompiler.prototype.registerEnum = function (name, members) {
33
+ };
34
+ return ReactThreeFiberCompiler;
35
+ }());
36
+ exports.ReactThreeFiberCompiler = ReactThreeFiberCompiler;
@@ -1,8 +1,8 @@
1
- /**@key is the typescript source file */
2
- export declare type TypeSourceInformation = {
3
- [key: string]: {
4
- componentName: string;
5
- filePath: string;
6
- }[];
7
- };
8
- export declare function writeTypeRegistry(types: TypeSourceInformation, registerTypesPath: string): void;
1
+ /**@key is the typescript source file */
2
+ export declare type TypeSourceInformation = {
3
+ [key: string]: {
4
+ componentName: string;
5
+ filePath: string;
6
+ }[];
7
+ };
8
+ export declare function writeTypeRegistry(types: TypeSourceInformation, registerTypesPath: string): void;
@@ -1,34 +1,34 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.writeTypeRegistry = void 0;
4
- var fs_1 = require("fs");
5
- var path = require("path");
6
- var base_compiler_1 = require("./base-compiler");
7
- function writeTypeRegistry(types, registerTypesPath) {
8
- console.log("Writing type registry to", registerTypesPath);
9
- var directory = path.dirname(registerTypesPath);
10
- if (!(0, fs_1.existsSync)(directory)) {
11
- (0, fs_1.mkdirSync)(directory);
12
- }
13
- var file = (0, fs_1.createWriteStream)(registerTypesPath);
14
- var writer = new base_compiler_1.CodeTextWriter();
15
- writer.writeLine("// This is an auto-generated file. Do not edit!\n");
16
- writer.writeLine("import { TypeStore } from \"@needle-tools/engine\";\n");
17
- for (var sourceFile in types) {
18
- if (!(0, fs_1.existsSync)(sourceFile))
19
- continue;
20
- var generatedFile = types[sourceFile];
21
- var relativePath = path.relative(directory, sourceFile).replace(/\\/g, "/");
22
- for (var _i = 0, generatedFile_1 = generatedFile; _i < generatedFile_1.length; _i++) {
23
- var fileInfo = generatedFile_1[_i];
24
- writer.writeLine("import { ".concat(fileInfo.componentName, " } from \"").concat(relativePath, "\";"));
25
- writer.writeLine("TypeStore.add(\"".concat(fileInfo.componentName, "\", ").concat(fileInfo.componentName, ");"));
26
- }
27
- }
28
- writer.writeLine("\n// Made with 🌵 Needle");
29
- writer.writeLine("// https://needle.tools");
30
- var code = writer.toString();
31
- file.write(code);
32
- file.end();
33
- }
34
- exports.writeTypeRegistry = writeTypeRegistry;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.writeTypeRegistry = void 0;
4
+ var fs_1 = require("fs");
5
+ var path = require("path");
6
+ var base_compiler_1 = require("./base-compiler");
7
+ function writeTypeRegistry(types, registerTypesPath) {
8
+ console.log("Writing type registry to", registerTypesPath);
9
+ var directory = path.dirname(registerTypesPath);
10
+ if (!(0, fs_1.existsSync)(directory)) {
11
+ (0, fs_1.mkdirSync)(directory);
12
+ }
13
+ var file = (0, fs_1.createWriteStream)(registerTypesPath);
14
+ var writer = new base_compiler_1.CodeTextWriter();
15
+ writer.writeLine("// This is an auto-generated file. Do not edit!\n");
16
+ writer.writeLine("import { TypeStore } from \"@needle-tools/engine\";\n");
17
+ for (var sourceFile in types) {
18
+ if (!(0, fs_1.existsSync)(sourceFile))
19
+ continue;
20
+ var generatedFile = types[sourceFile];
21
+ var relativePath = path.relative(directory, sourceFile).replace(/\\/g, "/");
22
+ for (var _i = 0, generatedFile_1 = generatedFile; _i < generatedFile_1.length; _i++) {
23
+ var fileInfo = generatedFile_1[_i];
24
+ writer.writeLine("import { ".concat(fileInfo.componentName, " } from \"").concat(relativePath, "\";"));
25
+ writer.writeLine("TypeStore.add(\"".concat(fileInfo.componentName, "\", ").concat(fileInfo.componentName, ");"));
26
+ }
27
+ }
28
+ writer.writeLine("\n// Made with 🌵 Needle");
29
+ writer.writeLine("// https://needle.tools");
30
+ var code = writer.toString();
31
+ file.write(code);
32
+ file.end();
33
+ }
34
+ exports.writeTypeRegistry = writeTypeRegistry;
package/dist/watcher.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { IWriter } from "./base-compiler";
2
- export declare class DirectoryWatcher {
3
- private readonly compiler;
4
- private _typesChanged;
5
- startWatching(dir: string, writer: IWriter, registerTypesPath: string): void;
6
- }
1
+ import { IWriter } from "./base-compiler";
2
+ export declare class DirectoryWatcher {
3
+ private readonly compiler;
4
+ private _typesChanged;
5
+ startWatching(dir: string, writer: IWriter, registerTypesPath: string): void;
6
+ }
package/dist/watcher.js CHANGED
@@ -1,79 +1,79 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DirectoryWatcher = void 0;
4
- var fs = require("fs");
5
- var base_compiler_1 = require("./base-compiler");
6
- var Compiler_1 = require("./Compiler");
7
- var blender_compiler_1 = require("./impl/blender-compiler");
8
- var chokidar = require("chokidar");
9
- var commands_1 = require("./commands");
10
- var register_types_1 = require("./register-types");
11
- // https://github.com/paulmillr/chokidar
12
- var DirectoryWatcher = /** @class */ (function () {
13
- function DirectoryWatcher() {
14
- this.compiler = new Compiler_1.Compiler();
15
- this._typesChanged = false;
16
- }
17
- DirectoryWatcher.prototype.startWatching = function (dir, writer, registerTypesPath) {
18
- var _this = this;
19
- // console.log("Start watching", dir);
20
- chokidar.watch(dir + "/**/*.ts").on('all', function (event, path) {
21
- try {
22
- switch (event) {
23
- case "add":
24
- console.log("File", path, "has been added");
25
- _this.compiler.compile(writer, fs.readFileSync(path).toString(), path);
26
- _this._typesChanged = true;
27
- break;
28
- case "change":
29
- console.log("File", path, "has been changed");
30
- _this.compiler.compile(writer, fs.readFileSync(path).toString(), path);
31
- _this._typesChanged = true;
32
- break;
33
- case "unlink":
34
- console.log("File", path, "has been removed");
35
- (0, base_compiler_1.handleDeletedFile)(path, writer.outputInfo);
36
- _this._typesChanged = true;
37
- break;
38
- default:
39
- console.log("File unhandled event", event, path);
40
- }
41
- }
42
- catch (err) {
43
- console.error(err);
44
- }
45
- });
46
- // call reload cmd
47
- setInterval(function () {
48
- if (_this._typesChanged) {
49
- _this._typesChanged = false;
50
- (0, commands_1.sendReloadCommand)();
51
- (0, register_types_1.writeTypeRegistry)(writer.outputInfo, registerTypesPath);
52
- }
53
- }, 2000);
54
- };
55
- return DirectoryWatcher;
56
- }());
57
- exports.DirectoryWatcher = DirectoryWatcher;
58
- // listen to process exit
59
- process.on('exit', function () {
60
- // console.log('Bye node');
61
- });
62
- var args = process.argv.slice(2);
63
- if (args.length < 3) {
64
- console.error("Missing arguments, usage: node watcher.js <directory> <output> <registerTypesPath>");
65
- process.exit(1);
66
- }
67
- var directoryToWatch = args[0].replace("\"", "");
68
- var outputDirectory = args[1].replace("\"", "");
69
- var registerTypesPath = args[2].replace("\"", "");
70
- if (!fs.existsSync(directoryToWatch)) {
71
- console.error("Directory to watch does not exist");
72
- process.exit(1);
73
- }
74
- if (fs.existsSync(outputDirectory))
75
- fs.rmSync(outputDirectory, { recursive: true });
76
- console.log("Watch: " + directoryToWatch + " and output to: " + outputDirectory);
77
- var watcher = new DirectoryWatcher();
78
- var sink = new base_compiler_1.FileSink(outputDirectory);
79
- watcher.startWatching(directoryToWatch, new blender_compiler_1.BlenderWriter(sink), registerTypesPath);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DirectoryWatcher = void 0;
4
+ var fs = require("fs");
5
+ var base_compiler_1 = require("./base-compiler");
6
+ var Compiler_1 = require("./Compiler");
7
+ var blender_compiler_1 = require("./impl/blender-compiler");
8
+ var chokidar = require("chokidar");
9
+ var commands_1 = require("./commands");
10
+ var register_types_1 = require("./register-types");
11
+ // https://github.com/paulmillr/chokidar
12
+ var DirectoryWatcher = /** @class */ (function () {
13
+ function DirectoryWatcher() {
14
+ this.compiler = new Compiler_1.Compiler();
15
+ this._typesChanged = false;
16
+ }
17
+ DirectoryWatcher.prototype.startWatching = function (dir, writer, registerTypesPath) {
18
+ var _this = this;
19
+ // console.log("Start watching", dir);
20
+ chokidar.watch(dir + "/**/*.ts").on('all', function (event, path) {
21
+ try {
22
+ switch (event) {
23
+ case "add":
24
+ console.log("File", path, "has been added");
25
+ _this.compiler.compile(writer, fs.readFileSync(path).toString(), path);
26
+ _this._typesChanged = true;
27
+ break;
28
+ case "change":
29
+ console.log("File", path, "has been changed");
30
+ _this.compiler.compile(writer, fs.readFileSync(path).toString(), path);
31
+ _this._typesChanged = true;
32
+ break;
33
+ case "unlink":
34
+ console.log("File", path, "has been removed");
35
+ (0, base_compiler_1.handleDeletedFile)(path, writer.outputInfo);
36
+ _this._typesChanged = true;
37
+ break;
38
+ default:
39
+ console.log("File unhandled event", event, path);
40
+ }
41
+ }
42
+ catch (err) {
43
+ console.error(err);
44
+ }
45
+ });
46
+ // call reload cmd
47
+ setInterval(function () {
48
+ if (_this._typesChanged) {
49
+ _this._typesChanged = false;
50
+ (0, commands_1.sendReloadCommand)();
51
+ (0, register_types_1.writeTypeRegistry)(writer.outputInfo, registerTypesPath);
52
+ }
53
+ }, 2000);
54
+ };
55
+ return DirectoryWatcher;
56
+ }());
57
+ exports.DirectoryWatcher = DirectoryWatcher;
58
+ // listen to process exit
59
+ process.on('exit', function () {
60
+ // console.log('Bye node');
61
+ });
62
+ var args = process.argv.slice(2);
63
+ if (args.length < 3) {
64
+ console.error("Missing arguments, usage: node watcher.js <directory> <output> <registerTypesPath>");
65
+ process.exit(1);
66
+ }
67
+ var directoryToWatch = args[0].replace("\"", "");
68
+ var outputDirectory = args[1].replace("\"", "");
69
+ var registerTypesPath = args[2].replace("\"", "");
70
+ if (!fs.existsSync(directoryToWatch)) {
71
+ console.error("Directory to watch does not exist");
72
+ process.exit(1);
73
+ }
74
+ if (fs.existsSync(outputDirectory))
75
+ fs.rmSync(outputDirectory, { recursive: true });
76
+ console.log("Watch: " + directoryToWatch + " and output to: " + outputDirectory);
77
+ var watcher = new DirectoryWatcher();
78
+ var sink = new base_compiler_1.FileSink(outputDirectory);
79
+ watcher.startWatching(directoryToWatch, new blender_compiler_1.BlenderWriter(sink), registerTypesPath);
package/package.json CHANGED
@@ -1,55 +1,60 @@
1
- {
2
- "name": "@needle-tools/needle-component-compiler",
3
- "version": "3.0.0-alpha",
4
- "description": "Compile Editor components for Needle Engine for C# and Blender",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "tsc": "tsc",
8
- "dev": "npm-watch compile",
9
- "compile": "tsc",
10
- "test": "npm run test:csharp && npm run test:blender",
11
- "test:csharp": "mocha -r ts-node/register 'test/csharp/**/*.test.ts'",
12
- "test:blender": "mocha -r ts-node/register 'test/blender/**/*.test.ts'",
13
- "test:single": "mocha"
14
- },
15
- "files": [
16
- "Readme.md",
17
- "Changelog.md",
18
- "package.json",
19
- "dist/**/*"
20
- ],
21
- "dependencies": {
22
- "chokidar": "^3.5.3",
23
- "typescript": "^4.5.5"
24
- },
25
- "devDependencies": {
26
- "@types/chai": "^4.3.3",
27
- "@types/mocha": "^9.1.1",
28
- "@types/node": "^18.7.18",
29
- "chai": "^4.3.6",
30
- "mocha": "^10.0.0",
31
- "npm-watch": "^0.11.0",
32
- "ts-node": "^10.9.1"
33
- },
34
- "watch": {
35
- "compile": {
36
- "patterns": [
37
- "src/**/*.ts",
38
- "test/*/*.ts",
39
- "test/*.ts"
40
- ],
41
- "ignore": "src/test.ts",
42
- "extensions": "ts",
43
- "quiet": false
44
- }
45
- },
46
- "author": {
47
- "name": "Needle",
48
- "email": "help@needle.tools",
49
- "url": "https://needle.tools/"
50
- },
51
- "repository": {
52
- "type": "git",
53
- "url": "git+https://github.com/needle-tools/needle-tiny-component-compiler.git"
54
- }
55
- }
1
+ {
2
+ "name": "@needle-tools/needle-component-compiler",
3
+ "version": "3.0.0-alpha.1.999f08a",
4
+ "description": "Compile Editor components for Needle Engine for C# and Blender",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "tsc": "tsc",
8
+ "dev": "npm-watch compile",
9
+ "compile": "tsc",
10
+ "prepublishOnly": "npm run compile",
11
+ "test": "npm run test:csharp && npm run test:blender",
12
+ "test:csharp": "mocha -r ts-node/register 'test/csharp/**/*.test.ts'",
13
+ "test:blender": "mocha -r ts-node/register 'test/blender/**/*.test.ts'",
14
+ "test:single": "mocha"
15
+ },
16
+ "files": [
17
+ "Readme.md",
18
+ "Changelog.md",
19
+ "package.json",
20
+ "dist/**/*"
21
+ ],
22
+ "dependencies": {
23
+ "chokidar": "^3.5.3",
24
+ "typescript": "^4.5.5"
25
+ },
26
+ "devDependencies": {
27
+ "@types/chai": "^4.3.3",
28
+ "@types/mocha": "^9.1.1",
29
+ "@types/node": "^18.7.18",
30
+ "chai": "^4.3.6",
31
+ "mocha": "^10.0.0",
32
+ "npm-watch": "^0.11.0",
33
+ "ts-node": "^10.9.1"
34
+ },
35
+ "watch": {
36
+ "compile": {
37
+ "patterns": [
38
+ "src/**/*.ts",
39
+ "test/*/*.ts",
40
+ "test/*.ts"
41
+ ],
42
+ "ignore": "src/test.ts",
43
+ "extensions": "ts",
44
+ "quiet": false
45
+ }
46
+ },
47
+ "author": {
48
+ "name": "Needle",
49
+ "email": "help@needle.tools",
50
+ "url": "https://needle.tools/"
51
+ },
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "git+https://github.com/needle-tools/needle-tiny-component-compiler.git"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public",
58
+ "registry": "https://registry.npmjs.org/"
59
+ }
60
+ }