@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
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,74 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TransformPluginContext, Plugin } from 'rollup';
|
|
2
2
|
import * as t from '@babel/types';
|
|
3
3
|
import { Expression, CallExpression, SpreadElement, ArgumentPlaceholder, ImportDeclaration, ExportNamedDeclaration, ExportAllDeclaration, ExportDefaultDeclaration } from '@babel/types';
|
|
4
|
-
import {
|
|
4
|
+
import { CompileOpt } from '@mbler/mcx-types';
|
|
5
|
+
|
|
6
|
+
interface callList {
|
|
7
|
+
source: Expression;
|
|
8
|
+
set: (callEXp: CallExpression) => boolean;
|
|
9
|
+
arguments: Array<SpreadElement | Expression | ArgumentPlaceholder>;
|
|
10
|
+
remove: () => void;
|
|
11
|
+
}
|
|
12
|
+
interface ImportListImport {
|
|
13
|
+
isAll: boolean;
|
|
14
|
+
import?: string | undefined;
|
|
15
|
+
as: string;
|
|
16
|
+
}
|
|
17
|
+
interface ImportList {
|
|
18
|
+
source: string;
|
|
19
|
+
imported: ImportListImport[];
|
|
20
|
+
raw?: ImportDeclaration;
|
|
21
|
+
}
|
|
22
|
+
interface BuildCache {
|
|
23
|
+
call: callList[];
|
|
24
|
+
import: ImportList[];
|
|
25
|
+
export: Array<ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration>;
|
|
26
|
+
}
|
|
27
|
+
declare const _MCXstructureLocComponentTypes: {
|
|
28
|
+
readonly items: "item";
|
|
29
|
+
readonly blocks: "block";
|
|
30
|
+
readonly entities: "entity";
|
|
31
|
+
};
|
|
32
|
+
type MCXstructureLocComponentType = typeof _MCXstructureLocComponentTypes[keyof typeof _MCXstructureLocComponentTypes];
|
|
33
|
+
interface MCXstructureLoc {
|
|
34
|
+
script: string;
|
|
35
|
+
Event: {
|
|
36
|
+
on: "after" | "before";
|
|
37
|
+
subscribe: Record<string, string>;
|
|
38
|
+
loc: {
|
|
39
|
+
line: number;
|
|
40
|
+
column: number;
|
|
41
|
+
};
|
|
42
|
+
isLoad: boolean;
|
|
43
|
+
};
|
|
44
|
+
Component: Record<string, {
|
|
45
|
+
type: MCXstructureLocComponentType;
|
|
46
|
+
useExpore: string;
|
|
47
|
+
loc: {
|
|
48
|
+
line: number;
|
|
49
|
+
column: number;
|
|
50
|
+
};
|
|
51
|
+
}>;
|
|
52
|
+
UI: ParsedTagNode | null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declare class JsCompileData {
|
|
56
|
+
node: t.Program;
|
|
57
|
+
BuildCache: BuildCache;
|
|
58
|
+
File: string;
|
|
59
|
+
isFile: boolean;
|
|
60
|
+
constructor(node: t.Program, BuildCache?: BuildCache);
|
|
61
|
+
setFilePath(dir: string): void;
|
|
62
|
+
}
|
|
63
|
+
declare class MCXCompileData {
|
|
64
|
+
raw: ParsedTagNode[];
|
|
65
|
+
JSIR: JsCompileData;
|
|
66
|
+
strLoc: MCXstructureLoc;
|
|
67
|
+
File: string;
|
|
68
|
+
isFile: boolean;
|
|
69
|
+
constructor(raw: ParsedTagNode[], JSIR: JsCompileData, strLoc: MCXstructureLoc);
|
|
70
|
+
setFilePath(dir: string): void;
|
|
71
|
+
}
|
|
5
72
|
|
|
6
73
|
interface BaseToken {
|
|
7
74
|
data: string;
|
|
@@ -39,6 +106,7 @@ interface ParsedTagNode {
|
|
|
39
106
|
content: (ParsedTagContentNode | ParsedTagNode)[];
|
|
40
107
|
end: TagEndToken | null;
|
|
41
108
|
loc: MCXLoc;
|
|
109
|
+
type: "TagNode";
|
|
42
110
|
}
|
|
43
111
|
interface ParsedTagContentNode {
|
|
44
112
|
data: string;
|
|
@@ -61,7 +129,33 @@ interface ParseReadFileOpt {
|
|
|
61
129
|
want: 'string' | 'object';
|
|
62
130
|
}
|
|
63
131
|
type ReadFileOpt = Partial<ParseReadFileOpt>;
|
|
64
|
-
type mcxType = "component" | "event" | "app";
|
|
132
|
+
type mcxType = "component" | "event" | "app" | "ui";
|
|
133
|
+
|
|
134
|
+
interface transformCtx {
|
|
135
|
+
rollupContext: TransformPluginContext;
|
|
136
|
+
compiledCode: MCXCompileData;
|
|
137
|
+
cache: Map<string, MCXCompileData>;
|
|
138
|
+
currentId: string;
|
|
139
|
+
scriptTag: ParsedTagNode;
|
|
140
|
+
currentAST: t.Program;
|
|
141
|
+
mainFn: {
|
|
142
|
+
param: t.FunctionParameter[];
|
|
143
|
+
body: t.Statement[];
|
|
144
|
+
};
|
|
145
|
+
impAST: t.ImportDeclaration[];
|
|
146
|
+
opt: CompileOpt;
|
|
147
|
+
}
|
|
148
|
+
interface transformParseCtx {
|
|
149
|
+
prop: t.ObjectProperty[];
|
|
150
|
+
impBody: t.ImportDeclaration[];
|
|
151
|
+
mainFn: t.Statement[];
|
|
152
|
+
ctx: transformCtx;
|
|
153
|
+
app: ((data: t.ObjectProperty[]) => void) & {
|
|
154
|
+
prototype: {
|
|
155
|
+
enable: t.ObjectProperty[] | null;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
}
|
|
65
159
|
|
|
66
160
|
type types_AttributeMap = AttributeMap;
|
|
67
161
|
type types_BaseToken = BaseToken;
|
|
@@ -80,12 +174,12 @@ type types_Token = Token;
|
|
|
80
174
|
type types_TokenType = TokenType;
|
|
81
175
|
type types_TypeVerifyBody = TypeVerifyBody;
|
|
82
176
|
type types_mcxType = mcxType;
|
|
177
|
+
type types_transformCtx = transformCtx;
|
|
178
|
+
type types_transformParseCtx = transformParseCtx;
|
|
83
179
|
declare namespace types {
|
|
84
|
-
export type { types_AttributeMap as AttributeMap, types_BaseToken as BaseToken, types_ContentToken as ContentToken, types_JsType as JsType, types_MCXLoc as MCXLoc, types_ParseReadFileOpt as ParseReadFileOpt, types_ParsedTagContentNode as ParsedTagContentNode, types_ParsedTagNode as ParsedTagNode, types_PropNode as PropNode, types_PropValue as PropValue, types_ReadFileOpt as ReadFileOpt, types_TagEndToken as TagEndToken, types_TagToken as TagToken, types_Token as Token, types_TokenType as TokenType, types_TypeVerifyBody as TypeVerifyBody, types_mcxType as mcxType };
|
|
180
|
+
export type { types_AttributeMap as AttributeMap, types_BaseToken as BaseToken, types_ContentToken as ContentToken, types_JsType as JsType, types_MCXLoc as MCXLoc, types_ParseReadFileOpt as ParseReadFileOpt, types_ParsedTagContentNode as ParsedTagContentNode, types_ParsedTagNode as ParsedTagNode, types_PropNode as PropNode, types_PropValue as PropValue, types_ReadFileOpt as ReadFileOpt, types_TagEndToken as TagEndToken, types_TagToken as TagToken, types_Token as Token, types_TokenType as TokenType, types_TypeVerifyBody as TypeVerifyBody, types_mcxType as mcxType, types_transformCtx as transformCtx, types_transformParseCtx as transformParseCtx };
|
|
85
181
|
}
|
|
86
182
|
|
|
87
|
-
declare function PropParser(code: string): PropNode[];
|
|
88
|
-
|
|
89
183
|
declare class McxAst {
|
|
90
184
|
private text;
|
|
91
185
|
constructor(text: string);
|
|
@@ -100,58 +194,14 @@ declare class McxAst {
|
|
|
100
194
|
static generateCode(node: ParsedTagNode): string;
|
|
101
195
|
}
|
|
102
196
|
|
|
103
|
-
declare
|
|
197
|
+
declare function PropParser(code: string): PropNode[];
|
|
198
|
+
|
|
199
|
+
declare const _default: {
|
|
104
200
|
tag: typeof McxAst;
|
|
105
201
|
prop: typeof PropParser;
|
|
106
202
|
};
|
|
107
203
|
|
|
108
|
-
|
|
109
|
-
source: Expression;
|
|
110
|
-
set: (callEXp: CallExpression) => boolean;
|
|
111
|
-
arguments: Array<SpreadElement | Expression | ArgumentPlaceholder>;
|
|
112
|
-
remove: () => void;
|
|
113
|
-
}
|
|
114
|
-
interface ImportListImport {
|
|
115
|
-
isAll: boolean;
|
|
116
|
-
import?: string | undefined;
|
|
117
|
-
as: string;
|
|
118
|
-
}
|
|
119
|
-
interface ImportList {
|
|
120
|
-
source: string;
|
|
121
|
-
imported: ImportListImport[];
|
|
122
|
-
raw?: ImportDeclaration;
|
|
123
|
-
}
|
|
124
|
-
interface BuildCache {
|
|
125
|
-
call: callList[];
|
|
126
|
-
import: ImportList[];
|
|
127
|
-
export: Array<ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration>;
|
|
128
|
-
}
|
|
129
|
-
declare const _MCXstructureLocComponentTypes: {
|
|
130
|
-
readonly items: "item";
|
|
131
|
-
readonly blocks: "block";
|
|
132
|
-
readonly entities: "entity";
|
|
133
|
-
};
|
|
134
|
-
type MCXstructureLocComponentType = typeof _MCXstructureLocComponentTypes[keyof typeof _MCXstructureLocComponentTypes];
|
|
135
|
-
interface MCXstructureLoc {
|
|
136
|
-
script: string;
|
|
137
|
-
Event: {
|
|
138
|
-
on: "after" | "before";
|
|
139
|
-
subscribe: Record<string, string>;
|
|
140
|
-
loc: {
|
|
141
|
-
line: number;
|
|
142
|
-
pos: number;
|
|
143
|
-
};
|
|
144
|
-
isLoad: boolean;
|
|
145
|
-
};
|
|
146
|
-
Component: Record<string, {
|
|
147
|
-
type: MCXstructureLocComponentType;
|
|
148
|
-
useExpore: string;
|
|
149
|
-
loc: {
|
|
150
|
-
line: number;
|
|
151
|
-
pos: number;
|
|
152
|
-
};
|
|
153
|
-
}>;
|
|
154
|
-
}
|
|
204
|
+
declare function mcxPlugn(opt: CompileOpt): Plugin;
|
|
155
205
|
|
|
156
206
|
declare function CompileMcxDir(BuildOpt: CompileOpt): Promise<void>;
|
|
157
207
|
|
|
@@ -174,32 +224,14 @@ declare class McxUtlis {
|
|
|
174
224
|
static AbsoluteJoin(baseDir: string, inputPath: string): string;
|
|
175
225
|
}
|
|
176
226
|
|
|
177
|
-
declare class JsCompileData {
|
|
178
|
-
node: t.Program;
|
|
179
|
-
BuildCache: BuildCache;
|
|
180
|
-
File: string;
|
|
181
|
-
isFile: boolean;
|
|
182
|
-
constructor(node: t.Program, BuildCache?: BuildCache);
|
|
183
|
-
setFilePath(dir: string): void;
|
|
184
|
-
}
|
|
185
|
-
declare class MCXCompileData {
|
|
186
|
-
raw: ParsedTagNode[];
|
|
187
|
-
JSIR: JsCompileData;
|
|
188
|
-
strLoc: MCXstructureLoc;
|
|
189
|
-
File: string;
|
|
190
|
-
isFile: boolean;
|
|
191
|
-
constructor(raw: ParsedTagNode[], JSIR: JsCompileData, strLoc: MCXstructureLoc);
|
|
192
|
-
setFilePath(dir: string): void;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
227
|
declare class CompileError extends Error {
|
|
196
228
|
loc: {
|
|
197
229
|
line: number;
|
|
198
|
-
|
|
230
|
+
column: number;
|
|
199
231
|
};
|
|
200
232
|
constructor(message: string, loc: {
|
|
201
233
|
line: number;
|
|
202
|
-
|
|
234
|
+
column: number;
|
|
203
235
|
});
|
|
204
236
|
}
|
|
205
237
|
type Context = Record<string, t.Expression | {
|
|
@@ -224,29 +256,27 @@ declare class CompileJS {
|
|
|
224
256
|
declare function compileJSFn(code: string): JsCompileData;
|
|
225
257
|
declare function compileMCXFn(mcxCode: string): MCXCompileData;
|
|
226
258
|
|
|
227
|
-
type
|
|
228
|
-
declare const
|
|
229
|
-
type
|
|
230
|
-
declare const
|
|
231
|
-
type
|
|
232
|
-
declare const
|
|
233
|
-
declare const
|
|
234
|
-
declare namespace
|
|
235
|
-
export {
|
|
236
|
-
export type {
|
|
259
|
+
type index$1_CompileError = CompileError;
|
|
260
|
+
declare const index$1_CompileError: typeof CompileError;
|
|
261
|
+
type index$1_CompileJS = CompileJS;
|
|
262
|
+
declare const index$1_CompileJS: typeof CompileJS;
|
|
263
|
+
type index$1_Context = Context;
|
|
264
|
+
declare const index$1_compileJSFn: typeof compileJSFn;
|
|
265
|
+
declare const index$1_compileMCXFn: typeof compileMCXFn;
|
|
266
|
+
declare namespace index$1 {
|
|
267
|
+
export { index$1_CompileError as CompileError, index$1_CompileJS as CompileJS, index$1_compileJSFn as compileJSFn, index$1_compileMCXFn as compileMCXFn };
|
|
268
|
+
export type { index$1_Context as Context };
|
|
237
269
|
}
|
|
238
270
|
|
|
239
|
-
declare function
|
|
271
|
+
declare function compileComponent(compiledCode: MCXCompileData, project: string): Promise<void>;
|
|
240
272
|
|
|
241
|
-
declare const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
transform: typeof transform;
|
|
250
|
-
};
|
|
273
|
+
declare const index_compileComponent: typeof compileComponent;
|
|
274
|
+
declare namespace index {
|
|
275
|
+
export {
|
|
276
|
+
index_compileComponent as compileComponent,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
declare function transform(code: MCXCompileData, cache: Map<string, MCXCompileData>, id: string, context: TransformPluginContext, opt: CompileOpt): Promise<string>;
|
|
251
281
|
|
|
252
|
-
export { _default
|
|
282
|
+
export { _default as AST, index$1 as Compiler, types as PUBTYPE, CompileMcxDir as compile, index as compile_component, mcxPlugn as plugin, transform, McxUtlis as utils };
|