@vcp-dev/site-edit-engine 0.3.14 → 0.4.0

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/README.md CHANGED
@@ -29,8 +29,10 @@ npm install @vcp-dev/contracts @vcp-dev/site-edit-engine
29
29
  Next App Router 路由扫描与 routeId 解析工具。
30
30
  - `@vcp-dev/site-edit-engine/source-watcher`
31
31
  预览场景使用的源码监听器。
32
+ - `@vcp-dev/site-edit-engine/site-edit-instrumentation-loader`
33
+ 仅用于 preview / instrumentation 的 bundler-neutral loader。
32
34
  - `@vcp-dev/site-edit-engine/webpack-loader`
33
- 仅用于 preview / instrumentation 的 webpack loader。
35
+ 兼容旧 Webpack 接入的 legacy alias,复用同一 instrumentation loader 实现。
34
36
 
35
37
  ## Snapshot runtime 示例
36
38
 
@@ -69,11 +71,15 @@ await runtime.setActiveRoute("/");
69
71
  runtime.dispose();
70
72
  ```
71
73
 
72
- ## `webpack-loader` 说明
74
+ ## `site-edit-instrumentation-loader` 说明
73
75
 
74
- `@vcp-dev/site-edit-engine/webpack-loader` 只用于开发态 preview instrumentation,
75
- 负责给 JSX / TSX 注入 VCP 编辑运行时属性。它不是通用的 Webpack / Next.js 插件平台,
76
- 也不承诺覆盖 preview instrumentation 之外的构建场景。
76
+ `@vcp-dev/site-edit-engine/site-edit-instrumentation-loader` 只用于开发态 preview
77
+ instrumentation,负责给 JSX / TSX 注入 VCP 编辑运行时属性。它不是通用的
78
+ Next.js 插件平台,也不承诺覆盖 preview instrumentation 之外的构建场景。
79
+
80
+ 旧版 Webpack 配置可继续引用 `@vcp-dev/site-edit-engine/webpack-loader`。该子路径只是
81
+ `site-edit-instrumentation-loader` 的兼容别名,不维护第二套转换逻辑;新接入建议优先使用
82
+ bundler-neutral 子路径。
77
83
 
78
84
  ## 非目标
79
85
 
@@ -0,0 +1 @@
1
+ "use strict";var S=require("@babel/generator"),v=require("@babel/parser"),h=require("@babel/traverse"),o=require("@babel/types"),j=typeof S=="function"?S:S.default,k=typeof h=="function"?h:h.default,O={key:"data-vcp-edit-key",parentKey:"data-vcp-edit-parent-key",movable:"data-vcp-movable",removable:"data-vcp-removable",flags:"data-vcp-flags"},M=new Set(["base","body","head","html","link","meta","noscript","script","style","template","title"]);var F="suppressHydrationWarning",$=new Set(["SiteEditBootstrap"]),L="data-vcp-ui-component",f="components/ui";function W(e,t){this.cacheable?.();let n=this.async();try{if(!U(this.resourcePath)){n(null,e,t);return}let r=this.getOptions?.()??{},i=A({source:e,file:this.resourcePath,projectRoot:r.projectRoot});n(null,i.code,i.code===e?t:null)}catch(r){n(r)}}function U(e){return typeof e=="string"&&/\.(jsx|tsx)$/.test(e)&&!e.includes("/node_modules/")&&!e.endsWith(".d.ts")}function A(e){let t=q(e.file,e.projectRoot);if(!D(e.source)||d(t))return{code:e.source,elements:[]};let n=e.attributes??O,r=v.parse(e.source,{sourceType:"module",plugins:["jsx","typescript"]}),i=[],s=H(r,t);return k(r,{JSXElement(c){let u=c.node.openingElement,l=u.name;if(!Y(l)||J(u,n.key))return;let P=ee(c)??"default",R=ne(c),y=z(t,P,R),g=m(l)??"unknown",E=K(l)?"jsx":"component-call";if(E==="component-call"&&!te(c.node.children)&&$.has(g))return;let _=E==="component-call"&&Q(g,s);Z(u,n.key,y),_&&C(u,L),B(c)&&C(u,F),i.push({key:y,tag:g,component_name:P,source_file:t,source_kind:E})}}),{code:j(r,{jsescOption:{minimal:!0}}).code,elements:i}}function B(e){return!e.findParent(t=>t.isJSXElement())}function D(e){return e.includes("<")}function z(e,t,n){return`${e}::${t}::${n}`}function q(e,t){let n=e.replace(/\\/g,"/").replace(/^\.\//,""),r=t?.replace(/\\/g,"/").replace(/\/+$/,"");if(r&&n.startsWith(`${r}/`))return n.slice(r.length+1);for(let[s,c]of[["/src/app/",1],["/src/components/",1],["/app/",1],["/components/",1]]){let u=n.indexOf(s);if(u>=0)return n.slice(u+c)}return n.match(/(?:^|\/)((?:src\/app|src\/components|app|components)\/.+)$/)?.[1]??n}function K(e){return o.isJSXIdentifier(e)&&/^[a-z]/.test(e.name)}function m(e){return o.isJSXIdentifier(e)?e.name:o.isJSXMemberExpression(e)?w(e):null}function H(e,t){let n=new Set;for(let r of e.program.body)if(!(!o.isImportDeclaration(r)||!V(r.source.value,t)))for(let i of r.specifiers)n.add(i.local.name);return n}function Q(e,t){let n=e.split(".")[0]??e;return t.has(n)}function d(e){if(!e)return!1;let t=x(e);return t===f||t.startsWith(`${f}/`)||t.includes(`/${f}/`)||t.endsWith(`/${f}`)}function V(e,t){return e?e.startsWith("@/")||e.startsWith("~/")?d(e.slice(2)):e.startsWith("./")||e.startsWith("../")?d(x(`${G(t)}/${e}`)):d(e):!1}function x(e){let n=(e.split("?")[0]??e).replace(/\\/g,"/").replace(/^\.\//,""),r=[];for(let i of n.split("/"))if(!(!i||i===".")){if(i===".."){r.pop();continue}r.push(i)}return r.join("/")}function G(e){let t=x(e),n=t.lastIndexOf("/");return n>=0?t.slice(0,n):""}function Y(e){let t=m(e);return!t||t==="Fragment"||t.endsWith(".Fragment")?!1:!M.has(t)}function J(e,t){return e.attributes.some(n=>o.isJSXAttribute(n)&&o.isJSXIdentifier(n.name,{name:t}))}function Z(e,t,n){X(e,o.jsxAttribute(o.jsxIdentifier(t),o.stringLiteral(n)))}function C(e,t){J(e,t)||X(e,o.jsxAttribute(o.jsxIdentifier(t),null))}function X(e,t){let n=e.attributes.findIndex(r=>o.isJSXSpreadAttribute(r));if(n>=0){e.attributes.splice(n,0,t);return}e.attributes.push(t)}function w(e){return`${o.isJSXIdentifier(e.object)?e.object.name:w(e.object)}.${e.property.name}`}function ee(e){let t=e;for(;t;){if(t.isFunctionDeclaration()||t.isClassDeclaration())return t.node.id?.name??null;if(t.isVariableDeclarator()&&o.isIdentifier(t.node.id)){let n=t.get("init");if(!Array.isArray(n)&&(n.isArrowFunctionExpression()||n.isFunctionExpression()))return t.node.id.name}t=t.parentPath}return null}function te(e){return e.some(t=>o.isJSXElement(t)||o.isJSXFragment(t))}var I=new WeakMap,N=new WeakMap,b=new WeakMap;function ne(e){let t=I.get(e.node);if(t!==void 0)return t;let n=[],r=e;for(;r;){if(r.isJSXElement()){let s=re(r);s&&n.unshift(s)}r=r.parentPath}let i=n.join("/");return I.set(e.node,i),i}function re(e){let t=m(e.node.openingElement.name);return!t||t==="Fragment"||t.endsWith(".Fragment")?null:/^[A-Z]/.test(t)?`component:${t}#${T(e,t)}`:`${t}#${T(e,t)}`}function T(e,t){let n=ie(e);if(!n)return 0;let r=b.get(n.node)?.get(t)?.get(e.node);if(r!==void 0)return r;let i=b.get(n.node);i||(i=new Map,b.set(n.node,i));let s=i.get(t);s||(s=new WeakMap,i.set(t,s));let c=0;for(let u of p(n))if(m(u.node.openingElement.name)===t){if(s.set(u.node,c),u.node===e.node)return c;c+=1}return s.get(e.node)??0}function ie(e){let t=e.parentPath,n=null;for(;t;){if(t.isJSXFragment()){n=t,t=t.parentPath;continue}if(t.isJSXElement())return t;t=t.parentPath}return n}function p(e){let t=N.get(e.node);if(t)return t;let n=[],r=e.get("children");for(let i of r)if(!Array.isArray(i)){if(i.isJSXElement()){n.push(i);continue}if(i.isJSXFragment()){n.push(...p(i));continue}i.isJSXExpressionContainer()&&n.push(...a(i.get("expression")))}return N.set(e.node,n),n}function a(e){return e.isJSXElement()?[e]:e.isJSXFragment()?p(e):e.isParenthesizedExpression()?a(e.get("expression")):e.isLogicalExpression()&&e.node.operator==="&&"?a(e.get("right")):e.isConditionalExpression()?[...a(e.get("consequent")),...a(e.get("alternate"))]:e.isCallExpression()&&se(e.node)?oe(e.get("arguments")[0]):[]}function oe(e){if(!e?.isArrowFunctionExpression()&&!e?.isFunctionExpression())return[];let t=e.get("body");if(t.isJSXElement())return[t];if(t.isJSXFragment())return p(t);if(t.isParenthesizedExpression())return a(t.get("expression"));if(!t.isBlockStatement())return[];for(let n of t.get("body")){if(!n.isReturnStatement())continue;let r=n.get("argument");return r.node?a(r):[]}return[]}function se(e){return o.isMemberExpression(e.callee)&&o.isIdentifier(e.callee.property)&&e.callee.property.name==="map"}module.exports=W;module.exports.instrumentSiteEditRuntimeAttributes=A;
@@ -1 +1 @@
1
- "use strict";var S=require("@babel/generator"),v=require("@babel/parser"),h=require("@babel/traverse"),o=require("@babel/types"),j=typeof S=="function"?S:S.default,k=typeof h=="function"?h:h.default,O={key:"data-vcp-edit-key",parentKey:"data-vcp-edit-parent-key",movable:"data-vcp-movable",removable:"data-vcp-removable",flags:"data-vcp-flags"},M=new Set(["base","body","head","html","link","meta","noscript","script","style","template","title"]);var F="suppressHydrationWarning",$=new Set(["SiteEditBootstrap"]),L="data-vcp-ui-component",f="components/ui";function W(e,t){this.cacheable?.();let n=this.async();try{if(!U(this.resourcePath)){n(null,e,t);return}let r=this.getOptions?.()??{},i=A({source:e,file:this.resourcePath,projectRoot:r.projectRoot});n(null,i.code,i.code===e?t:null)}catch(r){n(r)}}function U(e){return typeof e=="string"&&/\.(jsx|tsx)$/.test(e)&&!e.includes("/node_modules/")&&!e.endsWith(".d.ts")}function A(e){let t=q(e.file,e.projectRoot);if(!D(e.source)||d(t))return{code:e.source,elements:[]};let n=e.attributes??O,r=v.parse(e.source,{sourceType:"module",plugins:["jsx","typescript"]}),i=[],s=H(r,t);return k(r,{JSXElement(c){let u=c.node.openingElement,l=u.name;if(!Y(l)||J(u,n.key))return;let P=ee(c)??"default",R=ne(c),y=z(t,P,R),g=m(l)??"unknown",E=K(l)?"jsx":"component-call";if(E==="component-call"&&!te(c.node.children)&&$.has(g))return;let _=E==="component-call"&&Q(g,s);Z(u,n.key,y),_&&C(u,L),B(c)&&C(u,F),i.push({key:y,tag:g,component_name:P,source_file:t,source_kind:E})}}),{code:j(r,{jsescOption:{minimal:!0}}).code,elements:i}}function B(e){return!e.findParent(t=>t.isJSXElement())}function D(e){return e.includes("<")}function z(e,t,n){return`${e}::${t}::${n}`}function q(e,t){let n=e.replace(/\\/g,"/").replace(/^\.\//,""),r=t?.replace(/\\/g,"/").replace(/\/+$/,"");if(r&&n.startsWith(`${r}/`))return n.slice(r.length+1);for(let[s,c]of[["/src/app/",1],["/src/components/",1],["/app/",1],["/components/",1]]){let u=n.indexOf(s);if(u>=0)return n.slice(u+c)}return n.match(/(?:^|\/)((?:src\/app|src\/components|app|components)\/.+)$/)?.[1]??n}function K(e){return o.isJSXIdentifier(e)&&/^[a-z]/.test(e.name)}function m(e){return o.isJSXIdentifier(e)?e.name:o.isJSXMemberExpression(e)?w(e):null}function H(e,t){let n=new Set;for(let r of e.program.body)if(!(!o.isImportDeclaration(r)||!V(r.source.value,t)))for(let i of r.specifiers)n.add(i.local.name);return n}function Q(e,t){let n=e.split(".")[0]??e;return t.has(n)}function d(e){if(!e)return!1;let t=x(e);return t===f||t.startsWith(`${f}/`)||t.includes(`/${f}/`)||t.endsWith(`/${f}`)}function V(e,t){return e?e.startsWith("@/")||e.startsWith("~/")?d(e.slice(2)):e.startsWith("./")||e.startsWith("../")?d(x(`${G(t)}/${e}`)):d(e):!1}function x(e){let n=(e.split("?")[0]??e).replace(/\\/g,"/").replace(/^\.\//,""),r=[];for(let i of n.split("/"))if(!(!i||i===".")){if(i===".."){r.pop();continue}r.push(i)}return r.join("/")}function G(e){let t=x(e),n=t.lastIndexOf("/");return n>=0?t.slice(0,n):""}function Y(e){let t=m(e);return!t||t==="Fragment"||t.endsWith(".Fragment")?!1:!M.has(t)}function J(e,t){return e.attributes.some(n=>o.isJSXAttribute(n)&&o.isJSXIdentifier(n.name,{name:t}))}function Z(e,t,n){X(e,o.jsxAttribute(o.jsxIdentifier(t),o.stringLiteral(n)))}function C(e,t){J(e,t)||X(e,o.jsxAttribute(o.jsxIdentifier(t),null))}function X(e,t){let n=e.attributes.findIndex(r=>o.isJSXSpreadAttribute(r));if(n>=0){e.attributes.splice(n,0,t);return}e.attributes.push(t)}function w(e){return`${o.isJSXIdentifier(e.object)?e.object.name:w(e.object)}.${e.property.name}`}function ee(e){let t=e;for(;t;){if(t.isFunctionDeclaration()||t.isClassDeclaration())return t.node.id?.name??null;if(t.isVariableDeclarator()&&o.isIdentifier(t.node.id)){let n=t.get("init");if(!Array.isArray(n)&&(n.isArrowFunctionExpression()||n.isFunctionExpression()))return t.node.id.name}t=t.parentPath}return null}function te(e){return e.some(t=>o.isJSXElement(t)||o.isJSXFragment(t))}var I=new WeakMap,N=new WeakMap,b=new WeakMap;function ne(e){let t=I.get(e.node);if(t!==void 0)return t;let n=[],r=e;for(;r;){if(r.isJSXElement()){let s=re(r);s&&n.unshift(s)}r=r.parentPath}let i=n.join("/");return I.set(e.node,i),i}function re(e){let t=m(e.node.openingElement.name);return!t||t==="Fragment"||t.endsWith(".Fragment")?null:/^[A-Z]/.test(t)?`component:${t}#${T(e,t)}`:`${t}#${T(e,t)}`}function T(e,t){let n=ie(e);if(!n)return 0;let r=b.get(n.node)?.get(t)?.get(e.node);if(r!==void 0)return r;let i=b.get(n.node);i||(i=new Map,b.set(n.node,i));let s=i.get(t);s||(s=new WeakMap,i.set(t,s));let c=0;for(let u of p(n))if(m(u.node.openingElement.name)===t){if(s.set(u.node,c),u.node===e.node)return c;c+=1}return s.get(e.node)??0}function ie(e){let t=e.parentPath,n=null;for(;t;){if(t.isJSXFragment()){n=t,t=t.parentPath;continue}if(t.isJSXElement())return t;t=t.parentPath}return n}function p(e){let t=N.get(e.node);if(t)return t;let n=[],r=e.get("children");for(let i of r)if(!Array.isArray(i)){if(i.isJSXElement()){n.push(i);continue}if(i.isJSXFragment()){n.push(...p(i));continue}i.isJSXExpressionContainer()&&n.push(...a(i.get("expression")))}return N.set(e.node,n),n}function a(e){return e.isJSXElement()?[e]:e.isJSXFragment()?p(e):e.isParenthesizedExpression()?a(e.get("expression")):e.isLogicalExpression()&&e.node.operator==="&&"?a(e.get("right")):e.isConditionalExpression()?[...a(e.get("consequent")),...a(e.get("alternate"))]:e.isCallExpression()&&se(e.node)?oe(e.get("arguments")[0]):[]}function oe(e){if(!e?.isArrowFunctionExpression()&&!e?.isFunctionExpression())return[];let t=e.get("body");if(t.isJSXElement())return[t];if(t.isJSXFragment())return p(t);if(t.isParenthesizedExpression())return a(t.get("expression"));if(!t.isBlockStatement())return[];for(let n of t.get("body")){if(!n.isReturnStatement())continue;let r=n.get("argument");return r.node?a(r):[]}return[]}function se(e){return o.isMemberExpression(e.callee)&&o.isIdentifier(e.callee.property)&&e.callee.property.name==="map"}module.exports=W;module.exports.instrumentSiteEditRuntimeAttributes=A;
1
+ "use strict";var k=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var _=k((fe,P)=>{"use strict";var S=require("@babel/generator"),O=require("@babel/parser"),h=require("@babel/traverse"),o=require("@babel/types"),M=typeof S=="function"?S:S.default,F=typeof h=="function"?h:h.default,$={key:"data-vcp-edit-key",parentKey:"data-vcp-edit-parent-key",movable:"data-vcp-movable",removable:"data-vcp-removable",flags:"data-vcp-flags"},L=new Set(["base","body","head","html","link","meta","noscript","script","style","template","title"]),W="suppressHydrationWarning",U=new Set(["SiteEditBootstrap"]),B="data-vcp-ui-component",f="components/ui";function D(e,t){this.cacheable?.();let n=this.async();try{if(!z(this.resourcePath)){n(null,e,t);return}let r=this.getOptions?.()??{},i=J({source:e,file:this.resourcePath,projectRoot:r.projectRoot});n(null,i.code,i.code===e?t:null)}catch(r){n(r)}}function z(e){return typeof e=="string"&&/\.(jsx|tsx)$/.test(e)&&!e.includes("/node_modules/")&&!e.endsWith(".d.ts")}function J(e){let t=Q(e.file,e.projectRoot);if(!K(e.source)||d(t))return{code:e.source,elements:[]};let n=e.attributes??$,r=O.parse(e.source,{sourceType:"module",plugins:["jsx","typescript"]}),i=[],s=G(r,t);return F(r,{JSXElement(c){let u=c.node.openingElement,l=u.name;if(!te(l)||X(u,n.key))return;let y=re(c)??"default",v=oe(c),C=H(t,y,v),g=m(l)??"unknown",E=V(l)?"jsx":"component-call";if(E==="component-call"&&!ie(c.node.children)&&U.has(g))return;let j=E==="component-call"&&Y(g,s);ne(u,n.key,C),j&&I(u,B),q(c)&&I(u,W),i.push({key:C,tag:g,component_name:y,source_file:t,source_kind:E})}}),{code:M(r,{jsescOption:{minimal:!0}}).code,elements:i}}function q(e){return!e.findParent(t=>t.isJSXElement())}function K(e){return e.includes("<")}function H(e,t,n){return`${e}::${t}::${n}`}function Q(e,t){let n=e.replace(/\\/g,"/").replace(/^\.\//,""),r=t?.replace(/\\/g,"/").replace(/\/+$/,"");if(r&&n.startsWith(`${r}/`))return n.slice(r.length+1);for(let[s,c]of[["/src/app/",1],["/src/components/",1],["/app/",1],["/components/",1]]){let u=n.indexOf(s);if(u>=0)return n.slice(u+c)}return n.match(/(?:^|\/)((?:src\/app|src\/components|app|components)\/.+)$/)?.[1]??n}function V(e){return o.isJSXIdentifier(e)&&/^[a-z]/.test(e.name)}function m(e){return o.isJSXIdentifier(e)?e.name:o.isJSXMemberExpression(e)?R(e):null}function G(e,t){let n=new Set;for(let r of e.program.body)if(!(!o.isImportDeclaration(r)||!Z(r.source.value,t)))for(let i of r.specifiers)n.add(i.local.name);return n}function Y(e,t){let n=e.split(".")[0]??e;return t.has(n)}function d(e){if(!e)return!1;let t=x(e);return t===f||t.startsWith(`${f}/`)||t.includes(`/${f}/`)||t.endsWith(`/${f}`)}function Z(e,t){return e?e.startsWith("@/")||e.startsWith("~/")?d(e.slice(2)):e.startsWith("./")||e.startsWith("../")?d(x(`${ee(t)}/${e}`)):d(e):!1}function x(e){let n=(e.split("?")[0]??e).replace(/\\/g,"/").replace(/^\.\//,""),r=[];for(let i of n.split("/"))if(!(!i||i===".")){if(i===".."){r.pop();continue}r.push(i)}return r.join("/")}function ee(e){let t=x(e),n=t.lastIndexOf("/");return n>=0?t.slice(0,n):""}function te(e){let t=m(e);return!t||t==="Fragment"||t.endsWith(".Fragment")?!1:!L.has(t)}function X(e,t){return e.attributes.some(n=>o.isJSXAttribute(n)&&o.isJSXIdentifier(n.name,{name:t}))}function ne(e,t,n){w(e,o.jsxAttribute(o.jsxIdentifier(t),o.stringLiteral(n)))}function I(e,t){X(e,t)||w(e,o.jsxAttribute(o.jsxIdentifier(t),null))}function w(e,t){let n=e.attributes.findIndex(r=>o.isJSXSpreadAttribute(r));if(n>=0){e.attributes.splice(n,0,t);return}e.attributes.push(t)}function R(e){return`${o.isJSXIdentifier(e.object)?e.object.name:R(e.object)}.${e.property.name}`}function re(e){let t=e;for(;t;){if(t.isFunctionDeclaration()||t.isClassDeclaration())return t.node.id?.name??null;if(t.isVariableDeclarator()&&o.isIdentifier(t.node.id)){let n=t.get("init");if(!Array.isArray(n)&&(n.isArrowFunctionExpression()||n.isFunctionExpression()))return t.node.id.name}t=t.parentPath}return null}function ie(e){return e.some(t=>o.isJSXElement(t)||o.isJSXFragment(t))}var N=new WeakMap,T=new WeakMap,b=new WeakMap;function oe(e){let t=N.get(e.node);if(t!==void 0)return t;let n=[],r=e;for(;r;){if(r.isJSXElement()){let s=se(r);s&&n.unshift(s)}r=r.parentPath}let i=n.join("/");return N.set(e.node,i),i}function se(e){let t=m(e.node.openingElement.name);return!t||t==="Fragment"||t.endsWith(".Fragment")?null:/^[A-Z]/.test(t)?`component:${t}#${A(e,t)}`:`${t}#${A(e,t)}`}function A(e,t){let n=ue(e);if(!n)return 0;let r=b.get(n.node)?.get(t)?.get(e.node);if(r!==void 0)return r;let i=b.get(n.node);i||(i=new Map,b.set(n.node,i));let s=i.get(t);s||(s=new WeakMap,i.set(t,s));let c=0;for(let u of p(n))if(m(u.node.openingElement.name)===t){if(s.set(u.node,c),u.node===e.node)return c;c+=1}return s.get(e.node)??0}function ue(e){let t=e.parentPath,n=null;for(;t;){if(t.isJSXFragment()){n=t,t=t.parentPath;continue}if(t.isJSXElement())return t;t=t.parentPath}return n}function p(e){let t=T.get(e.node);if(t)return t;let n=[],r=e.get("children");for(let i of r)if(!Array.isArray(i)){if(i.isJSXElement()){n.push(i);continue}if(i.isJSXFragment()){n.push(...p(i));continue}i.isJSXExpressionContainer()&&n.push(...a(i.get("expression")))}return T.set(e.node,n),n}function a(e){return e.isJSXElement()?[e]:e.isJSXFragment()?p(e):e.isParenthesizedExpression()?a(e.get("expression")):e.isLogicalExpression()&&e.node.operator==="&&"?a(e.get("right")):e.isConditionalExpression()?[...a(e.get("consequent")),...a(e.get("alternate"))]:e.isCallExpression()&&ae(e.node)?ce(e.get("arguments")[0]):[]}function ce(e){if(!e?.isArrowFunctionExpression()&&!e?.isFunctionExpression())return[];let t=e.get("body");if(t.isJSXElement())return[t];if(t.isJSXFragment())return p(t);if(t.isParenthesizedExpression())return a(t.get("expression"));if(!t.isBlockStatement())return[];for(let n of t.get("body")){if(!n.isReturnStatement())continue;let r=n.get("argument");return r.node?a(r):[]}return[]}function ae(e){return o.isMemberExpression(e.callee)&&o.isIdentifier(e.callee.property)&&e.callee.property.name==="map"}P.exports=D;P.exports.instrumentSiteEditRuntimeAttributes=J});module.exports=_();
@@ -0,0 +1,3 @@
1
+ import siteEditInstrumentationLoader = require("./site-edit-instrumentation-loader.cjs");
2
+
3
+ export = siteEditInstrumentationLoader;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcp-dev/site-edit-engine",
3
- "version": "0.3.14",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -32,9 +32,14 @@
32
32
  "types": "./dist/source-watcher.d.ts",
33
33
  "default": "./dist/source-watcher.js"
34
34
  },
35
+ "./site-edit-instrumentation-loader": {
36
+ "development": "./src/site-edit-instrumentation-loader.cjs",
37
+ "types": "./dist/site-edit-instrumentation-loader.d.cts",
38
+ "default": "./dist/site-edit-instrumentation-loader.cjs"
39
+ },
35
40
  "./webpack-loader": {
36
41
  "development": "./src/webpack-loader.cjs",
37
- "types": "./dist/webpack-loader.d.ts",
42
+ "types": "./dist/webpack-loader.d.cts",
38
43
  "default": "./dist/webpack-loader.cjs"
39
44
  }
40
45
  },
@@ -46,7 +51,7 @@
46
51
  "node": ">=24.0.0"
47
52
  },
48
53
  "scripts": {
49
- "build": "pnpm --dir ../contracts build && node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json && node -e \"const fs=require('node:fs'); fs.mkdirSync('dist', { recursive: true }); fs.copyFileSync('src/webpack-loader.cjs', 'dist/webpack-loader.cjs'); fs.copyFileSync('src/webpack-loader.d.ts', 'dist/webpack-loader.d.ts')\"",
54
+ "build": "pnpm --dir ../contracts build && node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json && node -e \"const fs=require('node:fs'); fs.mkdirSync('dist', { recursive: true }); fs.copyFileSync('src/site-edit-instrumentation-loader.cjs', 'dist/site-edit-instrumentation-loader.cjs'); fs.copyFileSync('src/site-edit-instrumentation-loader.d.cts', 'dist/site-edit-instrumentation-loader.d.cts'); fs.copyFileSync('src/webpack-loader.cjs', 'dist/webpack-loader.cjs'); fs.copyFileSync('src/webpack-loader.d.cts', 'dist/webpack-loader.d.cts')\"",
50
55
  "test": "vitest run --root ../.. packages/site-edit-engine/src",
51
56
  "typecheck": "tsc -p tsconfig.json --noEmit"
52
57
  },
@@ -55,7 +60,7 @@
55
60
  "@babel/parser": "^7.29.3",
56
61
  "@babel/traverse": "^7.29.0",
57
62
  "@babel/types": "^7.29.0",
58
- "@vcp-dev/contracts": "0.3.14"
63
+ "@vcp-dev/contracts": "0.4.0"
59
64
  },
60
65
  "devDependencies": {
61
66
  "@types/babel__generator": "^7.27.0",