@lark.js/mvc 0.0.12 → 0.0.13

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/README.md CHANGED
@@ -41,7 +41,7 @@ Third, zero runtime dependencies. `@babel/parser` / `@babel/types` are used only
41
41
 
42
42
  Fourth, real DOM diff. Templates compile to functions that produce HTML strings, which are parsed into temporary DOM via `document.implementation.createHTMLDocument` and then diffed against the live DOM using keyed comparison. The advantage is that context-sensitive tags like `<table>` / `<select>` / `<svg>` are handled by the native parser. The trade-off is that large templates incur parse overhead, and SSR is not supported.
43
43
 
44
- Fifth, debug-friendly. `window.__lark_Debug = true` enables Safeguard Proxy protection against cross-page pollution and accidental writes. `installFrameDevtoolBridge` exposes the Frame tree to Devtool via `postMessage`. A set of `window.__lark_*` global shortcuts cover Framework / State / Router / Frame / View and HMR helpers.
44
+ Fifth, debug-friendly. `installFrameDevtoolBridge` exposes the Frame tree to Devtool via `postMessage`. A set of `window.__lark_*` global shortcuts cover Framework / State / Router / Frame / View and HMR helpers.
45
45
 
46
46
  Not suitable for: projects requiring SSR/streaming rendering, cross-platform needs like React Native, or projects needing off-the-shelf Chrome extension panels. For those, consider the React or Vue ecosystems.
47
47
 
