@lark.js/mvc 0.0.16 → 0.0.17
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/compiler.cjs +2 -2
- package/dist/compiler.d.cts +1 -1
- package/dist/compiler.d.ts +1 -1
- package/dist/compiler.js +2 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/rspack.cjs +7 -7
- package/dist/rspack.d.cts +3 -3
- package/dist/rspack.d.ts +3 -3
- package/dist/rspack.js +7 -7
- package/dist/vite.cjs +6 -6
- package/dist/vite.d.cts +5 -5
- package/dist/vite.d.ts +5 -5
- package/dist/vite.js +6 -6
- package/dist/webpack.cjs +7 -7
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +7 -7
- package/package.json +1 -1
package/dist/compiler.cjs
CHANGED
|
@@ -15582,14 +15582,14 @@ function compileToFunction(source, debug, file) {
|
|
|
15582
15582
|
return `($data,$viewId,$refAlt,$encHtml,$strSafe,$encUri,$refFn,$encQuote)=>{${fullSource}}`;
|
|
15583
15583
|
}
|
|
15584
15584
|
async function compileTemplate(source, options = {}) {
|
|
15585
|
-
const { debug = false, file,
|
|
15585
|
+
const { debug = false, file, vdom = false } = options;
|
|
15586
15586
|
const globalVars = options.globalVars ?? await extractGlobalVars(source);
|
|
15587
15587
|
const { protectedSource, comments } = protectComments(source);
|
|
15588
15588
|
const converted = convertArtSyntax(protectedSource, debug);
|
|
15589
15589
|
const viewEventProcessed = processViewEvents(converted);
|
|
15590
15590
|
const finalSource = restoreComments(viewEventProcessed, comments);
|
|
15591
15591
|
const varDeclarations = globalVars.map((key) => `,${key}=$data.${key}`).join("");
|
|
15592
|
-
if (
|
|
15592
|
+
if (vdom) {
|
|
15593
15593
|
const funcBody2 = compileToVDomFunction(finalSource, debug, file);
|
|
15594
15594
|
const funcWithVars2 = funcBody2.replace("{{VARS}}", () => varDeclarations);
|
|
15595
15595
|
return `import { vdomCreate as __larkVdomCreate } from "@lark.js/mvc";
|
package/dist/compiler.d.cts
CHANGED
package/dist/compiler.d.ts
CHANGED
package/dist/compiler.js
CHANGED
|
@@ -15568,14 +15568,14 @@ function compileToFunction(source, debug, file) {
|
|
|
15568
15568
|
return `($data,$viewId,$refAlt,$encHtml,$strSafe,$encUri,$refFn,$encQuote)=>{${fullSource}}`;
|
|
15569
15569
|
}
|
|
15570
15570
|
async function compileTemplate(source, options = {}) {
|
|
15571
|
-
const { debug = false, file,
|
|
15571
|
+
const { debug = false, file, vdom = false } = options;
|
|
15572
15572
|
const globalVars = options.globalVars ?? await extractGlobalVars(source);
|
|
15573
15573
|
const { protectedSource, comments } = protectComments(source);
|
|
15574
15574
|
const converted = convertArtSyntax(protectedSource, debug);
|
|
15575
15575
|
const viewEventProcessed = processViewEvents(converted);
|
|
15576
15576
|
const finalSource = restoreComments(viewEventProcessed, comments);
|
|
15577
15577
|
const varDeclarations = globalVars.map((key) => `,${key}=$data.${key}`).join("");
|
|
15578
|
-
if (
|
|
15578
|
+
if (vdom) {
|
|
15579
15579
|
const funcBody2 = compileToVDomFunction(finalSource, debug, file);
|
|
15580
15580
|
const funcWithVars2 = funcBody2.replace("{{VARS}}", () => varDeclarations);
|
|
15581
15581
|
return `import { vdomCreate as __larkVdomCreate } from "@lark.js/mvc";
|
package/dist/index.d.cts
CHANGED
|
@@ -576,7 +576,7 @@ interface ViewCtx {
|
|
|
576
576
|
/** EndUpdate pending flag (accessed via getEndUpdatePending/setEndUpdatePending) */
|
|
577
577
|
getEndUpdatePending(): number | undefined;
|
|
578
578
|
setEndUpdatePending(v: number | undefined): void;
|
|
579
|
-
/** Last rendered VDOM tree (only used when
|
|
579
|
+
/** Last rendered VDOM tree (only used when vdom is enabled) */
|
|
580
580
|
vdom?: VDomNode;
|
|
581
581
|
/** Wrapped render method */
|
|
582
582
|
renderMethod?: AnyFunc;
|
|
@@ -1042,7 +1042,7 @@ interface FrameworkConfig {
|
|
|
1042
1042
|
*/
|
|
1043
1043
|
crossSites?: CrossSiteConfig[];
|
|
1044
1044
|
/** Default false. */
|
|
1045
|
-
|
|
1045
|
+
vdom?: boolean;
|
|
1046
1046
|
/**
|
|
1047
1047
|
* Enable Frame Devtool Bridge (default: true).
|
|
1048
1048
|
* When true, installs a postMessage listener so the Lark DevTool browser
|
|
@@ -1106,7 +1106,7 @@ interface CompileOptions {
|
|
|
1106
1106
|
/** File path for debug error messages (default: undefined) */
|
|
1107
1107
|
file?: string;
|
|
1108
1108
|
/** Generate VDOM output instead of HTML string (default: false) */
|
|
1109
|
-
|
|
1109
|
+
vdom?: boolean;
|
|
1110
1110
|
}
|
|
1111
1111
|
|
|
1112
1112
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -576,7 +576,7 @@ interface ViewCtx {
|
|
|
576
576
|
/** EndUpdate pending flag (accessed via getEndUpdatePending/setEndUpdatePending) */
|
|
577
577
|
getEndUpdatePending(): number | undefined;
|
|
578
578
|
setEndUpdatePending(v: number | undefined): void;
|
|
579
|
-
/** Last rendered VDOM tree (only used when
|
|
579
|
+
/** Last rendered VDOM tree (only used when vdom is enabled) */
|
|
580
580
|
vdom?: VDomNode;
|
|
581
581
|
/** Wrapped render method */
|
|
582
582
|
renderMethod?: AnyFunc;
|
|
@@ -1042,7 +1042,7 @@ interface FrameworkConfig {
|
|
|
1042
1042
|
*/
|
|
1043
1043
|
crossSites?: CrossSiteConfig[];
|
|
1044
1044
|
/** Default false. */
|
|
1045
|
-
|
|
1045
|
+
vdom?: boolean;
|
|
1046
1046
|
/**
|
|
1047
1047
|
* Enable Frame Devtool Bridge (default: true).
|
|
1048
1048
|
* When true, installs a postMessage listener so the Lark DevTool browser
|
|
@@ -1106,7 +1106,7 @@ interface CompileOptions {
|
|
|
1106
1106
|
/** File path for debug error messages (default: undefined) */
|
|
1107
1107
|
file?: string;
|
|
1108
1108
|
/** Generate VDOM output instead of HTML string (default: false) */
|
|
1109
|
-
|
|
1109
|
+
vdom?: boolean;
|
|
1110
1110
|
}
|
|
1111
1111
|
|
|
1112
1112
|
/**
|
package/dist/rspack.cjs
CHANGED
|
@@ -15604,14 +15604,14 @@ function compileToFunction(source, debug, file) {
|
|
|
15604
15604
|
return `($data,$viewId,$refAlt,$encHtml,$strSafe,$encUri,$refFn,$encQuote)=>{${fullSource}}`;
|
|
15605
15605
|
}
|
|
15606
15606
|
async function compileTemplate(source, options = {}) {
|
|
15607
|
-
const { debug = false, file,
|
|
15607
|
+
const { debug = false, file, vdom = false } = options;
|
|
15608
15608
|
const globalVars = options.globalVars ?? await extractGlobalVars(source);
|
|
15609
15609
|
const { protectedSource, comments } = protectComments(source);
|
|
15610
15610
|
const converted = convertArtSyntax(protectedSource, debug);
|
|
15611
15611
|
const viewEventProcessed = processViewEvents(converted);
|
|
15612
15612
|
const finalSource = restoreComments(viewEventProcessed, comments);
|
|
15613
15613
|
const varDeclarations = globalVars.map((key) => `,${key}=$data.${key}`).join("");
|
|
15614
|
-
if (
|
|
15614
|
+
if (vdom) {
|
|
15615
15615
|
const funcBody2 = compileToVDomFunction(finalSource, debug, file);
|
|
15616
15616
|
const funcWithVars2 = funcBody2.replace("{{VARS}}", () => varDeclarations);
|
|
15617
15617
|
return `import { vdomCreate as __larkVdomCreate } from "@lark.js/mvc";
|
|
@@ -15689,12 +15689,12 @@ function injectTemplateHmrSnippet(source, bundler) {
|
|
|
15689
15689
|
async function larkMvcLoader(source) {
|
|
15690
15690
|
try {
|
|
15691
15691
|
const options = this.getOptions();
|
|
15692
|
-
const { debug = false,
|
|
15692
|
+
const { debug = false, vdom = false } = options;
|
|
15693
15693
|
const globalVars = await extractGlobalVars(source);
|
|
15694
15694
|
const compiled = await compileTemplate(source, {
|
|
15695
15695
|
debug,
|
|
15696
15696
|
globalVars,
|
|
15697
|
-
|
|
15697
|
+
vdom
|
|
15698
15698
|
});
|
|
15699
15699
|
return injectTemplateHmrSnippet(compiled, "rspack");
|
|
15700
15700
|
} catch (err) {
|
|
@@ -15707,7 +15707,7 @@ var LarkMvcPlugin = class {
|
|
|
15707
15707
|
constructor(options = {}) {
|
|
15708
15708
|
this.options = {
|
|
15709
15709
|
debug: false,
|
|
15710
|
-
|
|
15710
|
+
vdom: false,
|
|
15711
15711
|
test: /\.html$/,
|
|
15712
15712
|
exclude: /node_modules/,
|
|
15713
15713
|
...options
|
|
@@ -15718,7 +15718,7 @@ var LarkMvcPlugin = class {
|
|
|
15718
15718
|
* Called by rspack when the plugin is applied.
|
|
15719
15719
|
*/
|
|
15720
15720
|
apply(compiler) {
|
|
15721
|
-
const { debug,
|
|
15721
|
+
const { debug, vdom, test, exclude } = this.options;
|
|
15722
15722
|
compiler.options.module = compiler.options.module || {};
|
|
15723
15723
|
compiler.options.module.rules = compiler.options.module.rules || [];
|
|
15724
15724
|
compiler.options.module.rules.push({
|
|
@@ -15732,7 +15732,7 @@ var LarkMvcPlugin = class {
|
|
|
15732
15732
|
// __filename is provided by tsup's ESM shim (shims: true) in ESM output,
|
|
15733
15733
|
// and is a native CJS global in CJS output.
|
|
15734
15734
|
loader: __filename,
|
|
15735
|
-
options: { debug,
|
|
15735
|
+
options: { debug, vdom }
|
|
15736
15736
|
}
|
|
15737
15737
|
]
|
|
15738
15738
|
});
|
package/dist/rspack.d.cts
CHANGED
|
@@ -35,7 +35,7 @@ import 'vite7';
|
|
|
35
35
|
* plugins: [
|
|
36
36
|
* new LarkMvcPlugin({
|
|
37
37
|
* debug: process.env.NODE_ENV !== 'production',
|
|
38
|
-
*
|
|
38
|
+
* vdom: false,
|
|
39
39
|
* }),
|
|
40
40
|
* ],
|
|
41
41
|
* };
|
|
@@ -48,7 +48,7 @@ import 'vite7';
|
|
|
48
48
|
* rules: [{
|
|
49
49
|
* test: /\.html$/,
|
|
50
50
|
* loader: '@lark.js/mvc/rspack',
|
|
51
|
-
* options: { debug: false,
|
|
51
|
+
* options: { debug: false, vdom: false },
|
|
52
52
|
* }],
|
|
53
53
|
* },
|
|
54
54
|
* };
|
|
@@ -88,7 +88,7 @@ declare function larkMvcLoader(this: LoaderContext, source: string): Promise<str
|
|
|
88
88
|
* plugins: [
|
|
89
89
|
* new LarkMvcPlugin({
|
|
90
90
|
* debug: true,
|
|
91
|
-
*
|
|
91
|
+
* vdom: false,
|
|
92
92
|
* }),
|
|
93
93
|
* ],
|
|
94
94
|
* };
|
package/dist/rspack.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ import 'vite7';
|
|
|
35
35
|
* plugins: [
|
|
36
36
|
* new LarkMvcPlugin({
|
|
37
37
|
* debug: process.env.NODE_ENV !== 'production',
|
|
38
|
-
*
|
|
38
|
+
* vdom: false,
|
|
39
39
|
* }),
|
|
40
40
|
* ],
|
|
41
41
|
* };
|
|
@@ -48,7 +48,7 @@ import 'vite7';
|
|
|
48
48
|
* rules: [{
|
|
49
49
|
* test: /\.html$/,
|
|
50
50
|
* loader: '@lark.js/mvc/rspack',
|
|
51
|
-
* options: { debug: false,
|
|
51
|
+
* options: { debug: false, vdom: false },
|
|
52
52
|
* }],
|
|
53
53
|
* },
|
|
54
54
|
* };
|
|
@@ -88,7 +88,7 @@ declare function larkMvcLoader(this: LoaderContext, source: string): Promise<str
|
|
|
88
88
|
* plugins: [
|
|
89
89
|
* new LarkMvcPlugin({
|
|
90
90
|
* debug: true,
|
|
91
|
-
*
|
|
91
|
+
* vdom: false,
|
|
92
92
|
* }),
|
|
93
93
|
* ],
|
|
94
94
|
* };
|
package/dist/rspack.js
CHANGED
|
@@ -15596,14 +15596,14 @@ function compileToFunction(source, debug, file) {
|
|
|
15596
15596
|
return `($data,$viewId,$refAlt,$encHtml,$strSafe,$encUri,$refFn,$encQuote)=>{${fullSource}}`;
|
|
15597
15597
|
}
|
|
15598
15598
|
async function compileTemplate(source, options = {}) {
|
|
15599
|
-
const { debug = false, file,
|
|
15599
|
+
const { debug = false, file, vdom = false } = options;
|
|
15600
15600
|
const globalVars = options.globalVars ?? await extractGlobalVars(source);
|
|
15601
15601
|
const { protectedSource, comments } = protectComments(source);
|
|
15602
15602
|
const converted = convertArtSyntax(protectedSource, debug);
|
|
15603
15603
|
const viewEventProcessed = processViewEvents(converted);
|
|
15604
15604
|
const finalSource = restoreComments(viewEventProcessed, comments);
|
|
15605
15605
|
const varDeclarations = globalVars.map((key) => `,${key}=$data.${key}`).join("");
|
|
15606
|
-
if (
|
|
15606
|
+
if (vdom) {
|
|
15607
15607
|
const funcBody2 = compileToVDomFunction(finalSource, debug, file);
|
|
15608
15608
|
const funcWithVars2 = funcBody2.replace("{{VARS}}", () => varDeclarations);
|
|
15609
15609
|
return `import { vdomCreate as __larkVdomCreate } from "@lark.js/mvc";
|
|
@@ -15681,12 +15681,12 @@ function injectTemplateHmrSnippet(source, bundler) {
|
|
|
15681
15681
|
async function larkMvcLoader(source) {
|
|
15682
15682
|
try {
|
|
15683
15683
|
const options = this.getOptions();
|
|
15684
|
-
const { debug = false,
|
|
15684
|
+
const { debug = false, vdom = false } = options;
|
|
15685
15685
|
const globalVars = await extractGlobalVars(source);
|
|
15686
15686
|
const compiled = await compileTemplate(source, {
|
|
15687
15687
|
debug,
|
|
15688
15688
|
globalVars,
|
|
15689
|
-
|
|
15689
|
+
vdom
|
|
15690
15690
|
});
|
|
15691
15691
|
return injectTemplateHmrSnippet(compiled, "rspack");
|
|
15692
15692
|
} catch (err) {
|
|
@@ -15699,7 +15699,7 @@ var LarkMvcPlugin = class {
|
|
|
15699
15699
|
constructor(options = {}) {
|
|
15700
15700
|
this.options = {
|
|
15701
15701
|
debug: false,
|
|
15702
|
-
|
|
15702
|
+
vdom: false,
|
|
15703
15703
|
test: /\.html$/,
|
|
15704
15704
|
exclude: /node_modules/,
|
|
15705
15705
|
...options
|
|
@@ -15710,7 +15710,7 @@ var LarkMvcPlugin = class {
|
|
|
15710
15710
|
* Called by rspack when the plugin is applied.
|
|
15711
15711
|
*/
|
|
15712
15712
|
apply(compiler) {
|
|
15713
|
-
const { debug,
|
|
15713
|
+
const { debug, vdom, test, exclude } = this.options;
|
|
15714
15714
|
compiler.options.module = compiler.options.module || {};
|
|
15715
15715
|
compiler.options.module.rules = compiler.options.module.rules || [];
|
|
15716
15716
|
compiler.options.module.rules.push({
|
|
@@ -15724,7 +15724,7 @@ var LarkMvcPlugin = class {
|
|
|
15724
15724
|
// __filename is provided by tsup's ESM shim (shims: true) in ESM output,
|
|
15725
15725
|
// and is a native CJS global in CJS output.
|
|
15726
15726
|
loader: __filename,
|
|
15727
|
-
options: { debug,
|
|
15727
|
+
options: { debug, vdom }
|
|
15728
15728
|
}
|
|
15729
15729
|
]
|
|
15730
15730
|
});
|
package/dist/vite.cjs
CHANGED
|
@@ -15608,14 +15608,14 @@ function compileToFunction(source, debug, file) {
|
|
|
15608
15608
|
return `($data,$viewId,$refAlt,$encHtml,$strSafe,$encUri,$refFn,$encQuote)=>{${fullSource}}`;
|
|
15609
15609
|
}
|
|
15610
15610
|
async function compileTemplate(source, options = {}) {
|
|
15611
|
-
const { debug = false, file,
|
|
15611
|
+
const { debug = false, file, vdom = false } = options;
|
|
15612
15612
|
const globalVars = options.globalVars ?? await extractGlobalVars(source);
|
|
15613
15613
|
const { protectedSource, comments } = protectComments(source);
|
|
15614
15614
|
const converted = convertArtSyntax(protectedSource, debug);
|
|
15615
15615
|
const viewEventProcessed = processViewEvents(converted);
|
|
15616
15616
|
const finalSource = restoreComments(viewEventProcessed, comments);
|
|
15617
15617
|
const varDeclarations = globalVars.map((key) => `,${key}=$data.${key}`).join("");
|
|
15618
|
-
if (
|
|
15618
|
+
if (vdom) {
|
|
15619
15619
|
const funcBody2 = compileToVDomFunction(finalSource, debug, file);
|
|
15620
15620
|
const funcWithVars2 = funcBody2.replace("{{VARS}}", () => varDeclarations);
|
|
15621
15621
|
return `import { vdomCreate as __larkVdomCreate } from "@lark.js/mvc";
|
|
@@ -15822,7 +15822,7 @@ function findExpressionEnd(source, startIdx) {
|
|
|
15822
15822
|
// src/vite.ts
|
|
15823
15823
|
var LARK_TEMPLATE_SUFFIX = "?lark-template";
|
|
15824
15824
|
function larkMvcPlugin(options = {}) {
|
|
15825
|
-
const { debug = false,
|
|
15825
|
+
const { debug = false, vdom = false } = options;
|
|
15826
15826
|
let root = __dirname;
|
|
15827
15827
|
return {
|
|
15828
15828
|
name: "lark-template",
|
|
@@ -15868,7 +15868,7 @@ function larkMvcPlugin(options = {}) {
|
|
|
15868
15868
|
const compiled = await compileTemplate(raw, {
|
|
15869
15869
|
debug,
|
|
15870
15870
|
globalVars,
|
|
15871
|
-
|
|
15871
|
+
vdom
|
|
15872
15872
|
});
|
|
15873
15873
|
return { code: injectTemplateHmrSnippet(compiled, "vite"), map: null };
|
|
15874
15874
|
}
|
|
@@ -15894,7 +15894,7 @@ function larkMvcPlugin(options = {}) {
|
|
|
15894
15894
|
}
|
|
15895
15895
|
var vite_default = larkMvcPlugin;
|
|
15896
15896
|
function larkMvcPluginLegacy(options = {}) {
|
|
15897
|
-
const { debug = false,
|
|
15897
|
+
const { debug = false, vdom = false } = options;
|
|
15898
15898
|
return {
|
|
15899
15899
|
name: "lark-template",
|
|
15900
15900
|
enforce: "pre",
|
|
@@ -15912,7 +15912,7 @@ function larkMvcPluginLegacy(options = {}) {
|
|
|
15912
15912
|
const compiled = await compileTemplate(raw, {
|
|
15913
15913
|
debug,
|
|
15914
15914
|
globalVars,
|
|
15915
|
-
|
|
15915
|
+
vdom
|
|
15916
15916
|
});
|
|
15917
15917
|
return { code: compiled, map: null };
|
|
15918
15918
|
}
|
package/dist/vite.d.cts
CHANGED
|
@@ -29,28 +29,28 @@ interface LarkMvcVitePluginOptions {
|
|
|
29
29
|
/** Enable debug mode with line tracking (default: false) */
|
|
30
30
|
debug?: boolean;
|
|
31
31
|
/** Enable virtual DOM output (default: false) */
|
|
32
|
-
|
|
32
|
+
vdom?: boolean;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Create a Vite plugin that compiles .html template files.
|
|
36
36
|
*
|
|
37
37
|
* @param options - Plugin options
|
|
38
|
-
* @param options.
|
|
38
|
+
* @param options.vdom - Generate VDOM output instead of HTML string (default: false)
|
|
39
39
|
* @returns Vite plugin instance
|
|
40
40
|
*/
|
|
41
41
|
declare function larkMvcPlugin(options?: LarkMvcVitePluginOptions): Plugin;
|
|
42
42
|
|
|
43
43
|
declare function larkMvcPluginLegacy(options?: {
|
|
44
44
|
debug?: boolean;
|
|
45
|
-
|
|
45
|
+
vdom?: boolean;
|
|
46
46
|
}): Plugin;
|
|
47
47
|
declare function larkMvcPlugin7(options?: {
|
|
48
48
|
debug?: boolean;
|
|
49
|
-
|
|
49
|
+
vdom?: boolean;
|
|
50
50
|
}): Plugin$1;
|
|
51
51
|
declare function larkMvcPluginLegacy7(options?: {
|
|
52
52
|
debug?: boolean;
|
|
53
|
-
|
|
53
|
+
vdom?: boolean;
|
|
54
54
|
}): Plugin$1;
|
|
55
55
|
|
|
56
56
|
export { type LarkMvcVitePluginOptions, larkMvcPlugin as default, larkMvcPlugin, larkMvcPlugin7, larkMvcPluginLegacy, larkMvcPluginLegacy7 };
|
package/dist/vite.d.ts
CHANGED
|
@@ -29,28 +29,28 @@ interface LarkMvcVitePluginOptions {
|
|
|
29
29
|
/** Enable debug mode with line tracking (default: false) */
|
|
30
30
|
debug?: boolean;
|
|
31
31
|
/** Enable virtual DOM output (default: false) */
|
|
32
|
-
|
|
32
|
+
vdom?: boolean;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Create a Vite plugin that compiles .html template files.
|
|
36
36
|
*
|
|
37
37
|
* @param options - Plugin options
|
|
38
|
-
* @param options.
|
|
38
|
+
* @param options.vdom - Generate VDOM output instead of HTML string (default: false)
|
|
39
39
|
* @returns Vite plugin instance
|
|
40
40
|
*/
|
|
41
41
|
declare function larkMvcPlugin(options?: LarkMvcVitePluginOptions): Plugin;
|
|
42
42
|
|
|
43
43
|
declare function larkMvcPluginLegacy(options?: {
|
|
44
44
|
debug?: boolean;
|
|
45
|
-
|
|
45
|
+
vdom?: boolean;
|
|
46
46
|
}): Plugin;
|
|
47
47
|
declare function larkMvcPlugin7(options?: {
|
|
48
48
|
debug?: boolean;
|
|
49
|
-
|
|
49
|
+
vdom?: boolean;
|
|
50
50
|
}): Plugin$1;
|
|
51
51
|
declare function larkMvcPluginLegacy7(options?: {
|
|
52
52
|
debug?: boolean;
|
|
53
|
-
|
|
53
|
+
vdom?: boolean;
|
|
54
54
|
}): Plugin$1;
|
|
55
55
|
|
|
56
56
|
export { type LarkMvcVitePluginOptions, larkMvcPlugin as default, larkMvcPlugin, larkMvcPlugin7, larkMvcPluginLegacy, larkMvcPluginLegacy7 };
|
package/dist/vite.js
CHANGED
|
@@ -15599,14 +15599,14 @@ function compileToFunction(source, debug, file) {
|
|
|
15599
15599
|
return `($data,$viewId,$refAlt,$encHtml,$strSafe,$encUri,$refFn,$encQuote)=>{${fullSource}}`;
|
|
15600
15600
|
}
|
|
15601
15601
|
async function compileTemplate(source, options = {}) {
|
|
15602
|
-
const { debug = false, file,
|
|
15602
|
+
const { debug = false, file, vdom = false } = options;
|
|
15603
15603
|
const globalVars = options.globalVars ?? await extractGlobalVars(source);
|
|
15604
15604
|
const { protectedSource, comments } = protectComments(source);
|
|
15605
15605
|
const converted = convertArtSyntax(protectedSource, debug);
|
|
15606
15606
|
const viewEventProcessed = processViewEvents(converted);
|
|
15607
15607
|
const finalSource = restoreComments(viewEventProcessed, comments);
|
|
15608
15608
|
const varDeclarations = globalVars.map((key) => `,${key}=$data.${key}`).join("");
|
|
15609
|
-
if (
|
|
15609
|
+
if (vdom) {
|
|
15610
15610
|
const funcBody2 = compileToVDomFunction(finalSource, debug, file);
|
|
15611
15611
|
const funcWithVars2 = funcBody2.replace("{{VARS}}", () => varDeclarations);
|
|
15612
15612
|
return `import { vdomCreate as __larkVdomCreate } from "@lark.js/mvc";
|
|
@@ -15813,7 +15813,7 @@ function findExpressionEnd(source, startIdx) {
|
|
|
15813
15813
|
// src/vite.ts
|
|
15814
15814
|
var LARK_TEMPLATE_SUFFIX = "?lark-template";
|
|
15815
15815
|
function larkMvcPlugin(options = {}) {
|
|
15816
|
-
const { debug = false,
|
|
15816
|
+
const { debug = false, vdom = false } = options;
|
|
15817
15817
|
let root = __dirname;
|
|
15818
15818
|
return {
|
|
15819
15819
|
name: "lark-template",
|
|
@@ -15859,7 +15859,7 @@ function larkMvcPlugin(options = {}) {
|
|
|
15859
15859
|
const compiled = await compileTemplate(raw, {
|
|
15860
15860
|
debug,
|
|
15861
15861
|
globalVars,
|
|
15862
|
-
|
|
15862
|
+
vdom
|
|
15863
15863
|
});
|
|
15864
15864
|
return { code: injectTemplateHmrSnippet(compiled, "vite"), map: null };
|
|
15865
15865
|
}
|
|
@@ -15885,7 +15885,7 @@ function larkMvcPlugin(options = {}) {
|
|
|
15885
15885
|
}
|
|
15886
15886
|
var vite_default = larkMvcPlugin;
|
|
15887
15887
|
function larkMvcPluginLegacy(options = {}) {
|
|
15888
|
-
const { debug = false,
|
|
15888
|
+
const { debug = false, vdom = false } = options;
|
|
15889
15889
|
return {
|
|
15890
15890
|
name: "lark-template",
|
|
15891
15891
|
enforce: "pre",
|
|
@@ -15903,7 +15903,7 @@ function larkMvcPluginLegacy(options = {}) {
|
|
|
15903
15903
|
const compiled = await compileTemplate(raw, {
|
|
15904
15904
|
debug,
|
|
15905
15905
|
globalVars,
|
|
15906
|
-
|
|
15906
|
+
vdom
|
|
15907
15907
|
});
|
|
15908
15908
|
return { code: compiled, map: null };
|
|
15909
15909
|
}
|
package/dist/webpack.cjs
CHANGED
|
@@ -15604,14 +15604,14 @@ function compileToFunction(source, debug, file) {
|
|
|
15604
15604
|
return `($data,$viewId,$refAlt,$encHtml,$strSafe,$encUri,$refFn,$encQuote)=>{${fullSource}}`;
|
|
15605
15605
|
}
|
|
15606
15606
|
async function compileTemplate(source, options = {}) {
|
|
15607
|
-
const { debug = false, file,
|
|
15607
|
+
const { debug = false, file, vdom = false } = options;
|
|
15608
15608
|
const globalVars = options.globalVars ?? await extractGlobalVars(source);
|
|
15609
15609
|
const { protectedSource, comments } = protectComments(source);
|
|
15610
15610
|
const converted = convertArtSyntax(protectedSource, debug);
|
|
15611
15611
|
const viewEventProcessed = processViewEvents(converted);
|
|
15612
15612
|
const finalSource = restoreComments(viewEventProcessed, comments);
|
|
15613
15613
|
const varDeclarations = globalVars.map((key) => `,${key}=$data.${key}`).join("");
|
|
15614
|
-
if (
|
|
15614
|
+
if (vdom) {
|
|
15615
15615
|
const funcBody2 = compileToVDomFunction(finalSource, debug, file);
|
|
15616
15616
|
const funcWithVars2 = funcBody2.replace("{{VARS}}", () => varDeclarations);
|
|
15617
15617
|
return `import { vdomCreate as __larkVdomCreate } from "@lark.js/mvc";
|
|
@@ -15689,12 +15689,12 @@ function injectTemplateHmrSnippet(source, bundler) {
|
|
|
15689
15689
|
async function larkMvcLoader(source) {
|
|
15690
15690
|
try {
|
|
15691
15691
|
const options = this.getOptions() || {};
|
|
15692
|
-
const { debug = false,
|
|
15692
|
+
const { debug = false, vdom = false } = options;
|
|
15693
15693
|
const globalVars = await extractGlobalVars(source);
|
|
15694
15694
|
const compiled = await compileTemplate(source, {
|
|
15695
15695
|
debug,
|
|
15696
15696
|
globalVars,
|
|
15697
|
-
|
|
15697
|
+
vdom
|
|
15698
15698
|
});
|
|
15699
15699
|
return injectTemplateHmrSnippet(compiled, "webpack");
|
|
15700
15700
|
} catch (err) {
|
|
@@ -15707,7 +15707,7 @@ var LarkMvcPlugin = class {
|
|
|
15707
15707
|
constructor(options = {}) {
|
|
15708
15708
|
this.options = {
|
|
15709
15709
|
debug: false,
|
|
15710
|
-
|
|
15710
|
+
vdom: false,
|
|
15711
15711
|
test: /\.html$/,
|
|
15712
15712
|
exclude: /node_modules/,
|
|
15713
15713
|
...options
|
|
@@ -15718,7 +15718,7 @@ var LarkMvcPlugin = class {
|
|
|
15718
15718
|
* Called by webpack when the plugin is applied.
|
|
15719
15719
|
*/
|
|
15720
15720
|
apply(compiler) {
|
|
15721
|
-
const { debug,
|
|
15721
|
+
const { debug, vdom, test, exclude } = this.options;
|
|
15722
15722
|
compiler.options.module = compiler.options.module || {};
|
|
15723
15723
|
compiler.options.module.rules = compiler.options.module.rules || [];
|
|
15724
15724
|
compiler.options.module.rules.push({
|
|
@@ -15732,7 +15732,7 @@ var LarkMvcPlugin = class {
|
|
|
15732
15732
|
// __filename is provided by tsup's ESM shim (shims: true) in ESM output,
|
|
15733
15733
|
// and is a native CJS global in CJS output.
|
|
15734
15734
|
loader: __filename,
|
|
15735
|
-
options: { debug,
|
|
15735
|
+
options: { debug, vdom }
|
|
15736
15736
|
}
|
|
15737
15737
|
]
|
|
15738
15738
|
});
|
package/dist/webpack.d.cts
CHANGED
package/dist/webpack.d.ts
CHANGED
package/dist/webpack.js
CHANGED
|
@@ -15596,14 +15596,14 @@ function compileToFunction(source, debug, file) {
|
|
|
15596
15596
|
return `($data,$viewId,$refAlt,$encHtml,$strSafe,$encUri,$refFn,$encQuote)=>{${fullSource}}`;
|
|
15597
15597
|
}
|
|
15598
15598
|
async function compileTemplate(source, options = {}) {
|
|
15599
|
-
const { debug = false, file,
|
|
15599
|
+
const { debug = false, file, vdom = false } = options;
|
|
15600
15600
|
const globalVars = options.globalVars ?? await extractGlobalVars(source);
|
|
15601
15601
|
const { protectedSource, comments } = protectComments(source);
|
|
15602
15602
|
const converted = convertArtSyntax(protectedSource, debug);
|
|
15603
15603
|
const viewEventProcessed = processViewEvents(converted);
|
|
15604
15604
|
const finalSource = restoreComments(viewEventProcessed, comments);
|
|
15605
15605
|
const varDeclarations = globalVars.map((key) => `,${key}=$data.${key}`).join("");
|
|
15606
|
-
if (
|
|
15606
|
+
if (vdom) {
|
|
15607
15607
|
const funcBody2 = compileToVDomFunction(finalSource, debug, file);
|
|
15608
15608
|
const funcWithVars2 = funcBody2.replace("{{VARS}}", () => varDeclarations);
|
|
15609
15609
|
return `import { vdomCreate as __larkVdomCreate } from "@lark.js/mvc";
|
|
@@ -15681,12 +15681,12 @@ function injectTemplateHmrSnippet(source, bundler) {
|
|
|
15681
15681
|
async function larkMvcLoader(source) {
|
|
15682
15682
|
try {
|
|
15683
15683
|
const options = this.getOptions() || {};
|
|
15684
|
-
const { debug = false,
|
|
15684
|
+
const { debug = false, vdom = false } = options;
|
|
15685
15685
|
const globalVars = await extractGlobalVars(source);
|
|
15686
15686
|
const compiled = await compileTemplate(source, {
|
|
15687
15687
|
debug,
|
|
15688
15688
|
globalVars,
|
|
15689
|
-
|
|
15689
|
+
vdom
|
|
15690
15690
|
});
|
|
15691
15691
|
return injectTemplateHmrSnippet(compiled, "webpack");
|
|
15692
15692
|
} catch (err) {
|
|
@@ -15699,7 +15699,7 @@ var LarkMvcPlugin = class {
|
|
|
15699
15699
|
constructor(options = {}) {
|
|
15700
15700
|
this.options = {
|
|
15701
15701
|
debug: false,
|
|
15702
|
-
|
|
15702
|
+
vdom: false,
|
|
15703
15703
|
test: /\.html$/,
|
|
15704
15704
|
exclude: /node_modules/,
|
|
15705
15705
|
...options
|
|
@@ -15710,7 +15710,7 @@ var LarkMvcPlugin = class {
|
|
|
15710
15710
|
* Called by webpack when the plugin is applied.
|
|
15711
15711
|
*/
|
|
15712
15712
|
apply(compiler) {
|
|
15713
|
-
const { debug,
|
|
15713
|
+
const { debug, vdom, test, exclude } = this.options;
|
|
15714
15714
|
compiler.options.module = compiler.options.module || {};
|
|
15715
15715
|
compiler.options.module.rules = compiler.options.module.rules || [];
|
|
15716
15716
|
compiler.options.module.rules.push({
|
|
@@ -15724,7 +15724,7 @@ var LarkMvcPlugin = class {
|
|
|
15724
15724
|
// __filename is provided by tsup's ESM shim (shims: true) in ESM output,
|
|
15725
15725
|
// and is a native CJS global in CJS output.
|
|
15726
15726
|
loader: __filename,
|
|
15727
|
-
options: { debug,
|
|
15727
|
+
options: { debug, vdom }
|
|
15728
15728
|
}
|
|
15729
15729
|
]
|
|
15730
15730
|
});
|