@lark.js/mvc 0.0.11 → 0.0.12

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.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.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
30
+ // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/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.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
+ "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/esm_shims.js"() {
36
36
  "use strict";
37
37
  getFilename = () => fileURLToPath(import.meta.url);
38
38
  __filename = /* @__PURE__ */ getFilename();
@@ -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
@@ -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.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
36
+ // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/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.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"() {
38
+ "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
@@ -14620,7 +14620,8 @@ 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
+ larkMvcPluginLegacy: () => larkMvcPluginLegacy
14624
14625
  });
14625
14626
  module.exports = __toCommonJS(vite_exports);
14626
14627
  init_cjs_shims();
@@ -15925,6 +15926,51 @@ export default function(data, viewId, refData) {
15925
15926
  // src/vite.ts
15926
15927
  var LARK_TEMPLATE_SUFFIX = "?lark-template";
15927
15928
  function larkMvcPlugin(options = {}) {
15929
+ const { debug = false, virtualDom = false, useSwc = false } = options;
15930
+ let root = __dirname;
15931
+ return {
15932
+ name: "lark-template",
15933
+ enforce: "pre",
15934
+ configResolved(config) {
15935
+ root = config.root;
15936
+ },
15937
+ resolveId(source, importer) {
15938
+ const sourcePath = source.split("?")[0];
15939
+ if (sourcePath.endsWith(".html") && importer) {
15940
+ const importerPath = importer.split("?")[0];
15941
+ let resolved = import_path.default.resolve(import_path.default.dirname(importerPath), sourcePath);
15942
+ if (!import_fs.default.existsSync(resolved)) {
15943
+ const rootResolved = import_path.default.join(root, resolved);
15944
+ if (import_fs.default.existsSync(rootResolved)) {
15945
+ resolved = rootResolved;
15946
+ }
15947
+ }
15948
+ return resolved + LARK_TEMPLATE_SUFFIX;
15949
+ }
15950
+ return void 0;
15951
+ },
15952
+ async load(id) {
15953
+ const qIdx = id.indexOf("?");
15954
+ const query = qIdx >= 0 ? id.slice(qIdx + 1) : "";
15955
+ if (query.split("&").includes("lark-template")) {
15956
+ let filePath = qIdx >= 0 ? id.slice(0, qIdx) : id;
15957
+ if (!import_fs.default.existsSync(filePath)) {
15958
+ const rootResolved = import_path.default.join(root, filePath);
15959
+ if (import_fs.default.existsSync(rootResolved)) {
15960
+ filePath = rootResolved;
15961
+ }
15962
+ }
15963
+ if (!import_fs.default.existsSync(filePath)) return void 0;
15964
+ const raw = import_fs.default.readFileSync(filePath, "utf-8");
15965
+ const globalVars = await extractGlobalVars2(raw);
15966
+ return compileTemplate(raw, { debug, globalVars, virtualDom, useSwc });
15967
+ }
15968
+ return void 0;
15969
+ }
15970
+ };
15971
+ }
15972
+ var vite_default = larkMvcPlugin;
15973
+ function larkMvcPluginLegacy(options = {}) {
15928
15974
  const { debug = false, virtualDom = false, useSwc = false } = options;
15929
15975
  return {
15930
15976
  name: "lark-template",
@@ -15946,8 +15992,8 @@ function larkMvcPlugin(options = {}) {
15946
15992
  }
15947
15993
  };
15948
15994
  }
15949
- var vite_default = larkMvcPlugin;
15950
15995
  // Annotate the CommonJS export names for ESM import in node:
15951
15996
  0 && (module.exports = {
15952
- larkMvcPlugin
15997
+ larkMvcPlugin,
15998
+ larkMvcPluginLegacy
15953
15999
  });
package/dist/vite.d.cts CHANGED
@@ -38,4 +38,10 @@ 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
+ debug?: boolean;
43
+ virtualDom?: boolean;
44
+ useSwc?: boolean;
45
+ }): Plugin;
46
+
47
+ export { larkMvcPlugin as default, larkMvcPlugin, larkMvcPluginLegacy };
package/dist/vite.d.ts CHANGED
@@ -38,4 +38,10 @@ 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
+ debug?: boolean;
43
+ virtualDom?: boolean;
44
+ useSwc?: boolean;
45
+ }): Plugin;
46
+
47
+ export { larkMvcPlugin as default, larkMvcPlugin, larkMvcPluginLegacy };
package/dist/vite.js CHANGED
@@ -27,12 +27,16 @@ 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.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
30
+ // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/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
- "../../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
+ "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/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
 
@@ -15915,6 +15919,51 @@ export default function(data, viewId, refData) {
15915
15919
  // src/vite.ts
15916
15920
  var LARK_TEMPLATE_SUFFIX = "?lark-template";
15917
15921
  function larkMvcPlugin(options = {}) {
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 = {}) {
15918
15967
  const { debug = false, virtualDom = false, useSwc = false } = options;
15919
15968
  return {
15920
15969
  name: "lark-template",
@@ -15936,8 +15985,8 @@ function larkMvcPlugin(options = {}) {
15936
15985
  }
15937
15986
  };
15938
15987
  }
15939
- var vite_default = larkMvcPlugin;
15940
15988
  export {
15941
15989
  vite_default as default,
15942
- larkMvcPlugin
15990
+ larkMvcPlugin,
15991
+ larkMvcPluginLegacy
15943
15992
  };
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.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
36
+ // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/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.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"() {
38
+ "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
@@ -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
@@ -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.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
30
+ // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/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.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
+ "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.4_34a04ed47198e6dd24361ae1f6711a67/node_modules/tsup/assets/esm_shims.js"() {
36
36
  "use strict";
37
37
  getFilename = () => fileURLToPath(import.meta.url);
38
38
  __filename = /* @__PURE__ */ getFilename();
@@ -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.12",
4
4
  "description": "@lark.js/mvc - TypeScript MVC framework",
5
5
  "keywords": [
6
6
  "framework",
package/src/client.d.ts CHANGED
@@ -34,6 +34,14 @@ declare global {
34
34
  crossConfigs?: CrossSiteConfig[];
35
35
  scheduler?: Scheduler;
36
36
  }
37
+ interface ImportMeta {
38
+ /** HMR context provided by Vite / webpack dev server. Undefined in production. */
39
+ hot?: {
40
+ accept(cb?: (mod: { default?: unknown } | undefined) => void): void;
41
+ dispose(cb: (data: unknown) => void): void;
42
+ invalidate(): void;
43
+ };
44
+ }
37
45
  interface HTMLElement {
38
46
  /** Bound frame instance */
39
47
  frame?: FrameInterface | undefined;
File without changes