@@ -838,24 +838,16 @@ new ModuleFederationPlugin({
838
838
 
839
839
  After `Framework.boot` completes, the following are attached to `window`:
840
840
 
841
- | Global | Value | Purpose |
842
- | ------------------------------------ | ----------------------------- | ----------------------------------- |
843
- | `window.__lark_Framework` | Framework object | Direct access |
844
- | `window.__lark_State` | State object | Direct access |
845
- | `window.__lark_Router` | Router object | Direct access |
846
- | `window.__lark_Frame` | Frame class | Direct access |
847
- | `window.__lark_View` | View class | Direct access |
848
- | `window.__lark_registerViewClass` | Function | HMR: re-register View class |
849
- | `window.__lark_invalidateViewClass` | Function | HMR: remove View from registry |
850
- | `window.__lark_getViewClassRegistry` | Function | HMR: read registry |
851
- | `window.__lark_Debug` | boolean, must be set manually | Enable Safeguard Proxy debug checks |
852
-
853
- ### Safeguard Debug Mode
854
-
855
- Set `window.__lark_Debug = true` before boot, and the framework wraps `State.get()` / `Router.diff()` results and `Updater.get()` return values with Safeguard Proxy:
856
-
857
- - Warns when reading data written by another page (potential cross-page pollution).
858
- - Warns immediately when assigning directly to objects returned by `State.get()` (deduplicated by key); the correct approach is `State.set(patch)` + `State.digest()`.
841
+ | Global | Value | Purpose |
842
+ | ------------------------------------ | ---------------- | ------------------------------ |
843
+ | `window.__lark_Framework` | Framework object | Direct access |
844
+ | `window.__lark_State` | State object | Direct access |
845
+ | `window.__lark_Router` | Router object | Direct access |
846
+ | `window.__lark_Frame` | Frame class | Direct access |
847
+ | `window.__lark_View` | View class | Direct access |
848
+ | `window.__lark_registerViewClass` | Function | HMR: re-register View class |
849
+ | `window.__lark_invalidateViewClass` | Function | HMR: remove View from registry |
850
+ | `window.__lark_getViewClassRegistry` | Function | HMR: read registry |
859
851
 
860
852
  ### Frame Devtool Bridge
861
853
 
package/dist/devtool.cjs CHANGED
@@ -785,61 +785,6 @@ var EventDelegator = {
785
785
  }
786
786
  };
787
787
 
788
- // src/safeguard.ts
789
- var proxiesPool = /* @__PURE__ */ new Map();
790
- var SAFEGUARD_SENTINEL = "_safe_";
791
- function safeguard(data, getter, setter, isRoot) {
792
- if (typeof window.__lark_Debug === "undefined" || !window.__lark_Debug) {
793
- return data;
794
- }
795
- if (typeof Proxy === "undefined") {
796
- return data;
797
- }
798
- if (isPrimitive(data)) {
799
- return data;
800
- }
801
- const build = (prefix, obj) => {
802
- const cacheKey = (getter || "") + "" + (setter || "");
803
- const cached = proxiesPool.get(obj);
804
- if (cached && cached.cacheKey === cacheKey) {
805
- return cached.entity;
806
- }
807
- if (Reflect.get(obj, SAFEGUARD_SENTINEL)) {
808
- return obj;
809
- }
810
- const entity = new Proxy(obj, {
811
- set(target, property, value) {
812
- if (!setter && !prefix) {
813
- throw new Error(
814
- "Avoid write back, key: " + prefix + property + " value:" + value + " more: https://github.com/hangtiancheng/lark"
815
- );
816
- }
817
- Reflect.set(target, property, value);
818
- if (setter) {
819
- setter(prefix + property, value);
820
- }
821
- return true;
822
- },
823
- get(target, property) {
824
- if (property === SAFEGUARD_SENTINEL) {
825
- return true;
826
- }
827
- const out = Reflect.get(target, property);
828
- if (!prefix && getter) {
829
- getter(property);
830
- }
831
- if (!isRoot && hasOwnProperty(target, property) && (Array.isArray(out) || isPlainObject(out))) {
832
- return build(prefix + property + ".", out);
833
- }
834
- return out;
835
- }
836
- });
837
- proxiesPool.set(obj, { cacheKey, entity });
838
- return entity;
839
- };
840
- return build("", data);
841
- }
842
-
843
788
  // src/module-loader.ts
844
789
  var config = {
845
790
  rootId: "root",
@@ -1544,9 +1489,6 @@ var Updater = class {
1544
1489
  if (key) {
1545
1490
  result = this.data[key];
1546
1491
  }
1547
- if (typeof window !== "undefined" && window.__lark_Debug) {
1548
- return safeguard(result);
1549
- }
1550
1492
  return result;
1551
1493
  }
1552
1494
  /**
@@ -1922,9 +1864,6 @@ var Router = {
1922
1864
  attachViewAndPath(location);
1923
1865
  hrefCache.set(href, location);
1924
1866
  }
1925
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
1926
- location["params"] = safeguard(location["params"]);
1927
- }
1928
1867
  return location;
1929
1868
  },
1930
1869
  /**
@@ -1943,9 +1882,6 @@ var Router = {
1943
1882
  emitter.fire(RouterEvents.CHANGED, asRecord(lastChanged));
1944
1883
  }
1945
1884
  silent = 0;
1946
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug && lastChanged) {
1947
- lastChanged = safeguard(lastChanged);
1948
- }
1949
1885
  return lastChanged;
1950
1886
  },
1951
1887
  /**
package/dist/devtool.js CHANGED
@@ -698,61 +698,6 @@ var EventDelegator = {
698
698
  }
699
699
  };
700
700
 
701
- // src/safeguard.ts
702
- var proxiesPool = /* @__PURE__ */ new Map();
703
- var SAFEGUARD_SENTINEL = "_safe_";
704
- function safeguard(data, getter, setter, isRoot) {
705
- if (typeof window.__lark_Debug === "undefined" || !window.__lark_Debug) {
706
- return data;
707
- }
708
- if (typeof Proxy === "undefined") {
709
- return data;
710
- }
711
- if (isPrimitive(data)) {
712
- return data;
713
- }
714
- const build = (prefix, obj) => {
715
- const cacheKey = (getter || "") + "" + (setter || "");
716
- const cached = proxiesPool.get(obj);
717
- if (cached && cached.cacheKey === cacheKey) {
718
- return cached.entity;
719
- }
720
- if (Reflect.get(obj, SAFEGUARD_SENTINEL)) {
721
- return obj;
722
- }
723
- const entity = new Proxy(obj, {
724
- set(target, property, value) {
725
- if (!setter && !prefix) {
726
- throw new Error(
727
- "Avoid write back, key: " + prefix + property + " value:" + value + " more: https://github.com/hangtiancheng/lark"
728
- );
729
- }
730
- Reflect.set(target, property, value);
731
- if (setter) {
732
- setter(prefix + property, value);
733
- }
734
- return true;
735
- },
736
- get(target, property) {
737
- if (property === SAFEGUARD_SENTINEL) {
738
- return true;
739
- }
740
- const out = Reflect.get(target, property);
741
- if (!prefix && getter) {
742
- getter(property);
743
- }
744
- if (!isRoot && hasOwnProperty(target, property) && (Array.isArray(out) || isPlainObject(out))) {
745
- return build(prefix + property + ".", out);
746
- }
747
- return out;
748
- }
749
- });
750
- proxiesPool.set(obj, { cacheKey, entity });
751
- return entity;
752
- };
753
- return build("", data);
754
- }
755
-
756
701
  // src/module-loader.ts
757
702
  var config = {
758
703
  rootId: "root",
@@ -1457,9 +1402,6 @@ var Updater = class {
1457
1402
  if (key) {
1458
1403
  result = this.data[key];
1459
1404
  }
1460
- if (typeof window !== "undefined" && window.__lark_Debug) {
1461
- return safeguard(result);
1462
- }
1463
1405
  return result;
1464
1406
  }
1465
1407
  /**
@@ -1835,9 +1777,6 @@ var Router = {
1835
1777
  attachViewAndPath(location);
1836
1778
  hrefCache.set(href, location);
1837
1779
  }
1838
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
1839
- location["params"] = safeguard(location["params"]);
1840
- }
1841
1780
  return location;
1842
1781
  },
1843
1782
  /**
@@ -1856,9 +1795,6 @@ var Router = {
1856
1795
  emitter.fire(RouterEvents.CHANGED, asRecord(lastChanged));
1857
1796
  }
1858
1797
  silent = 0;
1859
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug && lastChanged) {
1860
- lastChanged = safeguard(lastChanged);
1861
- }
1862
1798
  return lastChanged;
1863
1799
  },
1864
1800
  /**
package/dist/index.cjs CHANGED
@@ -55,7 +55,6 @@ __export(index_exports, {
55
55
  registerViewClass: () => registerViewClass,
56
56
  reloadViews: () => reloadViews,
57
57
  resetProjectsMap: () => resetProjectsMap,
58
- safeguard: () => safeguard,
59
58
  unmark: () => unmark,
60
59
  use: () => use,
61
60
  useUrlState: () => useUrlState,
@@ -431,61 +430,6 @@ function unmark(host) {
431
430
  }
432
431
  }
433
432
 
434
- // src/safeguard.ts
435
- var proxiesPool = /* @__PURE__ */ new Map();
436
- var SAFEGUARD_SENTINEL = "_safe_";
437
- function safeguard(data, getter, setter, isRoot) {
438
- if (typeof window.__lark_Debug === "undefined" || !window.__lark_Debug) {
439
- return data;
440
- }
441
- if (typeof Proxy === "undefined") {
442
- return data;
443
- }
444
- if (isPrimitive(data)) {
445
- return data;
446
- }
447
- const build = (prefix, obj) => {
448
- const cacheKey = (getter || "") + "" + (setter || "");
449
- const cached = proxiesPool.get(obj);
450
- if (cached && cached.cacheKey === cacheKey) {
451
- return cached.entity;
452
- }
453
- if (Reflect.get(obj, SAFEGUARD_SENTINEL)) {
454
- return obj;
455
- }
456
- const entity = new Proxy(obj, {
457
- set(target, property, value) {
458
- if (!setter && !prefix) {
459
- throw new Error(
460
- "Avoid write back, key: " + prefix + property + " value:" + value + " more: https://github.com/hangtiancheng/lark"
461
- );
462
- }
463
- Reflect.set(target, property, value);
464
- if (setter) {
465
- setter(prefix + property, value);
466
- }
467
- return true;
468
- },
469
- get(target, property) {
470
- if (property === SAFEGUARD_SENTINEL) {
471
- return true;
472
- }
473
- const out = Reflect.get(target, property);
474
- if (!prefix && getter) {
475
- getter(property);
476
- }
477
- if (!isRoot && hasOwnProperty(target, property) && (Array.isArray(out) || isPlainObject(out))) {
478
- return build(prefix + property + ".", out);
479
- }
480
- return out;
481
- }
482
- });
483
- proxiesPool.set(obj, { cacheKey, entity });
484
- return entity;
485
- };
486
- return build("", data);
487
- }
488
-
489
433
  // src/cache.ts
490
434
  function sortCacheEntries(a, b) {
491
435
  return b.frequency - a.frequency || b.lastTimestamp - a.lastTimestamp;
@@ -761,7 +705,6 @@ var keyRefCounts = {};
761
705
  var changedKeys = /* @__PURE__ */ new Set();
762
706
  var stashedChangedKeys = EMPTY_STRING_SET;
763
707
  var dataIsChanged = false;
764
- var dataWhereSet = {};
765
708
  var emitter = new EventEmitter();
766
709
  var booted = false;
767
710
  function markBooted() {
@@ -785,47 +728,16 @@ function teardownKeysRef(keyList) {
785
728
  if (count <= 0) {
786
729
  Reflect.deleteProperty(keyRefCounts, key);
787
730
  Reflect.deleteProperty(appData, key);
788
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
789
- Reflect.deleteProperty(dataWhereSet, key);
790
- }
791
731
  }
792
732
  }
793
733
  }
794
734
  }
795
- var warnedKeys = /* @__PURE__ */ new Set();
796
- function clearNotify(key) {
797
- warnedKeys.delete(key);
798
- }
799
- function delayNotify(key, message) {
800
- if (warnedKeys.has(key)) return;
801
- warnedKeys.add(key);
802
- console.warn(message);
803
- }
804
735
  var State = {
805
736
  /**
806
737
  * Get data from state.
807
738
  */
808
739
  get(key) {
809
740
  const result = key ? appData[key] : appData;
810
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
811
- return safeguard(
812
- result,
813
- (dataKey) => {
814
- if (booted && hasOwnProperty(dataWhereSet, dataKey) && dataWhereSet[dataKey] !== window.location.pathname) {
815
- console.warn(
816
- `beware! You get state:"{State}.${dataKey}" where it set by page:${dataWhereSet[dataKey]}`
817
- );
818
- }
819
- },
820
- (path, _value) => {
821
- const sub = key || path;
822
- delayNotify(
823
- sub,
824
- `beware! You direct modify "{State}.${sub}" You should call State.set() and State.digest() to notify other views`
825
- );
826
- }
827
- );
828
- }
829
741
  return result;
830
742
  },
831
743
  /**
@@ -833,11 +745,6 @@ var State = {
833
745
  */
834
746
  set(data, excludes) {
835
747
  dataIsChanged = setData(data, appData, changedKeys, excludes || EMPTY_STRING_SET) || dataIsChanged;
836
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug && booted) {
837
- for (const p in data) {
838
- dataWhereSet[p] = window.location.pathname;
839
- }
840
- }
841
748
  return State;
842
749
  },
843
750
  /**
@@ -848,11 +755,6 @@ var State = {
848
755
  State.set(data, excludes);
849
756
  }
850
757
  if (dataIsChanged) {
851
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
852
- for (const p of changedKeys) {
853
- clearNotify(p);
854
- }
855
- }
856
758
  dataIsChanged = false;
857
759
  const keys2 = changedKeys;
858
760
  stashedChangedKeys = keys2;
@@ -1094,9 +996,6 @@ var Router = {
1094
996
  attachViewAndPath(location);
1095
997
  hrefCache.set(href, location);
1096
998
  }
1097
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
1098
- location["params"] = safeguard(location["params"]);
1099
- }
1100
999
  return location;
1101
1000
  },
1102
1001
  /**
@@ -1115,9 +1014,6 @@ var Router = {
1115
1014
  emitter2.fire(RouterEvents.CHANGED, asRecord(lastChanged));
1116
1015
  }
1117
1016
  silent = 0;
1118
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug && lastChanged) {
1119
- lastChanged = safeguard(lastChanged);
1120
- }
1121
1017
  return lastChanged;
1122
1018
  },
1123
1019
  /**
@@ -1874,6 +1770,13 @@ function vdomCreate(tag, props, children, specials) {
1874
1770
  reused[c.compareKey] = (reused[c.compareKey] || 0) + 1;
1875
1771
  reusedTotal++;
1876
1772
  }
1773
+ if (c.reused) {
1774
+ if (!reused) reused = {};
1775
+ for (const key in c.reused) {
1776
+ reused[key] = (reused[key] || 0) + c.reused[key];
1777
+ reusedTotal += c.reused[key];
1778
+ }
1779
+ }
1877
1780
  if (c.views) {
1878
1781
  if (!viewList) viewList = [];
1879
1782
  viewList.push(...c.views);
@@ -2325,9 +2228,6 @@ var Updater = class {
2325
2228
  if (key) {
2326
2229
  result = this.data[key];
2327
2230
  }
2328
- if (typeof window !== "undefined" && window.__lark_Debug) {
2329
- return safeguard(result);
2330
- }
2331
2231
  return result;
2332
2232
  }
2333
2233
  /**
@@ -4662,10 +4562,6 @@ var Framework = {
4662
4562
  * Generate globally unique ID.
4663
4563
  */
4664
4564
  guid: generateId,
4665
- /**
4666
- * Proxy-based debug guard.
4667
- */
4668
- guard: safeguard,
4669
4565
  /**
4670
4566
  * Cache class.
4671
4567
  */
@@ -4888,7 +4784,6 @@ function bindStore(view, store, selector) {
4888
4784
  registerViewClass,
4889
4785
  reloadViews,
4890
4786
  resetProjectsMap,
4891
- safeguard,
4892
4787
  unmark,
4893
4788
  use,
4894
4789
  useUrlState,
package/dist/index.d.cts CHANGED
@@ -63,26 +63,6 @@ declare function mark(host: object, key: string): () => boolean;
63
63
  */
64
64
  declare function unmark(host: object): void;
65
65
 
66
- /**
67
- * Safeguard: Proxy-based debug protection for data objects.
68
- *
69
- * In DEBUG mode, wraps data objects with Proxy to:
70
- * 1. Warn when data is read from a different page than where it was set
71
- * 2. Prevent direct mutation (forces use of State.set/digest)
72
- * 3. Track access patterns for debugging
73
- */
74
- /**
75
- * Wrap data with a Proxy for debug-mode protection.
76
- * Only active when window.__lark_Debug is true and Proxy is available.
77
- *
78
- * @param data - Data to wrap
79
- * @param getter - Optional callback when properties are read
80
- * @param setter - Optional callback when properties are written
81
- * @param isRoot - Whether this is the root data object
82
- * @returns Proxied data or original data if debug mode is off
83
- */
84
- declare function safeguard<T>(data: T, getter?: ((key: string) => void) | null, setter?: ((path: string, value: unknown) => void) | null, isRoot?: boolean): T;
85
-
86
66
  /**
87
67
  * Multi-cast event emitter class.
88
68
  *
@@ -1485,8 +1465,9 @@ interface FrameworkInterface {
1485
1465
  * @param fns Function or function array
1486
1466
  * @param args Arguments array passed to functions
1487
1467
  * @param context `this` binding during function execution
1468
+ * @param configError Optional error callback, receives the caught exception
1488
1469
  */
1489
- toTry(fns: AnyFunc | AnyFunc[], args?: unknown[], context?: unknown): unknown;
1470
+ toTry(fns: AnyFunc | AnyFunc[], args?: unknown[], context?: unknown, configError?: (e: unknown) => void): unknown;
1490
1471
  /**
1491
1472
  * Convert path and params to URL string.
1492
1473
  * Example: `Framework.toUrl('/xxx/', {a:'b',c:'d'})` => `/xxx/?a=b&c=d`
@@ -1506,7 +1487,7 @@ interface FrameworkInterface {
1506
1487
  * @param target Target object
1507
1488
  * @param sources One or more source objects
1508
1489
  */
1509
- mix<T extends object>(target: T, ...sources: Partial<T>[]): T;
1490
+ mix<T extends object>(target: T, ...sources: Record<string, unknown>[]): T;
1510
1491
  /**
1511
1492
  * Check if object has specified own property (safe hasOwnProperty).
1512
1493
  * @param owner Object to check, supports undefined/null
@@ -1543,13 +1524,6 @@ interface FrameworkInterface {
1543
1524
  * @param callback Callback after modules are loaded
1544
1525
  */
1545
1526
  use(names: string | string[], callback?: (...modules: unknown[]) => void): void;
1546
- /**
1547
- * Protect object from direct modification in debug mode.
1548
- * Wraps data object with Proxy, intercepts read/write operations, warns to use State.set/digest for state management.
1549
- * Only effective when `window.__lark_Debug` is true.
1550
- * @param o Object to protect
1551
- */
1552
- guard<T extends object>(o: T): T;
1553
1527
  /**
1554
1528
  * Dynamically inject CSS styles into page. Returns cleanup function to remove injected styles.
1555
1529
  * Supports single and batch injection.
@@ -2330,4 +2304,4 @@ declare function create<T>(name: string, creator: StateCreator<T>): StoreApi<T>;
2330
2304
  */
2331
2305
  declare function bindStore<T>(view: unknown, store: StoreApi<T>, selector?: (state: T) => Record<string, unknown>): () => void;
2332
2306
 
2333
- export { type AnyFunc, CALL_BREAK_TIME, Cache, type CacheEntry, type CacheInterface, type CacheOptions, type ChangeEvent, type CompileOptions, CrossSite, type CrossSiteConfig, type DomElement, type DomOp, type DomRef, EVENT_METHOD_REGEXP, EventDelegator, EventEmitter, type EventEmitterInterface, type EventListenerEntry, Frame, type FrameBoundElement, type FrameInterface, type FrameInvokeEntry, type FrameStaticEvent, Framework, type FrameworkConfig, type FrameworkInterface, type HotContext, LARK_VIEW, type Location, type LocationDiff, type MixinEventHandler, type ParamDiff, type ParsedUri, Payload, type PayloadInterface, type PendingCacheEntry, RouterEvents as ROUTER_EVENTS, type RouteChangeEvent, type RouteChangedEvent, type RouteViewConfig, Router, type RouterInterface, SPLITTER, Service, type ServiceCacheInfo, type ServiceEvent, type ServiceMetaEntry, type ServiceOptions, State, type StateInterface, type StoreApi, TAG_NAME_REGEXP, Updater, type UpdaterInterface, type VDomCreateFn, type VDomNode, type VDomRef, type VDomTemplate, VIEW_EVENT_METHOD_REGEXP, View, type ViewEvent, type ViewEventSelectorEntry, type ViewGlobalEventEntry, type ViewInterface, type ViewLocationObserved, type ViewObserveLocation, type ViewResourceEntry, type ViewTemplate, type VoidFunc, applyStyle, bindStore, computed, create, createVDomRef, defineView, config as frameworkConfig, getRouteMode, invalidateViewClass, mark, markBooted, markRouterBooted, nextCounter, registerViewClass, reloadViews, resetProjectsMap, safeguard, unmark, use, useUrlState, vdomCreate };
2307
+ export { type AnyFunc, CALL_BREAK_TIME, Cache, type CacheEntry, type CacheInterface, type CacheOptions, type ChangeEvent, type CompileOptions, CrossSite, type CrossSiteConfig, type DomElement, type DomOp, type DomRef, EVENT_METHOD_REGEXP, EventDelegator, EventEmitter, type EventEmitterInterface, type EventListenerEntry, Frame, type FrameBoundElement, type FrameInterface, type FrameInvokeEntry, type FrameStaticEvent, Framework, type FrameworkConfig, type FrameworkInterface, type HotContext, LARK_VIEW, type Location, type LocationDiff, type MixinEventHandler, type ParamDiff, type ParsedUri, Payload, type PayloadInterface, type PendingCacheEntry, RouterEvents as ROUTER_EVENTS, type RouteChangeEvent, type RouteChangedEvent, type RouteViewConfig, Router, type RouterInterface, SPLITTER, Service, type ServiceCacheInfo, type ServiceEvent, type ServiceMetaEntry, type ServiceOptions, State, type StateInterface, type StoreApi, TAG_NAME_REGEXP, Updater, type UpdaterInterface, type VDomCreateFn, type VDomNode, type VDomRef, type VDomTemplate, VIEW_EVENT_METHOD_REGEXP, View, type ViewEvent, type ViewEventSelectorEntry, type ViewGlobalEventEntry, type ViewInterface, type ViewLocationObserved, type ViewObserveLocation, type ViewResourceEntry, type ViewTemplate, type VoidFunc, applyStyle, bindStore, computed, create, createVDomRef, defineView, config as frameworkConfig, getRouteMode, invalidateViewClass, mark, markBooted, markRouterBooted, nextCounter, registerViewClass, reloadViews, resetProjectsMap, unmark, use, useUrlState, vdomCreate };
package/dist/index.d.ts CHANGED
@@ -63,26 +63,6 @@ declare function mark(host: object, key: string): () => boolean;
63
63
  */
64
64
  declare function unmark(host: object): void;
65
65
 
66
- /**
67
- * Safeguard: Proxy-based debug protection for data objects.
68
- *
69
- * In DEBUG mode, wraps data objects with Proxy to:
70
- * 1. Warn when data is read from a different page than where it was set
71
- * 2. Prevent direct mutation (forces use of State.set/digest)
72
- * 3. Track access patterns for debugging
73
- */
74
- /**
75
- * Wrap data with a Proxy for debug-mode protection.
76
- * Only active when window.__lark_Debug is true and Proxy is available.
77
- *
78
- * @param data - Data to wrap
79
- * @param getter - Optional callback when properties are read
80
- * @param setter - Optional callback when properties are written
81
- * @param isRoot - Whether this is the root data object
82
- * @returns Proxied data or original data if debug mode is off
83
- */
84
- declare function safeguard<T>(data: T, getter?: ((key: string) => void) | null, setter?: ((path: string, value: unknown) => void) | null, isRoot?: boolean): T;
85
-
86
66
  /**
87
67
  * Multi-cast event emitter class.
88
68
  *
@@ -1485,8 +1465,9 @@ interface FrameworkInterface {
1485
1465
  * @param fns Function or function array
1486
1466
  * @param args Arguments array passed to functions
1487
1467
  * @param context `this` binding during function execution
1468
+ * @param configError Optional error callback, receives the caught exception
1488
1469
  */
1489
- toTry(fns: AnyFunc | AnyFunc[], args?: unknown[], context?: unknown): unknown;
1470
+ toTry(fns: AnyFunc | AnyFunc[], args?: unknown[], context?: unknown, configError?: (e: unknown) => void): unknown;
1490
1471
  /**
1491
1472
  * Convert path and params to URL string.
1492
1473
  * Example: `Framework.toUrl('/xxx/', {a:'b',c:'d'})` => `/xxx/?a=b&c=d`
@@ -1506,7 +1487,7 @@ interface FrameworkInterface {
1506
1487
  * @param target Target object
1507
1488
  * @param sources One or more source objects
1508
1489
  */
1509
- mix<T extends object>(target: T, ...sources: Partial<T>[]): T;
1490
+ mix<T extends object>(target: T, ...sources: Record<string, unknown>[]): T;
1510
1491
  /**
1511
1492
  * Check if object has specified own property (safe hasOwnProperty).
1512
1493
  * @param owner Object to check, supports undefined/null
@@ -1543,13 +1524,6 @@ interface FrameworkInterface {
1543
1524
  * @param callback Callback after modules are loaded
1544
1525
  */
1545
1526
  use(names: string | string[], callback?: (...modules: unknown[]) => void): void;
1546
- /**
1547
- * Protect object from direct modification in debug mode.
1548
- * Wraps data object with Proxy, intercepts read/write operations, warns to use State.set/digest for state management.
1549
- * Only effective when `window.__lark_Debug` is true.
1550
- * @param o Object to protect
1551
- */
1552
- guard<T extends object>(o: T): T;
1553
1527
  /**
1554
1528
  * Dynamically inject CSS styles into page. Returns cleanup function to remove injected styles.
1555
1529
  * Supports single and batch injection.
@@ -2330,4 +2304,4 @@ declare function create<T>(name: string, creator: StateCreator<T>): StoreApi<T>;
2330
2304
  */
2331
2305
  declare function bindStore<T>(view: unknown, store: StoreApi<T>, selector?: (state: T) => Record<string, unknown>): () => void;
2332
2306
 
2333
- export { type AnyFunc, CALL_BREAK_TIME, Cache, type CacheEntry, type CacheInterface, type CacheOptions, type ChangeEvent, type CompileOptions, CrossSite, type CrossSiteConfig, type DomElement, type DomOp, type DomRef, EVENT_METHOD_REGEXP, EventDelegator, EventEmitter, type EventEmitterInterface, type EventListenerEntry, Frame, type FrameBoundElement, type FrameInterface, type FrameInvokeEntry, type FrameStaticEvent, Framework, type FrameworkConfig, type FrameworkInterface, type HotContext, LARK_VIEW, type Location, type LocationDiff, type MixinEventHandler, type ParamDiff, type ParsedUri, Payload, type PayloadInterface, type PendingCacheEntry, RouterEvents as ROUTER_EVENTS, type RouteChangeEvent, type RouteChangedEvent, type RouteViewConfig, Router, type RouterInterface, SPLITTER, Service, type ServiceCacheInfo, type ServiceEvent, type ServiceMetaEntry, type ServiceOptions, State, type StateInterface, type StoreApi, TAG_NAME_REGEXP, Updater, type UpdaterInterface, type VDomCreateFn, type VDomNode, type VDomRef, type VDomTemplate, VIEW_EVENT_METHOD_REGEXP, View, type ViewEvent, type ViewEventSelectorEntry, type ViewGlobalEventEntry, type ViewInterface, type ViewLocationObserved, type ViewObserveLocation, type ViewResourceEntry, type ViewTemplate, type VoidFunc, applyStyle, bindStore, computed, create, createVDomRef, defineView, config as frameworkConfig, getRouteMode, invalidateViewClass, mark, markBooted, markRouterBooted, nextCounter, registerViewClass, reloadViews, resetProjectsMap, safeguard, unmark, use, useUrlState, vdomCreate };
2307
+ export { type AnyFunc, CALL_BREAK_TIME, Cache, type CacheEntry, type CacheInterface, type CacheOptions, type ChangeEvent, type CompileOptions, CrossSite, type CrossSiteConfig, type DomElement, type DomOp, type DomRef, EVENT_METHOD_REGEXP, EventDelegator, EventEmitter, type EventEmitterInterface, type EventListenerEntry, Frame, type FrameBoundElement, type FrameInterface, type FrameInvokeEntry, type FrameStaticEvent, Framework, type FrameworkConfig, type FrameworkInterface, type HotContext, LARK_VIEW, type Location, type LocationDiff, type MixinEventHandler, type ParamDiff, type ParsedUri, Payload, type PayloadInterface, type PendingCacheEntry, RouterEvents as ROUTER_EVENTS, type RouteChangeEvent, type RouteChangedEvent, type RouteViewConfig, Router, type RouterInterface, SPLITTER, Service, type ServiceCacheInfo, type ServiceEvent, type ServiceMetaEntry, type ServiceOptions, State, type StateInterface, type StoreApi, TAG_NAME_REGEXP, Updater, type UpdaterInterface, type VDomCreateFn, type VDomNode, type VDomRef, type VDomTemplate, VIEW_EVENT_METHOD_REGEXP, View, type ViewEvent, type ViewEventSelectorEntry, type ViewGlobalEventEntry, type ViewInterface, type ViewLocationObserved, type ViewObserveLocation, type ViewResourceEntry, type ViewTemplate, type VoidFunc, applyStyle, bindStore, computed, create, createVDomRef, defineView, config as frameworkConfig, getRouteMode, invalidateViewClass, mark, markBooted, markRouterBooted, nextCounter, registerViewClass, reloadViews, resetProjectsMap, unmark, use, useUrlState, vdomCreate };
package/dist/index.js CHANGED
@@ -366,61 +366,6 @@ function unmark(host) {
366
366
  }
367
367
  }
368
368
 
369
- // src/safeguard.ts
370
- var proxiesPool = /* @__PURE__ */ new Map();
371
- var SAFEGUARD_SENTINEL = "_safe_";
372
- function safeguard(data, getter, setter, isRoot) {
373
- if (typeof window.__lark_Debug === "undefined" || !window.__lark_Debug) {
374
- return data;
375
- }
376
- if (typeof Proxy === "undefined") {
377
- return data;
378
- }
379
- if (isPrimitive(data)) {
380
- return data;
381
- }
382
- const build = (prefix, obj) => {
383
- const cacheKey = (getter || "") + "" + (setter || "");
384
- const cached = proxiesPool.get(obj);
385
- if (cached && cached.cacheKey === cacheKey) {
386
- return cached.entity;
387
- }
388
- if (Reflect.get(obj, SAFEGUARD_SENTINEL)) {
389
- return obj;
390
- }
391
- const entity = new Proxy(obj, {
392
- set(target, property, value) {
393
- if (!setter && !prefix) {
394
- throw new Error(
395
- "Avoid write back, key: " + prefix + property + " value:" + value + " more: https://github.com/hangtiancheng/lark"
396
- );
397
- }
398
- Reflect.set(target, property, value);
399
- if (setter) {
400
- setter(prefix + property, value);
401
- }
402
- return true;
403
- },
404
- get(target, property) {
405
- if (property === SAFEGUARD_SENTINEL) {
406
- return true;
407
- }
408
- const out = Reflect.get(target, property);
409
- if (!prefix && getter) {
410
- getter(property);
411
- }
412
- if (!isRoot && hasOwnProperty(target, property) && (Array.isArray(out) || isPlainObject(out))) {
413
- return build(prefix + property + ".", out);
414
- }
415
- return out;
416
- }
417
- });
418
- proxiesPool.set(obj, { cacheKey, entity });
419
- return entity;
420
- };
421
- return build("", data);
422
- }
423
-
424
369
  // src/cache.ts
425
370
  function sortCacheEntries(a, b) {
426
371
  return b.frequency - a.frequency || b.lastTimestamp - a.lastTimestamp;
@@ -696,7 +641,6 @@ var keyRefCounts = {};
696
641
  var changedKeys = /* @__PURE__ */ new Set();
697
642
  var stashedChangedKeys = EMPTY_STRING_SET;
698
643
  var dataIsChanged = false;
699
- var dataWhereSet = {};
700
644
  var emitter = new EventEmitter();
701
645
  var booted = false;
702
646
  function markBooted() {
@@ -720,47 +664,16 @@ function teardownKeysRef(keyList) {
720
664
  if (count <= 0) {
721
665
  Reflect.deleteProperty(keyRefCounts, key);
722
666
  Reflect.deleteProperty(appData, key);
723
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
724
- Reflect.deleteProperty(dataWhereSet, key);
725
- }
726
667
  }
727
668
  }
728
669
  }
729
670
  }
