@mulanjs/mulanjs 1.0.1-dev.20260212143840

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.
Files changed (53) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/compiler/compiler.js +90 -0
  4. package/dist/compiler/script-compiler.js +314 -0
  5. package/dist/compiler/sfc-parser.js +93 -0
  6. package/dist/compiler/style-compiler.js +56 -0
  7. package/dist/compiler/template-compiler.js +442 -0
  8. package/dist/components/bloch-sphere.js +252 -0
  9. package/dist/core/component.js +145 -0
  10. package/dist/core/hooks.js +229 -0
  11. package/dist/core/quantum.js +284 -0
  12. package/dist/core/query.js +63 -0
  13. package/dist/core/reactive.js +105 -0
  14. package/dist/core/renderer.js +70 -0
  15. package/dist/core/vault.js +81 -0
  16. package/dist/index.js +52 -0
  17. package/dist/mulan.esm.js +1948 -0
  18. package/dist/mulan.js +215 -0
  19. package/dist/router/index.js +210 -0
  20. package/dist/security/sanitizer.js +47 -0
  21. package/dist/store/index.js +42 -0
  22. package/dist/types/compiler/compiler.d.ts +7 -0
  23. package/dist/types/compiler/script-compiler.d.ts +8 -0
  24. package/dist/types/compiler/sfc-parser.d.ts +21 -0
  25. package/dist/types/compiler/style-compiler.d.ts +7 -0
  26. package/dist/types/compiler/template-compiler.d.ts +7 -0
  27. package/dist/types/compiler.d.ts +7 -0
  28. package/dist/types/components/bloch-sphere.d.ts +16 -0
  29. package/dist/types/core/component.d.ts +54 -0
  30. package/dist/types/core/hooks.d.ts +49 -0
  31. package/dist/types/core/quantum.d.ts +50 -0
  32. package/dist/types/core/query.d.ts +14 -0
  33. package/dist/types/core/reactive.d.ts +21 -0
  34. package/dist/types/core/renderer.d.ts +4 -0
  35. package/dist/types/core/vault.d.ts +12 -0
  36. package/dist/types/index.d.ts +70 -0
  37. package/dist/types/router/index.d.ts +24 -0
  38. package/dist/types/script-compiler.d.ts +8 -0
  39. package/dist/types/security/sanitizer.d.ts +17 -0
  40. package/dist/types/sfc-parser.d.ts +21 -0
  41. package/dist/types/store/index.d.ts +10 -0
  42. package/dist/types/style-compiler.d.ts +7 -0
  43. package/dist/types/template-compiler.d.ts +7 -0
  44. package/package.json +64 -0
  45. package/src/cli/extensions/mulanjs-vscode-1.0.0.vsix +0 -0
  46. package/src/cli/index.js +600 -0
  47. package/src/compiler/compiler.ts +102 -0
  48. package/src/compiler/script-compiler.ts +336 -0
  49. package/src/compiler/sfc-parser.ts +118 -0
  50. package/src/compiler/style-compiler.ts +66 -0
  51. package/src/compiler/template-compiler.ts +519 -0
  52. package/src/compiler/tsconfig.json +13 -0
  53. package/src/loader/index.js +81 -0
