circuitscript 0.0.21 → 0.0.24
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/dist/cjs/antlr/CircuitScriptLexer.js +288 -0
- package/dist/cjs/antlr/CircuitScriptParser.js +4905 -0
- package/dist/cjs/antlr/CircuitScriptVisitor.js +6 -0
- package/{src/draw_symbols.ts → dist/cjs/draw_symbols.js} +303 -614
- package/dist/cjs/execute.js +780 -0
- package/{src/export.ts → dist/cjs/export.js} +34 -56
- package/dist/cjs/fonts.js +4 -0
- package/dist/cjs/geometry.js +430 -0
- package/dist/cjs/globals.js +60 -0
- package/dist/cjs/helpers.js +99 -0
- package/dist/cjs/index.js +29 -0
- package/{src/layout.ts → dist/cjs/layout.js} +413 -1002
- package/dist/cjs/lexer.js +114 -0
- package/dist/cjs/logger.js +17 -0
- package/dist/cjs/main.js +87 -0
- package/dist/cjs/objects/ClassComponent.js +142 -0
- package/dist/cjs/objects/ExecutionScope.js +134 -0
- package/dist/cjs/objects/Frame.js +22 -0
- package/{src/objects/Net.ts → dist/cjs/objects/Net.js} +9 -24
- package/dist/cjs/objects/ParamDefinition.js +42 -0
- package/dist/cjs/objects/PinDefinition.js +31 -0
- package/dist/cjs/objects/PinTypes.js +11 -0
- package/dist/cjs/objects/Wire.js +9 -0
- package/dist/cjs/objects/types.js +9 -0
- package/dist/cjs/parser.js +299 -0
- package/dist/cjs/regenerate-tests.js +23 -0
- package/dist/cjs/render.js +155 -0
- package/{src/server.ts → dist/cjs/server.js} +15 -21
- package/dist/cjs/sizing.js +105 -0
- package/{src/utils.ts → dist/cjs/utils.js} +25 -35
- package/{src/visitor.ts → dist/cjs/visitor.js} +392 -948
- package/{build/src/antlr/CircuitScriptLexer.js → dist/esm/antlr/CircuitScriptLexer.mjs} +90 -91
- package/{build/src/antlr/CircuitScriptParser.js → dist/esm/antlr/CircuitScriptParser.mjs} +138 -136
- package/{build/src/draw_symbols.js → dist/esm/draw_symbols.mjs} +11 -11
- package/{build/src/execute.js → dist/esm/execute.mjs} +9 -8
- package/{build/src/export.js → dist/esm/export.mjs} +2 -2
- package/{build/src/geometry.js → dist/esm/geometry.mjs} +3 -7
- package/{build/src/helpers.js → dist/esm/helpers.mjs} +27 -7
- package/dist/esm/index.mjs +13 -0
- package/{build/src/layout.js → dist/esm/layout.mjs} +11 -11
- package/{build/src/lexer.js → dist/esm/lexer.mjs} +2 -2
- package/{build/src/main.js → dist/esm/main.mjs} +5 -5
- package/{build/src/objects/ClassComponent.js → dist/esm/objects/ClassComponent.mjs} +3 -3
- package/{build/src/objects/PinDefinition.js → dist/esm/objects/PinDefinition.mjs} +1 -1
- package/dist/esm/parser.mjs +269 -0
- package/{build/src/regenerate-tests.js → dist/esm/regenerate-tests.mjs} +1 -1
- package/{build/src/render.js → dist/esm/render.mjs} +7 -24
- package/{build/src/sizing.js → dist/esm/sizing.mjs} +22 -8
- package/{build/src/visitor.js → dist/esm/visitor.mjs} +10 -29
- package/dist/types/antlr/CircuitScriptLexer.d.ts +71 -0
- package/dist/types/antlr/CircuitScriptParser.d.ts +675 -0
- package/dist/types/antlr/CircuitScriptVisitor.d.ts +115 -0
- package/dist/types/draw_symbols.d.ts +162 -0
- package/dist/types/execute.d.ts +85 -0
- package/dist/types/export.d.ts +2 -0
- package/dist/types/fonts.d.ts +1 -0
- package/dist/types/geometry.d.ts +84 -0
- package/dist/types/globals.d.ts +50 -0
- package/dist/types/helpers.d.ts +9 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/layout.d.ts +147 -0
- package/dist/types/lexer.d.ts +19 -0
- package/dist/types/logger.d.ts +6 -0
- package/dist/types/main.d.ts +2 -0
- package/dist/types/objects/ClassComponent.d.ts +40 -0
- package/dist/types/objects/ExecutionScope.d.ts +64 -0
- package/dist/types/objects/Frame.d.ts +15 -0
- package/dist/types/objects/Net.d.ts +10 -0
- package/dist/types/objects/ParamDefinition.d.ts +20 -0
- package/dist/types/objects/PinDefinition.d.ts +24 -0
- package/dist/types/objects/PinTypes.d.ts +7 -0
- package/dist/types/objects/Wire.d.ts +11 -0
- package/dist/types/objects/types.d.ts +49 -0
- package/dist/types/parser.d.ts +38 -0
- package/dist/types/regenerate-tests.d.ts +1 -0
- package/dist/types/render.d.ts +10 -0
- package/dist/types/server.d.ts +1 -0
- package/dist/types/sizing.d.ts +15 -0
- package/dist/types/utils.d.ts +19 -0
- package/dist/types/visitor.d.ts +135 -0
- package/package.json +30 -12
- package/.editorconfig +0 -15
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -27
- package/.gitlab-ci.yml +0 -81
- package/.prettierignore +0 -8
- package/.prettierrc +0 -16
- package/__tests__/expectedResults.ts +0 -657
- package/__tests__/helpers.ts +0 -82
- package/__tests__/parseScripts.ts +0 -593
- package/__tests__/renderData/script1.cst +0 -58
- package/__tests__/renderData/script1.cst.svg +0 -1
- package/__tests__/renderData/script2.cst +0 -16
- package/__tests__/renderData/script2.cst.svg +0 -1
- package/__tests__/renderData/script3.cst +0 -30
- package/__tests__/renderData/script3.cst.svg +0 -1
- package/__tests__/renderData/script4.cst +0 -54
- package/__tests__/renderData/script4.cst.svg +0 -1
- package/__tests__/renderData/script5.cst +0 -23
- package/__tests__/renderData/script5.cst.svg +0 -1
- package/__tests__/renderData/script6.cst +0 -28
- package/__tests__/renderData/script6.cst.svg +0 -1
- package/__tests__/renderData/script7.cst +0 -26
- package/__tests__/renderData/script7.cst.svg +0 -1
- package/__tests__/renderData/script8.cst +0 -37
- package/__tests__/renderData/script8.cst.svg +0 -1
- package/__tests__/testCLI.ts +0 -68
- package/__tests__/testMathOps.ts +0 -36
- package/__tests__/testMergeWires.ts +0 -141
- package/__tests__/testParse.ts +0 -263
- package/__tests__/testRender.ts +0 -38
- package/build/src/parser.js +0 -69
- package/documentation.md +0 -238
- package/examples/example_arduino_uno.cst +0 -1146
- package/examples/example_garden_pump.cst +0 -567
- package/examples/lib.cst +0 -185
- package/fonts/Inter-Bold.ttf +0 -0
- package/fonts/Inter-Regular.ttf +0 -0
- package/fonts/OpenSans-Regular.ttf +0 -0
- package/fonts/Roboto-Regular.ttf +0 -0
- package/jest.config.js +0 -23
- package/libs/lib.cst +0 -185
- package/refresh.html +0 -42
- package/server.cjs +0 -50
- package/src/antlr/CircuitScript.g4 +0 -209
- package/src/antlr/CircuitScriptLexer.ts +0 -317
- package/src/antlr/CircuitScriptParser.ts +0 -4979
- package/src/antlr/CircuitScriptVisitor.ts +0 -420
- package/src/execute.ts +0 -1227
- package/src/fonts.ts +0 -1
- package/src/geometry.ts +0 -638
- package/src/globals.ts +0 -67
- package/src/helpers.ts +0 -114
- package/src/lexer.ts +0 -151
- package/src/logger.ts +0 -17
- package/src/main.ts +0 -105
- package/src/objects/ClassComponent.ts +0 -223
- package/src/objects/ExecutionScope.ts +0 -201
- package/src/objects/Frame.ts +0 -20
- package/src/objects/ParamDefinition.ts +0 -49
- package/src/objects/PinDefinition.ts +0 -49
- package/src/objects/PinTypes.ts +0 -7
- package/src/objects/Wire.ts +0 -19
- package/src/objects/types.ts +0 -66
- package/src/parser.ts +0 -106
- package/src/regenerate-tests.ts +0 -25
- package/src/render.ts +0 -260
- package/src/sizing.ts +0 -96
- package/tsconfig.json +0 -26
- package/tsconfig.release.json +0 -8
- /package/{build/src/antlr/CircuitScriptVisitor.js → dist/esm/antlr/CircuitScriptVisitor.mjs} +0 -0
- /package/{build/src/fonts.js → dist/esm/fonts.mjs} +0 -0
- /package/{build/src/globals.js → dist/esm/globals.mjs} +0 -0
- /package/{build/src/logger.js → dist/esm/logger.mjs} +0 -0
- /package/{build/src/objects/ExecutionScope.js → dist/esm/objects/ExecutionScope.mjs} +0 -0
- /package/{build/src/objects/Frame.js → dist/esm/objects/Frame.mjs} +0 -0
- /package/{build/src/objects/Net.js → dist/esm/objects/Net.mjs} +0 -0
- /package/{build/src/objects/ParamDefinition.js → dist/esm/objects/ParamDefinition.mjs} +0 -0
- /package/{build/src/objects/PinTypes.js → dist/esm/objects/PinTypes.mjs} +0 -0
- /package/{build/src/objects/Wire.js → dist/esm/objects/Wire.mjs} +0 -0
- /package/{build/src/objects/types.js → dist/esm/objects/types.mjs} +0 -0
- /package/{build/src/server.js → dist/esm/server.mjs} +0 -0
- /package/{build/src/utils.js → dist/esm/utils.mjs} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class SimpleStopwatch {
|
|
2
|
+
startTime: Date;
|
|
3
|
+
constructor();
|
|
4
|
+
lap(): number;
|
|
5
|
+
}
|
|
6
|
+
export type BoundBox = {
|
|
7
|
+
xmin: number;
|
|
8
|
+
ymin: number;
|
|
9
|
+
xmax: number;
|
|
10
|
+
ymax: number;
|
|
11
|
+
};
|
|
12
|
+
export declare function resizeBounds(bounds: BoundBox, value: number): BoundBox;
|
|
13
|
+
export declare function printBounds(bounds: BoundBox): string;
|
|
14
|
+
export declare function resizeToNearestGrid(bounds: BoundBox, gridSize?: number): BoundBox;
|
|
15
|
+
export declare function toNearestGrid(value: number, gridSize: number): number;
|
|
16
|
+
export declare function getBoundsSize(bounds: BoundBox): {
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { ParseTreeVisitor, ParserRuleContext } from 'antlr4';
|
|
2
|
+
import { Add_component_exprContext, AdditionExprContext, Assignment_exprContext, At_blockContext, At_block_pin_exprContext, At_block_pin_expression_complexContext, At_block_pin_expression_simpleContext, At_component_exprContext, Atom_exprContext, BinaryOperatorExprContext, Blank_exprContext, Path_blocksContext, Component_select_exprContext, Create_component_exprContext, Create_graphic_exprContext, DataExprContext, Data_expr_with_assignmentContext, Double_dot_property_set_exprContext, Frame_exprContext, Function_args_exprContext, Function_def_exprContext, Function_return_exprContext, Import_exprContext, Keyword_assignment_exprContext, MultiplyExprContext, Nested_propertiesContext, Net_namespace_exprContext, ParametersContext, Pin_select_expr2Context, Pin_select_exprContext, Point_exprContext, Property_exprContext, Property_key_exprContext, Property_set_exprContext, RoundedBracketsExprContext, ScriptContext, Single_line_propertyContext, Sub_exprContext, To_component_exprContext, Value_exprContext, Wire_exprContext, ValueAtomExprContext, UnaryOperatorExprContext } from './antlr/CircuitScriptParser.js';
|
|
3
|
+
import { ExecutionContext } from './execute.js';
|
|
4
|
+
import { ClassComponent } from './objects/ClassComponent.js';
|
|
5
|
+
import { PinBlankValue } from './objects/ParamDefinition.js';
|
|
6
|
+
import { PinTypes } from './objects/PinTypes.js';
|
|
7
|
+
import { CallableParameter, ComplexType, ComponentPin, ComponentPinNet, FunctionDefinedParameter, ReferenceType, ValueType } from './objects/types.js';
|
|
8
|
+
import { Logger } from './logger.js';
|
|
9
|
+
import { Net } from './objects/Net.js';
|
|
10
|
+
import { SymbolDrawingCommands } from './draw_symbols.js';
|
|
11
|
+
export declare class MainVisitor extends ParseTreeVisitor<any> {
|
|
12
|
+
indentLevel: number;
|
|
13
|
+
startingContext: ExecutionContext;
|
|
14
|
+
executionStack: ExecutionContext[];
|
|
15
|
+
silent: boolean;
|
|
16
|
+
logger: Logger;
|
|
17
|
+
printStream: string[];
|
|
18
|
+
printToConsole: boolean;
|
|
19
|
+
acceptedDirections: string[];
|
|
20
|
+
pinTypesList: string[];
|
|
21
|
+
onImportFile: (visitor: MainVisitor, filePath: string) => {
|
|
22
|
+
hasError: boolean;
|
|
23
|
+
hasParseError: boolean;
|
|
24
|
+
};
|
|
25
|
+
constructor(silent?: boolean);
|
|
26
|
+
getExecutor(): ExecutionContext;
|
|
27
|
+
visit(ctx: ParserRuleContext): any;
|
|
28
|
+
handleError(ctx: ParserRuleContext, err: string | VisitorExecutionException): void;
|
|
29
|
+
visitScript(ctx: ScriptContext): any;
|
|
30
|
+
visitParameters(ctx: ParametersContext): CallableParameter[];
|
|
31
|
+
visitKeyword_assignment_expr(ctx: Keyword_assignment_exprContext): [
|
|
32
|
+
key: string,
|
|
33
|
+
value: any
|
|
34
|
+
];
|
|
35
|
+
visitAssignment_expr(ctx: Assignment_exprContext): ComplexType;
|
|
36
|
+
setInstanceParam(object: ClassComponent, trailers: string[], value: any): void;
|
|
37
|
+
visitValue_expr(ctx: Value_exprContext): ValueType;
|
|
38
|
+
visitBlank_expr(ctx: Blank_exprContext): PinBlankValue;
|
|
39
|
+
visitPin_select_expr(ctx: Pin_select_exprContext): string | number | null;
|
|
40
|
+
visitAdd_component_expr(ctx: Add_component_exprContext): ComponentPin;
|
|
41
|
+
visitAt_component_expr(ctx: At_component_exprContext): ComponentPin;
|
|
42
|
+
visitTo_component_expr(ctx: To_component_exprContext): ComponentPin;
|
|
43
|
+
visitComponent_select_expr(ctx: Component_select_exprContext): ComponentPin;
|
|
44
|
+
visitPath_blocks(ctx: Path_blocksContext): ComponentPin;
|
|
45
|
+
visitBreak_keyword(): number;
|
|
46
|
+
visitCreate_component_expr(ctx: Create_component_exprContext): ClassComponent;
|
|
47
|
+
visitCreate_graphic_expr(ctx: Create_graphic_exprContext): SymbolDrawingCommands;
|
|
48
|
+
visitSub_expr(ctx: Sub_exprContext): [
|
|
49
|
+
id: string,
|
|
50
|
+
parameters: CallableParameter[]
|
|
51
|
+
];
|
|
52
|
+
visitProperty_expr(ctx: Property_exprContext): Map<string, any>;
|
|
53
|
+
visitSingle_line_property(ctx: Single_line_propertyContext): any | any[];
|
|
54
|
+
visitNested_properties(ctx: Nested_propertiesContext): Map<string, any>;
|
|
55
|
+
visitProperty_key_expr(ctx: Property_key_exprContext): string | number;
|
|
56
|
+
visitData_expr_with_assignment(ctx: Data_expr_with_assignmentContext): [
|
|
57
|
+
component: ComplexType,
|
|
58
|
+
pin: string | number | null
|
|
59
|
+
];
|
|
60
|
+
visitValueAtomExpr(ctx: ValueAtomExprContext): ComplexType;
|
|
61
|
+
visitUnaryOperatorExpr(ctx: UnaryOperatorExprContext): ComplexType;
|
|
62
|
+
visitDataExpr(ctx: DataExprContext): ComplexType;
|
|
63
|
+
visitBinaryOperatorExpr(ctx: BinaryOperatorExprContext): boolean | number;
|
|
64
|
+
visitMultiplyExpr(ctx: MultiplyExprContext): number;
|
|
65
|
+
visitAdditionExpr(ctx: AdditionExprContext): number;
|
|
66
|
+
visitFunction_args_expr(ctx: Function_args_exprContext): FunctionDefinedParameter[];
|
|
67
|
+
createNetResolver(executionStack: ExecutionContext[]): (netName: string, netNamespace: string) => {
|
|
68
|
+
found: boolean;
|
|
69
|
+
net?: Net;
|
|
70
|
+
};
|
|
71
|
+
visitFunction_def_expr(ctx: Function_def_exprContext): void;
|
|
72
|
+
private setupDefinedParameters;
|
|
73
|
+
visitFunction_return_expr(ctx: Function_return_exprContext): ComplexType;
|
|
74
|
+
visitAtom_expr(ctx: Atom_exprContext): ReferenceType;
|
|
75
|
+
visitPin_select_expr2(ctx: Pin_select_expr2Context): string | number;
|
|
76
|
+
visitAt_block_pin_expr(ctx: At_block_pin_exprContext): ComponentPin;
|
|
77
|
+
visitAt_block(ctx: At_blockContext): ComponentPin;
|
|
78
|
+
visitAt_block_pin_expression_simple(ctx: At_block_pin_expression_simpleContext): void;
|
|
79
|
+
visitAt_block_pin_expression_complex(ctx: At_block_pin_expression_complexContext): ComponentPin;
|
|
80
|
+
visitWire_expr(ctx: Wire_exprContext): void;
|
|
81
|
+
visitPoint_expr(ctx: Point_exprContext): ComponentPin;
|
|
82
|
+
visitImport_expr(ctx: Import_exprContext): void;
|
|
83
|
+
visitProperty_set_expr(ctx: Property_set_exprContext): void;
|
|
84
|
+
visitDouble_dot_property_set_expr(ctx: Double_dot_property_set_exprContext): void;
|
|
85
|
+
visitRoundedBracketsExpr(ctx: RoundedBracketsExprContext): any;
|
|
86
|
+
visitFrame_expr(ctx: Frame_exprContext): void;
|
|
87
|
+
visitNet_namespace_expr(ctx: Net_namespace_exprContext): string;
|
|
88
|
+
pinTypes: PinTypes[];
|
|
89
|
+
createImportFileHandler(directory: string, defaultLibsPath: string): ((visitor: MainVisitor, importPath: string) => {
|
|
90
|
+
hasError: boolean;
|
|
91
|
+
hasParseError: boolean;
|
|
92
|
+
pathExists: boolean;
|
|
93
|
+
});
|
|
94
|
+
private importLib;
|
|
95
|
+
private parseCreateComponentPins;
|
|
96
|
+
private parseCreateComponentParams;
|
|
97
|
+
private prepareStringValue;
|
|
98
|
+
print(...params: any[]): void;
|
|
99
|
+
printNets(): void;
|
|
100
|
+
dumpNets(): ComponentPinNet[];
|
|
101
|
+
dumpUniqueNets(): Net[];
|
|
102
|
+
dumpVariables(): Map<string, any>;
|
|
103
|
+
dumpInstances(): Map<string, ClassComponent>;
|
|
104
|
+
dump2(): {
|
|
105
|
+
name: string;
|
|
106
|
+
refdes: string;
|
|
107
|
+
pins: {};
|
|
108
|
+
}[];
|
|
109
|
+
getNetList(): NetListItem[];
|
|
110
|
+
getGraph(): {
|
|
111
|
+
sequence: any[];
|
|
112
|
+
nets: import("./objects/types.js").ComponentPinNetPair[];
|
|
113
|
+
components: ClassComponent[];
|
|
114
|
+
};
|
|
115
|
+
annotateComponents(): void;
|
|
116
|
+
private resolveNets;
|
|
117
|
+
private setComponentOrientation;
|
|
118
|
+
private getPropertyExprList;
|
|
119
|
+
private runExpressions;
|
|
120
|
+
private setupPrintFunction;
|
|
121
|
+
private getNetNamespace;
|
|
122
|
+
}
|
|
123
|
+
export type NetListItem = {
|
|
124
|
+
instanceName: string;
|
|
125
|
+
instance: ClassComponent;
|
|
126
|
+
pins: {
|
|
127
|
+
[key: string | number]: string;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
export declare class VisitorExecutionException {
|
|
131
|
+
errorMessage: string;
|
|
132
|
+
context: ParserRuleContext;
|
|
133
|
+
constructor(context: ParserRuleContext, errorMessage: string);
|
|
134
|
+
print(scriptData: string): void;
|
|
135
|
+
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "circuitscript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "Interpreter for the circuitscript language",
|
|
5
5
|
"homepage": "https://circuitscript.net",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=16.0"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
10
|
-
"
|
|
9
|
+
"main": "./dist/cjs/index.js",
|
|
10
|
+
"module": "./dist/esm/index.mjs",
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
11
12
|
"bin": {
|
|
12
|
-
"circuitscript": "./
|
|
13
|
+
"circuitscript": "./dist/esm/main.mjs"
|
|
13
14
|
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"require": "./dist/cjs/index.js",
|
|
18
|
+
"import": "./dist/esm/index.mjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
14
24
|
"devDependencies": {
|
|
15
25
|
"@types/figlet": "^1.5.8",
|
|
16
26
|
"@types/jest": "~29.5",
|
|
@@ -27,15 +37,22 @@
|
|
|
27
37
|
"source-map-support": "^0.5.21",
|
|
28
38
|
"ts-api-utils": "~0.0.44",
|
|
29
39
|
"ts-jest": "~29.1",
|
|
40
|
+
"ts2mjs": "^3.0.0",
|
|
30
41
|
"typescript": "^5.4.5"
|
|
31
42
|
},
|
|
32
43
|
"scripts": {
|
|
33
44
|
"start": "node build/src/main.js",
|
|
34
|
-
"clean": "rimraf coverage build tmp",
|
|
35
|
-
"build": "
|
|
36
|
-
"build:
|
|
37
|
-
"build:release": "
|
|
38
|
-
"
|
|
45
|
+
"clean": "rimraf coverage build tmp dist",
|
|
46
|
+
"build": "npm run build:cjs || npm run build:esm",
|
|
47
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
48
|
+
"build:release:cjs": "tsc -p tsconfig.release.cjs.json",
|
|
49
|
+
"build:esm": "tsc -p tsconfig.esm.json || npm run rename:esm",
|
|
50
|
+
"build:release:esm": "tsc -p tsconfig.release.esm.json || npm run rename:esm",
|
|
51
|
+
"rename:esm": "npx ts2mjs ./dist/esm && rm -rf ./dist/esm/*.js && rm -rf ./dist/esm/**/*.js",
|
|
52
|
+
"build:watch": "tsc -w -p tsconfig.esm.json",
|
|
53
|
+
"build:watch:cjs": "tsc -w -p tsconfig.cjs.json",
|
|
54
|
+
"build:release": "npm run clean && npm run build:release:cjs || npm run build:release:esm",
|
|
55
|
+
"prebuild": "npm run lint || true",
|
|
39
56
|
"lint": "eslint . --ext .ts --ext .mts",
|
|
40
57
|
"test": "jest",
|
|
41
58
|
"test-coverage": "jest --coverage",
|
|
@@ -49,15 +66,16 @@
|
|
|
49
66
|
"boilerplate_author": "Jakub Synowiec <jsynowiec@users.noreply.github.com>",
|
|
50
67
|
"license": "MIT",
|
|
51
68
|
"dependencies": {
|
|
52
|
-
"@dagrejs/graphlib": "
|
|
53
|
-
"@flatten-js/core": "
|
|
54
|
-
"@svgdotjs/svg.js": "
|
|
69
|
+
"@dagrejs/graphlib": "2.1.13",
|
|
70
|
+
"@flatten-js/core": "1.5.5",
|
|
71
|
+
"@svgdotjs/svg.js": "3.2.0",
|
|
55
72
|
"antlr4": "^4.13.0",
|
|
56
73
|
"commander": "^11.1.0",
|
|
57
74
|
"express": "^4.18.2",
|
|
58
75
|
"figlet": "^1.7.0",
|
|
59
76
|
"lodash": "^4.17.21",
|
|
60
77
|
"svgdom": "^0.1.14",
|
|
78
|
+
"this-file": "^2.0.3",
|
|
61
79
|
"tslib": "~2.5",
|
|
62
80
|
"ws": "^8.14.2"
|
|
63
81
|
},
|
package/.editorconfig
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
root = true
|
|
2
|
-
|
|
3
|
-
[*]
|
|
4
|
-
charset = utf-8
|
|
5
|
-
end_of_line = lf
|
|
6
|
-
trim_trailing_whitespace = true
|
|
7
|
-
insert_final_newline = true
|
|
8
|
-
|
|
9
|
-
[*.md]
|
|
10
|
-
insert_final_newline = false
|
|
11
|
-
trim_trailing_whitespace = false
|
|
12
|
-
|
|
13
|
-
[*.{js,json,ts,mts,yml,yaml}]
|
|
14
|
-
indent_size = 2
|
|
15
|
-
indent_style = space
|
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/**/*.js
|
package/.eslintrc.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": false,
|
|
4
|
-
"es6": true,
|
|
5
|
-
"node": true
|
|
6
|
-
},
|
|
7
|
-
"parser": "@typescript-eslint/parser",
|
|
8
|
-
"parserOptions": {
|
|
9
|
-
"project": "tsconfig.json",
|
|
10
|
-
"sourceType": "module",
|
|
11
|
-
"ecmaVersion": 2020
|
|
12
|
-
},
|
|
13
|
-
"plugins": ["@typescript-eslint", "jest"],
|
|
14
|
-
"extends": [
|
|
15
|
-
"eslint:recommended",
|
|
16
|
-
"plugin:@typescript-eslint/recommended",
|
|
17
|
-
"plugin:jest/recommended",
|
|
18
|
-
"prettier"
|
|
19
|
-
],
|
|
20
|
-
"rules": {
|
|
21
|
-
// The following rule is enabled only to supplement the inline suppression
|
|
22
|
-
// examples, and because it is not a recommended rule, you should either
|
|
23
|
-
// disable it, or understand what it enforces.
|
|
24
|
-
// https://typescript-eslint.io/rules/explicit-function-return-type/
|
|
25
|
-
"@typescript-eslint/explicit-function-return-type": "warn"
|
|
26
|
-
}
|
|
27
|
-
}
|
package/.gitlab-ci.yml
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
image: node:18
|
|
2
|
-
|
|
3
|
-
# variables:
|
|
4
|
-
# ARTIFACT_DOWNLOAD_ATTEMPTS: 2 # Number of retries for restoring saved artifacts.
|
|
5
|
-
# FORCE_COLOR: '1' # Whether to force colour output in compatible tooling.
|
|
6
|
-
# GET_SOURCES_ATTEMPTS: 2 # Number of retries for git commands.
|
|
7
|
-
# GIT_STRATEGY: fetch # How to pull submodules.
|
|
8
|
-
# GIT_SUBMODULE_STRATEGY: recursive # How to treat nested git submodules.
|
|
9
|
-
# RESTORE_CACHE_ATTEMPTS: 2 # Number of retries for restoring cached files.
|
|
10
|
-
|
|
11
|
-
stages:
|
|
12
|
-
- prepare
|
|
13
|
-
- test_jest
|
|
14
|
-
- test_build
|
|
15
|
-
- publish
|
|
16
|
-
|
|
17
|
-
.common_rules:
|
|
18
|
-
rules:
|
|
19
|
-
- if: $CI_COMMIT_TAG
|
|
20
|
-
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
21
|
-
|
|
22
|
-
# Installs all dependencies.
|
|
23
|
-
install:
|
|
24
|
-
stage: prepare
|
|
25
|
-
interruptible: true
|
|
26
|
-
retry: 1
|
|
27
|
-
dependencies: []
|
|
28
|
-
artifacts:
|
|
29
|
-
name: 'deps_$CI_COMMIT_REF_SLUG'
|
|
30
|
-
paths:
|
|
31
|
-
- node_modules/
|
|
32
|
-
when: on_success
|
|
33
|
-
expire_in: 12h
|
|
34
|
-
script:
|
|
35
|
-
- echo $CI_COMMIT_BRANCH
|
|
36
|
-
- echo $CI_COMMIT_TAG
|
|
37
|
-
- echo $CI_PIPELINE_SOURCE
|
|
38
|
-
- echo $CI_COMMIT_REF_NAME
|
|
39
|
-
- npm install --no-progress --no-audit --no-fund --verbose
|
|
40
|
-
rules:
|
|
41
|
-
- !reference [.common_rules, rules]
|
|
42
|
-
|
|
43
|
-
test_jest:
|
|
44
|
-
stage: test_jest
|
|
45
|
-
interruptible: true
|
|
46
|
-
retry: 1
|
|
47
|
-
dependencies:
|
|
48
|
-
- install
|
|
49
|
-
script:
|
|
50
|
-
- npm run build:release || true
|
|
51
|
-
- npm run test
|
|
52
|
-
rules:
|
|
53
|
-
- !reference [.common_rules, rules]
|
|
54
|
-
|
|
55
|
-
test_build:
|
|
56
|
-
stage: test_build
|
|
57
|
-
interruptible: true
|
|
58
|
-
retry: 1
|
|
59
|
-
dependencies:
|
|
60
|
-
- install
|
|
61
|
-
script:
|
|
62
|
-
- npm run build:release || true
|
|
63
|
-
- ls
|
|
64
|
-
- ls build
|
|
65
|
-
- node build/src/main.js
|
|
66
|
-
rules:
|
|
67
|
-
- !reference [.common_rules, rules]
|
|
68
|
-
|
|
69
|
-
# Publishes the package to npm.
|
|
70
|
-
publish:
|
|
71
|
-
stage: publish
|
|
72
|
-
interruptible: false
|
|
73
|
-
dependencies:
|
|
74
|
-
- install
|
|
75
|
-
script:
|
|
76
|
-
- npm config set -- '//registry.npmjs.org/:_authToken' "${NPM_AUTH_TOKEN}"
|
|
77
|
-
- npm run build:release || true
|
|
78
|
-
- npm publish --verbose
|
|
79
|
-
resource_group: 'deployment-$CI_COMMIT_REF_SLUG'
|
|
80
|
-
rules:
|
|
81
|
-
- !reference [.common_rules, rules]
|
package/.prettierignore
DELETED