@mbler/mcx-core 0.0.8-rc.4 → 0.1.0

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.
@@ -1,4 +1,6 @@
1
- import { Plugin } from "rollup";
2
- import { CompileOpt } from "../types";
3
- import { transformCtx } from "../../types";
4
- export declare function mcxPlugn(opt: CompileOpt, output: transformCtx["output"]): Plugin;
1
+ import type { Plugin } from 'rollup';
2
+ import type { Plugin as RolldownPlugin } from 'rolldown';
3
+ import { CompileOpt } from '../types';
4
+ import { transformCtx } from '../../types';
5
+ export declare function rollupPlugin(opt: CompileOpt, output: transformCtx['output']): Plugin;
6
+ export declare function rolldownPlugin(opt: CompileOpt, output: transformCtx['output']): RolldownPlugin;
@@ -1 +1 @@
1
- export { mcxPlugn as plugin } from "./compiler/main";
1
+ export { rollupPlugin, rolldownPlugin } from "./compiler/main";
@@ -1,10 +1,10 @@
1
1
  import AST from "./ast/index.js";
2
- import { plugin } from "./compile-mcx/index.js";
2
+ import { rollupPlugin, rolldownPlugin } from "./compile-mcx/index.js";
3
3
  import utils from "./utils.js";
4
4
  import * as Compiler from "./compile-mcx/compiler";
5
5
  import * as PUBTYPE from "./types.js";
6
6
  import * as compile_component from "./mcx-component/index.js";
7
7
  import { transform } from "./transforms";
8
- export { PUBTYPE, AST, Compiler as compiler, utils, transform, compile_component, plugin };
8
+ export { PUBTYPE, AST, Compiler as compiler, utils, transform, compile_component, rollupPlugin, rolldownPlugin, };
9
9
  export { ItemComponent, BlockComponent, EntityComponent, PNGImageComponent, JPGImageComponent, SVGImageComponent, GIFImageComponent } from "./mcx-component/lib";
10
10
  export * as ComponentType from "./mcx-component/types";
@@ -1,4 +1,4 @@
1
- import type { ReadFileOpt, TypeVerifyBody } from "./types.js";
1
+ import type { ReadFileOpt, TypeVerifyBody } from './types.js';
2
2
  export default class McxUtlis {
3
3
  /**
4
4
  * 检查文件是否存在
@@ -14,6 +14,16 @@ export default class McxUtlis {
14
14
  */
15
15
  static readFile(filePath: string, opt?: ReadFileOpt): Promise<object | string>;
16
16
  static sleep(time: number): Promise<void>;
17
- static TypeVerify(obj: any, types: TypeVerifyBody): boolean;
17
+ static TypeVerify<T extends Record<string, any>, U extends TypeVerifyBody>(obj: T, types: U): obj is T & {
18
+ [P in keyof U]: {
19
+ boolean: boolean;
20
+ number: number;
21
+ string: string;
22
+ object: object;
23
+ function: Function;
24
+ bigint: bigint;
25
+ symbol: Symbol;
26
+ }[U[P]];
27
+ };
18
28
  static AbsoluteJoin(baseDir: string, inputPath: string): string;
19
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mbler/mcx-core",
3
- "version": "0.0.8-rc.4",
3
+ "version": "0.1.0",
4
4
  "description": "a DSL compiler of mcx",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [
@@ -25,6 +25,7 @@
25
25
  "@volar/language-core": "^2.4.28",
26
26
  "magic-string": "0.30.21",
27
27
  "rollup": "4.59.0",
28
+ "rolldown": "1.0.0-rc.18",
28
29
  "typescript": "5.9.3",
29
30
  "@mbler/mcx-types": "0.0.3-rc.4"
30
31
  },
@@ -42,17 +43,6 @@
42
43
  "types": "./dist/index.d.ts",
43
44
  "author": "ruanhor",
44
45
  "license": "MIT",
45
- "devDependencies": {
46
- "@rollup/plugin-commonjs": "29.0.1",
47
- "@rollup/plugin-json": "6.1.0",
48
- "@rollup/plugin-node-resolve": "16.0.3",
49
- "@rollup/plugin-terser": "0.4.4",
50
- "@rollup/plugin-typescript": "12.3.0",
51
- "@types/babel__generator": "7.27.0",
52
- "@types/babel__traverse": "7.28.0",
53
- "rollup-plugin-dts": "6.3.0",
54
- "tslib": "2.8.1"
55
- },
56
46
  "scripts": {
57
47
  "lint": "eslint src --ext .js,.ts",
58
48
  "lint:fix": "eslint src --ext .js,.ts --fix",