@lark.js/mvc 0.0.1

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.
@@ -0,0 +1,18 @@
1
+ /** Webpack loader context */
2
+ interface LoaderContext {
3
+ /** Callback to return the result */
4
+ callback: (error: Error | null, result?: string) => void;
5
+ /** Whether in development mode */
6
+ dev?: boolean;
7
+ /** Loader options */
8
+ getOptions: () => {
9
+ debug?: boolean;
10
+ };
11
+ }
12
+ /**
13
+ * Webpack loader entry point.
14
+ * Compiles .html template files into JS function modules.
15
+ */
16
+ declare function larkTmplLoader(this: LoaderContext, source: string): void;
17
+
18
+ export { larkTmplLoader as default, larkTmplLoader };
@@ -0,0 +1,18 @@
1
+ /** Webpack loader context */
2
+ interface LoaderContext {
3
+ /** Callback to return the result */
4
+ callback: (error: Error | null, result?: string) => void;
5
+ /** Whether in development mode */
6
+ dev?: boolean;
7
+ /** Loader options */
8
+ getOptions: () => {
9
+ debug?: boolean;
10
+ };
11
+ }
12
+ /**
13
+ * Webpack loader entry point.
14
+ * Compiles .html template files into JS function modules.
15
+ */
16
+ declare function larkTmplLoader(this: LoaderContext, source: string): void;
17
+
18
+ export { larkTmplLoader as default, larkTmplLoader };
@@ -0,0 +1,22 @@
1
+ import {
2
+ compileTemplate,
3
+ extractGlobalVars
4
+ } from "./chunk-DZUOIUWX.js";
5
+
6
+ // src/webpack.ts
7
+ function larkTmplLoader(source) {
8
+ const options = this.getOptions();
9
+ const debug = options.debug ?? false;
10
+ try {
11
+ const globalVars = extractGlobalVars(source);
12
+ const result = compileTemplate(source, { debug, globalVars });
13
+ this.callback(null, result);
14
+ } catch (error) {
15
+ this.callback(error instanceof Error ? error : new Error(String(error)));
16
+ }
17
+ }
18
+ var webpack_default = larkTmplLoader;
19
+ export {
20
+ webpack_default as default,
21
+ larkTmplLoader
22
+ };
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@lark.js/mvc",
3
+ "version": "0.0.1",
4
+ "description": "Lark - TypeScript MVC framework",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.cts",
16
+ "default": "./dist/index.cjs"
17
+ }
18
+ },
19
+ "./vite": {
20
+ "import": {
21
+ "types": "./dist/vite.d.ts",
22
+ "default": "./dist/vite.js"
23
+ },
24
+ "require": {
25
+ "types": "./dist/vite.d.cts",
26
+ "default": "./dist/vite.cjs"
27
+ }
28
+ },
29
+ "./webpack": {
30
+ "import": {
31
+ "types": "./dist/webpack.d.ts",
32
+ "default": "./dist/webpack.js"
33
+ },
34
+ "require": {
35
+ "types": "./dist/webpack.d.cts",
36
+ "default": "./dist/webpack.cjs"
37
+ }
38
+ }
39
+ },
40
+ "main": "dist/index.cjs",
41
+ "module": "dist/index.js",
42
+ "types": "dist/index.d.ts",
43
+ "scripts": {
44
+ "build": "pnpm build:tsup",
45
+ "build:rollup": "rollup -c rollup.config.mjs",
46
+ "build:tsup": "tsup",
47
+ "clean": "rm -rf dist",
48
+ "format": "prettier -w ./",
49
+ "typecheck": "tsc -p tsconfig.build.json --noEmit"
50
+ },
51
+ "keywords": [
52
+ "lark",
53
+ "mvc",
54
+ "framework"
55
+ ],
56
+ "author": "https://github.com/hangtiancheng",
57
+ "license": "ISC",
58
+ "packageManager": "pnpm@10.33.0",
59
+ "devDependencies": {
60
+ "@rollup/plugin-commonjs": "^29.0.2",
61
+ "@rollup/plugin-node-resolve": "^16.0.3",
62
+ "@rollup/plugin-typescript": "^12.3.0",
63
+ "rollup": "^4.60.3",
64
+ "rollup-plugin-dts": "^6.4.1",
65
+ "tsup": "^8.5.1",
66
+ "typescript": "^5.8.3",
67
+ "vite": "^8.0.14"
68
+ },
69
+ "lint-staged": {
70
+ "*.{json,jsonc,js,cjs,mjs,jsx,ts,cts,mts,tsx,html,vue,css,scss,md,mdx}": [
71
+ "pnpm format"
72
+ ]
73
+ },
74
+ "type": "module",
75
+ "peerDependencies": {
76
+ "vite": "^8.0.14"
77
+ },
78
+ "dependencies": {
79
+ "@babel/parser": "^7.29.7",
80
+ "@babel/types": "^7.29.7"
81
+ }
82
+ }