@mbler/mcx-core 0.0.2 → 0.0.3-alpha.r20260311
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/index.d.ts +126 -96
- package/dist/index.js +493 -1634
- package/dist/index.js.map +1 -1
- package/dist/types/compile-mcx/compiler/index.d.ts +2 -2
- package/dist/types/compile-mcx/compiler/main.d.ts +2 -0
- package/dist/types/compile-mcx/index.d.ts +1 -0
- package/dist/types/compile-mcx/types.d.ts +4 -2
- package/dist/types/index.d.ts +3 -13
- package/dist/types/mcx-component/index.d.ts +2 -0
- package/dist/types/{compile-component → mcx-component}/lib.d.ts +0 -3
- package/dist/types/transforms/config.d.ts +2 -0
- package/dist/types/transforms/index.d.ts +3 -3
- package/dist/types/transforms/main.d.ts +2 -0
- package/dist/types/transforms/utils.d.ts +20 -5
- package/dist/types/transforms/x-comp/index.d.ts +3 -0
- package/dist/types/transforms/x-comp/x-app.d.ts +2 -0
- package/dist/types/transforms/x-comp/x-event.d.ts +2 -0
- package/dist/types/transforms/x-comp/x-ui.d.ts +2 -0
- package/dist/types/types.d.ts +31 -1
- package/package.json +15 -12
- package/dist/types/compile-component/index.d.ts +0 -4
- package/dist/types/compile-mcx/compiler/bundler.d.ts +0 -2
- package/dist/types/compile-mcx/compiler/str.d.ts +0 -6
- /package/dist/types/{compile-component → mcx-component}/types.d.ts +0 -0
- /package/dist/types/{compile-component → mcx-component}/utils.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import { TransformPluginContext } from "rollup";
|
|
1
2
|
import { MCXCompileData } from "../compile-mcx/compiler/compileData";
|
|
2
|
-
import { CompileOpt } from "
|
|
3
|
-
|
|
4
|
-
export declare function transform(compileData: MCXCompileData, cache: Map<string, MCXCompileData>, id: string, context: TransformPluginContext, opt: CompileOpt): Promise<string>;
|
|
3
|
+
import { CompileOpt } from "@mbler/mcx-types";
|
|
4
|
+
export declare function transform(code: MCXCompileData, cache: Map<string, MCXCompileData>, id: string, context: TransformPluginContext, opt: CompileOpt): Promise<string>;
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { JsCompileData } from "../compile-mcx/compiler/compileData";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare function
|
|
6
|
-
declare function
|
|
7
|
-
|
|
3
|
+
import { ParsedTagNode, transformCtx } from "../types";
|
|
4
|
+
declare function extrectVarDefIdList(express: t.LVal | t.VoidPattern): string[];
|
|
5
|
+
declare function extractIdList(expression: t.Declaration): string[];
|
|
6
|
+
declare function generateMain(code: JsCompileData): [t.Statement[], t.ImportDeclaration[]];
|
|
7
|
+
declare function generateEventConfig(eventTag: ParsedTagNode, ctx: transformCtx, impBody: t.ImportDeclaration[]): Promise<t.ObjectExpression>;
|
|
8
|
+
/**
|
|
9
|
+
* record enable
|
|
10
|
+
* @returns {(): void} - only call one
|
|
11
|
+
*/
|
|
12
|
+
declare function _enable(): (() => void) & {
|
|
13
|
+
prototype: {
|
|
14
|
+
enable: boolean;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
declare function _enableWithData<T extends any>(): ((data: T) => void) & {
|
|
18
|
+
prototype: {
|
|
19
|
+
enable: T | null;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export { extractIdList, extrectVarDefIdList, generateEventConfig, _enable, generateMain, _enableWithData };
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { TransformPluginContext } from "rollup";
|
|
2
|
+
import type { MCXCompileData } from "./compile-mcx/compiler/compileData";
|
|
3
|
+
import { CompileOpt } from "@mbler/mcx-types";
|
|
4
|
+
import * as t from "@babel/types";
|
|
1
5
|
interface BaseToken {
|
|
2
6
|
data: string;
|
|
3
7
|
type: TokenType;
|
|
@@ -34,6 +38,7 @@ interface ParsedTagNode {
|
|
|
34
38
|
content: (ParsedTagContentNode | ParsedTagNode)[];
|
|
35
39
|
end: TagEndToken | null;
|
|
36
40
|
loc: MCXLoc;
|
|
41
|
+
type: "TagNode";
|
|
37
42
|
}
|
|
38
43
|
interface ParsedTagContentNode {
|
|
39
44
|
data: string;
|
|
@@ -56,5 +61,30 @@ export interface ParseReadFileOpt {
|
|
|
56
61
|
want: 'string' | 'object';
|
|
57
62
|
}
|
|
58
63
|
export type ReadFileOpt = Partial<ParseReadFileOpt>;
|
|
59
|
-
export type mcxType = "component" | "event" | "app";
|
|
64
|
+
export type mcxType = "component" | "event" | "app" | "ui";
|
|
60
65
|
export type { Token, ContentToken, TagEndToken, TagToken, BaseToken, AttributeMap, PropValue, TokenType, ParsedTagContentNode, TypeVerifyBody, JsType, PropNode, ParsedTagNode, MCXLoc };
|
|
66
|
+
export interface transformCtx {
|
|
67
|
+
rollupContext: TransformPluginContext;
|
|
68
|
+
compiledCode: MCXCompileData;
|
|
69
|
+
cache: Map<string, MCXCompileData>;
|
|
70
|
+
currentId: string;
|
|
71
|
+
scriptTag: ParsedTagNode;
|
|
72
|
+
currentAST: t.Program;
|
|
73
|
+
mainFn: {
|
|
74
|
+
param: t.FunctionParameter[];
|
|
75
|
+
body: t.Statement[];
|
|
76
|
+
};
|
|
77
|
+
impAST: t.ImportDeclaration[];
|
|
78
|
+
opt: CompileOpt;
|
|
79
|
+
}
|
|
80
|
+
export interface transformParseCtx {
|
|
81
|
+
prop: t.ObjectProperty[];
|
|
82
|
+
impBody: t.ImportDeclaration[];
|
|
83
|
+
mainFn: t.Statement[];
|
|
84
|
+
ctx: transformCtx;
|
|
85
|
+
app: ((data: t.ObjectProperty[]) => void) & {
|
|
86
|
+
prototype: {
|
|
87
|
+
enable: t.ObjectProperty[] | null;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbler/mcx-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-alpha.r20260311",
|
|
4
4
|
"description": "a DSL compiler of mcx",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "cd __test__ && npm run test",
|
|
8
|
-
"build": "rollup -c"
|
|
8
|
+
"build": "rollup -c",
|
|
9
|
+
"publish": "BUILD_MODULE=release rollup -c && npm publish"
|
|
9
10
|
},
|
|
10
11
|
"keywords": [
|
|
11
12
|
"compiler",
|
|
@@ -16,12 +17,7 @@
|
|
|
16
17
|
"@babel/generator": "7.28.5",
|
|
17
18
|
"@babel/parser": "7.28.5",
|
|
18
19
|
"@babel/types": "7.28.6",
|
|
19
|
-
"
|
|
20
|
-
"@rollup/plugin-json": "^6.1.0",
|
|
21
|
-
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
22
|
-
"@rollup/plugin-typescript": "^12.3.0",
|
|
23
|
-
"magic-string": "^0.30.21",
|
|
24
|
-
"rollup": "^4.57.1"
|
|
20
|
+
"magic-string": "0.30.21"
|
|
25
21
|
},
|
|
26
22
|
"module": "commjs",
|
|
27
23
|
"files": [
|
|
@@ -38,9 +34,16 @@
|
|
|
38
34
|
"license": "MIT",
|
|
39
35
|
"devDependencies": {
|
|
40
36
|
"@mbler/mcx-types": "latest",
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"rollup
|
|
44
|
-
"
|
|
37
|
+
"@rollup/plugin-commonjs": "29.0.1",
|
|
38
|
+
"@rollup/plugin-json": "6.1.0",
|
|
39
|
+
"@rollup/plugin-node-resolve": "16.0.3",
|
|
40
|
+
"@rollup/plugin-typescript": "12.3.0",
|
|
41
|
+
"@types/babel__generator": "7.27.0",
|
|
42
|
+
"@types/babel__traverse": "7.28.0",
|
|
43
|
+
"@types/node": "25.3.5",
|
|
44
|
+
"rollup": "4.59.0",
|
|
45
|
+
"rollup-plugin-dts": "6.3.0",
|
|
46
|
+
"tslib": "2.8.1",
|
|
47
|
+
"typescript": "5.9.3"
|
|
45
48
|
}
|
|
46
49
|
}
|
|
File without changes
|
|
File without changes
|