@@ -0,0 +1,47 @@
1
+ export class Security {
2
+ static sanitize(input) {
3
+ // 1. Basic entity encoding
4
+ let secure = input
5
+ .replace(/&/g, "&")
6
+ .replace(/</g, "&lt;")
7
+ .replace(/>/g, "&gt;")
8
+ .replace(/"/g, "&quot;")
9
+ .replace(/'/g, "&#039;");
10
+ // 2. Remove dangerous events (extra layer if encoding fails)
11
+ const dangerousEvents = ['onload', 'onclick', 'onerror', 'onmouseover', 'onfocus'];
12
+ dangerousEvents.forEach(event => {
13
+ const regex = new RegExp(event, 'gi');
14
+ secure = secure.replace(regex, 'data-blocked-' + event);
15
+ });
16
+ return secure;
17
+ }
18
+ /**
19
+ * Generates a strict Content Security Policy header value.
20
+ * @param options Configuration for allowed sources
21
+ */
22
+ static generateCSP(options = {}) {
23
+ const scriptSrc = ["'self'", ...(options.scriptSrc || [])].join(" ");
24
+ const styleSrc = ["'self'", "'unsafe-inline'", ...(options.styleSrc || [])].join(" ");
25
+ return `default-src 'self'; script-src ${scriptSrc}; style-src ${styleSrc}; object-src 'none'; base-uri 'self';`;
26
+ }
27
+ static validateUrl(url) {
28
+ // Basic URL validation
29
+ const pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
30
+ '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
31
+ '((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
32
+ '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
33
+ '(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
34
+ '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
35
+ return !!pattern.test(url);
36
+ }
37
+ /**
38
+ * Prevents XSS by sanitizing common input fields on blur.
39
+ * Can be used as a utility in forms.
40
+ */
41
+ static preventXSS(inputElement) {
42
+ inputElement.addEventListener('blur', (e) => {
43
+ const target = e.target;
44
+ target.value = Security.sanitize(target.value);
45
+ });
46
+ }
47
+ }
@@ -0,0 +1,42 @@
1
+ import { reactive, effect } from '../core/reactive';
2
+ export class MuStore {
3
+ constructor(initialState, options) {
4
+ this.subscribers = [];
5
+ // Load from local storage if persist is true
6
+ let loadedState = initialState;
7
+ if (options === null || options === void 0 ? void 0 : options.persist) {
8
+ const key = options.key || 'mulan-store';
9
+ try {
10
+ const stored = localStorage.getItem(key);
11
+ if (stored) {
12
+ loadedState = Object.assign(Object.assign({}, initialState), JSON.parse(stored));
13
+ }
14
+ }
15
+ catch (e) {
16
+ console.error("Failed to load state", e);
17
+ }
18
+ // Auto-save effect
19
+ effect(() => {
20
+ localStorage.setItem(key, JSON.stringify(this.state));
21
+ });
22
+ }
23
+ this.state = reactive(loadedState);
24
+ }
25
+ // Subscribe to changes
26
+ subscribe(fn) {
27
+ this.subscribers.push(fn);
28
+ effect(() => {
29
+ fn(this.state);
30
+ });
31
+ }
32
+ // Action dispatcher pattern
33
+ dispatch(action) {
34
+ const result = action(this.state);
35
+ if (result instanceof Promise) {
36
+ result.then(() => {
37
+ // Optional: Notify subscribers of async completion if needed manually?
38
+ // But reactive() handles updates automatically.
39
+ });
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,7 @@
1
+ export interface CompileResult {
2
+ code: string;
3
+ css: string;
4
+ errors: string[];
5
+ map?: string;
6
+ }
7
+ export declare function compileSFC(source: string, filename: string): CompileResult;
@@ -0,0 +1,8 @@
1
+ import { SFCDescriptor } from './sfc-parser';
2
+ export interface ScriptCompileResult {
3
+ code: string;
4
+ bindings?: string[];
5
+ errors: string[];
6
+ map?: string;
7
+ }
8
+ export declare function compileScript(descriptor: SFCDescriptor): ScriptCompileResult;
@@ -0,0 +1,21 @@
1
+ export interface SFCBlock {
2
+ type: 'script' | 'template' | 'style';
3
+ content: string;
4
+ attrs: Record<string, string>;
5
+ start: number;
6
+ end: number;
7
+ }
8
+ export interface SFCDescriptor {
9
+ filename: string;
10
+ source: string;
11
+ template: SFCBlock | null;
12
+ script: SFCBlock | null;
13
+ scripts: SFCBlock[];
14
+ styles: SFCBlock[];
15
+ customBlocks: SFCBlock[];
16
+ }
17
+ /**
18
+ * Standardized State-Machine Parser for MulanJS
19
+ * Parses .mujs files safely, handling attributes, quotes, and nested content.
20
+ */
21
+ export declare function parseMUJS(source: string, filename: string): SFCDescriptor;
@@ -0,0 +1,7 @@
1
+ import { SFCDescriptor } from './sfc-parser';
2
+ export interface StyleCompileResult {
3
+ css: string;
4
+ scopedId?: string;
5
+ errors: string[];
6
+ }
7
+ export declare function compileStyle(descriptor: SFCDescriptor, filename: string): StyleCompileResult;
@@ -0,0 +1,7 @@
1
+ import { SFCDescriptor } from './sfc-parser';
2
+ import { ScriptCompileResult } from './script-compiler';
3
+ export interface TemplateCompileResult {
4
+ code: string;
5
+ errors: string[];
6
+ }
7
+ export declare function compileTemplate(descriptor: SFCDescriptor, scriptResult: ScriptCompileResult, scopedId?: string): TemplateCompileResult;
@@ -0,0 +1,7 @@
1
+ export interface CompileResult {
2
+ code: string;
3
+ css: string;
4
+ errors: string[];
5
+ map?: string;
6
+ }
7
+ export declare function compileSFC(source: string, filename: string): CompileResult;
@@ -0,0 +1,16 @@
1
+ export declare class MuBlochSphereElement extends HTMLElement {
2
+ private _qubit;
3
+ private _arrow;
4
+ private _container;
5
+ private _disposeEffect;
6
+ static get observedAttributes(): string[];
7
+ constructor();
8
+ connectedCallback(): void;
9
+ disconnectedCallback(): void;
10
+ set qubit(val: any);
11
+ get qubit(): any;
12
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
13
+ initReactivity(): void;
14
+ updateArrow(theta: number, phi: number): void;
15
+ render(): void;
16
+ }
@@ -0,0 +1,54 @@
1
+ export type FunctionalSetup = () => (() => string);
2
+ export declare abstract class MuComponent {
3
+ state: any;
4
+ container: HTMLElement;
5
+ $uid: string;
6
+ _hooks: {
7
+ onMuInit?: Array<() => void>;
8
+ onMuMount?: Array<() => void>;
9
+ onMuDestroy?: Array<() => void>;
10
+ };
11
+ _effects: Array<() => void>;
12
+ _isDestroyed: boolean;
13
+ constructor(container: HTMLElement);
14
+ setup(): void;
15
+ abstract template(): string;
16
+ onMount(): void;
17
+ onUpdate(): void;
18
+ onDestroy(): void;
19
+ _propsQueue: Array<[string, string, any]>;
20
+ _eventQueue: Array<[string, string, Function]>;
21
+ _b(id: string, prop: string, value: any): string;
22
+ _e(id: string, type: string, handler: Function): string;
23
+ mount(): void;
24
+ update(): void;
25
+ flushProps(): void;
26
+ flushEvents(): void;
27
+ }
28
+ export declare function defineComponent(optionsOrSetup: any): {
29
+ new (container: HTMLElement): {
30
+ setup(): void;
31
+ template(): string;
32
+ state: any;
33
+ container: HTMLElement;
34
+ $uid: string;
35
+ _hooks: {
36
+ onMuInit?: Array<() => void>;
37
+ onMuMount?: Array<() => void>;
38
+ onMuDestroy?: Array<() => void>;
39
+ };
40
+ _effects: Array<() => void>;
41
+ _isDestroyed: boolean;
42
+ onMount(): void;
43
+ onUpdate(): void;
44
+ onDestroy(): void;
45
+ _propsQueue: Array<[string, string, any]>;
46
+ _eventQueue: Array<[string, string, Function]>;
47
+ _b(id: string, prop: string, value: any): string;
48
+ _e(id: string, type: string, handler: Function): string;
49
+ mount(): void;
50
+ update(): void;
51
+ flushProps(): void;
52
+ flushEvents(): void;
53
+ };
54
+ };
@@ -0,0 +1,49 @@
1
+ export declare function setCurrentInstance(instance: any): void;
2
+ export declare function getCurrentInstance(): any;
3
+ export declare function muState<T>(initialValue: T): any;
4
+ export declare function muMemo<T>(computeFn: () => T): {
5
+ value: T;
6
+ };
7
+ export declare function muEffect(fn: () => void): void;
8
+ export declare function onMuInit(fn: () => void): void;
9
+ export declare function onMuMount(fn: () => void): void;
10
+ export declare function onMuDestroy(fn: () => void): void;
11
+ /**
12
+ * onMuIdle - The "Environment Life" Hook.
13
+ * Executes heavy logic ONLY when the browser is taking a nap (idle).
14
+ */
15
+ export declare function onMuIdle(fn: () => void): void;
16
+ /**
17
+ * onMuResume - The "Tab Life" Hook.
18
+ * Executes when the user switches BACK to this tab.
19
+ * Perfect for refreshing data or resuming animations to save battery.
20
+ */
21
+ export declare function onMuResume(fn: () => void): void;
22
+ /**
23
+ * onMuShake - The "Physical Life" Hook.
24
+ * Executes when the device is shaken.
25
+ * Usage: Undo, Refresh, or "Rage Quit" easter eggs.
26
+ */
27
+ export declare function onMuShake(fn: () => void): void;
28
+ /**
29
+ * onMuVoice - The "Sound Life" Hook.
30
+ * Executes when a specific word is spoken.
31
+ * @param command The word to listen for (e.g., "save", "next")
32
+ * @param fn The action to take
33
+ */
34
+ export declare function onMuVoice(command: string, fn: () => void): void;
35
+ /**
36
+ * muGeom - Tracks window or element dimensions reactively.
37
+ */
38
+ export declare function muGeom(): any;
39
+ /**
40
+ * muPulse - Reactive network status.
41
+ */
42
+ export declare function muPulse(): any;
43
+ /**
44
+ * muVault - Secure reactive LocalStorage wrapper.
45
+ * Powered by the Iron Fortress persistent primitive.
46
+ */
47
+ export declare function muVault<T>(key: string, initial: T, options?: {
48
+ encrypt?: boolean;
49
+ }): any;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Mulan Quantum (ASTR-Q+) Core
3
+ * Advanced Simulation Engine for multi-qubit registers and entanglement.
4
+ */
5
+ export interface Amplitude {
6
+ re: number;
7
+ im: number;
8
+ }
9
+ export interface QuantumState {
10
+ size: number;
11
+ amplitudes: Amplitude[];
12
+ alpha?: Amplitude;
13
+ beta?: Amplitude;
14
+ }
15
+ /**
16
+ * Creates a quantum register of size n.
17
+ * State vector will have 2^n amplitudes.
18
+ */
19
+ export declare function muRegister(n: number): any;
20
+ /**
21
+ * Backward compatible muQubit (Single Qubit Register)
22
+ */
23
+ export declare function muQubit(initial?: 0 | 1): any;
24
+ export type GateType = 'H' | 'X' | 'Z' | 'Y' | 'CNOT' | 'CZ' | 'SWAP';
25
+ export declare function muGate(reg: any, type: GateType, target?: number, control?: number | number[]): void;
26
+ /**
27
+ * Mulan Search Logic (Grover's Operator)
28
+ * Automatically constructs a multi-controlled Phase Flip (Z) for a specific target state.
29
+ * This is the core of the "Quantum Switch" or "Quantum Search" capability.
30
+ * @param reg Quantum Register
31
+ * @param targetState The integer state to "search" and mark (e.g. 2 for |10>)
32
+ */
33
+ export declare function muSearch(reg: any, targetState: number): void;
34
+ export declare function muEntangle(reg: any, i: number, j: number): void;
35
+ /**
36
+ * Quantum Teleportation Protocol
37
+ * Transfers the state of `msgIdx` to `targetIdx` using `ancillaIdx` as a resource.
38
+ * @param reg Register
39
+ * @param msgIdx The qubit containing the state to teleport (Alice)
40
+ * @param ancillaIdx The helper qubit (Alice's half of entanglement)
41
+ * @param targetIdx The destination qubit (Bob)
42
+ */
43
+ export declare function muTeleport(reg: any, msgIdx: number, ancillaIdx: number, targetIdx: number): void;
44
+ /**
45
+ * Measures a specific qubit in the register, collapsing the superposition.
46
+ * @param reg Quantum Register
47
+ * @param target Index of qubit to measure
48
+ * @returns 0 or 1
49
+ */
50
+ export declare function muMeasure(reg: any, target?: number): number;
@@ -0,0 +1,14 @@
1
+ export declare function useQuery<T>(queryFn: () => Promise<T>, options?: {
2
+ enabled?: boolean;
3
+ }): {
4
+ refetch: () => Promise<void>;
5
+ data: T | null;
6
+ isLoading: boolean;
7
+ error: any;
8
+ };
9
+ export declare function useMutation<T, A = void>(mutationFn: (args: A) => Promise<T>): {
10
+ mutate: (args: A) => Promise<T>;
11
+ data: T | null;
12
+ isLoading: boolean;
13
+ error: any;
14
+ };
@@ -0,0 +1,21 @@
1
+ type Effect = () => void;
2
+ export declare class Signal<T> {
3
+ private _value;
4
+ private _subscribers;
5
+ constructor(initialValue: T);
6
+ get value(): T;
7
+ set value(newValue: T);
8
+ notify(): void;
9
+ }
10
+ export declare function effect(fn: Effect): () => void;
11
+ /**
12
+ * Creates a reactive proxy object (Vue-compatible).
13
+ * Now optimized to respect Mulan Cycle.
14
+ */
15
+ export declare function reactive<T extends object>(target: T): T;
16
+ /**
17
+ * Creates a standalone reactive reference.
18
+ * Backed by the Mulan Signal Engine.
19
+ */
20
+ export declare function ref<T>(value: T): Signal<T>;
21
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare function render(template: string, container: HTMLElement): void;
2
+ export declare function hydrate(template: string, container: HTMLElement): void;
3
+ export declare function renderToString(template: string): string;
4
+ export declare function sanitize(str: string): string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Options for Mulan Vault
3
+ */
4
+ export interface VaultOptions {
5
+ encrypt?: boolean;
6
+ storage?: Storage;
7
+ }
8
+ /**
9
+ * Mulan Vault: The World's First Native Persistent State Primitive.
10
+ * Now fortified with Iron Fortress Obfuscation.
11
+ */
12
+ export declare function persistent<T>(key: string, initialValue: T, options?: VaultOptions): any;
@@ -0,0 +1,70 @@
1
+ export * from './core/reactive';
2
+ export { MuComponent, MuComponent as Component, defineComponent } from './core/component';
3
+ export * from './core/renderer';
4
+ export { MuRouter, MuRouter as Router, Route } from './router/index';
5
+ export { MuStore } from './store/index';
6
+ export * from './security/sanitizer';
7
+ export * from './core/hooks';
8
+ export * from './core/query';
9
+ export * from './core/vault';
10
+ export * from './core/quantum';
11
+ export * from './components/bloch-sphere';
12
+ import { reactive, effect } from './core/reactive';
13
+ import { MuComponent, defineComponent } from './core/component';
14
+ import { MuRouter } from './router/index';
15
+ import { MuStore } from './store/index';
16
+ import { Security } from './security/sanitizer';
17
+ import * as Quantum from './core/quantum';
18
+ declare const Mulan: {
19
+ log: (msg: string, ...args: any[]) => void;
20
+ warn: (msg: string, ...args: any[]) => void;
21
+ error: (msg: string, ...args: any[]) => void;
22
+ muRegister(n: number): any;
23
+ muQubit(initial?: 0 | 1): any;
24
+ muGate(reg: any, type: Quantum.GateType, target?: number, control?: number | number[]): void;
25
+ muSearch(reg: any, targetState: number): void;
26
+ muEntangle(reg: any, i: number, j: number): void;
27
+ muTeleport(reg: any, msgIdx: number, ancillaIdx: number, targetIdx: number): void;
28
+ muMeasure(reg: any, target?: number): number;
29
+ useQuery<T>(queryFn: () => Promise<T>, options?: {
30
+ enabled?: boolean;
31
+ }): {
32
+ refetch: () => Promise<void>;
33
+ data: T | null;
34
+ isLoading: boolean;
35
+ error: any;
36
+ };
37
+ useMutation<T, A = void>(mutationFn: (args: A) => Promise<T>): {
38
+ mutate: (args: A) => Promise<T>;
39
+ data: T | null;
40
+ isLoading: boolean;
41
+ error: any;
42
+ };
43
+ setCurrentInstance(instance: any): void;
44
+ getCurrentInstance(): any;
45
+ muState<T>(initialValue: T): any;
46
+ muMemo<T>(computeFn: () => T): {
47
+ value: T;
48
+ };
49
+ muEffect(fn: () => void): void;
50
+ onMuInit(fn: () => void): void;
51
+ onMuMount(fn: () => void): void;
52
+ onMuDestroy(fn: () => void): void;
53
+ onMuIdle(fn: () => void): void;
54
+ onMuResume(fn: () => void): void;
55
+ onMuShake(fn: () => void): void;
56
+ onMuVoice(command: string, fn: () => void): void;
57
+ muGeom(): any;
58
+ muPulse(): any;
59
+ muVault<T>(key: string, initial: T, options?: {
60
+ encrypt?: boolean;
61
+ }): any;
62
+ reactive: typeof reactive;
63
+ effect: typeof effect;
64
+ Component: typeof MuComponent;
65
+ defineComponent: typeof defineComponent;
66
+ Router: typeof MuRouter;
67
+ Store: typeof MuStore;
68
+ Security: typeof Security;
69
+ };
70
+ export default Mulan;
@@ -0,0 +1,24 @@
1
+ export interface Route {
2
+ path: string;
3
+ component: any | (() => Promise<any>);
4
+ beforeEnter?: (to: string, from: string, next: (allow: boolean) => void) => void;
5
+ meta?: Record<string, any>;
6
+ title?: string;
7
+ }
8
+ export declare class MuRouter {
9
+ routes: Route[];
10
+ rootContainer: HTMLElement | null;
11
+ currentPath: string;
12
+ currentComponent: any;
13
+ isServer: boolean;
14
+ private lastRouteId;
15
+ constructor(routes: Route[], rootContainer?: HTMLElement | null);
16
+ serverLookup(path: string): Promise<string>;
17
+ private matchRoute;
18
+ handleRoute(): Promise<void>;
19
+ navigate(path: string): void;
20
+ }
21
+ export declare const createRouter: (options: {
22
+ routes: Route[];
23
+ rootContainer?: HTMLElement | null;
24
+ }) => MuRouter;
@@ -0,0 +1,8 @@
1
+ import { SFCDescriptor } from './sfc-parser';
2
+ export interface ScriptCompileResult {
3
+ code: string;
4
+ bindings?: string[];
5
+ errors: string[];
6
+ map?: string;
7
+ }
8
+ export declare function compileScript(descriptor: SFCDescriptor): ScriptCompileResult;
@@ -0,0 +1,17 @@
1
+ export declare class Security {
2
+ static sanitize(input: string): string;
3
+ /**
4
+ * Generates a strict Content Security Policy header value.
5
+ * @param options Configuration for allowed sources
6
+ */
7
+ static generateCSP(options?: {
8
+ scriptSrc?: string[];
9
+ styleSrc?: string[];
10
+ }): string;
11
+ static validateUrl(url: string): boolean;
12
+ /**
13
+ * Prevents XSS by sanitizing common input fields on blur.
14
+ * Can be used as a utility in forms.
15
+ */
16
+ static preventXSS(inputElement: HTMLInputElement | HTMLTextAreaElement): void;
17
+ }
@@ -0,0 +1,21 @@
1
+ export interface SFCBlock {
2
+ type: 'script' | 'template' | 'style';
3
+ content: string;
4
+ attrs: Record<string, string>;
5
+ start: number;
6
+ end: number;
7
+ }
8
+ export interface SFCDescriptor {
9
+ filename: string;
10
+ source: string;
11
+ template: SFCBlock | null;
12
+ script: SFCBlock | null;
13
+ scripts: SFCBlock[];
14
+ styles: SFCBlock[];
15
+ customBlocks: SFCBlock[];
16
+ }
17
+ /**
18
+ * Standardized State-Machine Parser for MulanJS
19
+ * Parses .mujs files safely, handling attributes, quotes, and nested content.
20
+ */
21
+ export declare function parseMUJS(source: string, filename: string): SFCDescriptor;
@@ -0,0 +1,10 @@
1
+ export declare class MuStore<T extends object> {
2
+ state: T;
3
+ private subscribers;
4
+ constructor(initialState: T, options?: {
5
+ persist?: boolean;
6
+ key?: string;
7
+ });
8
+ subscribe(fn: (state: T) => void): void;
9
+ dispatch(action: (state: T) => void | Promise<void>): void;
10
+ }
@@ -0,0 +1,7 @@
1
+ import { SFCDescriptor } from './sfc-parser';
2
+ export interface StyleCompileResult {
3
+ css: string;
4
+ scopedId?: string;
5
+ errors: string[];
6
+ }
7
+ export declare function compileStyle(descriptor: SFCDescriptor, filename: string): StyleCompileResult;
@@ -0,0 +1,7 @@
1
+ import { SFCDescriptor } from './sfc-parser';
2
+ import { ScriptCompileResult } from './script-compiler';
3
+ export interface TemplateCompileResult {
4
+ code: string;
5
+ errors: string[];
6
+ }
7
+ export declare function compileTemplate(descriptor: SFCDescriptor, scriptResult: ScriptCompileResult, scopedId?: string): TemplateCompileResult;
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@mulanjs/mulanjs",
3
+ "version": "1.0.1-dev.20260212143840",
4
+ "description": "A powerful, secure, and enterprise-grade JavaScript framework.",
5
+ "main": "dist/mulan.js",
6
+ "module": "dist/mulan.esm.js",
7
+ "browser": "dist/mulan.js",
8
+ "bin": {
9
+ "mulan": "./src/cli/index.js"
10
+ },
11
+ "types": "dist/types/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/types/index.d.ts",
15
+ "import": "./dist/mulan.esm.js",
16
+ "require": "./dist/mulan.js"
17
+ },
18
+ "./loader": "./src/loader/index.js"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ "LICENSE",
24
+ "src/cli",
25
+ "src/compiler",
26
+ "src/loader"
27
+ ],
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "scripts": {
32
+ "build": "tsc && tsc -p src/compiler/tsconfig.json && npm run bundle",
33
+ "bundle": "webpack",
34
+ "test": "jest",
35
+ "prepublishOnly": "npm run build && npm run bundle && npm test",
36
+ "publish:dev": "node scripts/publish-dev.js"
37
+ },
38
+ "keywords": [
39
+ "framework",
40
+ "mulanjs",
41
+ "component",
42
+ "router",
43
+ "store",
44
+ "security"
45
+ ],
46
+ "author": "MulanJS Team",
47
+ "license": "MIT",
48
+ "dependencies": {
49
+ "commander": "^14.0.3",
50
+ "fs-extra": "^11.3.3",
51
+ "webpack": "^5.104.1",
52
+ "webpack-cli": "^6.0.1",
53
+ "webpack-dev-server": "^5.2.0",
54
+ "ts-loader": "^9.5.4",
55
+ "typescript": "^5.0.0"
56
+ },
57
+ "devDependencies": {
58
+ "@types/fs-extra": "^11.0.4",
59
+ "@types/jest": "^30.0.0",
60
+ "jest": "^30.2.0",
61
+ "jest-environment-jsdom": "^30.2.0",
62
+ "ts-jest": "^29.4.6"
63
+ }
64
+ }