@vtj/coder 0.16.29 → 0.16.31

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 CHANGED
@@ -2,13 +2,13 @@
2
2
  * Copyright (c) 2026, VTJ.PRO All rights reserved.
3
3
  * @name @vtj/coder
4
4
  * @author CHC chenhuachun1549@dingtalk.com
5
- * @version 0.16.29
5
+ * @version 0.16.31
6
6
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
7
- */const ne="0.16.29";/**!
7
+ */const ne="0.16.31";/**!
8
8
  * Copyright (c) 2026, VTJ.PRO All rights reserved.
9
9
  * @name @vtj/core
10
10
  * @author CHC chenhuachun1549@dingtalk.com
11
- * @version 0.16.29
11
+ * @version 0.16.31
12
12
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
13
13
  */const re=["slot","template","component","img","div","p","h1","h2","h3","span","a"];m.mitt();const B={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 W(t,e){return e?t:await T.format(t,{parser:"vue",...B,plugins:[se,J,M,q]})}async function U(t,e){if(e)return t;try{return(await T.format(t,{parser:"babel-ts",...B,plugins:[J,M]})).replace(/;\n$/gi,"")}catch(s){return console.warn(s),t}}async function F(t,e){return e?t:T.format(t,{parser:"scss",...B,plugins:[q]})}function w(t){return t&&t.type==="JSExpression"}function I(t){return typeof t=="object"&&t&&t.type==="JSFunction"}function j(t){return w(t)||I(t)}function V(t){return t.replace(new RegExp("this.","g"),"")}function D(t){return t.replace(/this\.context\??\./g,"")}function d(t,e=!0,s=!0,n=[],i=!0){let r=t;return j(t)?(r=t.value.trim().replace(/;$/,""),i&&(r=r.replace(/\"/g,"'"))):r=e?JSON.stringify(r):t,r=C(r,n),s?V(D(r)):D(r)}function C(t="",e=[]){let s=t;for(const n of e)s=s.replace(new RegExp(`this.${n}.value`,"g"),`this.${n}`);return s}function H(t){let e=t.trim().replace(/;$/,"");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 ie(t={}){return Object.entries(t).map(([e,s])=>`"${e}": ${d(s)}`)}function Q(t={},e=!1){const s=Object.keys(t);return e?s.map(n=>"."+n):s}function oe(t){let e="";for(var s in t)if(t.hasOwnProperty(s)){var n=t[s];e+=s+": "+n+";"}return e}function ae(t=[],e=[]){return t.filter(s=>!e.includes(s))}function L(t){return m.base64(JSON.stringify(t))}class ce{constructor(e,s){this.dsl=e,this.dependencies=s,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 s=e.split(".");if(s.length===4){const n=s.pop(),i=s.join(".")+".",r=s.pop();if(n&&r){const o=this.dependencies.find(c=>c.library===r)?.package;o&&(this.imports[o]||(this.imports[o]=new Set)).add(n)}return{name:n,path:i,library:r}}return null}replaceLibraryPath(e){const{libraryRegex:s}=this;let n=e.value;for(const i of s){const r=e.value?.match(i)||[];for(const o of r){const c=this.collectImport(o);if(c){const h=c.path.replace(/\$/g,"\\$");n=n.replace(new RegExp(h,"g"),"")}}}return n}walk(e){const s=n=>{if(!n||typeof n!="object")return;if(Array.isArray(n)){for(let r of n)s(r);return}const i=Object.values(n);for(const r of i)j(r)?r.value=this.replaceLibraryPath(r):s(r)};s(e)}getLibraryMember(e=[]){let s=[...e];const n={...this.imports};delete n["uni-h5"],delete n["@dcloudio/uni-h5"],delete n["uni-ui"],delete n["@dcloudio/uni-ui"];for(const i of Object.values(n))s=s.concat(Array.from(i));return m.dedupArray(s)}collectContext(e,s){const n=new Set(s?.id?this.context[s.id]:[]),i=(e.directives||[]).find(c=>c.name==="vFor");let r=new Set(Array.from(n));if(i){const{item:c="item",index:h="index"}=i.iterator||{};r=new Set([c,h,...Array.from(r)])}const o=e.slot;if(o){const c=typeof o=="string"?[]:o.params||[],h=c.length?c:[`scope_${s?.id}`];r=new Set([...h,...Array.from(r)])}this.context[e.id]=r}collectStyle(e){e.id&&e.props?.style&&Object.keys(e.props.style).length&&!j(e.props.style)&&(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 s=(n,i)=>{this.collectContext(n,i),this.collectStyle(n),this.collectUrlSchema(n),this.collectBlockPlugin(n),Array.isArray(n.children)&&n.children.forEach(r=>s(r,n))};Array.isArray(e.nodes)&&e.nodes.forEach(n=>s(n))}}function le(t={}){return Object.entries(t).map(([e,s])=>{const n=d(s,!1,!0,[],!1);return`${e}:${n}`})}function ue(t=[]){return t.map(e=>`${e.name}: {
14
14
  from: '${e.from||e.name}',
package/dist/index.mjs CHANGED
@@ -8,15 +8,15 @@ import * as V from "prettier/plugins/estree";
8
8
  * Copyright (c) 2026, VTJ.PRO All rights reserved.
9
9
  * @name @vtj/coder
10
10
  * @author CHC chenhuachun1549@dingtalk.com
11
- * @version 0.16.29
11
+ * @version 0.16.31
12
12
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
13
13
  */
14
- const Je = "0.16.29";
14
+ const Je = "0.16.31";
15
15
  /**!
16
16
  * Copyright (c) 2026, VTJ.PRO All rights reserved.
17
17
  * @name @vtj/core
18
18
  * @author CHC chenhuachun1549@dingtalk.com
19
- * @version 0.16.29
19
+ * @version 0.16.31
20
20
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
21
21
  */
22
22
  const ie = [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vtj/coder",
3
3
  "private": false,
4
- "version": "0.16.29",
4
+ "version": "0.16.31",
5
5
  "type": "module",
6
6
  "keywords": [
7
7
  "低代码引擎",
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "prettier": "~3.7.0",
25
25
  "@vtj/base": "~0.12.4",
26
- "@vtj/core": "~0.16.29"
26
+ "@vtj/core": "~0.16.31"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@vtj/cli": "~0.12.19"
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2026, VTJ.PRO All rights reserved.
3
3
  * @name @vtj/coder
4
4
  * @author CHC chenhuachun1549@dingtalk.com
5
- * @version 0.16.28
5
+ * @version 0.16.30
6
6
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
7
7
  */
8
- export declare const version = "0.16.28";
8
+ export declare const version = "0.16.30";