@vtj/coder 0.8.1 → 0.8.3
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/index.cjs +24 -24
- package/dist/index.mjs +105 -105
- package/package.json +5 -5
- package/types/generator.d.ts +1 -1
- package/types/version.d.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@vtj/base"),x=require("prettier/standalone"),H=require("prettier/plugins/html"),X=require("prettier/plugins/babel"),Y=require("prettier/plugins/postcss"),Z=require("prettier/plugins/estree");function k(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@vtj/base"),x=require("prettier/standalone"),H=require("prettier/plugins/html"),X=require("prettier/plugins/babel"),Y=require("prettier/plugins/postcss"),Z=require("prettier/plugins/estree");function k(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const K=k(H),J=k(X),T=k(Y),q=k(Z);/**!
|
|
2
2
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
3
3
|
* @name @vtj/coder
|
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
5
|
-
* @version 0.8.
|
|
5
|
+
* @version 0.8.3
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
|
-
*/const ee="0.8.
|
|
7
|
+
*/const ee="0.8.3";/**!
|
|
8
8
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
9
9
|
* @name @vtj/core
|
|
10
10
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
11
|
-
* @version 0.8.
|
|
11
|
+
* @version 0.8.3
|
|
12
12
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
13
|
-
*/const te=["slot","template","component","img","div","p","h1","h2","h3","span","a"];l.mitt();const _={arrowParens:"always",bracketSpacing:!0,bracketSameLine:!0,endOfLine:"lf",htmlWhitespaceSensitivity:"css",insertPragma:!1,jsxBracketSameLine:!0,jsxSingleQuote:!0,printWidth:80,proseWrap:"preserve",quoteProps:"as-needed",requirePragma:!1,semi:!0,singleQuote:!0,tabWidth:2,trailingComma:"none",useTabs:!1,vueIndentScriptAndStyle:!0};async function L(t,e){return e?t:await x.format(t,{parser:"vue",..._,plugins:[K,J,q,T]})}async function
|
|
13
|
+
*/const te=["slot","template","component","img","div","p","h1","h2","h3","span","a"];l.mitt();const _={arrowParens:"always",bracketSpacing:!0,bracketSameLine:!0,endOfLine:"lf",htmlWhitespaceSensitivity:"css",insertPragma:!1,jsxBracketSameLine:!0,jsxSingleQuote:!0,printWidth:80,proseWrap:"preserve",quoteProps:"as-needed",requirePragma:!1,semi:!0,singleQuote:!0,tabWidth:2,trailingComma:"none",useTabs:!1,vueIndentScriptAndStyle:!0};async function L(t,e){return e?t:await x.format(t,{parser:"vue",..._,plugins:[K,J,q,T]})}async function ne(t,e){return e?t:await x.format(t,{parser:"babel-ts",..._,plugins:[J,q]})}async function W(t,e){return e?t:x.format(t,{parser:"scss",..._,plugins:[T]})}function E(t){return t&&t.type==="JSExpression"}function A(t){return typeof t=="object"&&t&&t.type==="JSFunction"}function $(t){return E(t)||A(t)}function F(t){return t.replace(new RegExp("this.","g"),"")}function I(t){return t.replace(/this\.context\??\./g,"")}function u(t,e=!0,n=!0){const s=$(t)?t.value:e?JSON.stringify(t):t;return n?F(I(s)):I(s)}function w(t,e=[]){let n=t;for(const s of e)n=n.replace(new RegExp(`this.${s}.value`,"g"),`this.${s}`);return n}function U(t){let e=t.trim();if(e=/^\((\(|async|function)/.test(e)?e.substring(1,e.length-1):e,e.startsWith("{"))return e;if(e.startsWith("async function"))e=e.replace(/^async function/,"async");else if(e.startsWith("function"))e=e.replace(/^function/,"");else{const i=/^(async\s)?\([\w]*\)\s+\=\>\s([\w\W]+)/,r=e.match(i);r&&r[2]&&(r[2].startsWith("{")||(e=e.replace(r[2],`{ return ${r[2]} }`))),e=e.replace("=>","")}return e}function se(t={}){return Object.entries(t).map(([e,n])=>`"${e}": ${u(n)}`)}function M(t={},e=!1){const n=Object.keys(t);return e?n.map(s=>"."+s):n}function re(t){let e="";for(var n in t)if(t.hasOwnProperty(n)){var s=t[n];e+=n+": "+s+";"}return e}class oe{constructor(e,n){this.dsl=e,this.dependencies=n,this.libraryRegex=this.collectLibrary(),this.walk(e),this.walkNodes(e),this.members=this.getLibraryMember()}imports={};context={};style={};members=[];urlSchemas={};blockPlugins={};libraryRegex=[];collectLibrary(){return this.dependencies.filter(e=>!!e.library).map(e=>new RegExp(`(this.\\$libs.${e.library}.([\\w]+))`,"g"))}collectImport(e){const n=e.split(".");if(n.length===4){const s=n.pop(),i=n.join(".")+".",r=n.pop();if(s&&r){const o=this.dependencies.find(c=>c.library===r)?.package;o&&(this.imports[o]||(this.imports[o]=new Set)).add(s)}return{name:s,path:i,library:r}}return null}replaceLibraryPath(e){const{libraryRegex:n}=this;let s=e.value;for(const i of n){const r=e.value.match(i)||[];for(const o of r){const c=this.collectImport(o);if(c){const a=c.path.replace(/\$/g,"\\$");s=s.replace(new RegExp(a,"g"),"")}}}return s}walk(e){const n=s=>{if(!s||typeof s!="object")return;if(Array.isArray(s)){for(let r of s)n(r);return}const i=Object.values(s);for(const r of i)$(r)?r.value=this.replaceLibraryPath(r):n(r)};n(e)}getLibraryMember(e=[]){let n=[...e];for(const s of Object.values(this.imports))n=n.concat(Array.from(s));return l.dedupArray(n)}collectContext(e,n){const s=new Set(n?.id?this.context[n.id]:[]),i=(e.directives||[]).find(c=>c.name==="vFor");let r=new Set(Array.from(s));if(i){const{item:c="item",index:a="index"}=i.iterator||{};r=new Set([c,a,...Array.from(r)])}const o=e.slot;if(o){const c=typeof o=="string"?[]:o.params||[],a=c.length?c:[`scope_${n?.id}`];r=new Set([...a,...Array.from(r)])}this.context[e.id]=r}collectStyle(e){e.id&&e.props?.style&&Object.keys(e.props.style).length&&(this.style[`.${e.name}_${e.id}`]=e.props.style)}collectUrlSchema(e){typeof e.from=="object"&&e.from.type==="UrlSchema"&&(this.urlSchemas[e.name]=e.from)}collectBlockPlugin(e){typeof e.from=="object"&&e.from.type==="Plugin"&&(this.blockPlugins[e.name]=e.from)}walkNodes(e){const n=(s,i)=>{this.collectContext(s,i),this.collectStyle(s),this.collectUrlSchema(s),this.collectBlockPlugin(s),Array.isArray(s.children)&&s.children.forEach(r=>n(r,s))};Array.isArray(e.nodes)&&e.nodes.forEach(s=>n(s))}}function ie(t={}){return Object.entries(t).map(([e,n])=>{const s=u(n,!1);return`${e}:${s}`})}function ce(t=[]){return t.map(e=>`${e.name}: {
|
|
14
14
|
from: '${e.from||e.name}',
|
|
15
15
|
default: ${u(e.default,!0,!1)}
|
|
16
|
-
}`)}function ae(t=[]){const e=
|
|
17
|
-
type:${e(
|
|
18
|
-
required: ${
|
|
19
|
-
default: ${u(
|
|
20
|
-
}`)}function le(t=[]){return t.map(e=>`'${e}'`)}function
|
|
16
|
+
}`)}function ae(t=[]){const e=n=>n?`[${l.toArray(n).map(r=>r.replace(/\'|\"/gi,"")).join(",")}]`:void 0;return t.map(n=>typeof n=="string"?`${n}: {}`:($(n.default)&&!n.default.value&&(n.default.value="undefined"),`${n.name}: {
|
|
17
|
+
type:${e(n.type)},
|
|
18
|
+
required: ${u(!!n.required,!0,!1)},
|
|
19
|
+
default: ${u(n.default,!0,!1)}
|
|
20
|
+
}`))}function le(t=[]){return t.map(e=>`'${e}'`)}function S(t={},e=[]){return Object.entries(t).map(([n,s])=>{let i=U(u(s,!1,!1));return i=w(i,e),i.startsWith("async")?`async ${n}${i.replace(/^async/,"")}`:`${n}${i}`})}function ue(t=[],e=[]){const n=t.reduce((r,o)=>(o.id&&A(o.source)&&(r[`watcher_${o.id}`]=o.source),r),{}),s=S(n,e),i=t.map(r=>`watcher_${r.id}: {
|
|
21
21
|
deep: ${r.deep},
|
|
22
22
|
immediate:${r.immediate},
|
|
23
23
|
handler${U(r.handler.value)}
|
|
24
|
-
}`);return{computed:
|
|
25
|
-
return await this.provider.apis['${e.ref}'].apply(this, args).then(${
|
|
26
|
-
}`})}function V(t,e,
|
|
27
|
-
`),Object.assign(o,d?.methods||{}),c=c.concat(d?.components||[]),a=a.concat(d?.importBlocks||[]));const R=Q(h)||z(h)?"component":m
|
|
28
|
-
`+
|
|
29
|
-
`),i?.id);r.push(P)}),{nodes:r,methods:o,components:l.dedupArray(c),importBlocks:l.dedupArray(a,"id")}}function fe(t=[]){const e=new Map;for(const
|
|
24
|
+
}`);return{computed:s,watches:i}}function pe(t={}){return Object.values(t).map(e=>{const n=A(e.transform)&&e.transform.value||"(res) => res";return`async ${e.name}(...args:any[]) {
|
|
25
|
+
return await this.provider.apis['${e.ref}'].apply(this, args).then(${n});
|
|
26
|
+
}`})}function V(t,e,n=[],s={},i){const r=[];let o={},c=[],a=[];return fe(t).forEach(f=>{const b=[];for(const p of f.children){let{id:O,name:m,invisible:C,from:h}=p;if(C)continue;const j=me(m,e,h);j&&c.push(j),D(h)&&a.push({id:h.id,name:m});const{props:g,events:N,handlers:G}=$e(p,O,p.props,p.events,s,n),B=be(p.directives).join(" "),d=p.children?ve(p.children,n,e,s,p):"";Object.assign(o,G);let v="";typeof d=="string"?v=d:(v=(d?.nodes||[]).join(`
|
|
27
|
+
`),Object.assign(o,d?.methods||{}),c=c.concat(d?.components||[]),a=a.concat(d?.importBlocks||[]));const R=Q(h)||z(h)?"component":m;b.push(m==="img"?`<${m} ${B} ${g} ${N} />`:`<${R} ${B} ${g} ${N}>${v?`
|
|
28
|
+
`+v.trim():""}</${R}>`)}const P=Se(f.slot,b.join(`
|
|
29
|
+
`),i?.id);r.push(P)}),{nodes:r,methods:o,components:l.dedupArray(c),importBlocks:l.dedupArray(a,"id")}}function fe(t=[]){const e=new Map;for(const n of t){const s=typeof n.slot=="string"?n.slot:n.slot?.name,i=e.get(s);i?i.children.push(n):e.set(s,{slot:n.slot,children:[n]})}return e}function me(t,e,n){if(te.includes(t))return null;const s=e.get(t);if(s&&s.alias){const i=s.parent?`${s.parent}.${s.alias}`:s.alias;return`${t}: ${i}`}return D(n)||s?t:null}function D(t){return!!t&&typeof t=="object"&&t.type==="Schema"}function Q(t){return typeof t=="object"&&t.type==="UrlSchema"}function z(t){return typeof t=="object"&&t.type==="Plugin"}function he(t,e,n=[]){return t==="style"?"":t==="__class"&&$(e)?`:class="${u({...e,value:w(e.value,n)})}"`:typeof e=="string"?`${t}="${e}"`:$(e)?`:${t}="${u({...e,value:w(e.value,n)})}"`:l.isPlainObject(e)?`:${t}='{${se(e).join(", ")}}'`:`:${t}='${JSON.stringify(e)}'`}function de(t,e={},n=[]){if(!!Object.keys(e.style||{}).length){const r=`${t.name}_${t.id}`;e.class?typeof e.class=="string"?e.class=[e.class,r].join(" "):(e.__class=e.class,e.class=r):(e.class=r,delete e.style)}const i=t.from;return(Q(i)||z(i))&&(e.is={type:"JSExpression",value:t.name}),Object.entries(e).map(([r,o])=>he(r,o,n))}function ye(t,e,n,s){const i=M(e.modifiers,!0);return s&&s.length>0?`@${t}${i.join("")}="(...args:any[]) => ${n}"`:`@${t}${i.join("")}="${n}"`}function ge(t,e={},n={}){const s={},i=Array.from(n[t]||new Set([])),r=i.length?`({${i.join(", ")}}, args)`:"";return{binders:Object.entries(e).map(([c,a])=>{const y=a.handler.value.startsWith("this."),f=y?F(a.handler.value):`${l.camelCase(c)}_${t}${r}`;return y||(s[f]=i.length?{type:"JSFunction",value:`{
|
|
30
30
|
return (${a.handler.value}).apply(this, args);
|
|
31
|
-
}`}:a.handler),ye(c,a,f,i)}),handlers:
|
|
31
|
+
}`}:a.handler),ye(c,a,f,i)}),handlers:s}}function $e(t,e,n={},s={},i={},r){const{binders:o,handlers:c}=ge(e,s,i);return{props:de(t,n,r).join(" "),handlers:c,binders:o,events:o.join(" ")}}function be(t=[]){const e=[],{vIf:n,vShow:s,vModels:i,vFor:r}=je(t);if(n&&e.push(`v-if="${u(n.value)}"`),s&&e.push(`v-show="${u(s.value)}"`),i.forEach(o=>{const c=M(o.modifiers,!0),a=o.arg?E(o.arg)?`:[${u(o.arg)}]`:`:${o.arg}`:"";e.push(`v-model${a}${c}="${u(o.value)}"`)}),r){const{item:o,index:c}={item:"item",index:"index",...r.iterator};e.push(`v-for="(${o}, ${c}) in ${u(r.value)}"`)}return e}function je(t=[]){const e=t.find(o=>l.camelCase(o.name)==="vIf"),n=t.find(o=>l.camelCase(o.name)==="vFor"),s=t.find(o=>l.camelCase(o.name)==="vShow"),i=t.find(o=>l.camelCase(o.name)==="vBind"),r=t.filter(o=>l.camelCase(o.name)==="vModel");return{vIf:e,vFor:n,vShow:s,vModels:r,vBind:i}}function ve(t,e,n,s,i){if(typeof t=="string")return t;if(E(t)){let r=u(t,!1);return r=w(r,e),r=F(r),`{{ ${r} }}`}return Array.isArray(t)?V(t,n,e,s,i):""}function Se(t,e,n){if(!t)return e;const s=typeof t=="string"?{name:t,params:[]}:{params:[],...t};return`<template ${`#${s.name}="${s.params?.length>0?`{${s.params?.join(",")}}`:`scope_${n}`}"`}>
|
|
32
32
|
${e}
|
|
33
|
-
</template>`}function we(t,e=[],
|
|
34
|
-
${
|
|
35
|
-
${re(
|
|
33
|
+
</template>`}function we(t,e=[],n=[],s={}){const i={vue:["defineComponent","reactive"]};for(const r of e){const o=t.get(r.split(":")[0]);o&&o.package&&(i[o.package]??(i[o.package]=[])).push(o.parent||(o.alias||"").split(".")[0]||o.name)}for(const[r,o]of Object.entries(s))(i[r]??(i[r]=[])).push(...Array.from(o));return Object.entries(i).filter(([r,o])=>!!o.length).map(([r,o])=>`import { ${l.dedupArray(o).join(",")}} from '${r}';`).concat(n)}function ke(t={}){const e=[];for(const[n,s]of Object.entries(t))e.push(`
|
|
34
|
+
${n} {
|
|
35
|
+
${re(s)}
|
|
36
36
|
}
|
|
37
37
|
`);return e.join(`
|
|
38
|
-
`)}function Pe(t={}){const e=[];return Object.entries(t).forEach(([s
|
|
38
|
+
`)}function Pe(t={}){const e=[];return Object.entries(t).forEach(([n,s])=>{e.push(`const ${n} = provider.defineUrlSchemaComponent('${s.url}');`)}),e}function Oe(t={}){const e=[];return Object.entries(t).forEach(([n,s])=>{e.push(`const ${n} = provider.definePluginComponent(${JSON.stringify(s)});`)}),e}function Ce(t,e){const{dsl:n}=t,s=Object.keys(n.computed||{}),i=S(n.lifeCycles,s),r=S(n.computed,s),o=ue(n.watch,s),c=pe(n.dataSources),{methods:a,nodes:y,components:f,importBlocks:b}=V(n.nodes||[],e,s,t.context),P=[...r,...o.computed],p=S({...a,...n.methods||{}},s),O=b.map(g=>`import ${g.name} from './${g.id}.vue';`),m=we(e,f,O,t.imports),C=Object.keys({...t.urlSchemas,...t.blockPlugins}),h=Pe(t.urlSchemas),j=Oe(t.blockPlugins);return{id:n.id,version:n.__VERSION__,name:n.name,state:ie(n.state).join(","),inject:ce(n.inject).join(","),props:ae(n.props).join(","),emits:le(n.emits).join(","),watch:o.watches.join(","),lifeCycles:i.join(","),computed:P.join(","),methods:[...c,...p].join(","),imports:m.join(`
|
|
39
39
|
`),components:f.join(","),returns:t.members.join(","),template:y.join(`
|
|
40
|
-
`),css:
|
|
41
|
-
`),blockPlugins:
|
|
40
|
+
`),css:n.css||"",style:ke(t.style),urlSchemas:h.join(`
|
|
41
|
+
`),blockPlugins:j.join(`
|
|
42
42
|
`),asyncComponents:C.join(",")}}const xe=`
|
|
43
43
|
<%= imports %>
|
|
44
44
|
import { useProvider } from '@vtj/renderer';
|
|
@@ -79,7 +79,7 @@ export default defineComponent({
|
|
|
79
79
|
<%= css %>
|
|
80
80
|
<%= style %>
|
|
81
81
|
</style>
|
|
82
|
-
`,Ee=l.template(xe),Ae=l.template(_e);async function Fe(t,e=new Map,
|
|
82
|
+
`,Ee=l.template(xe),Ae=l.template(_e);async function Fe(t,e=new Map,n=[],s){const i=new oe(l.cloneDeep(t),n),r=Ce(i,e),o=Ee(r),c=Ae({template:r.template,css:await W(r.css,s),script:await ne(o,s),style:await W(r.style,s)});return await L(c,s).catch(a=>(a.content=c,a))}async function Ne(t){const e=`
|
|
83
83
|
<template>
|
|
84
84
|
<div>
|
|
85
85
|
<h3>源码模式页面</h3>
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mitt as X, dedupArray as
|
|
1
|
+
import { mitt as X, dedupArray as w, toArray as Y, camelCase as d, isPlainObject as Z, template as J, cloneDeep as K } from "@vtj/base";
|
|
2
2
|
import { format as C } from "prettier/standalone";
|
|
3
3
|
import * as tt from "prettier/plugins/html";
|
|
4
4
|
import * as L from "prettier/plugins/babel";
|
|
@@ -8,15 +8,15 @@ import * as U from "prettier/plugins/estree";
|
|
|
8
8
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
9
9
|
* @name @vtj/coder
|
|
10
10
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
11
|
-
* @version 0.8.
|
|
11
|
+
* @version 0.8.3
|
|
12
12
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
13
13
|
*/
|
|
14
|
-
const Bt = "0.8.
|
|
14
|
+
const Bt = "0.8.3";
|
|
15
15
|
/**!
|
|
16
16
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
17
17
|
* @name @vtj/core
|
|
18
18
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
19
|
-
* @version 0.8.
|
|
19
|
+
* @version 0.8.3
|
|
20
20
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
21
21
|
*/
|
|
22
22
|
const et = [
|
|
@@ -80,7 +80,7 @@ function _(e) {
|
|
|
80
80
|
function A(e) {
|
|
81
81
|
return typeof e == "object" && e && e.type === "JSFunction";
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function $(e) {
|
|
84
84
|
return _(e) || A(e);
|
|
85
85
|
}
|
|
86
86
|
function F(e) {
|
|
@@ -90,7 +90,7 @@ function I(e) {
|
|
|
90
90
|
return e.replace(/this\.context\??\./g, "");
|
|
91
91
|
}
|
|
92
92
|
function l(e, t = !0, s = !0) {
|
|
93
|
-
const n =
|
|
93
|
+
const n = $(e) ? e.value : t ? JSON.stringify(e) : e;
|
|
94
94
|
return s ? F(I(n)) : I(n);
|
|
95
95
|
}
|
|
96
96
|
function k(e, t = []) {
|
|
@@ -111,7 +111,7 @@ function q(e) {
|
|
|
111
111
|
else if (t.startsWith("function"))
|
|
112
112
|
t = t.replace(/^function/, "");
|
|
113
113
|
else {
|
|
114
|
-
const
|
|
114
|
+
const o = /^(async\s)?\([\w]*\)\s+\=\>\s([\w\W]+)/, r = t.match(o);
|
|
115
115
|
r && r[2] && (r[2].startsWith("{") || (t = t.replace(r[2], `{ return ${r[2]} }`))), t = t.replace("=>", "");
|
|
116
116
|
}
|
|
117
117
|
return t;
|
|
@@ -132,7 +132,7 @@ function rt(e) {
|
|
|
132
132
|
}
|
|
133
133
|
return t;
|
|
134
134
|
}
|
|
135
|
-
class
|
|
135
|
+
class it {
|
|
136
136
|
constructor(t, s) {
|
|
137
137
|
this.dsl = t, this.dependencies = s, this.libraryRegex = this.collectLibrary(), this.walk(t), this.walkNodes(t), this.members = this.getLibraryMember();
|
|
138
138
|
}
|
|
@@ -157,16 +157,16 @@ class ot {
|
|
|
157
157
|
collectImport(t) {
|
|
158
158
|
const s = t.split(".");
|
|
159
159
|
if (s.length === 4) {
|
|
160
|
-
const n = s.pop(),
|
|
160
|
+
const n = s.pop(), o = s.join(".") + ".", r = s.pop();
|
|
161
161
|
if (n && r) {
|
|
162
|
-
const
|
|
162
|
+
const i = this.dependencies.find(
|
|
163
163
|
(c) => c.library === r
|
|
164
164
|
)?.package;
|
|
165
|
-
|
|
165
|
+
i && (this.imports[i] || (this.imports[i] = /* @__PURE__ */ new Set())).add(n);
|
|
166
166
|
}
|
|
167
167
|
return {
|
|
168
168
|
name: n,
|
|
169
|
-
path:
|
|
169
|
+
path: o,
|
|
170
170
|
library: r
|
|
171
171
|
};
|
|
172
172
|
}
|
|
@@ -176,10 +176,10 @@ class ot {
|
|
|
176
176
|
replaceLibraryPath(t) {
|
|
177
177
|
const { libraryRegex: s } = this;
|
|
178
178
|
let n = t.value;
|
|
179
|
-
for (const
|
|
180
|
-
const r = t.value.match(
|
|
181
|
-
for (const
|
|
182
|
-
const c = this.collectImport(
|
|
179
|
+
for (const o of s) {
|
|
180
|
+
const r = t.value.match(o) || [];
|
|
181
|
+
for (const i of r) {
|
|
182
|
+
const c = this.collectImport(i);
|
|
183
183
|
if (c) {
|
|
184
184
|
const a = c.path.replace(/\$/g, "\\$");
|
|
185
185
|
n = n.replace(new RegExp(a, "g"), "");
|
|
@@ -197,9 +197,9 @@ class ot {
|
|
|
197
197
|
s(r);
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
|
-
const
|
|
201
|
-
for (const r of
|
|
202
|
-
|
|
200
|
+
const o = Object.values(n);
|
|
201
|
+
for (const r of o)
|
|
202
|
+
$(r) ? r.value = this.replaceLibraryPath(r) : s(r);
|
|
203
203
|
};
|
|
204
204
|
s(t);
|
|
205
205
|
}
|
|
@@ -207,18 +207,18 @@ class ot {
|
|
|
207
207
|
let s = [...t];
|
|
208
208
|
for (const n of Object.values(this.imports))
|
|
209
209
|
s = s.concat(Array.from(n));
|
|
210
|
-
return
|
|
210
|
+
return w(s);
|
|
211
211
|
}
|
|
212
212
|
collectContext(t, s) {
|
|
213
|
-
const n = new Set(s?.id ? this.context[s.id] : []),
|
|
213
|
+
const n = new Set(s?.id ? this.context[s.id] : []), o = (t.directives || []).find((c) => c.name === "vFor");
|
|
214
214
|
let r = new Set(Array.from(n));
|
|
215
|
-
if (
|
|
216
|
-
const { item: c = "item", index: a = "index" } =
|
|
215
|
+
if (o) {
|
|
216
|
+
const { item: c = "item", index: a = "index" } = o.iterator || {};
|
|
217
217
|
r = /* @__PURE__ */ new Set([c, a, ...Array.from(r)]);
|
|
218
218
|
}
|
|
219
|
-
const
|
|
220
|
-
if (
|
|
221
|
-
const c = typeof
|
|
219
|
+
const i = t.slot;
|
|
220
|
+
if (i) {
|
|
221
|
+
const c = typeof i == "string" ? [] : i.params || [], a = c.length ? c : [`scope_${s?.id}`];
|
|
222
222
|
r = /* @__PURE__ */ new Set([...a, ...Array.from(r)]);
|
|
223
223
|
}
|
|
224
224
|
this.context[t.id] = r;
|
|
@@ -233,13 +233,13 @@ class ot {
|
|
|
233
233
|
typeof t.from == "object" && t.from.type === "Plugin" && (this.blockPlugins[t.name] = t.from);
|
|
234
234
|
}
|
|
235
235
|
walkNodes(t) {
|
|
236
|
-
const s = (n,
|
|
237
|
-
this.collectContext(n,
|
|
236
|
+
const s = (n, o) => {
|
|
237
|
+
this.collectContext(n, o), this.collectStyle(n), this.collectUrlSchema(n), this.collectBlockPlugin(n), Array.isArray(n.children) && n.children.forEach((r) => s(r, n));
|
|
238
238
|
};
|
|
239
239
|
Array.isArray(t.nodes) && t.nodes.forEach((n) => s(n));
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function ot(e = {}) {
|
|
243
243
|
return Object.entries(e).map(([t, s]) => {
|
|
244
244
|
const n = l(s, !1);
|
|
245
245
|
return `${t}:${n}`;
|
|
@@ -253,33 +253,33 @@ function ct(e = []) {
|
|
|
253
253
|
}
|
|
254
254
|
function at(e = []) {
|
|
255
255
|
const t = (s) => s ? `[${Y(s).map((r) => r.replace(/\'|\"/gi, "")).join(",")}]` : void 0;
|
|
256
|
-
return e.map((s) => typeof s == "string" ? `${s}: {}` : `${s.name}: {
|
|
256
|
+
return e.map((s) => typeof s == "string" ? `${s}: {}` : ($(s.default) && !s.default.value && (s.default.value = "undefined"), `${s.name}: {
|
|
257
257
|
type:${t(s.type)},
|
|
258
|
-
required: ${s.required},
|
|
258
|
+
required: ${l(!!s.required, !0, !1)},
|
|
259
259
|
default: ${l(s.default, !0, !1)}
|
|
260
|
-
}`);
|
|
260
|
+
}`));
|
|
261
261
|
}
|
|
262
262
|
function lt(e = []) {
|
|
263
263
|
return e.map((t) => `'${t}'`);
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function S(e = {}, t = []) {
|
|
266
266
|
return Object.entries(e).map(([s, n]) => {
|
|
267
|
-
let
|
|
268
|
-
return
|
|
267
|
+
let o = q(l(n, !1, !1));
|
|
268
|
+
return o = k(o, t), o.startsWith("async") ? `async ${s}${o.replace(/^async/, "")}` : `${s}${o}`;
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
271
|
function ut(e = [], t = []) {
|
|
272
272
|
const s = e.reduce(
|
|
273
|
-
(r,
|
|
273
|
+
(r, i) => (i.id && A(i.source) && (r[`watcher_${i.id}`] = i.source), r),
|
|
274
274
|
{}
|
|
275
|
-
), n =
|
|
275
|
+
), n = S(s, t), o = e.map((r) => `watcher_${r.id}: {
|
|
276
276
|
deep: ${r.deep},
|
|
277
277
|
immediate:${r.immediate},
|
|
278
278
|
handler${q(r.handler.value)}
|
|
279
279
|
}`);
|
|
280
280
|
return {
|
|
281
281
|
computed: n,
|
|
282
|
-
watches:
|
|
282
|
+
watches: o
|
|
283
283
|
};
|
|
284
284
|
}
|
|
285
285
|
function pt(e = {}) {
|
|
@@ -290,17 +290,17 @@ function pt(e = {}) {
|
|
|
290
290
|
}`;
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
|
-
function D(e, t, s = [], n = {},
|
|
293
|
+
function D(e, t, s = [], n = {}, o) {
|
|
294
294
|
const r = [];
|
|
295
|
-
let
|
|
295
|
+
let i = {}, c = [], a = [];
|
|
296
296
|
return ft(e).forEach((p) => {
|
|
297
|
-
const
|
|
297
|
+
const b = [];
|
|
298
298
|
for (const u of p.children) {
|
|
299
299
|
let { id: x, name: f, invisible: O, from: m } = u;
|
|
300
300
|
if (O)
|
|
301
301
|
continue;
|
|
302
|
-
const
|
|
303
|
-
|
|
302
|
+
const v = mt(f, t, m);
|
|
303
|
+
v && c.push(v), Q(m) && a.push({ id: m.id, name: f });
|
|
304
304
|
const { props: g, events: N, handlers: H } = $t(
|
|
305
305
|
u,
|
|
306
306
|
x,
|
|
@@ -315,31 +315,31 @@ function D(e, t, s = [], n = {}, i) {
|
|
|
315
315
|
n,
|
|
316
316
|
u
|
|
317
317
|
) : "";
|
|
318
|
-
Object.assign(
|
|
319
|
-
let
|
|
320
|
-
typeof h == "string" ?
|
|
321
|
-
`), Object.assign(
|
|
318
|
+
Object.assign(i, H);
|
|
319
|
+
let j = "";
|
|
320
|
+
typeof h == "string" ? j = h : (j = (h?.nodes || []).join(`
|
|
321
|
+
`), Object.assign(i, h?.methods || {}), c = c.concat(h?.components || []), a = a.concat(h?.importBlocks || []));
|
|
322
322
|
const R = z(m) || G(m) ? "component" : f;
|
|
323
|
-
|
|
324
|
-
f === "img" ? `<${f} ${B} ${g} ${N} />` : `<${R} ${B} ${g} ${N}>${
|
|
325
|
-
` +
|
|
323
|
+
b.push(
|
|
324
|
+
f === "img" ? `<${f} ${B} ${g} ${N} />` : `<${R} ${B} ${g} ${N}>${j ? `
|
|
325
|
+
` + j.trim() : ""}</${R}>`
|
|
326
326
|
);
|
|
327
327
|
}
|
|
328
|
-
const P = St(p.slot,
|
|
329
|
-
`),
|
|
328
|
+
const P = St(p.slot, b.join(`
|
|
329
|
+
`), o?.id);
|
|
330
330
|
r.push(P);
|
|
331
331
|
}), {
|
|
332
332
|
nodes: r,
|
|
333
|
-
methods:
|
|
334
|
-
components:
|
|
335
|
-
importBlocks:
|
|
333
|
+
methods: i,
|
|
334
|
+
components: w(c),
|
|
335
|
+
importBlocks: w(a, "id")
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
338
|
function ft(e = []) {
|
|
339
339
|
const t = /* @__PURE__ */ new Map();
|
|
340
340
|
for (const s of e) {
|
|
341
|
-
const n = typeof s.slot == "string" ? s.slot : s.slot?.name,
|
|
342
|
-
|
|
341
|
+
const n = typeof s.slot == "string" ? s.slot : s.slot?.name, o = t.get(n);
|
|
342
|
+
o ? o.children.push(s) : t.set(n, { slot: s.slot, children: [s] });
|
|
343
343
|
}
|
|
344
344
|
return t;
|
|
345
345
|
}
|
|
@@ -348,8 +348,8 @@ function mt(e, t, s) {
|
|
|
348
348
|
return null;
|
|
349
349
|
const n = t.get(e);
|
|
350
350
|
if (n && n.alias) {
|
|
351
|
-
const
|
|
352
|
-
return `${e}: ${
|
|
351
|
+
const o = n.parent ? `${n.parent}.${n.alias}` : n.alias;
|
|
352
|
+
return `${e}: ${o}`;
|
|
353
353
|
}
|
|
354
354
|
return Q(s) || n ? e : null;
|
|
355
355
|
}
|
|
@@ -363,84 +363,84 @@ function G(e) {
|
|
|
363
363
|
return typeof e == "object" && e.type === "Plugin";
|
|
364
364
|
}
|
|
365
365
|
function ht(e, t, s = []) {
|
|
366
|
-
return e === "style" ? "" : e === "__class" &&
|
|
366
|
+
return e === "style" ? "" : e === "__class" && $(t) ? `:class="${l({
|
|
367
367
|
...t,
|
|
368
368
|
value: k(t.value, s)
|
|
369
|
-
})}"` : typeof t == "string" ? `${e}="${t}"` :
|
|
369
|
+
})}"` : typeof t == "string" ? `${e}="${t}"` : $(t) ? `:${e}="${l({
|
|
370
370
|
...t,
|
|
371
371
|
value: k(t.value, s)
|
|
372
372
|
})}"` : Z(t) ? `:${e}='{${nt(
|
|
373
373
|
t
|
|
374
374
|
).join(", ")}}'` : `:${e}='${JSON.stringify(t)}'`;
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function dt(e, t = {}, s = []) {
|
|
377
377
|
if (!!Object.keys(t.style || {}).length) {
|
|
378
378
|
const r = `${e.name}_${e.id}`;
|
|
379
379
|
t.class ? typeof t.class == "string" ? t.class = [t.class, r].join(" ") : (t.__class = t.class, t.class = r) : (t.class = r, delete t.style);
|
|
380
380
|
}
|
|
381
|
-
const
|
|
382
|
-
return (z(
|
|
381
|
+
const o = e.from;
|
|
382
|
+
return (z(o) || G(o)) && (t.is = {
|
|
383
383
|
type: "JSExpression",
|
|
384
384
|
value: e.name
|
|
385
|
-
}), Object.entries(t).map(([r,
|
|
385
|
+
}), Object.entries(t).map(([r, i]) => ht(r, i, s));
|
|
386
386
|
}
|
|
387
|
-
function
|
|
388
|
-
const
|
|
389
|
-
return n && n.length > 0 ? `@${e}${
|
|
387
|
+
function yt(e, t, s, n) {
|
|
388
|
+
const o = M(t.modifiers, !0);
|
|
389
|
+
return n && n.length > 0 ? `@${e}${o.join("")}="(...args:any[]) => ${s}"` : `@${e}${o.join("")}="${s}"`;
|
|
390
390
|
}
|
|
391
391
|
function gt(e, t = {}, s = {}) {
|
|
392
|
-
const n = {},
|
|
392
|
+
const n = {}, o = Array.from(s[e] || /* @__PURE__ */ new Set([])), r = o.length ? `({${o.join(", ")}}, args)` : "";
|
|
393
393
|
return {
|
|
394
394
|
binders: Object.entries(t).map(([c, a]) => {
|
|
395
|
-
const
|
|
396
|
-
return
|
|
395
|
+
const y = a.handler.value.startsWith("this."), p = y ? F(a.handler.value) : `${d(c)}_${e}${r}`;
|
|
396
|
+
return y || (n[p] = o.length ? {
|
|
397
397
|
type: "JSFunction",
|
|
398
398
|
value: `{
|
|
399
399
|
return (${a.handler.value}).apply(this, args);
|
|
400
400
|
}`
|
|
401
|
-
} : a.handler),
|
|
401
|
+
} : a.handler), yt(c, a, p, o);
|
|
402
402
|
}),
|
|
403
403
|
handlers: n
|
|
404
404
|
};
|
|
405
405
|
}
|
|
406
|
-
function $t(e, t, s = {}, n = {},
|
|
407
|
-
const { binders:
|
|
406
|
+
function $t(e, t, s = {}, n = {}, o = {}, r) {
|
|
407
|
+
const { binders: i, handlers: c } = gt(t, n, o);
|
|
408
408
|
return {
|
|
409
|
-
props:
|
|
409
|
+
props: dt(e, s, r).join(" "),
|
|
410
410
|
handlers: c,
|
|
411
|
-
binders:
|
|
412
|
-
events:
|
|
411
|
+
binders: i,
|
|
412
|
+
events: i.join(" ")
|
|
413
413
|
};
|
|
414
414
|
}
|
|
415
415
|
function bt(e = []) {
|
|
416
|
-
const t = [], { vIf: s, vShow: n, vModels:
|
|
417
|
-
if (s && t.push(`v-if="${l(s.value)}"`), n && t.push(`v-show="${l(n.value)}"`),
|
|
418
|
-
const c = M(
|
|
419
|
-
t.push(`v-model${a}${c}="${l(
|
|
416
|
+
const t = [], { vIf: s, vShow: n, vModels: o, vFor: r } = vt(e);
|
|
417
|
+
if (s && t.push(`v-if="${l(s.value)}"`), n && t.push(`v-show="${l(n.value)}"`), o.forEach((i) => {
|
|
418
|
+
const c = M(i.modifiers, !0), a = i.arg ? _(i.arg) ? `:[${l(i.arg)}]` : `:${i.arg}` : "";
|
|
419
|
+
t.push(`v-model${a}${c}="${l(i.value)}"`);
|
|
420
420
|
}), r) {
|
|
421
|
-
const { item:
|
|
422
|
-
t.push(`v-for="(${
|
|
421
|
+
const { item: i, index: c } = { item: "item", index: "index", ...r.iterator };
|
|
422
|
+
t.push(`v-for="(${i}, ${c}) in ${l(r.value)}"`);
|
|
423
423
|
}
|
|
424
424
|
return t;
|
|
425
425
|
}
|
|
426
426
|
function vt(e = []) {
|
|
427
|
-
const t = e.find((
|
|
427
|
+
const t = e.find((i) => d(i.name) === "vIf"), s = e.find((i) => d(i.name) === "vFor"), n = e.find((i) => d(i.name) === "vShow"), o = e.find((i) => d(i.name) === "vBind"), r = e.filter((i) => d(i.name) === "vModel");
|
|
428
428
|
return {
|
|
429
429
|
vIf: t,
|
|
430
430
|
vFor: s,
|
|
431
431
|
vShow: n,
|
|
432
432
|
vModels: r,
|
|
433
|
-
vBind:
|
|
433
|
+
vBind: o
|
|
434
434
|
};
|
|
435
435
|
}
|
|
436
|
-
function jt(e, t, s, n,
|
|
436
|
+
function jt(e, t, s, n, o) {
|
|
437
437
|
if (typeof e == "string")
|
|
438
438
|
return e;
|
|
439
439
|
if (_(e)) {
|
|
440
440
|
let r = l(e, !1);
|
|
441
441
|
return r = k(r, t), r = F(r), `{{ ${r} }}`;
|
|
442
442
|
}
|
|
443
|
-
return Array.isArray(e) ? D(e, s, t, n,
|
|
443
|
+
return Array.isArray(e) ? D(e, s, t, n, o) : "";
|
|
444
444
|
}
|
|
445
445
|
function St(e, t, s) {
|
|
446
446
|
if (!e)
|
|
@@ -451,16 +451,16 @@ function St(e, t, s) {
|
|
|
451
451
|
</template>`;
|
|
452
452
|
}
|
|
453
453
|
function wt(e, t = [], s = [], n = {}) {
|
|
454
|
-
const
|
|
454
|
+
const o = {
|
|
455
455
|
vue: ["defineComponent", "reactive"]
|
|
456
456
|
};
|
|
457
457
|
for (const r of t) {
|
|
458
|
-
const
|
|
459
|
-
|
|
458
|
+
const i = e.get(r.split(":")[0]);
|
|
459
|
+
i && i.package && (o[i.package] ?? (o[i.package] = [])).push(i.parent || (i.alias || "").split(".")[0] || i.name);
|
|
460
460
|
}
|
|
461
|
-
for (const [r,
|
|
462
|
-
(
|
|
463
|
-
return Object.entries(
|
|
461
|
+
for (const [r, i] of Object.entries(n))
|
|
462
|
+
(o[r] ?? (o[r] = [])).push(...Array.from(i));
|
|
463
|
+
return Object.entries(o).filter(([r, i]) => !!i.length).map(([r, i]) => `import { ${w(i).join(
|
|
464
464
|
","
|
|
465
465
|
)}} from '${r}';`).concat(s);
|
|
466
466
|
}
|
|
@@ -492,18 +492,18 @@ function xt(e = {}) {
|
|
|
492
492
|
}), t;
|
|
493
493
|
}
|
|
494
494
|
function Ot(e, t) {
|
|
495
|
-
const { dsl: s } = e, n = Object.keys(s.computed || {}),
|
|
495
|
+
const { dsl: s } = e, n = Object.keys(s.computed || {}), o = S(s.lifeCycles, n), r = S(s.computed, n), i = ut(s.watch, n), c = pt(s.dataSources), { methods: a, nodes: y, components: p, importBlocks: b } = D(
|
|
496
496
|
s.nodes || [],
|
|
497
497
|
t,
|
|
498
498
|
n,
|
|
499
499
|
e.context
|
|
500
|
-
), P = [...r, ...
|
|
500
|
+
), P = [...r, ...i.computed], u = S(
|
|
501
501
|
{
|
|
502
502
|
...a,
|
|
503
503
|
...s.methods || {}
|
|
504
504
|
},
|
|
505
505
|
n
|
|
506
|
-
), x =
|
|
506
|
+
), x = b.map((g) => `import ${g.name} from './${g.id}.vue';`), f = wt(
|
|
507
507
|
t,
|
|
508
508
|
p,
|
|
509
509
|
x,
|
|
@@ -511,30 +511,30 @@ function Ot(e, t) {
|
|
|
511
511
|
), O = Object.keys({
|
|
512
512
|
...e.urlSchemas,
|
|
513
513
|
...e.blockPlugins
|
|
514
|
-
}), m = Pt(e.urlSchemas),
|
|
514
|
+
}), m = Pt(e.urlSchemas), v = xt(e.blockPlugins);
|
|
515
515
|
return {
|
|
516
516
|
id: s.id,
|
|
517
517
|
version: s.__VERSION__,
|
|
518
518
|
name: s.name,
|
|
519
|
-
state:
|
|
519
|
+
state: ot(s.state).join(","),
|
|
520
520
|
inject: ct(s.inject).join(","),
|
|
521
521
|
props: at(s.props).join(","),
|
|
522
522
|
emits: lt(s.emits).join(","),
|
|
523
|
-
watch:
|
|
524
|
-
lifeCycles:
|
|
523
|
+
watch: i.watches.join(","),
|
|
524
|
+
lifeCycles: o.join(","),
|
|
525
525
|
computed: P.join(","),
|
|
526
526
|
methods: [...c, ...u].join(","),
|
|
527
527
|
imports: f.join(`
|
|
528
528
|
`),
|
|
529
529
|
components: p.join(","),
|
|
530
530
|
returns: e.members.join(","),
|
|
531
|
-
template:
|
|
531
|
+
template: y.join(`
|
|
532
532
|
`),
|
|
533
533
|
css: s.css || "",
|
|
534
534
|
style: kt(e.style),
|
|
535
535
|
urlSchemas: m.join(`
|
|
536
536
|
`),
|
|
537
|
-
blockPlugins:
|
|
537
|
+
blockPlugins: v.join(`
|
|
538
538
|
`),
|
|
539
539
|
asyncComponents: O.join(",")
|
|
540
540
|
};
|
|
@@ -581,13 +581,13 @@ export default defineComponent({
|
|
|
581
581
|
</style>
|
|
582
582
|
`, _t = J(Ct), At = J(Et);
|
|
583
583
|
async function Rt(e, t = /* @__PURE__ */ new Map(), s = [], n) {
|
|
584
|
-
const
|
|
584
|
+
const o = new it(K(e), s), r = Ot(o, t), i = _t(r), c = At({
|
|
585
585
|
template: r.template,
|
|
586
586
|
css: await W(r.css, n),
|
|
587
|
-
script: await st(
|
|
587
|
+
script: await st(i, n),
|
|
588
588
|
style: await W(r.style, n)
|
|
589
589
|
});
|
|
590
|
-
return await V(c, n);
|
|
590
|
+
return await V(c, n).catch((a) => (a.content = c, a));
|
|
591
591
|
}
|
|
592
592
|
async function Wt(e) {
|
|
593
593
|
const t = `
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtj/coder",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "vue-tsc && vite build",
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"coverage": "vitest run --coverage"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@vtj/base": "^0.8.
|
|
14
|
-
"@vtj/core": "^0.8.
|
|
13
|
+
"@vtj/base": "^0.8.2",
|
|
14
|
+
"@vtj/core": "^0.8.3",
|
|
15
15
|
"prettier": "~3.2.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@vtj/cli": "^0.8.
|
|
18
|
+
"@vtj/cli": "^0.8.2"
|
|
19
19
|
},
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dist",
|
|
32
32
|
"types"
|
|
33
33
|
],
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "5b5cc8b02b8f367591e4bee47a7d7ff54a01981b",
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
}
|
package/types/generator.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ import { BlockSchema, MaterialDescription, Dependencie, PageFile } from '@vtj/co
|
|
|
7
7
|
* 3. Parser 解析 dsl,提取 token
|
|
8
8
|
* 4. Compiled token 注入模板生成代码文件字符串
|
|
9
9
|
*/
|
|
10
|
-
export declare function generator(dsl: BlockSchema, componentMap?: Map<string, MaterialDescription>, dependencies?: Dependencie[], formatterDisabled?: boolean): Promise<
|
|
10
|
+
export declare function generator(dsl: BlockSchema, componentMap?: Map<string, MaterialDescription>, dependencies?: Dependencie[], formatterDisabled?: boolean): Promise<any>;
|
|
11
11
|
export declare function createEmptyPage(file: PageFile): Promise<string>;
|
package/types/version.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
3
3
|
* @name @vtj/coder
|
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
5
|
-
* @version 0.8.
|
|
5
|
+
* @version 0.8.2
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
7
|
*/
|
|
8
|
-
export declare const version = "0.8.
|
|
8
|
+
export declare const version = "0.8.2";
|