babel-plugin-vasille 5.1.1 → 5.1.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/lib/communication.js +2 -0
- package/lib/index.js +2 -0
- package/lib/jsx.js +4 -3
- package/lib/lib.js +1 -4
- package/lib/mesh.js +0 -3
- package/lib/transformer.js +29 -2
- package/package.json +5 -3
- package/types/call.d.ts +14 -0
- package/types/communication.d.ts +11 -0
- package/types/css-transformer.d.ts +3 -0
- package/types/expression.d.ts +27 -0
- package/types/index.d.ts +19 -0
- package/types/internal.d.ts +55 -0
- package/types/jsx-detect.d.ts +3 -0
- package/types/jsx.d.ts +11 -0
- package/types/lib.d.ts +30 -0
- package/types/mesh.d.ts +19 -0
- package/types/order-check.d.ts +3 -0
- package/types/process-types.d.ts +15 -0
- package/types/router.d.ts +2 -0
- package/types/transformer.d.ts +16 -0
- package/types/utils.d.ts +2 -0
package/lib/index.js
CHANGED
|
@@ -14,6 +14,8 @@ function default_1() {
|
|
|
14
14
|
headTag: !!params.opts.headTag,
|
|
15
15
|
bodyTag: !!params.opts.bodyTag,
|
|
16
16
|
shadow: !!params.opts.shadow,
|
|
17
|
+
throwAtFirstError: !!params.opts.throwAtFirstError,
|
|
18
|
+
reporter: typeof params.opts.reporter === "function" ? params.opts.reporter : undefined,
|
|
17
19
|
});
|
|
18
20
|
},
|
|
19
21
|
},
|
package/lib/jsx.js
CHANGED
|
@@ -284,7 +284,7 @@ function transformJsxElement(path, conditions, internal) {
|
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
286
|
else {
|
|
287
|
-
(0, lib_js_1.err)(lib_js_1.Errors.TokenNotSupported,
|
|
287
|
+
(0, lib_js_1.err)(lib_js_1.Errors.TokenNotSupported, attrPath, "Expected event handler", internal);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
else if (name.name === "class") {
|
|
@@ -349,7 +349,7 @@ function transformJsxElement(path, conditions, internal) {
|
|
|
349
349
|
// class={`a ${b}`}
|
|
350
350
|
else if (expressionPath && expressionPath.isExpression()) {
|
|
351
351
|
if ((0, lib_js_1.exprCall)(expressionPath, expressionPath.node, internal, { strong: true }, expressionPath.node)) {
|
|
352
|
-
|
|
352
|
+
internal.reportError("This will slow down your application", attrPath.node);
|
|
353
353
|
}
|
|
354
354
|
attrs.push(t.objectProperty(t.identifier("class"), expressionPath.node));
|
|
355
355
|
}
|
|
@@ -427,7 +427,7 @@ function transformJsxElement(path, conditions, internal) {
|
|
|
427
427
|
/* istanbul ignore else */
|
|
428
428
|
if (expressionPath && expressionPath.isExpression()) {
|
|
429
429
|
if ((0, lib_js_1.exprCall)(expressionPath, expressionPath.node, internal, { strong: true }, expressionPath.node)) {
|
|
430
|
-
|
|
430
|
+
internal.reportError("This will slow down your application", attrPath.node);
|
|
431
431
|
}
|
|
432
432
|
attrs.push(t.objectProperty(t.identifier("style"), expressionPath.node));
|
|
433
433
|
}
|
|
@@ -601,6 +601,7 @@ function transformJsxElement(path, conditions, internal) {
|
|
|
601
601
|
(0, lib_js_1.err)(lib_js_1.Errors.RulesOfVasille, path, "Malformed JSX If tag is missing", internal);
|
|
602
602
|
}
|
|
603
603
|
if (mapped === "If" || mapped === "ElseIf") {
|
|
604
|
+
/* istanbul ignore else */
|
|
604
605
|
if (t.isExpression(condition) && (t.isFunctionExpression(slot) || t.isArrowFunctionExpression(slot))) {
|
|
605
606
|
if (!conditions.cases) {
|
|
606
607
|
conditions.cases = [{ condition, slot }];
|
package/lib/lib.js
CHANGED
|
@@ -68,10 +68,7 @@ function err(e, node, content, internal, ret) {
|
|
|
68
68
|
Error.stackTraceLimit = 0;
|
|
69
69
|
const error = node.buildCodeFrameError(`Vasille[${e}]{${Errors[e]}}: ${content}`, Error);
|
|
70
70
|
Error.stackTraceLimit = limit;
|
|
71
|
-
|
|
72
|
-
internal.firstError = error;
|
|
73
|
-
}
|
|
74
|
-
console.log(error);
|
|
71
|
+
internal.reportError(`${Errors[e]}: ${content}`, node.node, error);
|
|
75
72
|
return ret;
|
|
76
73
|
}
|
|
77
74
|
function processCalculateCall(path, internal, area, name) {
|
package/lib/mesh.js
CHANGED
|
@@ -1130,9 +1130,6 @@ function composeStatement(path, internal) {
|
|
|
1130
1130
|
const argument = init.arguments[0];
|
|
1131
1131
|
const isReactive = (0, lib_js_1.exprCall)(initPath, initPath.node, internal, { name: idName(), strong: true }, declaration.node);
|
|
1132
1132
|
meshInit = !isReactive;
|
|
1133
|
-
if (!isReactive) {
|
|
1134
|
-
declaration.get("init").replaceWith((0, lib_js_1.ref)(argument, internal, declaration.node, idName()));
|
|
1135
|
-
}
|
|
1136
1133
|
(0, lib_js_1.checkReactiveName)(idPath, internal);
|
|
1137
1134
|
}
|
|
1138
1135
|
// let y = ref(2)
|
package/lib/transformer.js
CHANGED
|
@@ -207,6 +207,7 @@ function transformProgram(path, filename, opts) {
|
|
|
207
207
|
}
|
|
208
208
|
return t.callExpression(t.identifier(ids[key]), args);
|
|
209
209
|
}
|
|
210
|
+
const reports = [];
|
|
210
211
|
const internal = {
|
|
211
212
|
stack: new internal_js_1.StackedStates(),
|
|
212
213
|
mapping: new Map(),
|
|
@@ -330,6 +331,27 @@ function transformProgram(path, filename, opts) {
|
|
|
330
331
|
used.add("earlyInspector");
|
|
331
332
|
return t.identifier(ids["earlyInspector"]);
|
|
332
333
|
},
|
|
334
|
+
reportError(message, node, e) {
|
|
335
|
+
const pos = node.loc;
|
|
336
|
+
/* istanbul ignore else */
|
|
337
|
+
if (pos) {
|
|
338
|
+
reports.push({
|
|
339
|
+
message: message,
|
|
340
|
+
from: [pos.start.line, pos.start.column],
|
|
341
|
+
to: [pos.end.line, pos.end.column],
|
|
342
|
+
class: e ? "error" : "warning",
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
if (e) {
|
|
346
|
+
if (opts.throwAtFirstError) {
|
|
347
|
+
throw e;
|
|
348
|
+
}
|
|
349
|
+
console.error(e);
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
console.warn(message);
|
|
353
|
+
}
|
|
354
|
+
},
|
|
333
355
|
};
|
|
334
356
|
function getCtx() {
|
|
335
357
|
if (internal.isComposing)
|
|
@@ -369,8 +391,13 @@ function transformProgram(path, filename, opts) {
|
|
|
369
391
|
}
|
|
370
392
|
}
|
|
371
393
|
updateImports(path, internal, ids, used);
|
|
372
|
-
|
|
373
|
-
|
|
394
|
+
opts.reporter?.({
|
|
395
|
+
filePath: filename,
|
|
396
|
+
reports: reports,
|
|
397
|
+
});
|
|
398
|
+
if (reports.some(item => item.class === "error")) {
|
|
399
|
+
throw new Error("Compilation failed");
|
|
400
|
+
}
|
|
374
401
|
if (opts.devLayer) {
|
|
375
402
|
path.node.body.unshift(t.variableDeclaration("const", [t.variableDeclarator(filePathId, t.stringLiteral(internal.steelFilePath))]));
|
|
376
403
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-plugin-vasille",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.2",
|
|
4
4
|
"description": "Convert Vasille Meta Language code to pure JavaScript",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -8,11 +8,13 @@
|
|
|
8
8
|
"import": "./lib/index.js",
|
|
9
9
|
"browser": "./lib/index.js",
|
|
10
10
|
"node": "./lib/index.js",
|
|
11
|
-
"require": "./lib/index.js"
|
|
11
|
+
"require": "./lib/index.js",
|
|
12
|
+
"types": "./types/index.d.ts"
|
|
12
13
|
},
|
|
13
14
|
"scripts": {
|
|
14
15
|
"prepack": "cp -f ../README.md ./README.md",
|
|
15
16
|
"prettier": "prettier src test/**/*.ts* test/*.ts --write",
|
|
17
|
+
"prebuild": "rm -rf lib types",
|
|
16
18
|
"build": "tsc --build tsconfig-build.json",
|
|
17
19
|
"tsc-tests": "tsc --build test/tsconfig.json",
|
|
18
20
|
"test": "jest",
|
|
@@ -26,7 +28,7 @@
|
|
|
26
28
|
"babel"
|
|
27
29
|
],
|
|
28
30
|
"author": "lixcode",
|
|
29
|
-
"license": "
|
|
31
|
+
"license": "LGPL-2.1-only",
|
|
30
32
|
"bugs": {
|
|
31
33
|
"url": "https://github.com/vasille-js/vasille-js/issues"
|
|
32
34
|
},
|
package/types/call.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NodePath, types } from "@babel/core";
|
|
2
|
+
import { Internal } from "./internal.js";
|
|
3
|
+
export type FnNames = "compose" | "view" | "component" | "store" | "model" | "screen" | "page" | "modal" | "prompt" | "awaited" | "calculate" | "forward" | "watch" | "ref" | "bind" | "raw" | "arrayModel" | "setModel" | "mapModel" | "beforeMount" | "afterMount" | "beforeDestroy" | "router" | "theme" | "dark" | "mobile" | "tablet" | "laptop" | "prefersDark" | "prefersLight" | "styleSheet" | "share" | "receive" | "impute";
|
|
4
|
+
export declare const composeFunctions: ["compose", "store", "model", "view", "component", "page", "modal", "prompt", "screen"];
|
|
5
|
+
export declare const refFunctions: ["ref"];
|
|
6
|
+
export declare const asyncFunctions: ["awaited"];
|
|
7
|
+
export declare const bindFunctions: ["watch", "calculate", "bind"];
|
|
8
|
+
export declare const modelFunctions: ["arrayModel", "mapModel", "setModel"];
|
|
9
|
+
export declare const composeOnly: ["router", "beforeMount", "afterMount", "beforeDestroy"];
|
|
10
|
+
export declare const styleOnly: ["theme", "dark", "mobile", "tablet", "laptop", "prefersDark", "prefersLight", "styleSheet"];
|
|
11
|
+
export declare const dependencyInjections: ["share", "receive", "impute"];
|
|
12
|
+
export declare const hintFunctions: FnNames[];
|
|
13
|
+
export declare function calls(path: NodePath<types.CallExpression>, names: FnNames[], internal: Internal): boolean;
|
|
14
|
+
export declare function calls(path: NodePath<types.Expression | null | undefined>, names: FnNames[], internal: Internal): path is NodePath<types.CallExpression>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface CompilationErrorReport {
|
|
2
|
+
from: [number, number];
|
|
3
|
+
to: [number, number];
|
|
4
|
+
message: string;
|
|
5
|
+
class: "error" | "warning";
|
|
6
|
+
}
|
|
7
|
+
export interface CompilationErrorReports {
|
|
8
|
+
filePath: string;
|
|
9
|
+
reports: CompilationErrorReport[];
|
|
10
|
+
}
|
|
11
|
+
export type CompilationErrorReporter = (reports: CompilationErrorReports) => void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { NodePath, types } from "@babel/core";
|
|
2
|
+
import { Internal, StackedStates } from "./internal.js";
|
|
3
|
+
export interface Dependency {
|
|
4
|
+
node: types.Expression;
|
|
5
|
+
paramName: types.Identifier;
|
|
6
|
+
}
|
|
7
|
+
export interface Search {
|
|
8
|
+
found: Map<string, Dependency>;
|
|
9
|
+
external: Internal;
|
|
10
|
+
self: types.Expression | null;
|
|
11
|
+
inserted: Set<types.Expression>;
|
|
12
|
+
stack: StackedStates;
|
|
13
|
+
}
|
|
14
|
+
export declare function nodeIsMeshed(path: NodePath<types.Node | null | undefined>): boolean;
|
|
15
|
+
export declare function idIsIValue(path: NodePath<types.Identifier>): boolean;
|
|
16
|
+
export declare function memberIsIValue(node: types.MemberExpression | types.OptionalMemberExpression): boolean;
|
|
17
|
+
export declare function memberIsIValueInExpr(path: NodePath<types.MemberExpression | types.OptionalMemberExpression>, search: Search): boolean;
|
|
18
|
+
export declare function exprIsSure(path: NodePath<types.Expression | null | undefined>, internal: Internal): boolean | 1;
|
|
19
|
+
export declare function checkNode(path: NodePath<types.Node | null | undefined>, internal: Internal, area: types.Node, name?: string): Search;
|
|
20
|
+
export declare function checkOrIgnoreAllExpressions<T extends types.Node>(nodePaths: NodePath<types.Expression | null | T>[], search: Search): void;
|
|
21
|
+
export declare function checkAllExpressions(nodePaths: NodePath<types.Expression | null>[], search: Search): void;
|
|
22
|
+
export declare function checkAllUnknown(paths: NodePath<types.SpreadElement | types.ArgumentPlaceholder | types.Expression | null>[], internal: Search): void;
|
|
23
|
+
export declare function checkOrIgnoreExpression<T extends types.Node>(path: NodePath<types.Expression | null | undefined | T>, search: Search): void;
|
|
24
|
+
export declare function checkExpression(nodePath: NodePath<types.Expression | null | undefined>, search: Search): void;
|
|
25
|
+
export declare function checkStatements(paths: NodePath<types.Statement>[], search: Search): void;
|
|
26
|
+
export declare function checkStatement(path: NodePath<types.Statement | null | undefined>, search: Search): void;
|
|
27
|
+
export declare function checkFunction(path: NodePath<types.ArrowFunctionExpression | types.FunctionExpression | types.FunctionDeclaration | types.ObjectMethod>, search: Search): void;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as Babel from "@babel/core";
|
|
2
|
+
export default function (): Babel.PluginObj<{
|
|
3
|
+
file: {
|
|
4
|
+
opts: {
|
|
5
|
+
filename: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
opts: {
|
|
9
|
+
devLayer: unknown;
|
|
10
|
+
strictFolders: unknown;
|
|
11
|
+
replaceWeb: unknown;
|
|
12
|
+
headTag: unknown;
|
|
13
|
+
bodyTag: unknown;
|
|
14
|
+
shadow: unknown;
|
|
15
|
+
throwAtFirstError: unknown;
|
|
16
|
+
reporter: unknown;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
export type { CompilationErrorReporter, CompilationErrorReport, CompilationErrorReports } from "./communication";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { NodePath, types } from "@babel/core";
|
|
2
|
+
import { TSTypeElement } from "@babel/types";
|
|
3
|
+
export type VariableState = Record<string, 1>;
|
|
4
|
+
export declare class StackedStates {
|
|
5
|
+
private maps;
|
|
6
|
+
private checkingIndex;
|
|
7
|
+
constructor();
|
|
8
|
+
push(startChecking?: boolean): void;
|
|
9
|
+
pop(): void;
|
|
10
|
+
get(name: string, checkingContextOnly?: boolean): VariableState | undefined;
|
|
11
|
+
set(name: string, state: VariableState): void;
|
|
12
|
+
}
|
|
13
|
+
export interface Internal {
|
|
14
|
+
mapping: Map<string, string>;
|
|
15
|
+
interfaces: Map<string, TSTypeElement[]>;
|
|
16
|
+
componentsImports: Map<string, string>;
|
|
17
|
+
stack: StackedStates;
|
|
18
|
+
global: string;
|
|
19
|
+
prefix: string;
|
|
20
|
+
importStatement: NodePath<types.ImportDeclaration> | null;
|
|
21
|
+
stateOnly: boolean;
|
|
22
|
+
isComposing?: boolean;
|
|
23
|
+
isFunctionParsing?: boolean;
|
|
24
|
+
filename: string;
|
|
25
|
+
steelFilePath: string;
|
|
26
|
+
devLayer: boolean;
|
|
27
|
+
strictFolders: boolean;
|
|
28
|
+
stylesConnected: boolean;
|
|
29
|
+
replaceWeb: string;
|
|
30
|
+
headTag?: boolean;
|
|
31
|
+
bodyTag?: boolean;
|
|
32
|
+
shadow?: boolean;
|
|
33
|
+
reportError(message: string, node: types.Node, e?: Error): void;
|
|
34
|
+
ref(arg: types.Expression | null, area: types.Node, name: string | undefined): types.Expression;
|
|
35
|
+
expr(func: types.Expression, values: types.Expression[], codes: string[], area: types.Node, name: string | undefined): types.Expression;
|
|
36
|
+
setModel(arg: types.Expression | types.SpreadElement | types.ArgumentPlaceholder | null, usage: types.Node, name: string | undefined): types.Expression;
|
|
37
|
+
mapModel(arg: types.Expression | types.SpreadElement | types.ArgumentPlaceholder | null, usage: types.Node, name: string | undefined): types.Expression;
|
|
38
|
+
arrayModel(arg: types.Expression | types.SpreadElement | types.ArgumentPlaceholder | null, usage: types.Node, name: string | undefined): types.Expression;
|
|
39
|
+
ensure(arg: types.MemberExpression | types.OptionalMemberExpression, area: types.Node): types.Expression;
|
|
40
|
+
match(name: types.Expression, arg: types.Expression, area: types.Node): types.CallExpression;
|
|
41
|
+
set(obj: types.Expression, field: types.Expression, value: types.Expression, area: types.Node): types.CallExpression;
|
|
42
|
+
Switch(arg: types.ObjectExpression): types.CallExpression;
|
|
43
|
+
safe(arg: types.FunctionExpression | types.ArrowFunctionExpression): types.CallExpression;
|
|
44
|
+
updateIValue(assign: types.AssignmentExpression, left: types.Expression, right: types.Expression): types.Expression;
|
|
45
|
+
wrapFunctionBody(fn: types.FunctionDeclaration | types.ObjectMethod | types.ClassMethod | types.ClassPrivateMethod): void;
|
|
46
|
+
setupPosition(target: types.Expression, area: types.Node): types.Expression;
|
|
47
|
+
wrapFunction(fn: types.FunctionExpression | types.ArrowFunctionExpression): types.Node;
|
|
48
|
+
shareStateById(value: types.Expression, name: string): types.Expression;
|
|
49
|
+
positionedText(text: types.Expression, area: types.Node): types.Expression;
|
|
50
|
+
earlyInspector(): types.Expression;
|
|
51
|
+
}
|
|
52
|
+
export declare const ctx: types.Identifier;
|
|
53
|
+
export declare const runner: types.MemberExpression;
|
|
54
|
+
export declare const inspector: types.MemberExpression;
|
|
55
|
+
export declare const V: types.Identifier;
|
package/types/jsx.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NodePath, types } from "@babel/core";
|
|
2
|
+
import { Internal } from "./internal.js";
|
|
3
|
+
export interface ConditionCollection {
|
|
4
|
+
cases: {
|
|
5
|
+
condition: types.Expression;
|
|
6
|
+
slot: types.FunctionExpression | types.ArrowFunctionExpression;
|
|
7
|
+
}[] | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function transformJsx(path: NodePath<types.JSXElement | types.JSXFragment>, conditions: ConditionCollection, internal: Internal): types.Statement[];
|
|
10
|
+
export declare function transformJsxArray(paths: NodePath<types.JSXText | types.JSXExpressionContainer | types.JSXSpreadChild | types.JSXElement | types.JSXFragment>[], internal: Internal): types.Statement[];
|
|
11
|
+
export declare function processConditions(conditions: ConditionCollection, internal: Internal, _default?: types.FunctionExpression | types.ArrowFunctionExpression): types.Statement[];
|
package/types/lib.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NodePath, types } from "@babel/core";
|
|
2
|
+
import { Identifier } from "@babel/types";
|
|
3
|
+
import { Dependency } from "./expression.js";
|
|
4
|
+
import { Internal } from "./internal.js";
|
|
5
|
+
export declare enum Errors {
|
|
6
|
+
IncorrectArguments = 1,
|
|
7
|
+
IncompatibleContext = 2,
|
|
8
|
+
TokenNotSupported = 3,
|
|
9
|
+
Dilemma = 4,
|
|
10
|
+
ParserError = 5,
|
|
11
|
+
RulesOfVasille = 6
|
|
12
|
+
}
|
|
13
|
+
export declare function err(e: Errors, node: NodePath<unknown>, content: string, internal: Internal, ret?: undefined): void;
|
|
14
|
+
export declare function err<T>(e: Errors, node: NodePath<unknown>, content: string, internal: Internal, ret: T): T;
|
|
15
|
+
export declare function processCalculateCall(path: NodePath<types.CallExpression>, internal: Internal, area: types.Node, name: string | undefined): boolean;
|
|
16
|
+
export declare function parseCalculateCall(path: NodePath<types.Expression | null | undefined>, internal: Internal, area: types.Node, name: string | undefined): boolean;
|
|
17
|
+
export declare function bindCall(path: NodePath<types.Expression | null | undefined>, expr: types.Expression | null | undefined, data: Map<string, Dependency>, internal: Internal, name?: string): boolean;
|
|
18
|
+
export declare function exprCall(path: NodePath<types.Expression | null | undefined>, expr: types.Expression | null | undefined, internal: Internal, opts: {
|
|
19
|
+
name?: string;
|
|
20
|
+
strong?: boolean;
|
|
21
|
+
}, area: types.Node): boolean;
|
|
22
|
+
export declare function ref(expr: types.Node | null | undefined, internal: Internal, area: types.Node, name?: string): types.Expression;
|
|
23
|
+
export declare function arrayModel(args: types.CallExpression["arguments"], usage: types.Node, internal: Internal, name?: string): types.Expression;
|
|
24
|
+
export declare function setModel(args: types.CallExpression["arguments"], usage: types.Node, internal: Internal, name?: string): types.Expression;
|
|
25
|
+
export declare function mapModel(args: types.CallExpression["arguments"], usage: types.Node, internal: Internal, name?: string): types.Expression;
|
|
26
|
+
export declare function processModelCall(path: NodePath<types.CallExpression | types.NewExpression>, usage: types.Node, type: "Map" | "Set" | "Array", isConst: boolean, internal: Internal, name?: string): void;
|
|
27
|
+
export declare function checkReactiveName(idPath: NodePath<unknown>, internal: Internal): void;
|
|
28
|
+
export declare function checkNonReactiveName(idPath: NodePath<Identifier>, internal: Internal): void;
|
|
29
|
+
export declare function toKebabCase(name: string): string;
|
|
30
|
+
export declare function nameIsRestricted(name: string): boolean;
|
package/types/mesh.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NodePath, types } from "@babel/core";
|
|
2
|
+
import { Internal, VariableState } from "./internal.js";
|
|
3
|
+
export declare function meshOrIgnoreAllExpressions<T extends types.Node>(nodePaths: NodePath<types.Expression | null | T>[], internal: Internal): void;
|
|
4
|
+
export declare function meshAllExpressions(nodePaths: NodePath<types.Expression | null>[], internal: Internal): void;
|
|
5
|
+
export declare function meshComposeCall(name: string | null | undefined, path: NodePath<types.Node | null | undefined>, internal: Internal, isExported?: boolean): void;
|
|
6
|
+
export declare function meshAllUnknown(paths: NodePath<types.SpreadElement | types.ArgumentPlaceholder | types.Expression | null>[], internal: Internal): void;
|
|
7
|
+
export declare function meshLValue(path: NodePath<types.LVal | types.Expression | types.VoidPattern | null | undefined>, internal: Internal): void;
|
|
8
|
+
export declare function meshOrIgnoreExpression<T extends types.Node>(path: NodePath<types.Expression | types.VoidPattern | null | undefined | T>, internal: Internal): void;
|
|
9
|
+
export declare function meshExpression(nodePath: NodePath<types.Expression | null | undefined>, internal: Internal): void;
|
|
10
|
+
export declare function meshStatements(paths: NodePath<types.Statement>[], internal: Internal): void;
|
|
11
|
+
export declare function ignoreParams(path: NodePath<types.LVal | types.VoidPattern | null | undefined>, internal: Internal, allowReactiveId: false | ("id" | "array")[]): void;
|
|
12
|
+
export declare function reactiveArrayPattern(path: NodePath<types.LVal | types.OptionalMemberExpression | types.VoidPattern>, internal: Internal): void;
|
|
13
|
+
export declare function processObjectExpression(path: NodePath<types.ObjectExpression>, internal: Internal): VariableState;
|
|
14
|
+
export declare function meshStatement(path: NodePath<types.Statement | null | undefined>, internal: Internal): void;
|
|
15
|
+
export declare function meshFunction(path: NodePath<types.ArrowFunctionExpression | types.FunctionExpression | types.FunctionDeclaration | types.ObjectMethod | types.ClassMethod | types.ClassPrivateMethod>, internal: Internal): void;
|
|
16
|
+
export declare function composeExpression(path: NodePath<types.Expression | null | undefined>, internal: Internal): void;
|
|
17
|
+
export declare function composeStatements(paths: NodePath<types.Statement | null | undefined>[], internal: Internal): void;
|
|
18
|
+
export declare function composeStatement(path: NodePath<types.Statement | null | undefined>, internal: Internal): void;
|
|
19
|
+
export declare function compose(path: NodePath<types.ArrowFunctionExpression | types.FunctionExpression>, internal: Internal, isInternalSlot: boolean, isSlot: boolean): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { types } from "@babel/core";
|
|
2
|
+
import { TSTypeElement } from "@babel/types";
|
|
3
|
+
import { Internal } from "./internal";
|
|
4
|
+
declare const any = 0;
|
|
5
|
+
declare const string = 1;
|
|
6
|
+
declare const number = 2;
|
|
7
|
+
declare const boolean = 3;
|
|
8
|
+
type PropType = typeof string | typeof number | typeof boolean | typeof any;
|
|
9
|
+
export declare function registerInterface(name: string, members: TSTypeElement[], internal: Internal): void;
|
|
10
|
+
export declare function processUnion(type: types.TSUnionType): PropType;
|
|
11
|
+
export declare function processType(type: types.TSType): PropType;
|
|
12
|
+
export declare function processSignatures(members: TSTypeElement[]): types.ObjectExpression;
|
|
13
|
+
export declare function processTypeLiteral(literal: types.TSTypeLiteral): types.ObjectExpression;
|
|
14
|
+
export declare function processReference(id: types.TSTypeReference, internal: Internal): types.ObjectExpression | undefined;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NodePath, types } from "@babel/core";
|
|
2
|
+
import { Internal } from "./internal.js";
|
|
3
|
+
import { CompilationErrorReporter } from "./communication";
|
|
4
|
+
export interface TransformerOptions {
|
|
5
|
+
devLayer: boolean;
|
|
6
|
+
strictFolders: boolean;
|
|
7
|
+
replaceWeb: string | undefined;
|
|
8
|
+
headTag: boolean;
|
|
9
|
+
bodyTag: boolean;
|
|
10
|
+
shadow: boolean;
|
|
11
|
+
reporter: CompilationErrorReporter | undefined;
|
|
12
|
+
throwAtFirstError: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function nodeToStaticPosition(node: types.Node): types.ArrayExpression;
|
|
15
|
+
export declare function transformProgram(path: NodePath<types.Program>, filename: string, opts: TransformerOptions): void;
|
|
16
|
+
export declare function inspectorOf(internal: Internal): types.Expression;
|
package/types/utils.d.ts
ADDED