730
- var warnedKeys = /* @__PURE__ */ new Set();
731
- function clearNotify(key) {
732
- warnedKeys.delete(key);
733
- }
734
- function delayNotify(key, message) {
735
- if (warnedKeys.has(key)) return;
736
- warnedKeys.add(key);
737
- console.warn(message);
738
- }
739
671
  var State = {
740
672
  /**
741
673
  * Get data from state.
742
674
  */
743
675
  get(key) {
744
676
  const result = key ? appData[key] : appData;
745
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
746
- return safeguard(
747
- result,
748
- (dataKey) => {
749
- if (booted && hasOwnProperty(dataWhereSet, dataKey) && dataWhereSet[dataKey] !== window.location.pathname) {
750
- console.warn(
751
- `beware! You get state:"{State}.${dataKey}" where it set by page:${dataWhereSet[dataKey]}`
752
- );
753
- }
754
- },
755
- (path, _value) => {
756
- const sub = key || path;
757
- delayNotify(
758
- sub,
759
- `beware! You direct modify "{State}.${sub}" You should call State.set() and State.digest() to notify other views`
760
- );
761
- }
762
- );
763
- }
764
677
  return result;
765
678
  },
766
679
  /**
@@ -768,11 +681,6 @@ var State = {
768
681
  */
