@yannosay/sinth 1.8.0 → 1.8.2
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/LICENSE +660 -660
- package/README.md +548 -548
- package/package.json +45 -45
- package/src/cli.ts +338 -338
- package/src/core/builtins.ts +116 -116
- package/src/core/compiler.ts +1706 -1706
- package/src/core/expr.ts +88 -88
- package/src/core/head-builder.ts +86 -86
- package/src/core/lexer.ts +275 -275
- package/src/core/parser.ts +1523 -1523
- package/src/core/runtime/custom-element.ts +134 -134
- package/src/core/runtime/functions.ts +46 -46
- package/src/core/runtime/helpers.ts +332 -332
- package/src/core/runtime/render.ts +136 -136
- package/src/core/style-processor.ts +299 -299
- package/src/core/types.ts +192 -192
- package/src/resolver.ts +149 -149
- package/src/server.ts +128 -128
- package/src/utils.ts +76 -76
- package/tsconfig.json +26 -26
package/src/core/types.ts
CHANGED
|
@@ -1,193 +1,193 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Sinth Compiler
|
|
3
|
-
|
|
4
|
-
import * as fs from "fs";
|
|
5
|
-
import * as path from "path";
|
|
6
|
-
import * as http from "http";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export interface Loc { file: string; line: number; col: number }
|
|
10
|
-
|
|
11
|
-
export enum TT {
|
|
12
|
-
LBRACE, RBRACE, LPAREN, RPAREN, COLON, COMMA, EQUALS, DOT,
|
|
13
|
-
LBRACKET, RBRACKET,
|
|
14
|
-
STRING, NUMBER, BOOL_TRUE, BOOL_FALSE, NULL_LIT,
|
|
15
|
-
RAW_BLOCK,
|
|
16
|
-
IDENT,
|
|
17
|
-
KW_IMPORT, KW_AS, KW_CSS,
|
|
18
|
-
KW_COMPONENT, KW_STYLE, KW_SCRIPT,
|
|
19
|
-
KW_GLOBAL, KW_PAGE, KW_LANG,
|
|
20
|
-
KW_CUSTOM_EL, KW_CUSTOM,
|
|
21
|
-
KW_IF, KW_ELSE, KW_FOR, KW_IN, KW_REMOVE,
|
|
22
|
-
KW_FUNCTION, KW_RETURN,
|
|
23
|
-
OP_PLUS, OP_MINUS, OP_STAR, OP_SLASH, OP_MOD, OP_SEMI,
|
|
24
|
-
OP_LT, OP_GT, OP_NEQ, OP_EQEQ, OP_LTEQ, OP_GTEQ,
|
|
25
|
-
OP_ARROW,
|
|
26
|
-
OP_NOT,
|
|
27
|
-
EOF,
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface Token { type: TT; value: string; loc: Loc }
|
|
31
|
-
|
|
32
|
-
export type LitStr = { kind: "str"; value: string };
|
|
33
|
-
export type LitNum = { kind: "num"; value: number };
|
|
34
|
-
export type LitBool = { kind: "bool"; value: boolean };
|
|
35
|
-
export type LitNull = { kind: "null" };
|
|
36
|
-
export type Literal = LitStr | LitNum | LitBool | LitNull;
|
|
37
|
-
|
|
38
|
-
export type UnaryOp = "not" | "-";
|
|
39
|
-
export type BinaryOp = "+" | "-" | "*" | "/" | "%" | "==" | "!=" | "<" | ">" | "<=" | ">=" | "and" | "or";
|
|
40
|
-
export type AssignOp = "=" | "+=" | "-=";
|
|
41
|
-
export type PostfixOp = "++" | "--";
|
|
42
|
-
|
|
43
|
-
export interface Expression {
|
|
44
|
-
kind: "literal" | "variable" | "unary" | "binary" | "assign" | "postfix" | "index" | "call" | "expr_ref";
|
|
45
|
-
memo?: boolean;
|
|
46
|
-
value?: Literal;
|
|
47
|
-
name?: string;
|
|
48
|
-
op?: UnaryOp | BinaryOp | AssignOp | PostfixOp;
|
|
49
|
-
operand?: Expression;
|
|
50
|
-
left?: Expression;
|
|
51
|
-
right?: Expression;
|
|
52
|
-
target?: string;
|
|
53
|
-
object?: Expression;
|
|
54
|
-
key?: Expression;
|
|
55
|
-
callee?: Expression;
|
|
56
|
-
args?: Expression[];
|
|
57
|
-
exprId?: number; // for "expr_ref" kind
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface Attr { name: string; value: Literal | null; loc: Loc }
|
|
61
|
-
export interface TextNode { kind: "text"; value: string; loc: Loc }
|
|
62
|
-
export interface CompUse { kind: "use"; name: string; attrs: Attr[]; children: Child[]; loc: Loc }
|
|
63
|
-
export interface ExprNode { kind: "expr"; expression: Expression; loc: Loc }
|
|
64
|
-
export interface AssignStmt { kind: "assign_stmt"; expression: Expression; loc: Loc }
|
|
65
|
-
export interface IfBlock { kind: "if"; condition: Expression; body: Child[]; elseBody?: Child[]; persist?: boolean; loc: Loc }
|
|
66
|
-
export interface ForLoop { kind: "for"; keyVar?: string; itemVar: string; indexVar?: string; arrayVar: string; body: Child[]; loc: Loc }
|
|
67
|
-
export interface RemoveStmt { kind: "remove"; target: string; loc: Loc }
|
|
68
|
-
export interface ReturnStmt { kind: "return"; expression?: Expression; loc: Loc }
|
|
69
|
-
export interface ComponentExpr { kind: "component_expr"; children: Child[]; loc: Loc }
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
export type Child = TextNode | CompUse | ExprNode | AssignStmt | IfBlock | ForLoop | RemoveStmt | ReturnStmt | ComponentExpr;
|
|
73
|
-
|
|
74
|
-
export interface ParamDecl { name: string; paramType?: VarType; defaultVal?: Literal; loc: Loc }
|
|
75
|
-
|
|
76
|
-
export interface StyleBlock {
|
|
77
|
-
global: boolean;
|
|
78
|
-
lang: "css" | "scss";
|
|
79
|
-
raw: string;
|
|
80
|
-
target?: string;
|
|
81
|
-
extraAttrs: Record<string, string>;
|
|
82
|
-
loc: Loc;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface ScriptBlock { raw: string; attrs: Record<string, string>; loc: Loc }
|
|
86
|
-
export interface CompDef { name: string; params: ParamDecl[]; body: Child[]; styles: StyleBlock[]; scripts: ScriptBlock[]; loc: Loc }
|
|
87
|
-
export interface CustomElDecl { sinthName: string; tagName: string; exportTag?: string; params: ParamDecl[]; body: Child[]; styles: StyleBlock[]; scripts: ScriptBlock[]; varDecls: VarDeclaration[]; loc: Loc
|
|
88
|
-
}export interface CustomElInfo { tagName: string; params: ParamDecl[] }
|
|
89
|
-
|
|
90
|
-
export type VarType = "int" | "str" | "bool" | "str[]" | "obj" | "ui";
|
|
91
|
-
export interface VarDeclaration { kind: "var"; name: string; varType: VarType; value: Literal | null; loc: Loc }
|
|
92
|
-
|
|
93
|
-
export type ImportNode =
|
|
94
|
-
| { kind: "sinth"; path: string; loc: Loc }
|
|
95
|
-
| { kind: "css"; path: string; loc: Loc }
|
|
96
|
-
| { kind: "js"; name: string; alias?: string; loc: Loc };
|
|
97
|
-
|
|
98
|
-
export interface MetaEntry { key: string; value: Literal; loc: Loc }
|
|
99
|
-
|
|
100
|
-
export interface FunctionDef {
|
|
101
|
-
name: string;
|
|
102
|
-
params: ParamDecl[];
|
|
103
|
-
returnType?: VarType;
|
|
104
|
-
body: Child[];
|
|
105
|
-
loc: Loc;
|
|
106
|
-
}
|
|
107
|
-
export interface SinthFile {
|
|
108
|
-
filePath: string;
|
|
109
|
-
isPage: boolean;
|
|
110
|
-
imports: ImportNode[];
|
|
111
|
-
meta: MetaEntry[];
|
|
112
|
-
defs: CompDef[];
|
|
113
|
-
functions: FunctionDef[];
|
|
114
|
-
uses: CompUse[];
|
|
115
|
-
styles: StyleBlock[];
|
|
116
|
-
scripts: ScriptBlock[];
|
|
117
|
-
customEls: CustomElDecl[];
|
|
118
|
-
varDecls: VarDeclaration[];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface MixedBlockEntry {
|
|
122
|
-
id: string;
|
|
123
|
-
conditionJS: string;
|
|
124
|
-
ifJS: string;
|
|
125
|
-
ifHTML: string;
|
|
126
|
-
elseJS: string;
|
|
127
|
-
elseHTML: string;
|
|
128
|
-
replaceId?: string;
|
|
129
|
-
persist?: boolean;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export interface CompileCtx {
|
|
133
|
-
allDefs: Map<string, CompDef>;
|
|
134
|
-
functionDefs: FunctionDef[];
|
|
135
|
-
customEls: Map<string, CustomElInfo>;
|
|
136
|
-
cssLinks: string[];
|
|
137
|
-
jsLinks: { src: string; attrs: Record<string, string> }[];
|
|
138
|
-
scopeHash: string;
|
|
139
|
-
pageFile: string;
|
|
140
|
-
extraCSS: string[];
|
|
141
|
-
mixedBlocks: MixedBlockEntry[];
|
|
142
|
-
mixedCounter: number;
|
|
143
|
-
logicBlocks: string[];
|
|
144
|
-
ifIdCounter: number;
|
|
145
|
-
exprRegistry: string[];
|
|
146
|
-
exprMap: Map<string, number>;
|
|
147
|
-
varDecls?: VarDeclaration[];
|
|
148
|
-
actionButtons: { qid: string; delayMs: number; hide: boolean }[];
|
|
149
|
-
loopVars?: Set<string>;
|
|
150
|
-
diffingEnabled?: boolean;
|
|
151
|
-
declaredVars?: Set<string>;
|
|
152
|
-
// custom elements
|
|
153
|
-
scopePrefix?: string;
|
|
154
|
-
scopeVar?: string;
|
|
155
|
-
ceActionHandlers?: string[];
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export class SinthError extends Error {
|
|
159
|
-
constructor(
|
|
160
|
-
public readonly rawMsg: string,
|
|
161
|
-
public readonly loc?: Loc,
|
|
162
|
-
public readonly sourceLine?: string,
|
|
163
|
-
) {
|
|
164
|
-
super(SinthError.buildMessage(rawMsg, loc, sourceLine));
|
|
165
|
-
Object.setPrototypeOf(this, SinthError.prototype);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
static buildMessage(msg: string, loc?: Loc, sourceLine?: string): string {
|
|
169
|
-
let s = `Error: ${msg}`;
|
|
170
|
-
if (loc) {
|
|
171
|
-
s += `\n at: ${loc.file} (line ${loc.line}, col ${loc.col})`;
|
|
172
|
-
if (sourceLine !== undefined) {
|
|
173
|
-
const lineNum = String(loc.line).padStart(4);
|
|
174
|
-
const pointer = " ".repeat(Math.max(0, loc.col - 1)) + "^";
|
|
175
|
-
s += `\n${lineNum} | ${sourceLine}\n | ${pointer}`;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return s;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
withSource(lines: string[]): SinthError {
|
|
182
|
-
if (!this.loc || this.sourceLine !== undefined) return this;
|
|
183
|
-
const line = lines[this.loc.line - 1] ?? "";
|
|
184
|
-
return new SinthError(this.rawMsg, this.loc, line);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export class SinthWarning {
|
|
189
|
-
static emit(msg: string, loc?: Loc): void {
|
|
190
|
-
const where = loc ? `\n at: ${loc.file}:${loc.line}` : "";
|
|
191
|
-
process.stderr.write(`\x1b[33mWarning:\x1b[0m ${msg}${where}\n`);
|
|
192
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Sinth Compiler
|
|
3
|
+
|
|
4
|
+
import * as fs from "fs";
|
|
5
|
+
import * as path from "path";
|
|
6
|
+
import * as http from "http";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export interface Loc { file: string; line: number; col: number }
|
|
10
|
+
|
|
11
|
+
export enum TT {
|
|
12
|
+
LBRACE, RBRACE, LPAREN, RPAREN, COLON, COMMA, EQUALS, DOT,
|
|
13
|
+
LBRACKET, RBRACKET,
|
|
14
|
+
STRING, NUMBER, BOOL_TRUE, BOOL_FALSE, NULL_LIT,
|
|
15
|
+
RAW_BLOCK,
|
|
16
|
+
IDENT,
|
|
17
|
+
KW_IMPORT, KW_AS, KW_CSS,
|
|
18
|
+
KW_COMPONENT, KW_STYLE, KW_SCRIPT,
|
|
19
|
+
KW_GLOBAL, KW_PAGE, KW_LANG,
|
|
20
|
+
KW_CUSTOM_EL, KW_CUSTOM,
|
|
21
|
+
KW_IF, KW_ELSE, KW_FOR, KW_IN, KW_REMOVE,
|
|
22
|
+
KW_FUNCTION, KW_RETURN,
|
|
23
|
+
OP_PLUS, OP_MINUS, OP_STAR, OP_SLASH, OP_MOD, OP_SEMI,
|
|
24
|
+
OP_LT, OP_GT, OP_NEQ, OP_EQEQ, OP_LTEQ, OP_GTEQ,
|
|
25
|
+
OP_ARROW,
|
|
26
|
+
OP_NOT,
|
|
27
|
+
EOF,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface Token { type: TT; value: string; loc: Loc }
|
|
31
|
+
|
|
32
|
+
export type LitStr = { kind: "str"; value: string };
|
|
33
|
+
export type LitNum = { kind: "num"; value: number };
|
|
34
|
+
export type LitBool = { kind: "bool"; value: boolean };
|
|
35
|
+
export type LitNull = { kind: "null" };
|
|
36
|
+
export type Literal = LitStr | LitNum | LitBool | LitNull;
|
|
37
|
+
|
|
38
|
+
export type UnaryOp = "not" | "-";
|
|
39
|
+
export type BinaryOp = "+" | "-" | "*" | "/" | "%" | "==" | "!=" | "<" | ">" | "<=" | ">=" | "and" | "or";
|
|
40
|
+
export type AssignOp = "=" | "+=" | "-=";
|
|
41
|
+
export type PostfixOp = "++" | "--";
|
|
42
|
+
|
|
43
|
+
export interface Expression {
|
|
44
|
+
kind: "literal" | "variable" | "unary" | "binary" | "assign" | "postfix" | "index" | "call" | "expr_ref";
|
|
45
|
+
memo?: boolean;
|
|
46
|
+
value?: Literal;
|
|
47
|
+
name?: string;
|
|
48
|
+
op?: UnaryOp | BinaryOp | AssignOp | PostfixOp;
|
|
49
|
+
operand?: Expression;
|
|
50
|
+
left?: Expression;
|
|
51
|
+
right?: Expression;
|
|
52
|
+
target?: string;
|
|
53
|
+
object?: Expression;
|
|
54
|
+
key?: Expression;
|
|
55
|
+
callee?: Expression;
|
|
56
|
+
args?: Expression[];
|
|
57
|
+
exprId?: number; // for "expr_ref" kind
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface Attr { name: string; value: Literal | null; loc: Loc }
|
|
61
|
+
export interface TextNode { kind: "text"; value: string; loc: Loc }
|
|
62
|
+
export interface CompUse { kind: "use"; name: string; attrs: Attr[]; children: Child[]; loc: Loc }
|
|
63
|
+
export interface ExprNode { kind: "expr"; expression: Expression; loc: Loc }
|
|
64
|
+
export interface AssignStmt { kind: "assign_stmt"; expression: Expression; loc: Loc }
|
|
65
|
+
export interface IfBlock { kind: "if"; condition: Expression; body: Child[]; elseBody?: Child[]; persist?: boolean; loc: Loc }
|
|
66
|
+
export interface ForLoop { kind: "for"; keyVar?: string; itemVar: string; indexVar?: string; arrayVar: string; body: Child[]; loc: Loc }
|
|
67
|
+
export interface RemoveStmt { kind: "remove"; target: string; loc: Loc }
|
|
68
|
+
export interface ReturnStmt { kind: "return"; expression?: Expression; loc: Loc }
|
|
69
|
+
export interface ComponentExpr { kind: "component_expr"; children: Child[]; loc: Loc }
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
export type Child = TextNode | CompUse | ExprNode | AssignStmt | IfBlock | ForLoop | RemoveStmt | ReturnStmt | ComponentExpr;
|
|
73
|
+
|
|
74
|
+
export interface ParamDecl { name: string; paramType?: VarType; defaultVal?: Literal; loc: Loc }
|
|
75
|
+
|
|
76
|
+
export interface StyleBlock {
|
|
77
|
+
global: boolean;
|
|
78
|
+
lang: "css" | "scss";
|
|
79
|
+
raw: string;
|
|
80
|
+
target?: string;
|
|
81
|
+
extraAttrs: Record<string, string>;
|
|
82
|
+
loc: Loc;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface ScriptBlock { raw: string; attrs: Record<string, string>; loc: Loc }
|
|
86
|
+
export interface CompDef { name: string; params: ParamDecl[]; body: Child[]; styles: StyleBlock[]; scripts: ScriptBlock[]; loc: Loc }
|
|
87
|
+
export interface CustomElDecl { sinthName: string; tagName: string; exportTag?: string; params: ParamDecl[]; body: Child[]; styles: StyleBlock[]; scripts: ScriptBlock[]; varDecls: VarDeclaration[]; loc: Loc
|
|
88
|
+
}export interface CustomElInfo { tagName: string; params: ParamDecl[] }
|
|
89
|
+
|
|
90
|
+
export type VarType = "int" | "str" | "bool" | "str[]" | "obj" | "ui";
|
|
91
|
+
export interface VarDeclaration { kind: "var"; name: string; varType: VarType; value: Literal | null; loc: Loc }
|
|
92
|
+
|
|
93
|
+
export type ImportNode =
|
|
94
|
+
| { kind: "sinth"; path: string; loc: Loc }
|
|
95
|
+
| { kind: "css"; path: string; loc: Loc }
|
|
96
|
+
| { kind: "js"; name: string; alias?: string; loc: Loc };
|
|
97
|
+
|
|
98
|
+
export interface MetaEntry { key: string; value: Literal; loc: Loc }
|
|
99
|
+
|
|
100
|
+
export interface FunctionDef {
|
|
101
|
+
name: string;
|
|
102
|
+
params: ParamDecl[];
|
|
103
|
+
returnType?: VarType;
|
|
104
|
+
body: Child[];
|
|
105
|
+
loc: Loc;
|
|
106
|
+
}
|
|
107
|
+
export interface SinthFile {
|
|
108
|
+
filePath: string;
|
|
109
|
+
isPage: boolean;
|
|
110
|
+
imports: ImportNode[];
|
|
111
|
+
meta: MetaEntry[];
|
|
112
|
+
defs: CompDef[];
|
|
113
|
+
functions: FunctionDef[];
|
|
114
|
+
uses: CompUse[];
|
|
115
|
+
styles: StyleBlock[];
|
|
116
|
+
scripts: ScriptBlock[];
|
|
117
|
+
customEls: CustomElDecl[];
|
|
118
|
+
varDecls: VarDeclaration[];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface MixedBlockEntry {
|
|
122
|
+
id: string;
|
|
123
|
+
conditionJS: string;
|
|
124
|
+
ifJS: string;
|
|
125
|
+
ifHTML: string;
|
|
126
|
+
elseJS: string;
|
|
127
|
+
elseHTML: string;
|
|
128
|
+
replaceId?: string;
|
|
129
|
+
persist?: boolean;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface CompileCtx {
|
|
133
|
+
allDefs: Map<string, CompDef>;
|
|
134
|
+
functionDefs: FunctionDef[];
|
|
135
|
+
customEls: Map<string, CustomElInfo>;
|
|
136
|
+
cssLinks: string[];
|
|
137
|
+
jsLinks: { src: string; attrs: Record<string, string> }[];
|
|
138
|
+
scopeHash: string;
|
|
139
|
+
pageFile: string;
|
|
140
|
+
extraCSS: string[];
|
|
141
|
+
mixedBlocks: MixedBlockEntry[];
|
|
142
|
+
mixedCounter: number;
|
|
143
|
+
logicBlocks: string[];
|
|
144
|
+
ifIdCounter: number;
|
|
145
|
+
exprRegistry: string[];
|
|
146
|
+
exprMap: Map<string, number>;
|
|
147
|
+
varDecls?: VarDeclaration[];
|
|
148
|
+
actionButtons: { qid: string; delayMs: number; hide: boolean }[];
|
|
149
|
+
loopVars?: Set<string>;
|
|
150
|
+
diffingEnabled?: boolean;
|
|
151
|
+
declaredVars?: Set<string>;
|
|
152
|
+
// custom elements
|
|
153
|
+
scopePrefix?: string;
|
|
154
|
+
scopeVar?: string;
|
|
155
|
+
ceActionHandlers?: string[];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export class SinthError extends Error {
|
|
159
|
+
constructor(
|
|
160
|
+
public readonly rawMsg: string,
|
|
161
|
+
public readonly loc?: Loc,
|
|
162
|
+
public readonly sourceLine?: string,
|
|
163
|
+
) {
|
|
164
|
+
super(SinthError.buildMessage(rawMsg, loc, sourceLine));
|
|
165
|
+
Object.setPrototypeOf(this, SinthError.prototype);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
static buildMessage(msg: string, loc?: Loc, sourceLine?: string): string {
|
|
169
|
+
let s = `Error: ${msg}`;
|
|
170
|
+
if (loc) {
|
|
171
|
+
s += `\n at: ${loc.file} (line ${loc.line}, col ${loc.col})`;
|
|
172
|
+
if (sourceLine !== undefined) {
|
|
173
|
+
const lineNum = String(loc.line).padStart(4);
|
|
174
|
+
const pointer = " ".repeat(Math.max(0, loc.col - 1)) + "^";
|
|
175
|
+
s += `\n${lineNum} | ${sourceLine}\n | ${pointer}`;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return s;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
withSource(lines: string[]): SinthError {
|
|
182
|
+
if (!this.loc || this.sourceLine !== undefined) return this;
|
|
183
|
+
const line = lines[this.loc.line - 1] ?? "";
|
|
184
|
+
return new SinthError(this.rawMsg, this.loc, line);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export class SinthWarning {
|
|
189
|
+
static emit(msg: string, loc?: Loc): void {
|
|
190
|
+
const where = loc ? `\n at: ${loc.file}:${loc.line}` : "";
|
|
191
|
+
process.stderr.write(`\x1b[33mWarning:\x1b[0m ${msg}${where}\n`);
|
|
192
|
+
}
|
|
193
193
|
}
|