@lark.js/mvc 0.0.11 → 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/dist/rspack.cjs CHANGED
@@ -15956,7 +15956,6 @@ var LarkMvcPlugin = class {
15956
15956
  */
15957
15957
  apply(compiler) {
15958
15958
  const { debug, virtualDom, useSwc, test, exclude } = this.options;
15959
- const loaderPath = __filename;
15960
15959
  compiler.options.module = compiler.options.module || {};
15961
15960
  compiler.options.module.rules = compiler.options.module.rules || [];
15962
15961
  compiler.options.module.rules.push({
@@ -15964,7 +15963,12 @@ var LarkMvcPlugin = class {
15964
15963
  exclude,
15965
15964
  use: [
15966
15965
  {
15967
- loader: loaderPath,
15966
+ // Resolve the loader path (this file).
15967
+ // Deprecated implementation
15968
+ // isCjs() ? __filename : fileURLToPath(import.meta.url);
15969
+ // __filename is provided by tsup's ESM shim (shims: true) in ESM output,
15970
+ // and is a native CJS global in CJS output.
15971
+ loader: __filename,
15968
15972
  options: { debug, virtualDom, useSwc }
15969
15973
  }
15970
15974
  ]
package/dist/rspack.js CHANGED
@@ -15948,7 +15948,6 @@ var LarkMvcPlugin = class {
15948
15948
  */
15949
15949
  apply(compiler) {
15950
15950
  const { debug, virtualDom, useSwc, test, exclude } = this.options;
15951
- const loaderPath = __filename;
15952
15951
  compiler.options.module = compiler.options.module || {};
15953
15952
  compiler.options.module.rules = compiler.options.module.rules || [];
15954
15953
  compiler.options.module.rules.push({
@@ -15956,7 +15955,12 @@ var LarkMvcPlugin = class {
15956
15955
  exclude,
15957
15956
  use: [
15958
15957
  {
15959
- loader: loaderPath,
15958
+ // Resolve the loader path (this file).
15959
+ // Deprecated implementation
15960
+ // isCjs() ? __filename : fileURLToPath(import.meta.url);
15961
+ // __filename is provided by tsup's ESM shim (shims: true) in ESM output,
15962
+ // and is a native CJS global in CJS output.
15963
+ loader: __filename,
15960
15964
  options: { debug, virtualDom, useSwc }
15961
15965
  }
15962
15966
  ]
package/dist/runtime.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  encodeURIExtra,
5
5
  refFn,
6
6
  strSafe
7
- } from "./chunk-RIV4NK3K.js";
7
+ } from "./chunk-66OZBBSP.js";
8
8
 
9
9
  // src/runtime.ts
10
10
  var strSafe2 = strSafe;
package/dist/vite.cjs CHANGED
@@ -14620,7 +14620,10 @@ var require_lib = __commonJS({
14620
14620
  var vite_exports = {};
14621
14621
  __export(vite_exports, {
14622
14622
  default: () => vite_default,
14623
- larkMvcPlugin: () => larkMvcPlugin
14623
+ larkMvcPlugin: () => larkMvcPlugin,
14624
+ larkMvcPlugin7: () => larkMvcPlugin7,
14625
+ larkMvcPluginLegacy: () => larkMvcPluginLegacy,
14626
+ larkMvcPluginLegacy7: () => larkMvcPluginLegacy7
14624
14627
  });
14625
14628
  module.exports = __toCommonJS(vite_exports);
14626
14629
  init_cjs_shims();
@@ -15926,6 +15929,51 @@ export default function(data, viewId, refData) {
15926
15929
  var LARK_TEMPLATE_SUFFIX = "?lark-template";
15927
15930
  function larkMvcPlugin(options = {}) {
15928
15931
  const { debug = false, virtualDom = false, useSwc = false } = options;
15932
+ let root = __dirname;
15933
+ return {
15934
+ name: "lark-template",
15935
+ enforce: "pre",
15936
+ configResolved(config) {
15937
+ root = config.root;
15938
+ },
15939
+ resolveId(source, importer) {
15940
+ const sourcePath = source.split("?")[0];
15941
+ if (sourcePath.endsWith(".html") && importer) {
15942
+ const importerPath = importer.split("?")[0];
15943
+ let resolved = import_path.default.resolve(import_path.default.dirname(importerPath), sourcePath);
15944
+ if (!import_fs.default.existsSync(resolved)) {
15945
+ const rootResolved = import_path.default.join(root, resolved);
15946
+ if (import_fs.default.existsSync(rootResolved)) {
15947
+ resolved = rootResolved;
15948
+ }
15949
+ }
15950
+ return resolved + LARK_TEMPLATE_SUFFIX;
15951
+ }
15952
+ return void 0;
15953
+ },
15954
+ async load(id) {
15955
+ const qIdx = id.indexOf("?");
15956
+ const query = qIdx >= 0 ? id.slice(qIdx + 1) : "";
15957
+ if (query.split("&").includes("lark-template")) {
15958
+ let filePath = qIdx >= 0 ? id.slice(0, qIdx) : id;
15959
+ if (!import_fs.default.existsSync(filePath)) {
15960
+ const rootResolved = import_path.default.join(root, filePath);
15961
+ if (import_fs.default.existsSync(rootResolved)) {
15962
+ filePath = rootResolved;
15963
+ }
15964
+ }
15965
+ if (!import_fs.default.existsSync(filePath)) return void 0;
15966
+ const raw = import_fs.default.readFileSync(filePath, "utf-8");
15967
+ const globalVars = await extractGlobalVars2(raw);
15968
+ return compileTemplate(raw, { debug, globalVars, virtualDom, useSwc });
15969
+ }
15970
+ return void 0;
15971
+ }
15972
+ };
15973
+ }
15974
+ var vite_default = larkMvcPlugin;
15975
+ function larkMvcPluginLegacy(options = {}) {
15976
+ const { virtualDom = false, useSwc = false } = options;
15929
15977
  return {
15930
15978
  name: "lark-template",
15931
15979
  enforce: "pre",
@@ -15940,14 +15988,22 @@ function larkMvcPlugin(options = {}) {
15940
15988
  const filePath = id.slice(0, -LARK_TEMPLATE_SUFFIX.length);
15941
15989
  const raw = import_fs.default.readFileSync(filePath, "utf-8");
15942
15990
  const globalVars = await extractGlobalVars2(raw);
15943
- return compileTemplate(raw, { debug, globalVars, virtualDom, useSwc });
15991
+ return compileTemplate(raw, { globalVars, virtualDom, useSwc });
15944
15992
  }
15945
15993
  return void 0;
15946
15994
  }
15947
15995
  };
15948
15996
  }
15949
- var vite_default = larkMvcPlugin;
15997
+ function larkMvcPlugin7(options = {}) {
15998
+ return larkMvcPlugin(options);
15999
+ }
16000
+ function larkMvcPluginLegacy7(options = {}) {
16001
+ return larkMvcPluginLegacy(options);
16002
+ }
15950
16003
  // Annotate the CommonJS export names for ESM import in node:
15951
16004
  0 && (module.exports = {
15952
- larkMvcPlugin
16005
+ larkMvcPlugin,
16006
+ larkMvcPlugin7,
16007
+ larkMvcPluginLegacy,
16008
+ larkMvcPluginLegacy7
15953
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
  */
@@ -38,4 +38,18 @@ declare function larkMvcPlugin(options?: {
38
38
  useSwc?: boolean;
39
39
  }): Plugin;
40
40
 
41
- export { larkMvcPlugin as default, larkMvcPlugin };
41
+ declare function larkMvcPluginLegacy(options?: {
42
+ virtualDom?: boolean;
43
+ useSwc?: boolean;
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;
54
+
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
  */
@@ -38,4 +38,18 @@ declare function larkMvcPlugin(options?: {
38
38
  useSwc?: boolean;
39
39
  }): Plugin;
40
40
 
41
- export { larkMvcPlugin as default, larkMvcPlugin };
41
+ declare function larkMvcPluginLegacy(options?: {
42
+ virtualDom?: boolean;
43
+ useSwc?: boolean;
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;
54
+
55
+ export { larkMvcPlugin as default, larkMvcPlugin, larkMvcPlugin7, larkMvcPluginLegacy, larkMvcPluginLegacy7 };
package/dist/vite.js CHANGED
@@ -30,9 +30,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
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
+ var getFilename, getDirname, __dirname;
33
34
  var init_esm_shims = __esm({
34
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"() {
35
36
  "use strict";
37
+ getFilename = () => fileURLToPath(import.meta.url);
38
+ getDirname = () => path.dirname(getFilename());
39
+ __dirname = /* @__PURE__ */ getDirname();
36
40
  }
37
41
  });
38
42
 
@@ -15916,6 +15920,51 @@ export default function(data, viewId, refData) {
15916
15920
  var LARK_TEMPLATE_SUFFIX = "?lark-template";
15917
15921
  function larkMvcPlugin(options = {}) {
15918
15922
  const { debug = false, virtualDom = false, useSwc = false } = options;
15923
+ let root = __dirname;
15924
+ return {
15925
+ name: "lark-template",
15926
+ enforce: "pre",
15927
+ configResolved(config) {
15928
+ root = config.root;
15929
+ },
15930
+ resolveId(source, importer) {
15931
+ const sourcePath = source.split("?")[0];
15932
+ if (sourcePath.endsWith(".html") && importer) {
15933
+ const importerPath = importer.split("?")[0];
15934
+ let resolved = path2.resolve(path2.dirname(importerPath), sourcePath);
15935
+ if (!fs.existsSync(resolved)) {
15936
+ const rootResolved = path2.join(root, resolved);
15937
+ if (fs.existsSync(rootResolved)) {
15938
+ resolved = rootResolved;
15939
+ }
15940
+ }
15941
+ return resolved + LARK_TEMPLATE_SUFFIX;
15942
+ }
15943
+ return void 0;
15944
+ },
15945
+ async load(id) {
15946
+ const qIdx = id.indexOf("?");
15947
+ const query = qIdx >= 0 ? id.slice(qIdx + 1) : "";
15948
+ if (query.split("&").includes("lark-template")) {
15949
+ let filePath = qIdx >= 0 ? id.slice(0, qIdx) : id;
15950
+ if (!fs.existsSync(filePath)) {
15951
+ const rootResolved = path2.join(root, filePath);
15952
+ if (fs.existsSync(rootResolved)) {
15953
+ filePath = rootResolved;
15954
+ }
15955
+ }
15956
+ if (!fs.existsSync(filePath)) return void 0;
15957
+ const raw = fs.readFileSync(filePath, "utf-8");
15958
+ const globalVars = await extractGlobalVars2(raw);
15959
+ return compileTemplate(raw, { debug, globalVars, virtualDom, useSwc });
15960
+ }
15961
+ return void 0;
15962
+ }
15963
+ };
15964
+ }
15965
+ var vite_default = larkMvcPlugin;
15966
+ function larkMvcPluginLegacy(options = {}) {
15967
+ const { virtualDom = false, useSwc = false } = options;
15919
15968
  return {
15920
15969
  name: "lark-template",
15921
15970
  enforce: "pre",
@@ -15930,14 +15979,22 @@ function larkMvcPlugin(options = {}) {
15930
15979
  const filePath = id.slice(0, -LARK_TEMPLATE_SUFFIX.length);
15931
15980
  const raw = fs.readFileSync(filePath, "utf-8");
15932
15981
  const globalVars = await extractGlobalVars2(raw);
15933
- return compileTemplate(raw, { debug, globalVars, virtualDom, useSwc });
15982
+ return compileTemplate(raw, { globalVars, virtualDom, useSwc });
15934
15983
  }
15935
15984
  return void 0;
15936
15985
  }
15937
15986
  };
15938
15987
  }
15939
- var vite_default = larkMvcPlugin;
15988
+ function larkMvcPlugin7(options = {}) {
15989
+ return larkMvcPlugin(options);
15990
+ }
15991
+ function larkMvcPluginLegacy7(options = {}) {
15992
+ return larkMvcPluginLegacy(options);
15993
+ }
15940
15994
  export {
15941
15995
  vite_default as default,
15942
- larkMvcPlugin
15996
+ larkMvcPlugin,
15997
+ larkMvcPlugin7,
15998
+ larkMvcPluginLegacy,
15999
+ larkMvcPluginLegacy7
15943
16000
  };
package/dist/webpack.cjs CHANGED
@@ -15956,7 +15956,6 @@ var LarkMvcPlugin = class {
15956
15956
  */
15957
15957
  apply(compiler) {
15958
15958
  const { debug, virtualDom, useSwc, test, exclude } = this.options;
15959
- const loaderPath = __filename;
15960
15959
  compiler.options.module = compiler.options.module || {};
15961
15960
  compiler.options.module.rules = compiler.options.module.rules || [];
15962
15961
  compiler.options.module.rules.push({
@@ -15964,7 +15963,12 @@ var LarkMvcPlugin = class {
15964
15963
  exclude,
15965
15964
  use: [
15966
15965
  {
15967
- loader: loaderPath,
15966
+ // Resolve the loader path (this file).
15967
+ // Deprecated implementation
15968
+ // isCjs() ? __filename : fileURLToPath(import.meta.url);
15969
+ // __filename is provided by tsup's ESM shim (shims: true) in ESM output,
15970
+ // and is a native CJS global in CJS output.
15971
+ loader: __filename,
15968
15972
  options: { debug, virtualDom, useSwc }
15969
15973
  }
15970
15974
  ]
package/dist/webpack.js CHANGED
@@ -15948,7 +15948,6 @@ var LarkMvcPlugin = class {
15948
15948
  */
15949
15949
  apply(compiler) {
15950
15950
  const { debug, virtualDom, useSwc, test, exclude } = this.options;
15951
- const loaderPath = __filename;
15952
15951
  compiler.options.module = compiler.options.module || {};
15953
15952
  compiler.options.module.rules = compiler.options.module.rules || [];
15954
15953
  compiler.options.module.rules.push({
@@ -15956,7 +15955,12 @@ var LarkMvcPlugin = class {
15956
15955
  exclude,
15957
15956
  use: [
15958
15957
  {
15959
- loader: loaderPath,
15958
+ // Resolve the loader path (this file).
15959
+ // Deprecated implementation
15960
+ // isCjs() ? __filename : fileURLToPath(import.meta.url);
15961
+ // __filename is provided by tsup's ESM shim (shims: true) in ESM output,
15962
+ // and is a native CJS global in CJS output.
15963
+ loader: __filename,
15960
15964
  options: { debug, virtualDom, useSwc }
15961
15965
  }
15962
15966
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark.js/mvc",
3
- "version": "0.0.11",
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 */
@@ -34,6 +32,14 @@ declare global {
34
32
  crossConfigs?: CrossSiteConfig[];
35
33
  scheduler?: Scheduler;
36
34
  }
35
+ interface ImportMeta {
36
+ /** HMR context provided by Vite / webpack dev server. Undefined in production. */
37
+ hot?: {
38
+ accept(cb?: (mod: { default?: unknown } | undefined) => void): void;
39
+ dispose(cb: (data: unknown) => void): void;
40
+ invalidate(): void;
41
+ };
42
+ }
37
43
  interface HTMLElement {
38
44
  /** Bound frame instance */
39
45
  frame?: FrameInterface | undefined;
File without changes