769
682
  set(data, excludes) {
770
683
  dataIsChanged = setData(data, appData, changedKeys, excludes || EMPTY_STRING_SET) || dataIsChanged;
771
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug && booted) {
772
- for (const p in data) {
773
- dataWhereSet[p] = window.location.pathname;
774
- }
775
- }
776
684
  return State;
777
685
  },
778
686
  /**
@@ -783,11 +691,6 @@ var State = {
783
691
  State.set(data, excludes);
784
692
  }
785
693
  if (dataIsChanged) {
786
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
787
- for (const p of changedKeys) {
788
- clearNotify(p);
789
- }
790
- }
791
694
  dataIsChanged = false;
792
695
  const keys2 = changedKeys;
793
696
  stashedChangedKeys = keys2;
@@ -1029,9 +932,6 @@ var Router = {
1029
932
  attachViewAndPath(location);
1030
933
  hrefCache.set(href, location);
1031
934
  }
1032
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
1033
- location["params"] = safeguard(location["params"]);
1034
- }
1035
935
  return location;
1036
936
  },
1037
937
  /**
@@ -1050,9 +950,6 @@ var Router = {
1050
950
  emitter2.fire(RouterEvents.CHANGED, asRecord(lastChanged));
1051
951
  }
1052
952
  silent = 0;
1053
- if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug && lastChanged) {
1054
- lastChanged = safeguard(lastChanged);
1055
- }
1056
953
  return lastChanged;
1057
954
  },
1058
955
  /**
@@ -1809,6 +1706,13 @@ function vdomCreate(tag, props, children, specials) {
1809
1706
  reused[c.compareKey] = (reused[c.compareKey] || 0) + 1;
1810
1707
  reusedTotal++;
1811
1708
  }
1709
+ if (c.reused) {
1710
+ if (!reused) reused = {};
1711
+ for (const key in c.reused) {
1712
+ reused[key] = (reused[key] || 0) + c.reused[key];
1713
+ reusedTotal += c.reused[key];
1714
+ }
1715
+ }
1812
1716
  if (c.views) {
1813
1717
  if (!viewList) viewList = [];
1814
1718
  viewList.push(...c.views);
@@ -2260,9 +2164,6 @@ var Updater = class {
2260
2164
  if (key) {
2261
2165
  result = this.data[key];
2262
2166
  }
2263
- if (typeof window !== "undefined" && window.__lark_Debug) {
2264
- return safeguard(result);
2265
- }
2266
2167
  return result;
2267
2168
  }
2268
2169
  /**
@@ -4597,10 +4498,6 @@ var Framework = {
4597
4498
  * Generate globally unique ID.
4598
4499
  */
4599
4500
  guid: generateId,
4600
- /**
4601
- * Proxy-based debug guard.
4602
- */
4603
- guard: safeguard,
4604
4501
  /**
4605
4502
  * Cache class.
4606
4503
  */
@@ -4822,7 +4719,6 @@ export {
4822
4719
  registerViewClass,
4823
4720
  reloadViews,
4824
4721
  resetProjectsMap,
4825
- safeguard,
4826
4722
  unmark,
4827
4723
  use,
4828
4724
  useUrlState,
package/dist/rspack.cjs CHANGED
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.41_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js
37
37
  var init_cjs_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/cjs_shims.js"() {
38
+ "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.41_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
package/dist/rspack.js CHANGED
@@ -27,12 +27,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.41_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js
31
31
  import path from "path";
32
32
  import { fileURLToPath } from "url";
33
33
  var getFilename, __filename;
34
34
  var init_esm_shims = __esm({
35
- "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/esm_shims.js"() {
35
+ "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.41_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js"() {
36
36
  "use strict";
37
37
  getFilename = () => fileURLToPath(import.meta.url);
38
38
  __filename = /* @__PURE__ */ getFilename();
package/dist/vite.cjs CHANGED
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.41_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js
37
37
  var init_cjs_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/cjs_shims.js"() {
38
+ "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.41_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
@@ -14621,7 +14621,9 @@ var vite_exports = {};
14621
14621
  __export(vite_exports, {
14622
14622
  default: () => vite_default,
14623
14623
  larkMvcPlugin: () => larkMvcPlugin,
14624
- larkMvcPluginLegacy: () => larkMvcPluginLegacy
14624
+ larkMvcPlugin7: () => larkMvcPlugin7,
14625
+ larkMvcPluginLegacy: () => larkMvcPluginLegacy,
14626
+ larkMvcPluginLegacy7: () => larkMvcPluginLegacy7
14625
14627
  });
14626
14628
  module.exports = __toCommonJS(vite_exports);
14627
14629
  init_cjs_shims();
@@ -15971,7 +15973,7 @@ function larkMvcPlugin(options = {}) {
15971
15973
  }
15972
15974
  var vite_default = larkMvcPlugin;
15973
15975
  function larkMvcPluginLegacy(options = {}) {
15974
- const { debug = false, virtualDom = false, useSwc = false } = options;
15976
+ const { virtualDom = false, useSwc = false } = options;
15975
15977
  return {
15976
15978
  name: "lark-template",
15977
15979
  enforce: "pre",
@@ -15986,14 +15988,22 @@ function larkMvcPluginLegacy(options = {}) {
15986
15988
  const filePath = id.slice(0, -LARK_TEMPLATE_SUFFIX.length);
15987
15989
  const raw = import_fs.default.readFileSync(filePath, "utf-8");
15988
15990
  const globalVars = await extractGlobalVars2(raw);
15989
- return compileTemplate(raw, { debug, globalVars, virtualDom, useSwc });
15991
+ return compileTemplate(raw, { globalVars, virtualDom, useSwc });
15990
15992
  }
15991
15993
  return void 0;
15992
15994
  }
15993
15995
  };
15994
15996
  }
15997
+ function larkMvcPlugin7(options = {}) {
15998
+ return larkMvcPlugin(options);
15999
+ }
16000
+ function larkMvcPluginLegacy7(options = {}) {
16001
+ return larkMvcPluginLegacy(options);
16002
+ }
15995
16003
  // Annotate the CommonJS export names for ESM import in node:
15996
16004
  0 && (module.exports = {
15997
16005
  larkMvcPlugin,
15998
- larkMvcPluginLegacy
16006
+ larkMvcPlugin7,
16007
+ larkMvcPluginLegacy,
16008
+ larkMvcPluginLegacy7
15999
16009
  });
package/dist/vite.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Plugin } from 'vite';
2
+ import { Plugin as Plugin$1 } from 'vite7';
2
3
 
3
4
  /**
4
5
  * @lark.js/mvc Vite Plugin for Template Compilation
@@ -28,7 +29,6 @@ import { Plugin } from 'vite';
28
29
  * Create a Vite plugin that compiles .html template files.
29
30
  *
30
31
  * @param options - Plugin options
31
- * @param options.debug - Enable debug mode with line tracking (default: false)
32
32
  * @param options.virtualDom - Generate VDOM output instead of HTML string (default: false)
33
33
  * @returns Vite plugin instance
34
34
  */
@@ -39,9 +39,17 @@ declare function larkMvcPlugin(options?: {
39
39
  }): Plugin;
40
40
 
41
41
  declare function larkMvcPluginLegacy(options?: {
42
- debug?: boolean;
43
42
  virtualDom?: boolean;
44
43
  useSwc?: boolean;
45
44
  }): Plugin;
45
+ declare function larkMvcPlugin7(options?: {
46
+ debug?: boolean;
47
+ virtualDom?: boolean;
48
+ useSwc?: boolean;
49
+ }): Plugin$1;
50
+ declare function larkMvcPluginLegacy7(options?: {
51
+ virtualDom?: boolean;
52
+ useSwc?: boolean;
53
+ }): Plugin$1;
46
54
 
47
- export { larkMvcPlugin as default, larkMvcPlugin, larkMvcPluginLegacy };
55
+ export { larkMvcPlugin as default, larkMvcPlugin, larkMvcPlugin7, larkMvcPluginLegacy, larkMvcPluginLegacy7 };
package/dist/vite.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Plugin } from 'vite';
2
+ import { Plugin as Plugin$1 } from 'vite7';
2
3
 
3
4
  /**
4
5
  * @lark.js/mvc Vite Plugin for Template Compilation
@@ -28,7 +29,6 @@ import { Plugin } from 'vite';
28
29
  * Create a Vite plugin that compiles .html template files.
29
30
  *
30
31
  * @param options - Plugin options
31
- * @param options.debug - Enable debug mode with line tracking (default: false)
32
32
  * @param options.virtualDom - Generate VDOM output instead of HTML string (default: false)
33
33
  * @returns Vite plugin instance
34
34
  */
@@ -39,9 +39,17 @@ declare function larkMvcPlugin(options?: {
39
39
  }): Plugin;
40
40
 
41
41
  declare function larkMvcPluginLegacy(options?: {
42
- debug?: boolean;
43
42
  virtualDom?: boolean;
44
43
  useSwc?: boolean;
45
44
  }): Plugin;
45
+ declare function larkMvcPlugin7(options?: {
46
+ debug?: boolean;
47
+ virtualDom?: boolean;
48
+ useSwc?: boolean;
49
+ }): Plugin$1;
50
+ declare function larkMvcPluginLegacy7(options?: {
51
+ virtualDom?: boolean;
52
+ useSwc?: boolean;
53
+ }): Plugin$1;
46
54
 
47
- export { larkMvcPlugin as default, larkMvcPlugin, larkMvcPluginLegacy };
55
+ export { larkMvcPlugin as default, larkMvcPlugin, larkMvcPlugin7, larkMvcPluginLegacy, larkMvcPluginLegacy7 };
package/dist/vite.js CHANGED
@@ -27,12 +27,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.41_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js
31
31
  import path from "path";
32
32
  import { fileURLToPath } from "url";
33
33
  var getFilename, getDirname, __dirname;
34
34
  var init_esm_shims = __esm({
35
- "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/esm_shims.js"() {
35
+ "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.41_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js"() {
36
36
  "use strict";
37
37
  getFilename = () => fileURLToPath(import.meta.url);
38
38
  getDirname = () => path.dirname(getFilename());
@@ -15964,7 +15964,7 @@ function larkMvcPlugin(options = {}) {
15964
15964
  }
15965
15965
  var vite_default = larkMvcPlugin;
15966
15966
  function larkMvcPluginLegacy(options = {}) {
15967
- const { debug = false, virtualDom = false, useSwc = false } = options;
15967
+ const { virtualDom = false, useSwc = false } = options;
15968
15968
  return {
15969
15969
  name: "lark-template",
15970
15970
  enforce: "pre",
@@ -15979,14 +15979,22 @@ function larkMvcPluginLegacy(options = {}) {
15979
15979
  const filePath = id.slice(0, -LARK_TEMPLATE_SUFFIX.length);
15980
15980
  const raw = fs.readFileSync(filePath, "utf-8");
15981
15981
  const globalVars = await extractGlobalVars2(raw);
15982
- return compileTemplate(raw, { debug, globalVars, virtualDom, useSwc });
15982
+ return compileTemplate(raw, { globalVars, virtualDom, useSwc });
15983
15983
  }
15984
15984
  return void 0;
15985
15985
  }
15986
15986
  };
15987
15987
  }
15988
+ function larkMvcPlugin7(options = {}) {
15989
+ return larkMvcPlugin(options);
15990
+ }
15991
+ function larkMvcPluginLegacy7(options = {}) {
15992
+ return larkMvcPluginLegacy(options);
15993
+ }
15988
15994
  export {
15989
15995
  vite_default as default,
15990
15996
  larkMvcPlugin,
15991
- larkMvcPluginLegacy
15997
+ larkMvcPlugin7,
15998
+ larkMvcPluginLegacy,
15999
+ larkMvcPluginLegacy7
15992
16000
  };
package/dist/webpack.cjs CHANGED
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.41_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js
37
37
  var init_cjs_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/cjs_shims.js"() {
38
+ "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.41_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
package/dist/webpack.js CHANGED
@@ -27,12 +27,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.41_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js
31
31
  import path from "path";
32
32
  import { fileURLToPath } from "url";
33
33
  var getFilename, __filename;
34
34
  var init_esm_shims = __esm({
35
- "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/esm_shims.js"() {
35
+ "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.41_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js"() {
36
36
  "use strict";
37
37
  getFilename = () => fileURLToPath(import.meta.url);
38
38
  __filename = /* @__PURE__ */ getFilename();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark.js/mvc",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "@lark.js/mvc - TypeScript MVC framework",
5
5
  "keywords": [
6
6
  "framework",
@@ -115,11 +115,12 @@
115
115
  "@rollup/plugin-typescript": "^12.3.0",
116
116
  "@types/node": "^24.13.2",
117
117
  "@vitest/coverage-v8": "4.1.6",
118
- "rollup": "^4.62.0",
118
+ "rollup": "^4.62.2",
119
119
  "rollup-plugin-dts": "^6.4.1",
120
120
  "tsup": "^8.5.1",
121
121
  "typescript": "^5.9.3",
122
122
  "vite": "^8.0.16",
123
+ "vite7": "npm:vite@7.3.5",
123
124
  "vitest": "^4.1.9"
124
125
  },
125
126
  "peerDependencies": {
package/src/client.d.ts CHANGED
@@ -9,8 +9,6 @@ import type { Frame } from "./frame";
9
9
  import type { View } from "./view";
10
10
  declare global {
11
11
  interface Window {
12
- /** Whether lark debug mode is enabled */
13
- __lark_Debug: boolean;
14
12
  /** Lark Framework object */
15
13
  __lark_Framework?: FrameworkInterface;
16
14
  /** Lark State object */