vbapm 0.7.0 → 0.8.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 +40 -0
- package/addins/build/vbapm.xlam +0 -0
- package/lib/actions/export-project.d.ts +2 -0
- package/lib/actions/update-project.d.ts +7 -0
- package/lib/{add-source-_Z4tr2ea.js → add-source-BOumGmx7.js} +1 -1
- package/lib/addin.d.ts +1 -0
- package/lib/bin/vbapm-update.d.ts +2 -0
- package/lib/build-project-De7NPBpt.js +3 -0
- package/lib/build-target-ooHNsSLD.js +9 -0
- package/lib/{create-project-CTAlegO8.js → create-project-BYc3XMZw.js} +1 -1
- package/lib/errors.d.ts +2 -0
- package/lib/export-project-CgFMyE-g.js +4 -0
- package/lib/export-target-C0RYJqUX.js +4 -0
- package/lib/{get-target-Ba_ZoGUl.js → get-target-LUoY1UWJ.js} +1 -1
- package/lib/index-C61lSPb5.js +1 -0
- package/lib/{index-CB6KQLC7.js → index-CBGUBgfk.js} +3 -3
- package/lib/{index-_8uEunjn.js → index-ClUEyMCY.js} +1 -1
- package/lib/{index-mBZsirl0.js → index-Cp8MNK26.js} +1 -1
- package/lib/{index-Cwtynogk.js → index-Dv6JxqGo.js} +1 -1
- package/lib/index.js +1 -1
- package/lib/{init-project-BY-a8CIk.js → init-project-9RKSVG_H.js} +3 -3
- package/lib/installer-DPj-zT7L.js +9 -0
- package/lib/{load-from-project-wNJg8fme.js → load-from-project-ClF4qaC0.js} +1 -1
- package/lib/messages.d.ts +2 -0
- package/lib/{project-DFh-2QTw.js → project-BPmPCkUS.js} +4 -4
- package/lib/run-macro-C1-aJWu5.js +1 -0
- package/lib/{sat-solver-CqS8Vf6C.js → sat-solver-B6RXdyQs.js} +1 -1
- package/lib/targets/build-target.d.ts +1 -0
- package/lib/targets/export-target.d.ts +3 -1
- package/lib/targets/transforms/format-xml.d.ts +2 -0
- package/lib/test-project-DXBFZH3o.js +1 -0
- package/lib/transform-build-graph-DgRrocSn.js +1 -0
- package/lib/transform-target-CYhuozxP.js +2 -0
- package/lib/utils/encoding.d.ts +30 -0
- package/lib/utils/run.d.ts +4 -1
- package/lib/utils/xml.d.ts +14 -0
- package/lib/{vbapm-add-QPN5uEGK.js → vbapm-add-CASFjXAL.js} +1 -1
- package/lib/vbapm-build-Bhm_pqQW.js +9 -0
- package/lib/vbapm-export-8KDCdFOz.js +9 -0
- package/lib/{vbapm-init-BMY4x_xq.js → vbapm-init-Ba2xCez2.js} +1 -1
- package/lib/{vbapm-new-DLW9SdvJ.js → vbapm-new-YQRNQ4Iq.js} +1 -1
- package/lib/{vbapm-run-DzRxAhlD.js → vbapm-run-J-R--noZ.js} +2 -2
- package/lib/{vbapm-test-DInh0MDC.js → vbapm-test-C4KWMPLz.js} +1 -1
- package/lib/vbapm-update-DnbmW8tc.js +13 -0
- package/lib/{vbapm-version-3Xv7JjGv.js → vbapm-version-CRicT8YA.js} +1 -1
- package/lib/vbapm.js +2 -1
- package/package.json +6 -3
- package/run-scripts/run.applescript +18 -7
- package/run-scripts/run.ps1 +42 -10
- package/lib/build-project-CIZanDh1.js +0 -3
- package/lib/build-target-B03OPzeI.js +0 -9
- package/lib/export-project-DdTYRyAw.js +0 -4
- package/lib/export-target-CEupP86g.js +0 -4
- package/lib/installer-C0iBwEpK.js +0 -9
- package/lib/run-macro-Ck_8Iku3.js +0 -1
- package/lib/test-project-CM-XUOdH.js +0 -1
- package/lib/transform-target-DJmqMjY0.js +0 -2
- package/lib/vbapm-build-BKtQ6OeP.js +0 -9
- package/lib/vbapm-export-4H_qDinP.js +0 -7
|
@@ -2,6 +2,8 @@ import { Target } from "../manifest/target";
|
|
|
2
2
|
import { Project } from "../project";
|
|
3
3
|
import { ProjectInfo } from "./project-info";
|
|
4
4
|
export interface ExportOptions {
|
|
5
|
+
xmlOnly?: boolean;
|
|
6
|
+
vbaOnly?: boolean;
|
|
5
7
|
}
|
|
6
8
|
/**
|
|
7
9
|
* Export target (with staging directory)
|
|
@@ -11,5 +13,5 @@ export interface ExportOptions {
|
|
|
11
13
|
* 3. Export build graph to src
|
|
12
14
|
* 4. Move extracted to target to src
|
|
13
15
|
*/
|
|
14
|
-
export declare function exportTarget(target: Target, info: ProjectInfo, staging: string): Promise<void>;
|
|
16
|
+
export declare function exportTarget(target: Target, info: ProjectInfo, staging: string, options?: ExportOptions): Promise<void>;
|
|
15
17
|
export declare function extractTarget(project: Project, target: Target, staging: string): Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var r=require("./installer-DPj-zT7L.js"),t=require("./run-macro-C1-aJWu5.js");exports.testProject=async function(s){const{target:e,args:a}=s,n=r.env.isWindows?"CON":"/dev/stdout";await t.runMacro({target:e,macro:"Tests.Run",args:[n,...a]})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=require("./installer-DPj-zT7L.js"),e=require("path"),n=require("./_commonjsHelpers-Bjf42z7h.js"),r=require("fs"),i=require("node:fs"),s=require("node:path"),o=require("node:buffer");const a={excel:["xlsx","xlsm","xlam"]},c={excel:t.join(t.env.addins,"vbapm.xlam")},l={};for(const[t,e]of Object.entries(a))for(const n of e)l[n]=t;function h(e,n,r={}){const i=u(n.type);return{application:i,addin:c[i],file:t.join(r.staging?e.paths.staging:e.paths.build,n.filename)}}function u(e){e=e.replace(".","");const n=l[e];if(!n)throw new t.CliError(t.ErrorCode.AddinUnsupportedType,`The target type "${e} is not currently supported.`);return n}var p,f,g={},d={},m={};function b(){return f||(f=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.EXPANSION_MAX=void 0,t.expand=function(e,a={}){if(!e)return[];const{max:c=t.EXPANSION_MAX}=a;"{}"===e.slice(0,2)&&(e="\\{\\}"+e.slice(2));return M(function(t){return t.replace(f,n).replace(g,r).replace(d,i).replace(b,s).replace(y,o)}(e),c,!0).map(w)};const e=(p||(p=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.range=t.balanced=void 0,t.balanced=(n,r,i)=>{const s=n instanceof RegExp?e(n,i):n,o=r instanceof RegExp?e(r,i):r,a=null!==s&&null!=o&&(0,t.range)(s,o,i);return a&&{start:a[0],end:a[1],pre:i.slice(0,a[0]),body:i.slice(a[0]+s.length,a[1]),post:i.slice(a[1]+o.length)}};const e=(t,e)=>{const n=e.match(t);return n?n[0]:null};t.range=(t,e,n)=>{let r,i,s,o,a,c=n.indexOf(t),l=n.indexOf(e,c+1),h=c;if(c>=0&&l>0){if(t===e)return[c,l];for(r=[],s=n.length;h>=0&&!a;){if(h===c)r.push(h),c=n.indexOf(t,h+1);else if(1===r.length){const t=r.pop();void 0!==t&&(a=[t,l])}else i=r.pop(),void 0!==i&&i<s&&(s=i,o=l),l=n.indexOf(e,h+1);h=c<l&&c>=0?c:l}r.length&&void 0!==o&&(a=[s,o])}return a}}(m)),m),n="\0SLASH"+Math.random()+"\0",r="\0OPEN"+Math.random()+"\0",i="\0CLOSE"+Math.random()+"\0",s="\0COMMA"+Math.random()+"\0",o="\0PERIOD"+Math.random()+"\0",a=new RegExp(n,"g"),c=new RegExp(r,"g"),l=new RegExp(i,"g"),h=new RegExp(s,"g"),u=new RegExp(o,"g"),f=/\\\\/g,g=/\\{/g,d=/\\}/g,b=/\\,/g,y=/\\./g;function _(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function w(t){return t.replace(a,"\\").replace(c,"{").replace(l,"}").replace(h,",").replace(u,".")}function S(t){if(!t)return[""];const n=[],r=(0,e.balanced)("{","}",t);if(!r)return t.split(",");const{pre:i,body:s,post:o}=r,a=i.split(",");a[a.length-1]+="{"+s+"}";const c=S(o);return o.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),n.push.apply(n,a),n}function v(t){return"{"+t+"}"}function x(t){return/^-?0\d/.test(t)}function O(t,e){return t<=e}function E(t,e){return t>=e}function M(t,n,r){const s=[],o=(0,e.balanced)("{","}",t);if(!o)return[t];const a=o.pre,c=o.post.length?M(o.post,n,!1):[""];if(/\$$/.test(o.pre))for(let t=0;t<c.length&&t<n;t++){const e=a+"{"+o.body+"}"+c[t];s.push(e)}else{const e=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),h=e||l,u=o.body.indexOf(",")>=0;if(!h&&!u)return o.post.match(/,(?!,).*\}/)?M(t=o.pre+"{"+o.body+i+o.post,n,!0):[t];let p,f;if(h)p=o.body.split(/\.\./);else if(p=S(o.body),1===p.length&&void 0!==p[0]&&(p=M(p[0],n,!1).map(v),1===p.length))return c.map(t=>o.pre+p[0]+t);if(h&&void 0!==p[0]&&void 0!==p[1]){const t=_(p[0]),e=_(p[1]),n=Math.max(p[0].length,p[1].length);let r=3===p.length&&void 0!==p[2]?Math.abs(_(p[2])):1,i=O;e<t&&(r*=-1,i=E);const s=p.some(x);f=[];for(let o=t;i(o,e);o+=r){let t;if(l)t=String.fromCharCode(o),"\\"===t&&(t="");else if(t=String(o),s){const e=n-t.length;if(e>0){const n=new Array(e+1).join("0");t=o<0?"-"+n+t.slice(1):n+t}}f.push(t)}}else{f=[];for(let t=0;t<p.length;t++)f.push.apply(f,M(p[t],n,!1))}for(let t=0;t<f.length;t++)for(let e=0;e<c.length&&s.length<n;e++){const n=a+f[t]+c[e];(!r||h||n)&&s.push(n)}}return s}t.EXPANSION_MAX=1e5}(d)),d}var y,_={};var w,S={},v={};var x,O,E={};function M(){if(x)return E;x=1,Object.defineProperty(E,"__esModule",{value:!0}),E.unescape=void 0;return E.unescape=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!0}={})=>n?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1"),E}function P(){if(O)return S;O=1,Object.defineProperty(S,"__esModule",{value:!0}),S.AST=void 0;const t=function(){if(w)return v;w=1,Object.defineProperty(v,"__esModule",{value:!0}),v.parseClass=void 0;const t={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},e=t=>t.replace(/[[\]\\-]/g,"\\$&"),n=t=>t.join("");return v.parseClass=(r,i)=>{const s=i;if("["!==r.charAt(s))throw new Error("not in a brace expression");const o=[],a=[];let c=s+1,l=!1,h=!1,u=!1,p=!1,f=s,g="";t:for(;c<r.length;){const n=r.charAt(c);if("!"!==n&&"^"!==n||c!==s+1){if("]"===n&&l&&!u){f=c+1;break}if(l=!0,"\\"!==n||u){if("["===n&&!u)for(const[e,[n,i,l]]of Object.entries(t))if(r.startsWith(e,c)){if(g)return["$.",!1,r.length-s,!0];c+=e.length,l?a.push(n):o.push(n),h=h||i;continue t}u=!1,g?(n>g?o.push(e(g)+"-"+e(n)):n===g&&o.push(e(n)),g="",c++):r.startsWith("-]",c+1)?(o.push(e(n+"-")),c+=2):r.startsWith("-",c+1)?(g=n,c+=2):(o.push(e(n)),c++)}else u=!0,c++}else p=!0,c++}if(f<c)return["",!1,0,!1];if(!o.length&&!a.length)return["$.",!1,r.length-s,!0];if(0===a.length&&1===o.length&&/^\\?.$/.test(o[0])&&!p){return[(d=2===o[0].length?o[0].slice(-1):o[0],d.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")),!1,f-s,!1]}var d;const m="["+(p?"^":"")+n(o)+"]",b="["+(p?"":"^")+n(a)+"]";return[o.length&&a.length?"("+m+"|"+b+")":o.length?m:b,h,f-s,!0]},v}(),e=M(),n=new Set(["!","?","+","*","@"]),r=t=>n.has(t),i="(?!\\.)",s=new Set(["[","."]),o=new Set(["..","."]),a=new Set("().*{}+?[]^$\\!"),c=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),l="[^/]",h=l+"*?",u=l+"+?";class p{type;#t;#e;#n=!1;#r=[];#i;#s;#o;#a=!1;#c;#l;#h=!1;constructor(t,e,n={}){this.type=t,t&&(this.#e=!0),this.#i=e,this.#t=this.#i?this.#i.#t:this,this.#c=this.#t===this?n:this.#t.#c,this.#o=this.#t===this?[]:this.#t.#o,"!"!==t||this.#t.#a||this.#o.push(this),this.#s=this.#i?this.#i.#r.length:0}get hasMagic(){if(void 0!==this.#e)return this.#e;for(const t of this.#r)if("string"!=typeof t&&(t.type||t.hasMagic))return this.#e=!0;return this.#e}toString(){return void 0!==this.#l?this.#l:this.type?this.#l=this.type+"("+this.#r.map(t=>String(t)).join("|")+")":this.#l=this.#r.map(t=>String(t)).join("")}#u(){if(this!==this.#t)throw new Error("should only call on root");if(this.#a)return this;let t;for(this.toString(),this.#a=!0;t=this.#o.pop();){if("!"!==t.type)continue;let e=t,n=e.#i;for(;n;){for(let r=e.#s+1;!n.type&&r<n.#r.length;r++)for(const e of t.#r){if("string"==typeof e)throw new Error("string part in extglob AST??");e.copyIn(n.#r[r])}e=n,n=e.#i}}return this}push(...t){for(const e of t)if(""!==e){if("string"!=typeof e&&!(e instanceof p&&e.#i===this))throw new Error("invalid part: "+e);this.#r.push(e)}}toJSON(){const t=null===this.type?this.#r.slice().map(t=>"string"==typeof t?t:t.toJSON()):[this.type,...this.#r.map(t=>t.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#a&&"!"===this.#i?.type)&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#i?.isStart())return!1;if(0===this.#s)return!0;const t=this.#i;for(let e=0;e<this.#s;e++){const n=t.#r[e];if(!(n instanceof p&&"!"===n.type))return!1}return!0}isEnd(){if(this.#t===this)return!0;if("!"===this.#i?.type)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();const t=this.#i?this.#i.#r.length:0;return this.#s===t-1}copyIn(t){"string"==typeof t?this.push(t):this.push(t.clone(this))}clone(t){const e=new p(this.type,t);for(const t of this.#r)e.copyIn(t);return e}static#p(t,e,n,i){let s=!1,o=!1,a=-1,c=!1;if(null===e.type){let l=n,h="";for(;l<t.length;){const n=t.charAt(l++);if(s||"\\"===n)s=!s,h+=n;else if(o)l===a+1?"^"!==n&&"!"!==n||(c=!0):"]"!==n||l===a+2&&c||(o=!1),h+=n;else if("["!==n){if(!i.noext&&r(n)&&"("===t.charAt(l)){e.push(h),h="";const r=new p(n,e);l=p.#p(t,r,l,i),e.push(r);continue}h+=n}else o=!0,a=l,c=!1,h+=n}return e.push(h),l}let l=n+1,h=new p(null,e);const u=[];let f="";for(;l<t.length;){const n=t.charAt(l++);if(s||"\\"===n)s=!s,f+=n;else if(o)l===a+1?"^"!==n&&"!"!==n||(c=!0):"]"!==n||l===a+2&&c||(o=!1),f+=n;else if("["!==n){if(r(n)&&"("===t.charAt(l)){h.push(f),f="";const e=new p(n,h);h.push(e),l=p.#p(t,e,l,i);continue}if("|"!==n){if(")"===n)return""===f&&0===e.#r.length&&(e.#h=!0),h.push(f),f="",e.push(...u,h),l;f+=n}else h.push(f),f="",u.push(h),h=new p(null,e)}else o=!0,a=l,c=!1,f+=n}return e.type=null,e.#e=void 0,e.#r=[t.substring(n-1)],l}static fromGlob(t,e={}){const n=new p(null,void 0,e);return p.#p(t,n,0,e),n}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();const t=this.toString(),[e,n,r,i]=this.toRegExpSource();if(!(r||this.#e||this.#c.nocase&&!this.#c.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;const s=(this.#c.nocase?"i":"")+(i?"u":"");return Object.assign(new RegExp(`^${e}$`,s),{_src:e,_glob:t})}get options(){return this.#c}toRegExpSource(t){const n=t??!!this.#c.dot;if(this.#t===this&&this.#u(),!this.type){const r=this.isStart()&&this.isEnd()&&!this.#r.some(t=>"string"!=typeof t),a=this.#r.map(e=>{const[n,i,s,o]="string"==typeof e?p.#f(e,this.#e,r):e.toRegExpSource(t);return this.#e=this.#e||s,this.#n=this.#n||o,n}).join("");let c="";if(this.isStart()&&"string"==typeof this.#r[0]){if(!(1===this.#r.length&&o.has(this.#r[0]))){const e=s,r=n&&e.has(a.charAt(0))||a.startsWith("\\.")&&e.has(a.charAt(2))||a.startsWith("\\.\\.")&&e.has(a.charAt(4)),o=!n&&!t&&e.has(a.charAt(0));c=r?"(?!(?:^|/)\\.\\.?(?:$|/))":o?i:""}}let l="";this.isEnd()&&this.#t.#a&&"!"===this.#i?.type&&(l="(?:$|\\/)");return[c+a+l,(0,e.unescape)(a),this.#e=!!this.#e,this.#n]}const r="*"===this.type||"+"===this.type,a="!"===this.type?"(?:(?!(?:":"(?:";let c=this.#g(n);if(this.isStart()&&this.isEnd()&&!c&&"!"!==this.type){const t=this.toString();return this.#r=[t],this.type=null,this.#e=void 0,[t,(0,e.unescape)(this.toString()),!1,!1]}let l=!r||t||n?"":this.#g(!0);l===c&&(l=""),l&&(c=`(?:${c})(?:${l})*?`);let f="";if("!"===this.type&&this.#h)f=(this.isStart()&&!n?i:"")+u;else{f=a+c+("!"===this.type?"))"+(!this.isStart()||n||t?"":i)+h+")":"@"===this.type?")":"?"===this.type?")?":"+"===this.type&&l?")":"*"===this.type&&l?")?":`)${this.type}`)}return[f,(0,e.unescape)(c),this.#e=!!this.#e,this.#n]}#g(t){return this.#r.map(e=>{if("string"==typeof e)throw new Error("string type in extglob ast??");const[n,r,i,s]=e.toRegExpSource(t);return this.#n=this.#n||s,n}).filter(t=>!(this.isStart()&&this.isEnd()&&!t)).join("|")}static#f(n,r,i=!1){let s=!1,o="",p=!1,f=!1;for(let e=0;e<n.length;e++){const g=n.charAt(e);if(s)s=!1,o+=(a.has(g)?"\\":"")+g;else if("*"!==g)if(f=!1,"\\"!==g){if("["===g){const[i,s,a,c]=(0,t.parseClass)(n,e);if(a){o+=i,p=p||s,e+=a-1,r=r||c;continue}}"?"!==g?o+=c(g):(o+=l,r=!0)}else e===n.length-1?o+="\\\\":s=!0;else{if(f)continue;f=!0,o+=i&&/^[*]+$/.test(n)?u:h,r=!0}}return[o,(0,e.unescape)(n),!!r,p]}}return S.AST=p,S}var j,A,T,$,N,R,L,C,B={};function k(){if(j)return B;j=1,Object.defineProperty(B,"__esModule",{value:!0}),B.escape=void 0;return B.escape=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!1}={})=>n?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&"),B}function W(){return A||(A=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.unescape=t.escape=t.AST=t.Minimatch=t.match=t.makeRe=t.braceExpand=t.defaults=t.filter=t.GLOBSTAR=t.sep=t.minimatch=void 0;const e=b(),n=(y||(y=1,Object.defineProperty(_,"__esModule",{value:!0}),_.assertValidPattern=void 0,_.assertValidPattern=t=>{if("string"!=typeof t)throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")}),_),r=P(),i=k(),s=M();t.minimatch=(t,e,r={})=>((0,n.assertValidPattern)(e),!(!r.nocomment&&"#"===e.charAt(0))&&new B(e,r).match(t));const o=/^\*+([^+@!?\*\[\(]*)$/,a=t=>e=>!e.startsWith(".")&&e.endsWith(t),c=t=>e=>e.endsWith(t),l=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),h=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),u=/^\*+\.\*+$/,p=t=>!t.startsWith(".")&&t.includes("."),f=t=>"."!==t&&".."!==t&&t.includes("."),g=/^\.\*+$/,d=t=>"."!==t&&".."!==t&&t.startsWith("."),m=/^\*+$/,w=t=>0!==t.length&&!t.startsWith("."),S=t=>0!==t.length&&"."!==t&&".."!==t,v=/^\?+([^+@!?\*\[\(]*)?$/,x=([t,e=""])=>{const n=A([t]);return e?(e=e.toLowerCase(),t=>n(t)&&t.toLowerCase().endsWith(e)):n},O=([t,e=""])=>{const n=T([t]);return e?(e=e.toLowerCase(),t=>n(t)&&t.toLowerCase().endsWith(e)):n},E=([t,e=""])=>{const n=T([t]);return e?t=>n(t)&&t.endsWith(e):n},j=([t,e=""])=>{const n=A([t]);return e?t=>n(t)&&t.endsWith(e):n},A=([t])=>{const e=t.length;return t=>t.length===e&&!t.startsWith(".")},T=([t])=>{const e=t.length;return t=>t.length===e&&"."!==t&&".."!==t},$="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",N={sep:"\\"},R={sep:"/"};t.sep="win32"===$?N.sep:R.sep,t.minimatch.sep=t.sep,t.GLOBSTAR=Symbol("globstar **"),t.minimatch.GLOBSTAR=t.GLOBSTAR;t.filter=(e,n={})=>r=>(0,t.minimatch)(r,e,n),t.minimatch.filter=t.filter;const L=(t,e={})=>Object.assign({},t,e);t.defaults=e=>{if(!e||"object"!=typeof e||!Object.keys(e).length)return t.minimatch;const n=t.minimatch;return Object.assign((t,r,i={})=>n(t,r,L(e,i)),{Minimatch:class extends n.Minimatch{constructor(t,n={}){super(t,L(e,n))}static defaults(t){return n.defaults(L(e,t)).Minimatch}},AST:class extends n.AST{constructor(t,n,r={}){super(t,n,L(e,r))}static fromGlob(t,r={}){return n.AST.fromGlob(t,L(e,r))}},unescape:(t,r={})=>n.unescape(t,L(e,r)),escape:(t,r={})=>n.escape(t,L(e,r)),filter:(t,r={})=>n.filter(t,L(e,r)),defaults:t=>n.defaults(L(e,t)),makeRe:(t,r={})=>n.makeRe(t,L(e,r)),braceExpand:(t,r={})=>n.braceExpand(t,L(e,r)),match:(t,r,i={})=>n.match(t,r,L(e,i)),sep:n.sep,GLOBSTAR:t.GLOBSTAR})},t.minimatch.defaults=t.defaults;t.braceExpand=(t,r={})=>((0,n.assertValidPattern)(t),r.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,e.expand)(t,{max:r.braceExpandMax})),t.minimatch.braceExpand=t.braceExpand;t.makeRe=(t,e={})=>new B(t,e).makeRe(),t.minimatch.makeRe=t.makeRe;t.match=(t,e,n={})=>{const r=new B(e,n);return t=t.filter(t=>r.match(t)),r.options.nonull&&!t.length&&t.push(e),t},t.minimatch.match=t.match;const C=/[?*]|[+@!]\(.*?\)|\[|\]/;class B{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){(0,n.assertValidPattern)(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||$,this.isWindows="win32"===this.platform;this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||!1===e.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=void 0!==e.windowsNoMagicRoot?e.windowsNoMagicRoot:!(!this.isWindows||!this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(const t of this.set)for(const e of t)if("string"!=typeof e)return!0;return!1}debug(...t){}make(){const t=this.pattern,e=this.options;if(!e.nocomment&&"#"===t.charAt(0))return void(this.comment=!0);if(!t)return void(this.empty=!0);this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...t)=>console.error(...t)),this.debug(this.pattern,this.globSet);const n=this.globSet.map(t=>this.slashSplit(t));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((t,e,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){const e=!(""!==t[0]||""!==t[1]||"?"!==t[2]&&C.test(t[2])||C.test(t[3])),n=/^[a-z]:/i.test(t[0]);if(e)return[...t.slice(0,4),...t.slice(4).map(t=>this.parse(t))];if(n)return[t[0],...t.slice(1).map(t=>this.parse(t))]}return t.map(t=>this.parse(t))});if(this.debug(this.pattern,r),this.set=r.filter(t=>-1===t.indexOf(!1)),this.isWindows)for(let t=0;t<this.set.length;t++){const e=this.set[t];""===e[0]&&""===e[1]&&"?"===this.globParts[t][2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3])&&(e[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let e=0;e<t.length;e++)for(let n=0;n<t[e].length;n++)"**"===t[e][n]&&(t[e][n]="*");const{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):t=e>=1?this.levelOneOptimize(t):this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(t=>{let e=-1;for(;-1!==(e=t.indexOf("**",e+1));){let n=e;for(;"**"===t[n+1];)n++;n!==e&&t.splice(e,n-e)}return t})}levelOneOptimize(t){return t.map(t=>0===(t=t.reduce((t,e)=>{const n=t[t.length-1];return"**"===e&&"**"===n?t:".."===e&&n&&".."!==n&&"."!==n&&"**"!==n?(t.pop(),t):(t.push(e),t)},[])).length?[""]:t)}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let n=1;n<t.length-1;n++){const r=t[n];1===n&&""===r&&""===t[0]||("."!==r&&""!==r||(e=!0,t.splice(n,1),n--))}"."!==t[0]||2!==t.length||"."!==t[1]&&""!==t[1]||(e=!0,t.pop())}let n=0;for(;-1!==(n=t.indexOf("..",n+1));){const r=t[n-1];r&&"."!==r&&".."!==r&&"**"!==r&&(e=!0,t.splice(n-1,2),n-=2)}}while(e);return 0===t.length?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let n of t){let r=-1;for(;-1!==(r=n.indexOf("**",r+1));){let i=r;for(;"**"===n[i+1];)i++;i>r&&n.splice(r+1,i-r);let s=n[r+1];const o=n[r+2],a=n[r+3];if(".."!==s)continue;if(!o||"."===o||".."===o||!a||"."===a||".."===a)continue;e=!0,n.splice(r,1);const c=n.slice(0);c[r]="**",t.push(c),r--}if(!this.preserveMultipleSlashes){for(let t=1;t<n.length-1;t++){const r=n[t];1===t&&""===r&&""===n[0]||("."!==r&&""!==r||(e=!0,n.splice(t,1),t--))}"."!==n[0]||2!==n.length||"."!==n[1]&&""!==n[1]||(e=!0,n.pop())}let i=0;for(;-1!==(i=n.indexOf("..",i+1));){const t=n[i-1];if(t&&"."!==t&&".."!==t&&"**"!==t){e=!0;const t=1===i&&"**"===n[i+1]?["."]:[];n.splice(i-1,2,...t),0===n.length&&n.push(""),i-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let n=e+1;n<t.length;n++){const r=this.partsMatch(t[e],t[n],!this.preserveMultipleSlashes);if(r){t[e]=[],t[n]=r;break}}return t.filter(t=>t.length)}partsMatch(t,e,n=!1){let r=0,i=0,s=[],o="";for(;r<t.length&&i<e.length;)if(t[r]===e[i])s.push("b"===o?e[i]:t[r]),r++,i++;else if(n&&"**"===t[r]&&e[i]===t[r+1])s.push(t[r]),r++;else if(n&&"**"===e[i]&&t[r]===e[i+1])s.push(e[i]),i++;else if("*"!==t[r]||!e[i]||!this.options.dot&&e[i].startsWith(".")||"**"===e[i]){if("*"!==e[i]||!t[r]||!this.options.dot&&t[r].startsWith(".")||"**"===t[r])return!1;if("a"===o)return!1;o="b",s.push(e[i]),r++,i++}else{if("b"===o)return!1;o="a",s.push(t[r]),r++,i++}return t.length===e.length&&s}parseNegate(){if(this.nonegate)return;const t=this.pattern;let e=!1,n=0;for(let r=0;r<t.length&&"!"===t.charAt(r);r++)e=!e,n++;n&&(this.pattern=t.slice(n)),this.negate=e}matchOne(e,n,r=!1){const i=this.options;if(this.isWindows){const t="string"==typeof e[0]&&/^[a-z]:$/i.test(e[0]),r=!t&&""===e[0]&&""===e[1]&&"?"===e[2]&&/^[a-z]:$/i.test(e[3]),i="string"==typeof n[0]&&/^[a-z]:$/i.test(n[0]),s=r?3:t?0:void 0,o=!i&&""===n[0]&&""===n[1]&&"?"===n[2]&&"string"==typeof n[3]&&/^[a-z]:$/i.test(n[3])?3:i?0:void 0;if("number"==typeof s&&"number"==typeof o){const[t,r]=[e[s],n[o]];t.toLowerCase()===r.toLowerCase()&&(n[o]=t,o>s?n=n.slice(o):s>o&&(e=e.slice(s)))}}const{optimizationLevel:s=1}=this.options;s>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:n}),this.debug("matchOne",e.length,n.length);for(var o=0,a=0,c=e.length,l=n.length;o<c&&a<l;o++,a++){this.debug("matchOne loop");var h=n[a],u=e[o];if(this.debug(n,h,u),!1===h)return!1;if(h===t.GLOBSTAR){this.debug("GLOBSTAR",[n,h,u]);var p=o,f=a+1;if(f===l){for(this.debug("** at the end");o<c;o++)if("."===e[o]||".."===e[o]||!i.dot&&"."===e[o].charAt(0))return!1;return!0}for(;p<c;){var g=e[p];if(this.debug("\nglobstar while",e,p,n,f,g),this.matchOne(e.slice(p),n.slice(f),r))return this.debug("globstar found match!",p,c,g),!0;if("."===g||".."===g||!i.dot&&"."===g.charAt(0)){this.debug("dot detected!",e,p,n,f);break}this.debug("globstar swallow a segment, and continue"),p++}return!(!r||(this.debug("\n>>> no match, partial?",e,p,n,f),p!==c))}let s;if("string"==typeof h?(s=u===h,this.debug("string match",h,u,s)):(s=h.test(u),this.debug("pattern match",h,u,s)),!s)return!1}if(o===c&&a===l)return!0;if(o===c)return r;if(a===l)return o===c-1&&""===e[o];throw new Error("wtf?")}braceExpand(){return(0,t.braceExpand)(this.pattern,this.options)}parse(e){(0,n.assertValidPattern)(e);const i=this.options;if("**"===e)return t.GLOBSTAR;if(""===e)return"";let s,b=null;(s=e.match(m))?b=i.dot?S:w:(s=e.match(o))?b=(i.nocase?i.dot?h:l:i.dot?c:a)(s[1]):(s=e.match(v))?b=(i.nocase?i.dot?O:x:i.dot?E:j)(s):(s=e.match(u))?b=i.dot?f:p:(s=e.match(g))&&(b=d);const y=r.AST.fromGlob(e,this.options).toMMPattern();return b&&"object"==typeof y&&Reflect.defineProperty(y,"test",{value:b}),y}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;const e=this.set;if(!e.length)return this.regexp=!1,this.regexp;const n=this.options,r=n.noglobstar?"[^/]*?":n.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",i=new Set(n.nocase?["i"]:[]);let s=e.map(e=>{const n=e.map(e=>{if(e instanceof RegExp)for(const t of e.flags.split(""))i.add(t);return"string"==typeof e?e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):e===t.GLOBSTAR?t.GLOBSTAR:e._src});n.forEach((e,i)=>{const s=n[i+1],o=n[i-1];e===t.GLOBSTAR&&o!==t.GLOBSTAR&&(void 0===o?void 0!==s&&s!==t.GLOBSTAR?n[i+1]="(?:\\/|"+r+"\\/)?"+s:n[i]=r:void 0===s?n[i-1]=o+"(?:\\/|\\/"+r+")?":s!==t.GLOBSTAR&&(n[i-1]=o+"(?:\\/|\\/"+r+"\\/)"+s,n[i+1]=t.GLOBSTAR))});const s=n.filter(e=>e!==t.GLOBSTAR);if(this.partial&&s.length>=1){const t=[];for(let e=1;e<=s.length;e++)t.push(s.slice(0,e).join("/"));return"(?:"+t.join("|")+")"}return s.join("/")}).join("|");const[o,a]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch(t){this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return""===t;if("/"===t&&e)return!0;const n=this.options;this.isWindows&&(t=t.split("\\").join("/"));const r=this.slashSplit(t);this.debug(this.pattern,"split",r);const i=this.set;this.debug(this.pattern,"set",i);let s=r[r.length-1];if(!s)for(let t=r.length-2;!s&&t>=0;t--)s=r[t];for(let t=0;t<i.length;t++){const o=i[t];let a=r;n.matchBase&&1===o.length&&(a=[s]);if(this.matchOne(a,o,e))return!!n.flipNegate||!this.negate}return!n.flipNegate&&this.negate}static defaults(e){return t.minimatch.defaults(e).Minimatch}}t.Minimatch=B;var W=P();Object.defineProperty(t,"AST",{enumerable:!0,get:function(){return W.AST}});var I=k();Object.defineProperty(t,"escape",{enumerable:!0,get:function(){return I.escape}});var z=M();Object.defineProperty(t,"unescape",{enumerable:!0,get:function(){return z.unescape}}),t.minimatch.AST=r.AST,t.minimatch.Minimatch=B,t.minimatch.escape=i.escape,t.minimatch.unescape=s.unescape}(g)),g}var I=function(){if(C)return L;C=1;const t=r,n=function(){if($)return T;$=1;var t=W();return T=function(){function e(e){this.matchers=e.map(function(e){return"string"==typeof e?new t.Minimatch(e):e})}return e.prototype.match=function(t){for(var e=0;e<this.matchers.length;e++)if(this.matchers[e].match(t))return!0;return!1},e.prototype.mayContain=function(t){for(var e=t.split(/\/|\\/g).filter(Boolean),n=0;n<this.matchers.length;n++)for(var r=this.matchers[n],i=0;i<r.set.length;i++)if(r.matchOne(e,r.set[i],!0))return!0;return!1},e}()}(),i=W(),s=function(){if(R)return N;R=1;var t=e;return N=function(e){return"/"!==t.sep?e.split(t.sep).join("/"):e}}(),o=e;function a(t,e){const n=l(e);let r;return r=n.includeBasePath?function(t){return t.basePath.split(o.sep).join("/").replace(/\/+$/,"")+"/"+t.relativePath}:function(t){return t.relativePath},p(t,n,null,[]).map(r)}function c(t){return void 0!==t}function l(t){let e={};return Array.isArray(t)?e.globs=t:t&&(e=t),e}function h(t,e){return null==t?void 0:t.map(t=>"string"==typeof t?new i.Minimatch(t,e):t)}function u(t,e){const n=t.relativePath,r=e.relativePath;return n===r?0:n<r?-1:1}function p(e,r,i,s){var o;const l=null!==(o=r.fs)&&void 0!==o?o:t,f=function(t){return null==t?"":"/"!==t.slice(-1)?t+"/":t}(i),g=l.realpathSync(e+"/"+f);if(s.indexOf(g)>=0)return[];s.push(g);try{const i=r.globOptions,o=c(i)?h(r.ignore,i):r.ignore,g=c(i)?h(r.globs,i):r.globs;let d,m,b=[];if(o&&(m=new n(o)),g&&(d=new n(g)),d&&!d.mayContain(f))return b;const y=l.readdirSync(e+"/"+f).map(n=>{let r=f+n;if(m&&m.match(r))return;let i=function(e,n=t){try{return n.statSync(e)}catch(t){if(null!==t&&"object"==typeof t&&["ENOENT","ENOTDIR","EPERM"].includes(t.code))return;throw t}}(e+"/"+r,l);return i&&i.isDirectory()?new a.Entry(r+"/",e,i.mode,i.size,i.mtime.getTime()):new a.Entry(r,e,i&&i.mode||0,i&&i.size||0,i&&i.mtime.getTime()||0)}).filter(c),_=y.sort(u);for(let t=0;t<_.length;++t){let n=_[t];n.isDirectory()?(!1===r.directories||d&&!d.match(n.relativePath)||b.push(n),b=b.concat(p(e,r,n.relativePath,s))):d&&!d.match(n.relativePath)||b.push(n)}return b}finally{s.pop()}}return function(e){e.entries=function(t,e){const n=l(e);return p(s(t),n,null,[])};e.Entry=class{constructor(t,e,n,r,i){this.relativePath=t,this.basePath=e,this.mode=n,this.size=r,this.mtime=i}get fullPath(){return`${this.basePath}/${this.relativePath}`}isDirectory(){return(this.mode&t.constants.S_IFMT)===t.constants.S_IFDIR}}}(a||(a={})),L=a}(),z=n.getDefaultExportFromCjs(I);function G(...t){return async e=>{let n=e;for(const e of t)n=await e(n);return n}}var D,F={},V={};function J(){if(D)return V;D=1;const t=Object.freeze({Key:0,0:"Key",Value:1,1:"Value",Section:2,2:"Section",CommentIndicator:3,3:"CommentIndicator",CommentValue:4,4:"CommentValue"});function e(t){const n=typeof t;if("number"==n||"boolean"==n||null==t)return`${t}`;if("string"==n)return`"${t}"`;if("symbol"==n){const e=t.description;return null==e?"Symbol":`Symbol(${e})`}if("function"==n){const e=t.name;return"string"==typeof e&&e.length>0?`Function(${e})`:"Function"}if(Array.isArray(t)){const n=t.length;let r="[";n>0&&(r+=e(t[0]));for(let i=1;i<n;i++)r+=", "+e(t[i]);return r+="]",r}const r=/\[object ([^\]]+)\]/.exec(toString.call(t));let i;if(!(r&&r.length>1))return toString.call(t);if(i=r[1],"Object"==i)try{return"Object("+JSON.stringify(t)+")"}catch(t){return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:i}V.TokenTypes=t,V.parse_to_json=function(t){const e=l(t,m.__wbindgen_malloc,m.__wbindgen_realloc),n=p;return m.parse_to_json(e,n)},V.parse_to_uint32array=function(t){const e=function(t,e){const n=e(1*t.length,1)>>>0;return c().set(t,n/1),p=t.length,n}(t,m.__wbindgen_malloc),n=p,r=m.parse_to_uint32array(e,n);if(r[3])throw function(t){const e=m.__wbindgen_externrefs.get(t);return m.__externref_table_dealloc(t),e}(r[2]);var i,s,a=(i=r[0],s=r[1],i>>>=0,(null!==o&&0!==o.byteLength||(o=new Uint32Array(m.memory.buffer)),o).subarray(i/4,i/4+s)).slice();return m.__wbindgen_free(r[0],4*r[1],4),a},V.version=function(){let t,e;try{const n=m.version();return t=n[0],e=n[1],s(n[0],n[1])}finally{m.__wbindgen_free(t,e,1)}};let n=null;function i(){return(null===n||!0===n.buffer.detached||void 0===n.buffer.detached&&n.buffer!==m.memory.buffer)&&(n=new DataView(m.memory.buffer)),n}function s(t,e){return function(t,e){return h.decode(c().subarray(t,t+e))}(t>>>=0,e)}let o=null;let a=null;function c(){return null!==a&&0!==a.byteLength||(a=new Uint8Array(m.memory.buffer)),a}function l(t,e,n){if(void 0===n){const n=u.encode(t),r=e(n.length,1)>>>0;return c().subarray(r,r+n.length).set(n),p=n.length,r}let r=t.length,i=e(r,1)>>>0;const s=c();let o=0;for(;o<r;o++){const e=t.charCodeAt(o);if(e>127)break;s[i+o]=e}if(o!==r){0!==o&&(t=t.slice(o)),i=n(i,r,r=o+3*t.length,1)>>>0;const e=c().subarray(i+o,i+r);o+=u.encodeInto(t,e).written,i=n(i,r,o,1)>>>0}return p=o,i}let h=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});h.decode();const u=new TextEncoder;"encodeInto"in u||(u.encodeInto=function(t,e){const n=u.encode(t);return e.set(n),{read:t.length,written:n.length}});let p=0;const f=`${__dirname}/one_ini_bg.wasm`,g=r.readFileSync(f),d=new WebAssembly.Module(g);let m=new WebAssembly.Instance(d,function(){const t={__proto__:null,__wbg_Error_ecbf49c1b9d07c30:function(t,e){return Error(s(t,e))},__wbg___wbindgen_debug_string_43c7ccb034739216:function(t,n){const r=l(e(n),m.__wbindgen_malloc,m.__wbindgen_realloc),s=p;i().setInt32(t+4,s,!0),i().setInt32(t+0,r,!0)},__wbg___wbindgen_throw_df03e93053e0f4bc:function(t,e){throw new Error(s(t,e))},__wbg_fromCodePoint_e00c387b1e85dfa6:function(){return function(t,e){try{return t.apply(this,e)}catch(t){const e=function(t){const e=m.__externref_table_alloc();return m.__wbindgen_externrefs.set(e,t),e}(t);m.__wbindgen_exn_store(e)}}(function(t){return String.fromCodePoint(t>>>0)},arguments)},__wbg_new_62f131e968c83d75:function(){return new Object},__wbg_new_66075f8c2ea6575e:function(){return new Array},__wbg_set_6be42768c690e380:function(t,e,n){t[e]=n},__wbg_set_7bf9e2df46e7632c:function(t,e,n){t[e>>>0]=n},__wbindgen_cast_0000000000000001:function(t,e){return s(t,e)},__wbindgen_init_externref_table:function(){const t=m.__wbindgen_externrefs,e=t.grow(4);t.set(0,void 0),t.set(e+0,void 0),t.set(e+1,null),t.set(e+2,!0),t.set(e+3,!1)}};return{__proto__:null,"./one_ini_bg.js":t}}()).exports;return m.__wbindgen_start(),V}var q,X={name:"editorconfig",version:"3.0.2",description:"EditorConfig File Locator and Interpreter for Node.js",keywords:["editorconfig","core"],main:"./lib/index.js",files:["lib/*","bin/*"],contributors:["Hong Xu (topbug.net)","Jed Mao (https://github.com/jedmao/)","Trey Hunner (http://treyhunner.com)","Joe Hildebrand (https://github.com/hildjj/)","SunsetTechuila (https://github.com/SunsetTechuila/)","Rex Lorenzo (https://github.com/rlorenzo/)"],directories:{bin:"./bin",lib:"./lib"},repository:{type:"git",url:"git://github.com/editorconfig/editorconfig-core-js.git"},bugs:"https://github.com/editorconfig/editorconfig-core-js/issues",author:"EditorConfig Team",license:"MIT",dependencies:{"@one-ini/wasm":"0.2.1",commander:"^14.0.3",minimatch:"~10.2.4",semver:"^7.7.4"},engines:{node:">=20"}};var H=function(){if(q)return F;q=1;var e,n=F&&F.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),r=F&&F.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=F&&F.__importStar||(e=function(t){return e=Object.getOwnPropertyNames||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[e.length]=n);return e},e(t)},function(t){if(t&&t.__esModule)return t;var i={};if(null!=t)for(var s=e(t),o=0;o<s.length;o++)"default"!==s[o]&&n(i,t,s[o]);return r(i,t),i}),c=F&&F.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(F,"__esModule",{value:!0}),F.parseBuffer=_,F.parseString=function(t){return _(g.Buffer.from(t))},F.unset=P,F.parseFromFilesSync=A,F.parseFromFiles=async function(t,e,n={}){return A(t,await e,n)},F.parse=async function(t,e={}){const[n,r]=M(t,e),i=w(n,r),s=await async function(t,e){const n=[];for(const r of t){const t=await O(r,e);if(!t.notfound&&(n.push(t),t.root))break}return n}(i,r);return j(n,s,r)},F.parseSync=function(t,e={}){const[n,r]=M(t,e),i=function(t,e){const n=[];for(const r of t){const t=E(r,e);if(!t.notfound&&(n.push(t),t.root))break}return n}(w(n,r),r);return j(n,i,r)},F.matcher=function(t,...e){const[n,r]=M("",t),i=e.map((t,e)=>x(h.join(r.root,`buffer-${e}`),t,r));return t=>j(h.resolve(t),i,r)};const l=a(i),h=a(s),u=a(t.requireSemver()),p=W(),f=J(),g=o,d=c(X),m=new RegExp(h.sep.replace(/\\/g,"\\\\"),"g"),b={matchBase:!0,dot:!0},y=new Set(["charset","end_of_line","indent_size","indent_style","insert_final_newline","trim_trailing_whitespace"]);function _(t){const e=(0,f.parse_to_uint32array)(t);let n={};const r=[[null,n]];let i=null;for(let s=0;s<e.length;s+=3)switch(e[s]){case f.TokenTypes.Section:n={},r.push([t.toString("utf8",e[s+1],e[s+2]),n]);break;case f.TokenTypes.Key:i=t.toString("utf8",e[s+1],e[s+2]);break;case f.TokenTypes.Value:n[i]=t.toString("utf8",e[s+1],e[s+2])}return r}function w(t,e){const n=[];do{t=h.dirname(t),n.push(h.join(t,e.config))}while(t!==e.root);return n}function S(t,e){switch(e.indexOf("/")){case-1:e=`**/${e}`;break;case 0:e=e.substring(1)}return e=(e=e.replace(/\\\\/g,"\\\\\\\\")).replace(/\*\*/g,"{*,**/**/**}"),new p.Minimatch(`${t}/${e}`,b)}function v(t){const e={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const r=t[n],i=n.toLowerCase();let s=r;y.has(i)&&(s=String(r).toLowerCase());try{s=JSON.parse(String(r))}catch(t){}null==s&&(s=String(r)),e[i]=s}return e}function x(t,e,n){let r;if(e){let n=h.dirname(t);"/"!==h.sep&&(n=n.replace(m,"/")),n=(0,p.escape)(n,{windowsPathsNoEscape:!0}),n=n.replace(/^#/,"[#]");const i=_(e).map(([t,e])=>[t,v(e),t?S(n,t):null]);r={root:Boolean(i[0][1].root),name:t,config:i}}else r={root:!1,notfound:!0,name:t,config:[[null,{},null]]};return n.cache&&n.cache.set(t,r),r}async function O(t,e){if(e.cache){const n=e.cache.get(t);if(n)return n}const n=await new Promise(e=>{l.readFile(t,(t,n)=>{e(n)})});return x(t,n,e)}function E(t,e){if(e.cache){const n=e.cache.get(t);if(n)return n}let n;try{n=l.readFileSync(t)}catch(t){}return x(t,n,e)}function M(t,e={}){const n=h.resolve(t);return[n,{config:e.config||".editorconfig",version:e.version||d.default.version,root:h.resolve(e.root||h.parse(n).root),files:e.files,cache:e.cache,unset:e.unset}]}function P(t){const e=Object.keys(t);for(const n of e)"unset"===t[n]&&delete t[n]}function j(t,e,n){const r=e.reverse().reduce((e,r)=>{for(const[i,s,o]of r.config)(null==o?void 0:o.match(t))&&(Object.assign(e,s),n.files&&n.files.push({fileName:r.name,glob:i}));return e},{});return n.unset&&P(r),function(t,e){return"indent_style"in t&&"tab"===t.indent_style&&!("indent_size"in t)&&u.gte(e,"0.10.0")&&(t.indent_size="tab"),"indent_size"in t&&!("tab_width"in t)&&"tab"!==t.indent_size&&(t.tab_width=t.indent_size),"indent_size"in t&&"tab_width"in t&&"tab"===t.indent_size&&(t.indent_size=t.tab_width),t}(r,n.version)}function A(t,e,n={}){const[r,i]=M(t,n),s=[];for(const t of e){let e;if(n.cache&&(e=n.cache.get(t.name))||(e=x(t.name,t.contents,i)),e.notfound||s.push(e),e.root)break}return j(r,s,i)}return F}();const Z=t.env.debug("vbapm:editor-config"),U=new Map;async function K(n){const{end_of_line:r,trim_trailing_whitespace:i,insert_final_newline:s}=await async function(t){const n=e.extname(t.filename);if(U.has(n))return U.get(n);const r=await H.parse(t.filename);return U.set(n,r),Z(`Formatting ${n} with`,r),r}(n),o="lf"===r?"\n":"\r\n",a=n.code.split(t.BY_LINE).map(i?Y:Q).join(o);return n.code=s?function(t){"\n"!==t[t.length-1]&&(t+="\n");return t}(a):a,n}function Y(t){return t.trimEnd()}function Q(t){return t}var tt=Object.freeze({__proto__:null,toCompiled:async function(t){return t},toSrc:async function(e){const{name:n,references:r,fromDependencies:i}=e;return{name:n,components:await t.parallel(e.components,K),references:r,fromDependencies:i}}});const et=[tt];G(...et.map(t=>t.toCompiled).filter(Boolean));const nt=G(...et.map(t=>t.toSrc).filter(Boolean));exports.addins=c,exports.createDocument=async function(n,r,i={}){const{application:s,addin:o,file:a}=h(n,r,i),c=!t.env.isWindows&&!i.staging;let l=c?t.join(n.paths.staging,r.filename):a;return await t.mkdirsExports.ensureDir(e.dirname(l)),await t.run(s,i.addin||o,"Build.CreateDocument",[JSON.stringify({path:l})]),c&&(await t.mkdirsExports.ensureDir(e.dirname(a)),await t.copyExports.copy(l,a)),a},exports.exportTo=async function(n,r,i,s={}){let{application:o,addin:a,file:c}=h(n,r);if(!t.env.isWindows){const n=t.join(i,"staged",r.filename);await t.pathExistsExports.pathExists(n)||(await t.mkdirsExports.ensureDir(e.dirname(n)),await t.copyExports.copy(c,n)),c=n}await t.run(o,s.addin||a,"Build.ExportTo",[JSON.stringify({file:c,staging:i})])},exports.extensionToApplication=u,exports.importGraph=async function(e,n,r,i,s={}){const{application:o,addin:a}=h(e,n),{name:c,components:l,references:u}=r;await t.run(o,s.addin||a,"Build.ImportGraph",[JSON.stringify({file:i,name:c,src:l,references:u})],{keepOpen:s.open})},exports.requireCommonjs=W,exports.toSrc=nt,exports.walk=z;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=require("string_decoder"),e=require("./installer-DPj-zT7L.js");var n,r,a,i,s,o,c,u,l,f,m,p,E,g,d,T={};function y(){return n||(n=1,function(e){e.parser=function(t,e){return new a(t,e)},e.SAXParser=a,e.SAXStream=s,e.createStream=function(t,e){return new s(t,e)},e.MAX_BUFFER_LENGTH=65536;var n,r=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function a(t,n){if(!(this instanceof a))return new a(t,n);var i=this;!function(t){for(var e=0,n=r.length;e<n;e++)t[r[e]]=""}(i),i.q=i.c="",i.bufferCheckPosition=e.MAX_BUFFER_LENGTH,i.opt=n||{},i.opt.lowercase=i.opt.lowercase||i.opt.lowercasetags,i.looseCase=i.opt.lowercase?"toLowerCase":"toUpperCase",i.tags=[],i.closed=i.closedRoot=i.sawRoot=!1,i.tag=i.error=null,i.strict=!!t,i.noscript=!(!t&&!i.opt.noscript),i.state=F.BEGIN,i.strictEntities=i.opt.strictEntities,i.ENTITIES=i.strictEntities?Object.create(e.XML_ENTITIES):Object.create(e.ENTITIES),i.attribList=[],i.opt.xmlns&&(i.ns=Object.create(f)),i.trackPosition=!1!==i.opt.position,i.trackPosition&&(i.position=i.line=i.column=0),I(i,"onready")}e.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(t){function e(){}return e.prototype=t,new e}),Object.keys||(Object.keys=function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e}),a.prototype={end:function(){w(this)},write:function(t){var n=this;if(this.error)throw this.error;if(n.closed)return v(n,"Cannot write after close. Assign an onready handler.");if(null===t)return w(n);"object"==typeof t&&(t=t.toString());for(var a=0,i="";i=M(t,a++),n.c=i,i;)switch(n.trackPosition&&(n.position++,"\n"===i?(n.line++,n.column=0):n.column++),n.state){case F.BEGIN:if(n.state=F.BEGIN_WHITESPACE,"\ufeff"===i)continue;k(n,i);continue;case F.BEGIN_WHITESPACE:k(n,i);continue;case F.TEXT:if(n.sawRoot&&!n.closedRoot){for(var s=a-1;i&&"<"!==i&&"&"!==i;)(i=M(t,a++))&&n.trackPosition&&(n.position++,"\n"===i?(n.line++,n.column=0):n.column++);n.textNode+=t.substring(s,a-1)}"<"!==i||n.sawRoot&&n.closedRoot&&!n.strict?(d(i)||n.sawRoot&&!n.closedRoot||K(n,"Text data outside of root node."),"&"===i?n.state=F.TEXT_ENTITY:n.textNode+=i):(n.state=F.OPEN_WAKA,n.startTagPosition=n.position);continue;case F.SCRIPT:"<"===i?n.state=F.SCRIPT_ENDING:n.script+=i;continue;case F.SCRIPT_ENDING:"/"===i?n.state=F.CLOSE_TAG:(n.script+="<"+i,n.state=F.SCRIPT);continue;case F.OPEN_WAKA:if("!"===i)n.state=F.SGML_DECL,n.sgmlDecl="";else if(d(i));else if(h(m,i))n.state=F.OPEN_TAG,n.tagName=i;else if("/"===i)n.state=F.CLOSE_TAG,n.tagName="";else if("?"===i)n.state=F.PROC_INST,n.procInstName=n.procInstBody="";else{if(K(n,"Unencoded <"),n.startTagPosition+1<n.position){var u=n.position-n.startTagPosition;i=new Array(u).join(" ")+i}n.textNode+="<"+i,n.state=F.TEXT}continue;case F.SGML_DECL:(n.sgmlDecl+i).toUpperCase()===o?(D(n,"onopencdata"),n.state=F.CDATA,n.sgmlDecl="",n.cdata=""):n.sgmlDecl+i==="--"?(n.state=F.COMMENT,n.comment="",n.sgmlDecl=""):(n.sgmlDecl+i).toUpperCase()===c?(n.state=F.DOCTYPE,(n.doctype||n.sawRoot)&&K(n,"Inappropriately located doctype declaration"),n.doctype="",n.sgmlDecl=""):">"===i?(D(n,"onsgmldeclaration",n.sgmlDecl),n.sgmlDecl="",n.state=F.TEXT):T(i)?(n.state=F.SGML_DECL_QUOTED,n.sgmlDecl+=i):n.sgmlDecl+=i;continue;case F.SGML_DECL_QUOTED:i===n.q&&(n.state=F.SGML_DECL,n.q=""),n.sgmlDecl+=i;continue;case F.DOCTYPE:">"===i?(n.state=F.TEXT,D(n,"ondoctype",n.doctype),n.doctype=!0):(n.doctype+=i,"["===i?n.state=F.DOCTYPE_DTD:T(i)&&(n.state=F.DOCTYPE_QUOTED,n.q=i));continue;case F.DOCTYPE_QUOTED:n.doctype+=i,i===n.q&&(n.q="",n.state=F.DOCTYPE);continue;case F.DOCTYPE_DTD:n.doctype+=i,"]"===i?n.state=F.DOCTYPE:T(i)&&(n.state=F.DOCTYPE_DTD_QUOTED,n.q=i);continue;case F.DOCTYPE_DTD_QUOTED:n.doctype+=i,i===n.q&&(n.state=F.DOCTYPE_DTD,n.q="");continue;case F.COMMENT:"-"===i?n.state=F.COMMENT_ENDING:n.comment+=i;continue;case F.COMMENT_ENDING:"-"===i?(n.state=F.COMMENT_ENDED,n.comment=O(n.opt,n.comment),n.comment&&D(n,"oncomment",n.comment),n.comment=""):(n.comment+="-"+i,n.state=F.COMMENT);continue;case F.COMMENT_ENDED:">"!==i?(K(n,"Malformed comment"),n.comment+="--"+i,n.state=F.COMMENT):n.state=F.TEXT;continue;case F.CDATA:"]"===i?n.state=F.CDATA_ENDING:n.cdata+=i;continue;case F.CDATA_ENDING:"]"===i?n.state=F.CDATA_ENDING_2:(n.cdata+="]"+i,n.state=F.CDATA);continue;case F.CDATA_ENDING_2:">"===i?(n.cdata&&D(n,"oncdata",n.cdata),D(n,"onclosecdata"),n.cdata="",n.state=F.TEXT):"]"===i?n.cdata+="]":(n.cdata+="]]"+i,n.state=F.CDATA);continue;case F.PROC_INST:"?"===i?n.state=F.PROC_INST_ENDING:d(i)?n.state=F.PROC_INST_BODY:n.procInstName+=i;continue;case F.PROC_INST_BODY:if(!n.procInstBody&&d(i))continue;"?"===i?n.state=F.PROC_INST_ENDING:n.procInstBody+=i;continue;case F.PROC_INST_ENDING:">"===i?(D(n,"onprocessinginstruction",{name:n.procInstName,body:n.procInstBody}),n.procInstName=n.procInstBody="",n.state=F.TEXT):(n.procInstBody+="?"+i,n.state=F.PROC_INST_BODY);continue;case F.OPEN_TAG:h(p,i)?n.tagName+=i:(S(n),">"===i?L(n):"/"===i?n.state=F.OPEN_TAG_SLASH:(d(i)||K(n,"Invalid character in tag name"),n.state=F.ATTRIB));continue;case F.OPEN_TAG_SLASH:">"===i?(L(n,!0),R(n)):(K(n,"Forward-slash in opening tag not followed by >"),n.state=F.ATTRIB);continue;case F.ATTRIB:if(d(i))continue;">"===i?L(n):"/"===i?n.state=F.OPEN_TAG_SLASH:h(m,i)?(n.attribName=i,n.attribValue="",n.state=F.ATTRIB_NAME):K(n,"Invalid attribute name");continue;case F.ATTRIB_NAME:"="===i?n.state=F.ATTRIB_VALUE:">"===i?(K(n,"Attribute without value"),n.attribValue=n.attribName,P(n),L(n)):d(i)?n.state=F.ATTRIB_NAME_SAW_WHITE:h(p,i)?n.attribName+=i:K(n,"Invalid attribute name");continue;case F.ATTRIB_NAME_SAW_WHITE:if("="===i)n.state=F.ATTRIB_VALUE;else{if(d(i))continue;K(n,"Attribute without value"),n.tag.attributes[n.attribName]="",n.attribValue="",D(n,"onattribute",{name:n.attribName,value:""}),n.attribName="",">"===i?L(n):h(m,i)?(n.attribName=i,n.state=F.ATTRIB_NAME):(K(n,"Invalid attribute name"),n.state=F.ATTRIB)}continue;case F.ATTRIB_VALUE:if(d(i))continue;T(i)?(n.q=i,n.state=F.ATTRIB_VALUE_QUOTED):(K(n,"Unquoted attribute value"),n.state=F.ATTRIB_VALUE_UNQUOTED,n.attribValue=i);continue;case F.ATTRIB_VALUE_QUOTED:if(i!==n.q){"&"===i?n.state=F.ATTRIB_VALUE_ENTITY_Q:n.attribValue+=i;continue}P(n),n.q="",n.state=F.ATTRIB_VALUE_CLOSED;continue;case F.ATTRIB_VALUE_CLOSED:d(i)?n.state=F.ATTRIB:">"===i?L(n):"/"===i?n.state=F.OPEN_TAG_SLASH:h(m,i)?(K(n,"No whitespace between attributes"),n.attribName=i,n.attribValue="",n.state=F.ATTRIB_NAME):K(n,"Invalid attribute name");continue;case F.ATTRIB_VALUE_UNQUOTED:if(!y(i)){"&"===i?n.state=F.ATTRIB_VALUE_ENTITY_U:n.attribValue+=i;continue}P(n),">"===i?L(n):n.state=F.ATTRIB;continue;case F.CLOSE_TAG:if(n.tagName)">"===i?R(n):h(p,i)?n.tagName+=i:n.script?(n.script+="</"+n.tagName,n.tagName="",n.state=F.SCRIPT):(d(i)||K(n,"Invalid tagname in closing tag"),n.state=F.CLOSE_TAG_SAW_WHITE);else{if(d(i))continue;b(m,i)?n.script?(n.script+="</"+i,n.state=F.SCRIPT):K(n,"Invalid tagname in closing tag."):n.tagName=i}continue;case F.CLOSE_TAG_SAW_WHITE:if(d(i))continue;">"===i?R(n):K(n,"Invalid characters in closing tag");continue;case F.TEXT_ENTITY:case F.ATTRIB_VALUE_ENTITY_Q:case F.ATTRIB_VALUE_ENTITY_U:var l,f;switch(n.state){case F.TEXT_ENTITY:l=F.TEXT,f="textNode";break;case F.ATTRIB_VALUE_ENTITY_Q:l=F.ATTRIB_VALUE_QUOTED,f="attribValue";break;case F.ATTRIB_VALUE_ENTITY_U:l=F.ATTRIB_VALUE_UNQUOTED,f="attribValue"}";"===i?(n[f]+=U(n),n.entity="",n.state=l):h(n.entity.length?g:E,i)?n.entity+=i:(K(n,"Invalid character in entity name"),n[f]+="&"+n.entity+i,n.entity="",n.state=l);continue;default:throw new Error(n,"Unknown state: "+n.state)}return n.position>=n.bufferCheckPosition&&function(t){for(var n=Math.max(e.MAX_BUFFER_LENGTH,10),a=0,i=0,s=r.length;i<s;i++){var o=t[r[i]].length;if(o>n)switch(r[i]){case"textNode":C(t);break;case"cdata":D(t,"oncdata",t.cdata),t.cdata="";break;case"script":D(t,"onscript",t.script),t.script="";break;default:v(t,"Max buffer length exceeded: "+r[i])}a=Math.max(a,o)}var c=e.MAX_BUFFER_LENGTH-a;t.bufferCheckPosition=c+t.position}(n),n}
|
|
2
|
+
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var t;C(t=this),""!==t.cdata&&(D(t,"oncdata",t.cdata),t.cdata=""),""!==t.script&&(D(t,"onscript",t.script),t.script="")}};try{n=require("stream").Stream}catch(t){n=function(){}}var i=e.EVENTS.filter(function(t){return"error"!==t&&"end"!==t});function s(t,e){if(!(this instanceof s))return new s(t,e);n.apply(this),this._parser=new a(t,e),this.writable=!0,this.readable=!0;var r=this;this._parser.onend=function(){r.emit("end")},this._parser.onerror=function(t){r.emit("error",t),r._parser.error=null},this._decoder=null,i.forEach(function(t){Object.defineProperty(r,"on"+t,{get:function(){return r._parser["on"+t]},set:function(e){if(!e)return r.removeAllListeners(t),r._parser["on"+t]=e,e;r.on(t,e)},enumerable:!0,configurable:!1})})}s.prototype=Object.create(n.prototype,{constructor:{value:s}}),s.prototype.write=function(e){if("function"==typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(e)){if(!this._decoder){var n=t.StringDecoder;this._decoder=new n("utf8")}e=this._decoder.write(e)}return this._parser.write(e.toString()),this.emit("data",e),!0},s.prototype.end=function(t){return t&&t.length&&this.write(t),this._parser.end(),!0},s.prototype.on=function(t,e){var r=this;return r._parser["on"+t]||-1===i.indexOf(t)||(r._parser["on"+t]=function(){var e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);e.splice(0,0,t),r.emit.apply(r,e)}),n.prototype.on.call(r,t,e)};var o="[CDATA[",c="DOCTYPE",u="http://www.w3.org/XML/1998/namespace",l="http://www.w3.org/2000/xmlns/",f={xml:u,xmlns:l},m=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,p=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,E=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,g=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function d(t){return" "===t||"\n"===t||"\r"===t||"\t"===t}function T(t){return'"'===t||"'"===t}function y(t){return">"===t||d(t)}function h(t,e){return t.test(e)}function b(t,e){return!h(t,e)}var N,A,x,F=0;for(var _ in e.STATE={BEGIN:F++,BEGIN_WHITESPACE:F++,TEXT:F++,TEXT_ENTITY:F++,OPEN_WAKA:F++,SGML_DECL:F++,SGML_DECL_QUOTED:F++,DOCTYPE:F++,DOCTYPE_QUOTED:F++,DOCTYPE_DTD:F++,DOCTYPE_DTD_QUOTED:F++,COMMENT_STARTING:F++,COMMENT:F++,COMMENT_ENDING:F++,COMMENT_ENDED:F++,CDATA:F++,CDATA_ENDING:F++,CDATA_ENDING_2:F++,PROC_INST:F++,PROC_INST_BODY:F++,PROC_INST_ENDING:F++,OPEN_TAG:F++,OPEN_TAG_SLASH:F++,ATTRIB:F++,ATTRIB_NAME:F++,ATTRIB_NAME_SAW_WHITE:F++,ATTRIB_VALUE:F++,ATTRIB_VALUE_QUOTED:F++,ATTRIB_VALUE_CLOSED:F++,ATTRIB_VALUE_UNQUOTED:F++,ATTRIB_VALUE_ENTITY_Q:F++,ATTRIB_VALUE_ENTITY_U:F++,CLOSE_TAG:F++,CLOSE_TAG_SAW_WHITE:F++,SCRIPT:F++,SCRIPT_ENDING:F++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach(function(t){var n=e.ENTITIES[t],r="number"==typeof n?String.fromCharCode(n):n;e.ENTITIES[t]=r}),e.STATE)e.STATE[e.STATE[_]]=_;function I(t,e,n){t[e]&&t[e](n)}function D(t,e,n){t.textNode&&C(t),I(t,e,n)}function C(t){t.textNode=O(t.opt,t.textNode),t.textNode&&I(t,"ontext",t.textNode),t.textNode=""}function O(t,e){return t.trim&&(e=e.trim()),t.normalize&&(e=e.replace(/\s+/g," ")),e}function v(t,e){return C(t),t.trackPosition&&(e+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c),e=new Error(e),t.error=e,I(t,"onerror",e),t}function w(t){return t.sawRoot&&!t.closedRoot&&K(t,"Unclosed root tag"),t.state!==F.BEGIN&&t.state!==F.BEGIN_WHITESPACE&&t.state!==F.TEXT&&v(t,"Unexpected end"),C(t),t.c="",t.closed=!0,I(t,"onend"),a.call(t,t.strict,t.opt),t}function K(t,e){if("object"!=typeof t||!(t instanceof a))throw new Error("bad call to strictFail");t.strict&&v(t,e)}function S(t){t.strict||(t.tagName=t.tagName[t.looseCase]());var e=t.tags[t.tags.length-1]||t,n=t.tag={name:t.tagName,attributes:{}};t.opt.xmlns&&(n.ns=e.ns),t.attribList.length=0,D(t,"onopentagstart",n)}function B(t,e){var n=t.indexOf(":")<0?["",t]:t.split(":"),r=n[0],a=n[1];return e&&"xmlns"===t&&(r="xmlns",a=""),{prefix:r,local:a}}function P(t){if(t.strict||(t.attribName=t.attribName[t.looseCase]()),-1!==t.attribList.indexOf(t.attribName)||t.tag.attributes.hasOwnProperty(t.attribName))t.attribName=t.attribValue="";else{if(t.opt.xmlns){var e=B(t.attribName,!0),n=e.prefix,r=e.local;if("xmlns"===n)if("xml"===r&&t.attribValue!==u)K(t,"xml: prefix must be bound to "+u+"\nActual: "+t.attribValue);else if("xmlns"===r&&t.attribValue!==l)K(t,"xmlns: prefix must be bound to "+l+"\nActual: "+t.attribValue);else{var a=t.tag,i=t.tags[t.tags.length-1]||t;a.ns===i.ns&&(a.ns=Object.create(i.ns)),a.ns[r]=t.attribValue}t.attribList.push([t.attribName,t.attribValue])}else t.tag.attributes[t.attribName]=t.attribValue,D(t,"onattribute",{name:t.attribName,value:t.attribValue});t.attribName=t.attribValue=""}}function L(t,e){if(t.opt.xmlns){var n=t.tag,r=B(t.tagName);n.prefix=r.prefix,n.local=r.local,n.uri=n.ns[r.prefix]||"",n.prefix&&!n.uri&&(K(t,"Unbound namespace prefix: "+JSON.stringify(t.tagName)),n.uri=r.prefix);var a=t.tags[t.tags.length-1]||t;n.ns&&a.ns!==n.ns&&Object.keys(n.ns).forEach(function(e){D(t,"onopennamespace",{prefix:e,uri:n.ns[e]})});for(var i=0,s=t.attribList.length;i<s;i++){var o=t.attribList[i],c=o[0],u=o[1],l=B(c,!0),f=l.prefix,m=l.local,p=""===f?"":n.ns[f]||"",E={name:c,value:u,prefix:f,local:m,uri:p};f&&"xmlns"!==f&&!p&&(K(t,"Unbound namespace prefix: "+JSON.stringify(f)),E.uri=f),t.tag.attributes[c]=E,D(t,"onattribute",E)}t.attribList.length=0}t.tag.isSelfClosing=!!e,t.sawRoot=!0,t.tags.push(t.tag),D(t,"onopentag",t.tag),e||(t.noscript||"script"!==t.tagName.toLowerCase()?t.state=F.TEXT:t.state=F.SCRIPT,t.tag=null,t.tagName=""),t.attribName=t.attribValue="",t.attribList.length=0}function R(t){if(!t.tagName)return K(t,"Weird empty close tag."),t.textNode+="</>",void(t.state=F.TEXT);if(t.script){if("script"!==t.tagName)return t.script+="</"+t.tagName+">",t.tagName="",void(t.state=F.SCRIPT);D(t,"onscript",t.script),t.script=""}var e=t.tags.length,n=t.tagName;t.strict||(n=n[t.looseCase]());for(var r=n;e--&&t.tags[e].name!==r;)K(t,"Unexpected close tag");if(e<0)return K(t,"Unmatched closing tag: "+t.tagName),t.textNode+="</"+t.tagName+">",void(t.state=F.TEXT);t.tagName=n;for(var a=t.tags.length;a-- >e;){var i=t.tag=t.tags.pop();t.tagName=t.tag.name,D(t,"onclosetag",t.tagName);var s={};for(var o in i.ns)s[o]=i.ns[o];var c=t.tags[t.tags.length-1]||t;t.opt.xmlns&&i.ns!==c.ns&&Object.keys(i.ns).forEach(function(e){var n=i.ns[e];D(t,"onclosenamespace",{prefix:e,uri:n})})}0===e&&(t.closedRoot=!0),t.tagName=t.attribValue=t.attribName="",t.attribList.length=0,t.state=F.TEXT}function U(t){var e,n=t.entity,r=n.toLowerCase(),a="";return t.ENTITIES[n]?t.ENTITIES[n]:t.ENTITIES[r]?t.ENTITIES[r]:("#"===(n=r).charAt(0)&&("x"===n.charAt(1)?(n=n.slice(2),a=(e=parseInt(n,16)).toString(16)):(n=n.slice(1),a=(e=parseInt(n,10)).toString(10))),n=n.replace(/^0+/,""),isNaN(e)||a.toLowerCase()!==n?(K(t,"Invalid character entity"),"&"+t.entity+";"):String.fromCodePoint(e))}function k(t,e){"<"===e?(t.state=F.OPEN_WAKA,t.startTagPosition=t.position):d(e)||(K(t,"Non-whitespace before first tag."),t.textNode=e,t.state=F.TEXT)}function M(t,e){var n="";return e<t.length&&(n=t.charAt(e)),n}F=e.STATE,String.fromCodePoint||(N=String.fromCharCode,A=Math.floor,x=function(){var t,e,n=[],r=-1,a=arguments.length;if(!a)return"";for(var i="";++r<a;){var s=Number(arguments[r]);if(!isFinite(s)||s<0||s>1114111||A(s)!==s)throw RangeError("Invalid code point: "+s);s<=65535?n.push(s):(t=55296+((s-=65536)>>10),e=s%1024+56320,n.push(t,e)),(r+1===a||n.length>16384)&&(i+=N.apply(null,n),n.length=0)}return i},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:x,configurable:!0,writable:!0}):String.fromCodePoint=x)}(T)),T}function h(){return a?r:(a=1,r={isArray:function(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}})}function b(){if(s)return i;s=1;var t=h().isArray;return i={copyOptions:function(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n},ensureFlagExists:function(t,e){t in e&&"boolean"==typeof e[t]||(e[t]=!1)},ensureSpacesExists:function(t){(!("spaces"in t)||"number"!=typeof t.spaces&&"string"!=typeof t.spaces)&&(t.spaces=0)},ensureAlwaysArrayExists:function(e){"alwaysArray"in e&&("boolean"==typeof e.alwaysArray||t(e.alwaysArray))||(e.alwaysArray=!1)},ensureKeyExists:function(t,e){t+"Key"in e&&"string"==typeof e[t+"Key"]||(e[t+"Key"]=e.compact?"_"+t:t)},checkFnExists:function(t,e){return t+"Fn"in e}}}function N(){if(c)return o;c=1;var t,e,n=y(),r=b(),a=h().isArray;function i(t){var e=Number(t);if(!isNaN(e))return e;var n=t.toLowerCase();return"true"===n||"false"!==n&&t}function s(n,r){var i;if(t.compact){if(!e[t[n+"Key"]]&&(a(t.alwaysArray)?-1!==t.alwaysArray.indexOf(t[n+"Key"]):t.alwaysArray)&&(e[t[n+"Key"]]=[]),e[t[n+"Key"]]&&!a(e[t[n+"Key"]])&&(e[t[n+"Key"]]=[e[t[n+"Key"]]]),n+"Fn"in t&&"string"==typeof r&&(r=t[n+"Fn"](r,e)),"instruction"===n&&("instructionFn"in t||"instructionNameFn"in t))for(i in r)if(r.hasOwnProperty(i))if("instructionFn"in t)r[i]=t.instructionFn(r[i],i,e);else{var s=r[i];delete r[i],r[t.instructionNameFn(i,s,e)]=s}a(e[t[n+"Key"]])?e[t[n+"Key"]].push(r):e[t[n+"Key"]]=r}else{e[t.elementsKey]||(e[t.elementsKey]=[]);var o={};if(o[t.typeKey]=n,"instruction"===n){for(i in r)if(r.hasOwnProperty(i))break;o[t.nameKey]="instructionNameFn"in t?t.instructionNameFn(i,r,e):i,t.instructionHasAttributes?(o[t.attributesKey]=r[i][t.attributesKey],"instructionFn"in t&&(o[t.attributesKey]=t.instructionFn(o[t.attributesKey],i,e))):("instructionFn"in t&&(r[i]=t.instructionFn(r[i],i,e)),o[t.instructionKey]=r[i])}else n+"Fn"in t&&(r=t[n+"Fn"](r,e)),o[t[n+"Key"]]=r;t.addParent&&(o[t.parentKey]=e),e[t.elementsKey].push(o)}}function u(n){var r;if("attributesFn"in t&&n&&(n=t.attributesFn(n,e)),(t.trim||"attributeValueFn"in t||"attributeNameFn"in t||t.nativeTypeAttributes)&&n)for(r in n)if(n.hasOwnProperty(r)&&(t.trim&&(n[r]=n[r].trim()),t.nativeTypeAttributes&&(n[r]=i(n[r])),"attributeValueFn"in t&&(n[r]=t.attributeValueFn(n[r],r,e)),"attributeNameFn"in t)){var a=n[r];delete n[r],n[t.attributeNameFn(r,n[r],e)]=a}return n}function l(n){var r={};if(n.body&&("xml"===n.name.toLowerCase()||t.instructionHasAttributes)){for(var a,i=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g;null!==(a=i.exec(n.body));)r[a[1]]=a[2]||a[3]||a[4];r=u(r)}if("xml"===n.name.toLowerCase()){if(t.ignoreDeclaration)return;e[t.declarationKey]={},Object.keys(r).length&&(e[t.declarationKey][t.attributesKey]=r),t.addParent&&(e[t.declarationKey][t.parentKey]=e)}else{if(t.ignoreInstruction)return;t.trim&&(n.body=n.body.trim());var o={};t.instructionHasAttributes&&Object.keys(r).length?(o[n.name]={},o[n.name][t.attributesKey]=r):o[n.name]=n.body,s("instruction",o)}}function f(n,r){var i;if("object"==typeof n&&(r=n.attributes,n=n.name),r=u(r),"elementNameFn"in t&&(n=t.elementNameFn(n,e)),t.compact){var s;if(i={},!t.ignoreAttributes&&r&&Object.keys(r).length)for(s in i[t.attributesKey]={},r)r.hasOwnProperty(s)&&(i[t.attributesKey][s]=r[s]);!(n in e)&&(a(t.alwaysArray)?-1!==t.alwaysArray.indexOf(n):t.alwaysArray)&&(e[n]=[]),e[n]&&!a(e[n])&&(e[n]=[e[n]]),a(e[n])?e[n].push(i):e[n]=i}else e[t.elementsKey]||(e[t.elementsKey]=[]),(i={})[t.typeKey]="element",i[t.nameKey]=n,!t.ignoreAttributes&&r&&Object.keys(r).length&&(i[t.attributesKey]=r),t.alwaysChildren&&(i[t.elementsKey]=[]),e[t.elementsKey].push(i);i[t.parentKey]=e,e=i}function m(e){t.ignoreText||(e.trim()||t.captureSpacesBetweenElements)&&(t.trim&&(e=e.trim()),t.nativeType&&(e=i(e)),t.sanitize&&(e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")),s("text",e))}function p(e){t.ignoreComment||(t.trim&&(e=e.trim()),s("comment",e))}function E(n){var r=e[t.parentKey];t.addParent||delete e[t.parentKey],e=r}function g(e){t.ignoreCdata||(t.trim&&(e=e.trim()),s("cdata",e))}function d(e){t.ignoreDoctype||(e=e.replace(/^ /,""),t.trim&&(e=e.trim()),s("doctype",e))}function T(t){t.note=t}return o=function(a,i){var s=n.parser(!0,{}),o={};if(e=o,t=function(e){return t=r.copyOptions(e),r.ensureFlagExists("ignoreDeclaration",t),r.ensureFlagExists("ignoreInstruction",t),r.ensureFlagExists("ignoreAttributes",t),r.ensureFlagExists("ignoreText",t),r.ensureFlagExists("ignoreComment",t),r.ensureFlagExists("ignoreCdata",t),r.ensureFlagExists("ignoreDoctype",t),r.ensureFlagExists("compact",t),r.ensureFlagExists("alwaysChildren",t),r.ensureFlagExists("addParent",t),r.ensureFlagExists("trim",t),r.ensureFlagExists("nativeType",t),r.ensureFlagExists("nativeTypeAttributes",t),r.ensureFlagExists("sanitize",t),r.ensureFlagExists("instructionHasAttributes",t),r.ensureFlagExists("captureSpacesBetweenElements",t),r.ensureAlwaysArrayExists(t),r.ensureKeyExists("declaration",t),r.ensureKeyExists("instruction",t),r.ensureKeyExists("attributes",t),r.ensureKeyExists("text",t),r.ensureKeyExists("comment",t),r.ensureKeyExists("cdata",t),r.ensureKeyExists("doctype",t),r.ensureKeyExists("type",t),r.ensureKeyExists("name",t),r.ensureKeyExists("elements",t),r.ensureKeyExists("parent",t),r.checkFnExists("doctype",t),r.checkFnExists("instruction",t),r.checkFnExists("cdata",t),r.checkFnExists("comment",t),r.checkFnExists("text",t),r.checkFnExists("instructionName",t),r.checkFnExists("elementName",t),r.checkFnExists("attributeName",t),r.checkFnExists("attributeValue",t),r.checkFnExists("attributes",t),t}(i),s.opt={strictEntities:!0},s.onopentag=f,s.ontext=m,s.oncomment=p,s.onclosetag=E,s.onerror=T,s.oncdata=g,s.ondoctype=d,s.onprocessinginstruction=l,s.write(a).close(),o[t.elementsKey]){var c=o[t.elementsKey];delete o[t.elementsKey],o[t.elementsKey]=c,delete o.text}return o}}function A(){if(l)return u;l=1;var t=b(),e=N();return u=function(n,r){var a,i,s;return a=function(e){var n=t.copyOptions(e);return t.ensureSpacesExists(n),n}(r),i=e(n,a),s="compact"in a&&a.compact?"_parent":"parent",("addParent"in a&&a.addParent?JSON.stringify(i,function(t,e){return t===s?"_":e},a.spaces):JSON.stringify(i,null,a.spaces)).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}}function x(){if(m)return f;m=1;var t,e,n=b(),r=h().isArray;function a(t,e,n){return(!n&&t.spaces?"\n":"")+Array(e+1).join(t.spaces)}function i(n,r,i){if(r.ignoreAttributes)return"";"attributesFn"in r&&(n=r.attributesFn(n,e,t));var s,o,c,u,l=[];for(s in n)n.hasOwnProperty(s)&&null!==n[s]&&void 0!==n[s]&&(u=r.noQuotesForNativeAttributes&&"string"!=typeof n[s]?"":'"',o=(o=""+n[s]).replace(/"/g,"""),c="attributeNameFn"in r?r.attributeNameFn(s,o,e,t):s,l.push(r.spaces&&r.indentAttributes?a(r,i+1,!1):" "),l.push(c+"="+u+("attributeValueFn"in r?r.attributeValueFn(o,s,e,t):o)+u));return n&&Object.keys(n).length&&r.spaces&&r.indentAttributes&&l.push(a(r,i,!1)),l.join("")}function s(n,r,a){return t=n,e="xml",r.ignoreDeclaration?"":"<?xml"+i(n[r.attributesKey],r,a)+"?>"}function o(n,r,a){if(r.ignoreInstruction)return"";var s;for(s in n)if(n.hasOwnProperty(s))break;var o="instructionNameFn"in r?r.instructionNameFn(s,n[s],e,t):s;if("object"==typeof n[s])return t=n,e=o,"<?"+o+i(n[s][r.attributesKey],r,a)+"?>";var c=n[s]?n[s]:"";return"instructionFn"in r&&(c=r.instructionFn(c,s,e,t)),"<?"+o+(c?" "+c:"")+"?>"}function c(n,r){return r.ignoreComment?"":"\x3c!--"+("commentFn"in r?r.commentFn(n,e,t):n)+"--\x3e"}function u(n,r){return r.ignoreCdata?"":"<![CDATA["+("cdataFn"in r?r.cdataFn(n,e,t):n.replace("]]>","]]]]><![CDATA[>"))+"]]>"}function l(n,r){return r.ignoreDoctype?"":"<!DOCTYPE "+("doctypeFn"in r?r.doctypeFn(n,e,t):n)+">"}function p(n,r){return r.ignoreText?"":(n=(n=(n=""+n).replace(/&/g,"&")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),"textFn"in r?r.textFn(n,e,t):n)}function E(n,r,s,f){return n.reduce(function(n,m){var g=a(r,s,f&&!n);switch(m.type){case"element":return n+g+function(n,r,a){t=n,e=n.name;var s=[],o="elementNameFn"in r?r.elementNameFn(n.name,n):n.name;s.push("<"+o),n[r.attributesKey]&&s.push(i(n[r.attributesKey],r,a));var c=n[r.elementsKey]&&n[r.elementsKey].length||n[r.attributesKey]&&"preserve"===n[r.attributesKey]["xml:space"];return c||(c="fullTagEmptyElementFn"in r?r.fullTagEmptyElementFn(n.name,n):r.fullTagEmptyElement),c?(s.push(">"),n[r.elementsKey]&&n[r.elementsKey].length&&(s.push(E(n[r.elementsKey],r,a+1)),t=n,e=n.name),s.push(r.spaces&&function(t,e){var n;if(t.elements&&t.elements.length)for(n=0;n<t.elements.length;++n)switch(t.elements[n][e.typeKey]){case"text":if(e.indentText)return!0;break;case"cdata":if(e.indentCdata)return!0;break;case"instruction":if(e.indentInstruction)return!0;break;default:return!0}return!1}(n,r)?"\n"+Array(a+1).join(r.spaces):""),s.push("</"+o+">")):s.push("/>"),s.join("")}(m,r,s);case"comment":return n+g+c(m[r.commentKey],r);case"doctype":return n+g+l(m[r.doctypeKey],r);case"cdata":return n+(r.indentCdata?g:"")+u(m[r.cdataKey],r);case"text":return n+(r.indentText?g:"")+p(m[r.textKey],r);case"instruction":var d={};return d[m[r.nameKey]]=m[r.attributesKey]?m:m[r.instructionKey],n+(r.indentInstruction?g:"")+o(d,r,s)}},"")}function g(t,e,n){var r;for(r in t)if(t.hasOwnProperty(r))switch(r){case e.parentKey:case e.attributesKey:break;case e.textKey:if(e.indentText||n)return!0;break;case e.cdataKey:if(e.indentCdata||n)return!0;break;case e.instructionKey:if(e.indentInstruction||n)return!0;break;case e.doctypeKey:case e.commentKey:default:return!0}return!1}function d(n,r,s,o,c){t=n,e=r;var u="elementNameFn"in s?s.elementNameFn(r,n):r;if(null==n||""===n)return"fullTagEmptyElementFn"in s&&s.fullTagEmptyElementFn(r,n)||s.fullTagEmptyElement?"<"+u+"></"+u+">":"<"+u+"/>";var l=[];if(r){if(l.push("<"+u),"object"!=typeof n)return l.push(">"+p(n,s)+"</"+u+">"),l.join("");n[s.attributesKey]&&l.push(i(n[s.attributesKey],s,o));var f=g(n,s,!0)||n[s.attributesKey]&&"preserve"===n[s.attributesKey]["xml:space"];if(f||(f="fullTagEmptyElementFn"in s?s.fullTagEmptyElementFn(r,n):s.fullTagEmptyElement),!f)return l.push("/>"),l.join("");l.push(">")}return l.push(T(n,s,o+1,!1)),t=n,e=r,r&&l.push((c?a(s,o,!1):"")+"</"+u+">"),l.join("")}function T(t,e,n,i){var f,m,E,T=[];for(m in t)if(t.hasOwnProperty(m))for(E=r(t[m])?t[m]:[t[m]],f=0;f<E.length;++f){switch(m){case e.declarationKey:T.push(s(E[f],e,n));break;case e.instructionKey:T.push((e.indentInstruction?a(e,n,i):"")+o(E[f],e,n));break;case e.attributesKey:case e.parentKey:break;case e.textKey:T.push((e.indentText?a(e,n,i):"")+p(E[f],e));break;case e.cdataKey:T.push((e.indentCdata?a(e,n,i):"")+u(E[f],e));break;case e.doctypeKey:T.push(a(e,n,i)+l(E[f],e));break;case e.commentKey:T.push(a(e,n,i)+c(E[f],e));break;default:T.push(a(e,n,i)+d(E[f],m,e,n,g(E[f],e)))}i=i&&!T.length}return T.join("")}return f=function(r,a){a=function(t){var e=n.copyOptions(t);return n.ensureFlagExists("ignoreDeclaration",e),n.ensureFlagExists("ignoreInstruction",e),n.ensureFlagExists("ignoreAttributes",e),n.ensureFlagExists("ignoreText",e),n.ensureFlagExists("ignoreComment",e),n.ensureFlagExists("ignoreCdata",e),n.ensureFlagExists("ignoreDoctype",e),n.ensureFlagExists("compact",e),n.ensureFlagExists("indentText",e),n.ensureFlagExists("indentCdata",e),n.ensureFlagExists("indentAttributes",e),n.ensureFlagExists("indentInstruction",e),n.ensureFlagExists("fullTagEmptyElement",e),n.ensureFlagExists("noQuotesForNativeAttributes",e),n.ensureSpacesExists(e),"number"==typeof e.spaces&&(e.spaces=Array(e.spaces+1).join(" ")),n.ensureKeyExists("declaration",e),n.ensureKeyExists("instruction",e),n.ensureKeyExists("attributes",e),n.ensureKeyExists("text",e),n.ensureKeyExists("comment",e),n.ensureKeyExists("cdata",e),n.ensureKeyExists("doctype",e),n.ensureKeyExists("type",e),n.ensureKeyExists("name",e),n.ensureKeyExists("elements",e),n.checkFnExists("doctype",e),n.checkFnExists("instruction",e),n.checkFnExists("cdata",e),n.checkFnExists("comment",e),n.checkFnExists("text",e),n.checkFnExists("instructionName",e),n.checkFnExists("elementName",e),n.checkFnExists("attributeName",e),n.checkFnExists("attributeValue",e),n.checkFnExists("attributes",e),n.checkFnExists("fullTagEmptyElement",e),e}(a);var i=[];return t=r,e="_root_",a.compact?i.push(T(r,a,0,!0)):(r[a.declarationKey]&&i.push(s(r[a.declarationKey],a,0)),r[a.elementsKey]&&r[a.elementsKey].length&&i.push(E(r[a.elementsKey],a,0,!i.length))),i.join("")}}function F(){if(E)return p;E=1;var t=x();return p=function(e,n){e instanceof Buffer&&(e=e.toString());var r=null;if("string"==typeof e)try{r=JSON.parse(e)}catch(t){throw new Error("The JSON structure is invalid")}else r=e;return t(r,n)}}var _=function(){if(d)return g;d=1;var t=N(),e=A(),n=x(),r=F();return g={xml2js:t,xml2json:e,js2xml:n,json2xml:r}}();function I(t){const e=Buffer.allocUnsafe(t.length);for(let n=0;n<t.length-1;n+=2)e[n]=t[n+1],e[n+1]=t[n];return t.length%2==1&&(e[t.length-1]=t[t.length-1]),e}function D(t){const e=function(t){if(t.length>=2){if(255===t[0]&&254===t[1])return{encoding:"utf16le",hasBom:!0};if(254===t[0]&&255===t[1])return{encoding:"utf16be",hasBom:!0}}let e=0,n=0;for(let r=0;r<t.length;r++)0===t[r]&&(r%2==0?n++:e++);return e>8&&e>2*n?{encoding:"utf16le",hasBom:!1}:n>8&&n>2*e?{encoding:"utf16be",hasBom:!1}:{encoding:"utf8",hasBom:!1}}(t);if("utf16le"===e.encoding){return{text:(e.hasBom?t.subarray(2):t).toString("utf16le"),encoding:e}}if("utf16be"===e.encoding){return{text:I(e.hasBom?t.subarray(2):t).toString("utf16le"),encoding:e}}return{text:t.toString("utf8"),encoding:e}}function C(t){return Buffer.isBuffer(t)&&(t=D(t).text),_.xml2js(t,{compact:!1})}function O(t){return t.replace(/&(?!(?:amp|lt|gt|quot);)/g,"&").replace(/</g,"<").replace(/>/g,">")}function v(t,e){return _.js2xml(t,{attributeValueFn:O,...e})}function w(t,e={}){var n;Buffer.isBuffer(t)&&(t=D(t).text);const r=null!==(n=e.spaces)&&void 0!==n?n:2;return function(t,e){let n=0;for(;n<t.length&&t.charCodeAt(n)<=32;)n++;if(n>=t.length||"<"!==t[n])throw new Error("Not valid XML: must start with <");const r=t.length,a=[];let i=n,s=0;for(;i<r;){for(;i<r&&t.charCodeAt(i)<=32;)i++;if(i>=r)break;if("<"!==t[i]){const n=t.indexOf("<",i),o=-1===n?t.slice(i):t.slice(i,n);o&&a.push(e.repeat(s),o,"\n"),i=-1===n?r:n;continue}const n=t[i+1];if("?"===n){const n=t.indexOf("?>",i);if(-1===n)throw new Error("Unterminated processing instruction");a.push(e.repeat(s),t.slice(i,n+2),"\n"),i=n+2}else if("!"===n&&"-"===t[i+2]&&"-"===t[i+3]){const n=t.indexOf("--\x3e",i);if(-1===n)throw new Error("Unterminated comment");a.push(e.repeat(s),t.slice(i,n+3),"\n"),i=n+3}else if("!"===n&&"["===t[i+2]){const n=t.indexOf("]]>",i);if(-1===n)throw new Error("Unterminated CDATA section");a.push(e.repeat(s),t.slice(i,n+3),"\n"),i=n+3}else if("/"===n){if(s--,s<0)throw new Error("Unexpected closing tag");const n=t.indexOf(">",i);if(-1===n)throw new Error("Unterminated closing tag");a.push(e.repeat(s),t.slice(i,n+1),"\n"),i=n+1}else{let n=i+1;for(;n<r&&">"!==t[n];){if('"'===t[n])for(n++;n<r&&'"'!==t[n];)n++;else if("'"===t[n])for(n++;n<r&&"'"!==t[n];)n++;n++}if(n>=r)throw new Error("Unterminated tag");const o=n+1;if("/"===t[n-1])a.push(e.repeat(s),t.slice(i,o),"\n"),i=o;else{const n=t.indexOf("<",o);if(-1!==n&&"/"===t[n+1]){const r=t.slice(o,n),c=t.indexOf(">",n);if(-1===c)throw new Error("Unterminated closing tag");a.push(e.repeat(s),t.slice(i,o),r,t.slice(n,c+1),"\n"),i=c+1}else a.push(e.repeat(s),t.slice(i,o),"\n"),s++,i=o}}}return a.join("")}(t,"string"==typeof r?r:" ".repeat(r))}function K(t,e={},n){if(t.length>=5242880){const e=(t.length/1048576).toFixed(2),r=n?`"${n}"`:"XML buffer";return console.log(`Skipping XML formatting: ${r} size (${e} MB) exceeds the 5 MB limit.`),t}const r=D(t);return function(t,e){if("utf16le"===e.encoding){const n=Buffer.from(t,"utf16le");return e.hasBom?Buffer.concat([Buffer.from([255,254]),n]):n}if("utf16be"===e.encoding){const n=I(Buffer.from(t,"utf16le"));return e.hasBom?Buffer.concat([Buffer.from([254,255]),n]):n}const n=Buffer.from(t,"utf8");return e.hasBom?Buffer.concat([Buffer.from([239,187,191]),n]):n}(w(r.text,e),r.encoding)}function S(t,e){return function(t,e){return t&&t.find(e)}(t,t=>t.name===e)}const B=e.env.debug("vbapm:target.transforms.core-xml"),P=/docProps[\/,\\]core\.xml/i;const L=/\.(xml|rels)$/i;function R(t,...e){t=t.slice();for(const n of e){const e=t.indexOf(n);t.splice(e,1)}return t}const U=e.env.debug("vbapm:target.transforms.workbook-xml"),k=/xl[\/,\\]workbook\.xml/i;const M=/vba.*\.bin/i;const V=function(...t){return(e,n,r)=>t.reduce((t,a)=>t?a(e,n,r):t,!0)}(function(t){return!M.test(t.path)}),G=function(...t){return(e,n,r)=>t.reduce((t,e)=>e(t,n,r),e)}(function(t){if(!P.test(t.path))return t;const e=C(t.data.toString("utf8")),n=S(e.elements,"cp:coreProperties");if(n){const t=S(n.elements,"cp:lastModifiedBy"),e=S(n.elements,"dc:creator");t&&e&&(t.elements[0].text=e.elements[0].text);const r=S(n.elements,"dcterms:modified"),a=S(n.elements,"dcterms:created");r&&a&&(r.elements[0].text=a.elements[0].text)}else B("Warning: cp:coreProperties not found, unable to transform core.xml");return t.data=Buffer.from(v(e)),t},function(t){if(!k.test(t.path))return t;const e=C(t.data.toString("utf8")),n=S(e.elements,"workbook");if(n){const t=S(n.elements,"mc:AlternateContent"),e=S(t&&t.elements,"mc:Choice"),r=S(e&&e.elements,"x15ac:absPath");r&&(r.attributes.url="");const a=S(n.elements,"bookViews");a&&(n.elements=R(n.elements,a));const i=S(n.elements,"fileVersion");i&&(n.elements=R(n.elements,i));const s=S(n.elements,"calcPr");s&&(s.attributes.calcId="0")}else U("Warning: workbook not found, unable to transform workbook.xml");return t.data=Buffer.from(v(e)),t},function(t){if(!L.test(t.path))return t;try{t.data=K(t.data,{spaces:2},t.path)}catch{console.warn(`Warning: Failed to parse ${t.path} as XML. Leaving unmodified.`)}return t});exports.filterTarget=V,exports.mapTarget=G;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text encoding detection and buffer round-trip helpers.
|
|
3
|
+
*
|
|
4
|
+
* This utility was originally created to handle XML documents generated in
|
|
5
|
+
* Open XML formats (e.g. OOXML parts), where files may be encoded as UTF-8,
|
|
6
|
+
* UTF-16 LE, or UTF-16 BE and must keep their original encoding after edits.
|
|
7
|
+
*/
|
|
8
|
+
export type TextEncoding = "utf8" | "utf16le" | "utf16be";
|
|
9
|
+
export interface BufferEncoding {
|
|
10
|
+
encoding: TextEncoding;
|
|
11
|
+
hasBom: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Decodes a UTF-8, UTF-16 LE, or UTF-16 BE buffer into a text string, along with the detected encoding and BOM presence for later re-encoding.
|
|
15
|
+
* If the buffer has a BOM, it will be stripped from the output text.
|
|
16
|
+
* @param data The buffer containing the encoded text.
|
|
17
|
+
* @returns An object containing the decoded text and the detected encoding information.
|
|
18
|
+
*/
|
|
19
|
+
export declare function decodeBuffer(data: Buffer): {
|
|
20
|
+
text: string;
|
|
21
|
+
encoding: BufferEncoding;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Encodes a text string into a UTF-8, UTF-16 LE, or UTF-16 BE buffer.
|
|
25
|
+
* Optionally includes a BOM if specified in the encoding information.
|
|
26
|
+
* @param text The text string to encode.
|
|
27
|
+
* @param encoding The encoding information, including the desired encoding and BOM presence.
|
|
28
|
+
* @returns A buffer containing the encoded text.
|
|
29
|
+
*/
|
|
30
|
+
export declare function encodeBuffer(text: string, encoding: BufferEncoding): Buffer;
|
package/lib/utils/run.d.ts
CHANGED
|
@@ -11,7 +11,10 @@ export declare class RunError extends Error {
|
|
|
11
11
|
constructor(result: RunResult);
|
|
12
12
|
}
|
|
13
13
|
export declare function isRunError(error: Error | RunError): error is RunError;
|
|
14
|
-
export
|
|
14
|
+
export interface RunOptions {
|
|
15
|
+
keepOpen?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function run(application: string, file: string, macro: string, args: string[], options?: RunOptions): Promise<RunResult>;
|
|
15
18
|
export declare function escape(value: string): string;
|
|
16
19
|
export declare function unescape(value: string): string;
|
|
17
20
|
export declare function toResult(stdout: string, stderr: string, err?: Error): RunResult;
|
package/lib/utils/xml.d.ts
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import { Element } from "xml-js";
|
|
2
2
|
export type Xml = any;
|
|
3
|
+
/**
|
|
4
|
+
* Parses an XML string or buffer into an (xml-js) Element object.
|
|
5
|
+
* @param xml The XML content as a string or buffer.
|
|
6
|
+
* @returns The parsed XML as an (xml-js) Element object.
|
|
7
|
+
*/
|
|
3
8
|
export declare function parseXml(xml: string | Buffer): Element;
|
|
4
9
|
export interface ConvertOptions {
|
|
5
10
|
compact?: boolean;
|
|
11
|
+
spaces?: number | string;
|
|
6
12
|
}
|
|
7
13
|
export declare function convertXml(value: Xml, options?: ConvertOptions): string;
|
|
14
|
+
/**
|
|
15
|
+
* Single-pass XML formatting
|
|
16
|
+
* @param xml The XML string or buffer to format.
|
|
17
|
+
* @param options Formatting options.
|
|
18
|
+
* @returns The formatted XML string.
|
|
19
|
+
*/
|
|
20
|
+
export declare function formatXml(xml: string | Buffer, options?: ConvertOptions): string;
|
|
21
|
+
export declare function formatXmlBuffer(xml: Buffer, options?: ConvertOptions, fileName?: string): Buffer;
|
|
8
22
|
export declare function findElement(elements: Element[] | undefined, callback: (element: Element, index: number, elements: Element[]) => boolean): Element | undefined;
|
|
9
23
|
export declare function findElementByName(elements: Element[] | undefined, name: string): Element | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("./installer-
|
|
1
|
+
"use strict";var e=require("./installer-DPj-zT7L.js"),r=require("./add-source-BOumGmx7.js");require("child_process"),require("util"),require("assert"),require("path"),require("fs"),require("./_commonjsHelpers-Bjf42z7h.js"),require("crypto"),require("events"),require("os"),require("constants"),require("stream"),require("http"),require("url"),require("punycode"),require("https"),require("zlib"),require("./index-CBGUBgfk.js");const s=e.dedent`
|
|
2
2
|
Create and register a new source file in vbaproject.toml
|
|
3
3
|
|
|
4
4
|
Usage: vbapm add <name> [options]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";var e=require("./installer-DPj-zT7L.js"),r=require("node:process"),t=require("node:path"),o=require("node:url"),i=require("node:child_process"),n=require("node:fs/promises"),a=require("node:util"),s=require("node:os"),c=require("node:fs"),l=require("node:buffer"),u=require("./index-C61lSPb5.js"),d=require("./build-project-De7NPBpt.js");require("child_process"),require("util"),require("assert"),require("path"),require("fs"),require("./_commonjsHelpers-Bjf42z7h.js"),require("crypto"),require("events"),require("os"),require("constants"),require("stream"),require("http"),require("url"),require("punycode"),require("https"),require("zlib"),require("./project-BPmPCkUS.js"),require("./index-CBGUBgfk.js"),require("querystring"),require("./build-target-ooHNsSLD.js"),require("./transform-build-graph-DgRrocSn.js"),require("./load-from-project-ClF4qaC0.js"),require("./transform-target-CYhuozxP.js"),require("string_decoder"),require("./get-target-LUoY1UWJ.js");var m="undefined"!=typeof document?document.currentScript:null;let p,f;function g(){return void 0===p&&(p=function(){try{return c.statSync("/.dockerenv"),!0}catch{return!1}}()||function(){try{return c.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}()),p}function w(){return void 0===f&&(f=(()=>{try{return c.statSync("/run/.containerenv"),!0}catch{return!1}})()||g()),f}const h=()=>{if("linux"!==r.platform)return!1;if(s.release().toLowerCase().includes("microsoft"))return!w();try{if(c.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft"))return!w()}catch{}return!(!c.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")&&!c.existsSync("/run/WSL"))&&!w()};var v=r.env.__IS_WSL_TEST__?h:h();const y=a.promisify(i.execFile),x=()=>`${r.env.SYSTEMROOT||r.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,b=async(e,r={})=>{const{powerShellPath:t,...o}=r,i=b.encodeCommand(e);return y(t??x(),[...b.argumentsPrefix,i],{encoding:"utf8",...o})};b.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"],b.encodeCommand=e=>l.Buffer.from(e,"utf16le").toString("base64"),b.escapeArgument=e=>`'${String(e).replaceAll("'","''")}'`;const S=a.promisify(i.execFile),P=(()=>{const e="/mnt/";let r;return async function(){if(r)return r;const t="/etc/wsl.conf";let o=!1;try{await n.access(t,n.constants.F_OK),o=!0}catch{}if(!o)return e;const i=function(e){for(const r of e.split("\n")){if(/^\s*#/.test(r))continue;const e=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(r);if(e)return e.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}(await n.readFile(t,{encoding:"utf8"}));return void 0===i?e:(r=i,r=r.endsWith("/")?r:`${r}/`,r)}})(),q=v?async()=>`${await P()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:x;let E;function C(e,r,t){const o=t=>Object.defineProperty(e,r,{value:t,enumerable:!0,writable:!0});return Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){const e=t();return o(e),e},set(e){o(e)}}),e}const B=a.promisify(i.execFile);const T=a.promisify(i.execFile);async function A(e){return async function(e,{humanReadableOutput:t=!0,signal:o}={}){if("darwin"!==r.platform)throw new Error("macOS only");const i=t?[]:["-ss"],n={};o&&(n.signal=o);const{stdout:a}=await T("osascript",["-e",e,i],n);return a.trim()}(`tell application "Finder" to set app_path to application file id "${e}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}const F=a.promisify(i.execFile),L={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},_=new Map(Object.entries(L));class j extends Error{}const O=a.promisify(i.execFile);async function H(){if("darwin"===r.platform){const e=await async function(){if("darwin"!==r.platform)throw new Error("macOS only");const{stdout:e}=await B("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e),o=t?.groups.id??"com.apple.Safari";return"com.apple.safari"===o?"com.apple.Safari":o}();return{name:await A(e),id:e}}if("linux"===r.platform){const{stdout:e}=await O("xdg-mime",["query","default","x-scheme-handler/http"]),r=e.trim();return{name:r.replace(/.desktop$/,"").replace("-"," ").toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase()),id:r}}if("win32"===r.platform)return async function(e=F){const{stdout:r}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),t=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(r);if(!t)throw new j(`Cannot find Windows browser in stdout: ${JSON.stringify(r)}`);const{id:o}=t.groups,i=o.lastIndexOf("."),n=o.lastIndexOf("-"),a=-1===i?void 0:o.slice(0,i),s=-1===n?void 0:o.slice(0,n);return L[o]??L[a]??L[s]??{name:o,id:o}}();throw new Error("Only macOS, Linux, and Windows are supported")}const M=Boolean(r.env.SSH_CONNECTION||r.env.SSH_CLIENT||r.env.SSH_TTY),U=Symbol("fallbackAttempt"),I=("undefined"==typeof document?require("url").pathToFileURL(__filename).href:m&&"SCRIPT"===m.tagName.toUpperCase()&&m.src||new URL("vbapm-build-Bhm_pqQW.js",document.baseURI).href)?t.dirname(o.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(__filename).href:m&&"SCRIPT"===m.tagName.toUpperCase()&&m.src||new URL("vbapm-build-Bhm_pqQW.js",document.baseURI).href)):"",R=t.join(I,"xdg-open"),{platform:$,arch:N}=r,W=async(e,r)=>{if(0===e.length)return;const t=[];for(const o of e)try{return await r(o)}catch(e){t.push(e)}throw new AggregateError(t,"Failed to open in all supported apps")},k=async e=>{const t=!0===(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e})[U];if(delete e[U],Array.isArray(e.app))return W(e.app,r=>k({...e,app:r,[U]:!0}));let o,{name:a,arguments:s=[]}=e.app??{};if(s=[...s],Array.isArray(a))return W(a,r=>k({...e,app:{name:r,arguments:s},[U]:!0}));if("browser"===a||"browserPrivate"===a){const r={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},t={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"};let o;if(v){const e=await(async()=>{const e=await q(),r=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:t}=await b(r,{powerShellPath:e});return t.trim()})();o=_.get(e)??{}}else o=await H();if(o.id in r){const i=r[o.id.toLowerCase()];if("browserPrivate"===a){if("safari"===i)throw new Error("Safari doesn't support opening in private mode via command line");s.push(t[i])}return k({...e,app:{name:Y[i],arguments:s}})}throw new Error(`${o.name} is not supported as a default browser`)}const c=[],l={};let u=!1;if(!v||w()||M||a||(u=await(async()=>(E??=(async()=>{try{const e=await q();return await n.access(e,n.constants.X_OK),!0}catch{return!1}})(),E))()),"darwin"===$)o="open",e.wait&&c.push("--wait-apps"),e.background&&c.push("--background"),e.newInstance&&c.push("--new"),a&&c.push("-a",a);else if("win32"===$||u){o=await q(),c.push(...b.argumentsPrefix),v||(l.windowsVerbatimArguments=!0),v&&e.target&&(e.target=await(async e=>{if(/^[a-z]+:\/\//i.test(e))return e;try{const{stdout:r}=await S("wslpath",["-aw",e],{encoding:"utf8"});return r.trim()}catch{return e}})(e.target));const r=["$ProgressPreference = 'SilentlyContinue';","Start"];e.wait&&r.push("-Wait"),a?(r.push(b.escapeArgument(a)),e.target&&s.push(e.target)):e.target&&r.push(b.escapeArgument(e.target)),s.length>0&&(s=s.map(e=>b.escapeArgument(e)),r.push("-ArgumentList",s.join(","))),e.target=b.encodeCommand(r.join(" ")),e.wait||(l.stdio="ignore")}else{if(a)o=a;else{const e=!I||"/"===I;let t=!1;try{await n.access(R,n.constants.X_OK),t=!0}catch{}o=r.versions.electron??("android"===$||e||!t)?"xdg-open":R}s.length>0&&c.push(...s),e.wait||(l.stdio="ignore",l.detached=!0)}"darwin"===$&&s.length>0&&c.push("--args",...s),e.target&&c.push(e.target);const d=i.spawn(o,c,l);return e.wait?new Promise((r,t)=>{d.once("error",t),d.once("close",o=>{e.allowNonzeroExitCode||0===o?r(d):t(new Error(`Exited with code ${o}`))})}):t?new Promise((e,r)=>{d.once("error",r),d.once("spawn",()=>{d.once("close",t=>{d.off("error",r),0===t?(d.unref(),e(d)):r(new Error(`Exited with code ${t}`))})})}):(d.unref(),new Promise((e,r)=>{d.once("error",r),d.once("spawn",()=>{d.off("error",r),e(d)})}))};function z(e){if("string"==typeof e||Array.isArray(e))return e;const{[N]:r}=e;if(!r)throw new Error(`${N} is not supported`);return r}function D({[$]:e},{wsl:r}={}){if(r&&v)return z(r);if(!e)throw new Error(`${$} is not supported`);return z(e)}const Y={browser:"browser",browserPrivate:"browserPrivate"};C(Y,"chrome",()=>D({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}})),C(Y,"brave",()=>D({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}})),C(Y,"firefox",()=>D({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"})),C(Y,"edge",()=>D({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"})),C(Y,"safari",()=>D({darwin:"Safari"}));const G=e.dedent`
|
|
2
|
+
Build project from manifest (after backing up any existing built targets).
|
|
3
|
+
|
|
4
|
+
Usage: vbapm build [options]
|
|
5
|
+
|
|
6
|
+
Options:
|
|
7
|
+
--target=TYPE Build target of type TYPE
|
|
8
|
+
--release Exclude dev-* items from build
|
|
9
|
+
--open Open built target`;exports.default=async function(e){if(e.help)return void console.log(G);const r=process.hrtime(),t=e.target,o=e.addin,i=!!e.release,n=await d.buildProject({target:t,addin:o,release:i});if(console.log(`Done. ${u.time(process.hrtime(r))}`),e.open){console.log(`Opening built target: ${n}`);try{await((e,r)=>{if("string"!=typeof e)throw new TypeError("Expected a `target`");return k({...r,target:e})})(n,{wait:!0})}catch(e){throw console.error(`Failed to open built target: ${(null==e?void 0:e.message)||e}`),e}}};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";var e=require("./installer-DPj-zT7L.js"),r=require("./export-project-CgFMyE-g.js");require("child_process"),require("util"),require("assert"),require("path"),require("fs"),require("./_commonjsHelpers-Bjf42z7h.js"),require("crypto"),require("events"),require("os"),require("constants"),require("stream"),require("http"),require("url"),require("punycode"),require("https"),require("zlib"),require("./transform-build-graph-DgRrocSn.js"),require("node:fs"),require("node:path"),require("node:buffer"),require("./project-BPmPCkUS.js"),require("./index-CBGUBgfk.js"),require("querystring"),require("./export-target-C0RYJqUX.js"),require("./load-from-project-ClF4qaC0.js"),require("./transform-target-CYhuozxP.js"),require("string_decoder");const t=e.dedent`
|
|
2
|
+
Export built project, including src, references, and target.
|
|
3
|
+
|
|
4
|
+
Usage: vbapm export
|
|
5
|
+
|
|
6
|
+
Options:
|
|
7
|
+
--target=TYPE Export target of type TYPE
|
|
8
|
+
--xml-only Only extract the target XML, skip VBA source export
|
|
9
|
+
--vba-only Only export the VBA source, skip target XML extraction`;exports.default=async function(e){if(e.help)return void console.log(t);const i=e.target,o=e.completed,s=e.addin,u=!!e["xml-only"],n=!!e["vba-only"];await r.exportProject({target:i,completed:o,addin:s,xmlOnly:u,vbaOnly:n})};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("./installer-
|
|
1
|
+
"use strict";var e=require("./installer-DPj-zT7L.js"),r=require("./init-project-9RKSVG_H.js");require("child_process"),require("util"),require("assert"),require("path"),require("fs"),require("./_commonjsHelpers-Bjf42z7h.js"),require("crypto"),require("events"),require("os"),require("constants"),require("stream"),require("http"),require("url"),require("punycode"),require("https"),require("zlib"),require("./index-CBGUBgfk.js"),require("./project-BPmPCkUS.js"),require("querystring"),require("./transform-build-graph-DgRrocSn.js"),require("node:fs"),require("node:path"),require("node:buffer"),require("./build-target-ooHNsSLD.js"),require("./load-from-project-ClF4qaC0.js"),require("./export-target-C0RYJqUX.js"),require("./transform-target-CYhuozxP.js"),require("string_decoder");const t=e.dedent`
|
|
2
2
|
Initialize a new project in the current directory
|
|
3
3
|
|
|
4
4
|
Usage: vbapm init [options]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("./installer-
|
|
1
|
+
"use strict";var e=require("./installer-DPj-zT7L.js"),r=require("./create-project-BYc3XMZw.js");require("child_process"),require("util"),require("assert"),require("path"),require("fs"),require("./_commonjsHelpers-Bjf42z7h.js"),require("crypto"),require("events"),require("os"),require("constants"),require("stream"),require("http"),require("url"),require("punycode"),require("https"),require("zlib"),require("./init-project-9RKSVG_H.js"),require("./index-CBGUBgfk.js"),require("./project-BPmPCkUS.js"),require("querystring"),require("./transform-build-graph-DgRrocSn.js"),require("node:fs"),require("node:path"),require("node:buffer"),require("./build-target-ooHNsSLD.js"),require("./load-from-project-ClF4qaC0.js"),require("./export-target-C0RYJqUX.js"),require("./transform-target-CYhuozxP.js"),require("string_decoder");const t=e.dedent`
|
|
2
2
|
Create a new project / package in a new directory
|
|
3
3
|
|
|
4
4
|
Usage: vbapm new <name> [options]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var r=require("./installer-DPj-zT7L.js"),e=require("./run-macro-C1-aJWu5.js");require("child_process"),require("util"),require("assert"),require("path"),require("fs"),require("./_commonjsHelpers-Bjf42z7h.js"),require("crypto"),require("events"),require("os"),require("constants"),require("stream"),require("http"),require("url"),require("punycode"),require("https"),require("zlib"),require("./transform-build-graph-DgRrocSn.js"),require("node:fs"),require("node:path"),require("node:buffer"),require("./project-BPmPCkUS.js"),require("./index-CBGUBgfk.js"),require("querystring"),require("./transform-target-CYhuozxP.js"),require("string_decoder"),require("./get-target-LUoY1UWJ.js");const i=r.dedent`
|
|
2
2
|
Run macro in given workbook or add-in.
|
|
3
3
|
|
|
4
4
|
Usage: vbapm run <macro> [<arg>...] [options]
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
<macro> Public macro to run in given file (e.g. Tests.RunTests)
|
|
8
8
|
<arg> Arguments to pass to macro (optional)
|
|
9
9
|
--target=TYPE Run in pre-built target of type TYPE
|
|
10
|
-
--file=PATH Full path to workbook or name of add-in`;exports.default=async function(
|
|
10
|
+
--file=PATH Full path to workbook or name of add-in`;exports.default=async function(r){if(r.help)return void console.log(i);const[t,...o]=r._,u=r.target;let s=r.file;await e.runMacro({target:u,file:s,macro:t,args:o})};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("./installer-
|
|
1
|
+
"use strict";var e=require("./installer-DPj-zT7L.js"),r=require("./test-project-DXBFZH3o.js");require("child_process"),require("util"),require("assert"),require("path"),require("fs"),require("./_commonjsHelpers-Bjf42z7h.js"),require("crypto"),require("events"),require("os"),require("constants"),require("stream"),require("http"),require("url"),require("punycode"),require("https"),require("zlib"),require("./run-macro-C1-aJWu5.js"),require("./transform-build-graph-DgRrocSn.js"),require("node:fs"),require("node:path"),require("node:buffer"),require("./project-BPmPCkUS.js"),require("./index-CBGUBgfk.js"),require("querystring"),require("./transform-target-CYhuozxP.js"),require("string_decoder"),require("./get-target-LUoY1UWJ.js");const t=e.dedent`
|
|
2
2
|
Run tests for built target.
|
|
3
3
|
|
|
4
4
|
Usage: vbapm test [options]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";var e=require("./installer-DPj-zT7L.js"),r=require("./index-C61lSPb5.js"),t=require("./project-BPmPCkUS.js"),i=require("./build-target-ooHNsSLD.js"),a=require("./get-target-LUoY1UWJ.js");require("child_process"),require("util"),require("assert"),require("path"),require("fs"),require("./_commonjsHelpers-Bjf42z7h.js"),require("crypto"),require("events"),require("os"),require("constants"),require("stream"),require("http"),require("url"),require("punycode"),require("https"),require("zlib"),require("./index-CBGUBgfk.js"),require("querystring"),require("./transform-build-graph-DgRrocSn.js"),require("node:fs"),require("node:path"),require("node:buffer"),require("./load-from-project-ClF4qaC0.js");const n=e.dedent`
|
|
2
|
+
Update VBA source in a built target (including one currently open in Excel).
|
|
3
|
+
|
|
4
|
+
Usage: vbapm update [options]
|
|
5
|
+
|
|
6
|
+
Options:
|
|
7
|
+
--target=TYPE Update VBA in a target of type TYPE
|
|
8
|
+
--release Exclude dev-* items from update
|
|
9
|
+
--open Leave the target open in Excel after updating`;exports.default=async function(o){if(o.help)return void console.log(n);const s=process.hrtime(),u=o.target,d=o.addin,p=!!o.release,l=!!o.open;await async function(r={}){e.env.reporter.log(e.Message.UpdateProjectLoading,"[1/2] Loading project...");const n=await t.loadProject(),{target:o}=a.getTarget(n,r.target),s=await t.fetchDependencies(n),u=e.join(n.paths.build,o.filename);if(!await e.pathExistsExports.pathExists(u))throw new e.CliError(e.ErrorCode.UpdateTargetNotBuilt,e.dedent`
|
|
10
|
+
No built target found for "${o.name}" at "${u}".
|
|
11
|
+
|
|
12
|
+
Run "vbapm build" first to create the built target.
|
|
13
|
+
`);return e.env.reporter.log(e.Message.UpdateTargetUpdating,`\n[2/2] Updating VBA in "${o.filename}"...`),await i.importTarget(o,{project:n,dependencies:s},u,{addin:r.addin,release:r.release,open:r.open}),u}({target:u,addin:d,release:p,open:l}),console.log(`Done. ${r.time(process.hrtime(s))}`)};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("./installer-
|
|
1
|
+
"use strict";var e=require("./installer-DPj-zT7L.js"),r=require("./index-CBGUBgfk.js"),i=require("./project-BPmPCkUS.js");require("child_process"),require("util"),require("assert"),require("path"),require("fs"),require("./_commonjsHelpers-Bjf42z7h.js"),require("crypto"),require("events"),require("os"),require("constants"),require("stream"),require("http"),require("url"),require("punycode"),require("https"),require("zlib"),require("querystring");const t=["patch","minor","major","prepatch","preminor","premajor","prerelease"];async function s(s,n={}){const o=await i.loadProject(),a=o.manifest.version,p=(c=s,t.includes(c));var c;let u;try{u=p?e.semverExports.inc(a,s,void 0,n.preid):e.semverExports.valid(s)}catch(e){}if(!u)throw new e.CliError(e.ErrorCode.InvalidVersion,`Invalid version increment "${s}"`);return o.manifest.version=u,await r.writeManifest(o.manifest,o.paths.dir),u}const n=e.dedent`
|
|
2
2
|
Increment this project's version.
|
|
3
3
|
|
|
4
4
|
Usage: vbapm version [<increment>] [options]
|
package/lib/vbapm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var e,r,n=require("./installer-
|
|
2
|
+
"use strict";var e,r,n=require("./installer-DPj-zT7L.js"),t=require("fs"),o=require("./_commonjsHelpers-Bjf42z7h.js");require("child_process"),require("util"),require("assert"),require("path"),require("crypto"),require("events"),require("os"),require("constants"),require("stream"),require("http"),require("url"),require("punycode"),require("https"),require("zlib");var i=(r||(r=1,e=function(e,r){var n=[],t=[];return r.forEach(function(r,t){var o={};o[function(e,r){var n=[],t=0;for(t=0;t<=e.length;t++)n[t]=[t];for(t=0;t<=r.length;t++)n[0][t]=t;return r.split("").forEach(function(r,t){e.split("").forEach(function(e,o){n[o+1][t+1]=e!==r?Math.min(n[o][t+1]+1,n[o+1][t]+1,n[o][t]+1):n[o][t]})}),n[e.length][r.length]}(e,r)]=t,n.push(o)}),n.sort(function(e,r){return Number(Object.keys(e)[0])-Number(Object.keys(r)[0])}),n.forEach(function(n){var o=Number(Object.keys(n)[0]);e.length/2>=o&&t.push(r[n[o]])}),t}),e),a=o.getDefaultExportFromCjs(i);function s(e){return null==e?[]:Array.isArray(e)?e:[e]}function l(e,r,n,t){var o,i=e[r],a=~t.string.indexOf(r)?null==n||!0===n?"":String(n):"boolean"==typeof n?n:~t.boolean.indexOf(r)?"false"!==n&&("true"===n||(e._.push(0*(o=+n)==0?o:n),!!n)):0*(o=+n)==0?o:n;e[r]=null==i?a:Array.isArray(i)?i.concat(a):[i,a]}Error.stackTraceLimit=1/0;const u=n.env.debug("vbapm:main"),c={new:async()=>(await Promise.resolve().then(function(){return require("./vbapm-new-YQRNQ4Iq.js")})).default,init:async()=>(await Promise.resolve().then(function(){return require("./vbapm-init-Ba2xCez2.js")})).default,add:async()=>(await Promise.resolve().then(function(){return require("./vbapm-add-CASFjXAL.js")})).default,build:async()=>(await Promise.resolve().then(function(){return require("./vbapm-build-Bhm_pqQW.js")})).default,test:async()=>(await Promise.resolve().then(function(){return require("./vbapm-test-C4KWMPLz.js")})).default,export:async()=>(await Promise.resolve().then(function(){return require("./vbapm-export-8KDCdFOz.js")})).default,update:async()=>(await Promise.resolve().then(function(){return require("./vbapm-update-DnbmW8tc.js")})).default,run:async()=>(await Promise.resolve().then(function(){return require("./vbapm-run-J-R--noZ.js")})).default,version:async()=>(await Promise.resolve().then(function(){return require("./vbapm-version-CRicT8YA.js")})).default},p=function(e,r){r=r||{};var n,t,o,i,a,u={_:[]},c=0,p=0,f=0,d=(e=e||[]).length;const h=void 0!==r.alias,m=void 0!==r.unknown,v=void 0!==r.default;if(r.alias=r.alias||{},r.string=s(r.string),r.boolean=s(r.boolean),h)for(n in r.alias)for(t=r.alias[n]=s(r.alias[n]),c=0;c<t.length;c++)(r.alias[t[c]]=t.concat(n)).splice(c,1);for(c=r.boolean.length;c-- >0;)for(p=(t=r.alias[r.boolean[c]]||[]).length;p-- >0;)r.boolean.push(t[p]);for(c=r.string.length;c-- >0;)for(p=(t=r.alias[r.string[c]]||[]).length;p-- >0;)r.string.push(t[p]);if(v)for(n in r.default)if(i=typeof r.default[n],t=r.alias[n]=r.alias[n]||[],void 0!==r[i])for(r[i].push(n),c=0;c<t.length;c++)r[i].push(t[c]);const g=m?Object.keys(r.alias):[];for(c=0;c<d;c++){if("--"===(o=e[c])){u._=u._.concat(e.slice(++c));break}for(p=0;p<o.length&&45===o.charCodeAt(p);p++);if(0===p)u._.push(o);else if("no-"===o.substring(p,p+3)){if(i=o.substring(p+3),m&&!~g.indexOf(i))return r.unknown(o);u[i]=!1}else{for(f=p+1;f<o.length&&61!==o.charCodeAt(f);f++);for(i=o.substring(p,f),a=o.substring(++f)||c+1===d||45===(""+e[c+1]).charCodeAt(0)||e[++c],t=2===p?[i]:i,f=0;f<t.length;f++){if(i=t[f],m&&!~g.indexOf(i))return r.unknown("-".repeat(p)+i);l(u,i,f+1<t.length||a,r)}}}if(v)for(n in r.default)void 0===u[n]&&(u[n]=r.default[n]);if(h)for(n in u)for(t=r.alias[n]||[];t.length>0;)u[t.shift()]=u[n];return u}(process.argv.slice(2),{alias:{v:"version",h:"help"}});if(p.debug){let e=p.debug;!0===e?e="*":Array.isArray(e)&&(e=e.join(","));const r=e.split(",").map(e=>`vbapm:${e}`),n=process.env.DEBUG?process.env.DEBUG.split(","):[];process.env.DEBUG=n.concat(r).join(",")}const f=n.dedent`
|
|
3
3
|
vbapm v${n.version}
|
|
4
4
|
|
|
5
5
|
Usage: vbapm [command] [options]
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
- build Build project from manifest
|
|
12
12
|
- test Run tests for built target
|
|
13
13
|
- export Export src from built target
|
|
14
|
+
- update Update VBA source in a built target
|
|
14
15
|
- run Run macro in document / add-in
|
|
15
16
|
- help Outputs this message or the help of the given command
|
|
16
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vbapm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "A package manager and build tool for VBA",
|
|
5
5
|
"repository": "https://github.com/vbapm/core.git",
|
|
6
6
|
"contributors": [
|
|
@@ -37,14 +37,17 @@
|
|
|
37
37
|
"typecheck": "tsc",
|
|
38
38
|
"deps": "npm i",
|
|
39
39
|
"dev": "run-s deps typecheck format:check test build:cli",
|
|
40
|
-
"test:e2e": "jest --config e2e.config.mjs --runInBand",
|
|
40
|
+
"test:e2e": "cross-env VBA_BACKGROUND_BUILD=0 jest --config e2e.config.mjs --runInBand",
|
|
41
|
+
"test:e2e:background": "cross-env VBA_BACKGROUND_BUILD=1 jest --config e2e.config.mjs --runInBand",
|
|
42
|
+
"test:e2e:updateSnapshots": "cross-env VBA_BACKGROUND_BUILD=0 jest --config e2e.config.mjs --runInBand --updateSnapshot",
|
|
41
43
|
"build": "rimraf lib && rollup -c rollup.config.mjs",
|
|
42
44
|
"build:lib": "run-s build && tsc -p tsconfig.build.json",
|
|
43
45
|
"build:cli": "run-s build && node scripts/ensure-vendor",
|
|
44
46
|
"build:dev": "cross-env NODE_ENV=development rollup -c rollup.config.mjs",
|
|
45
47
|
"build:addins": "cd addins && node --no-warnings ../scripts/build-addins",
|
|
46
48
|
"build:bootstrap": "cd scripts/bootstrap && node --no-warnings ../../lib/vbapm build",
|
|
47
|
-
"clean": "rimraf lib && rimraf dist && rimraf addins/build"
|
|
49
|
+
"clean": "rimraf lib && rimraf dist && rimraf addins/build",
|
|
50
|
+
"deploy:dev": "npm run build:dev && powershell -ExecutionPolicy Bypass -File ./installer/devinstall.ps1"
|
|
48
51
|
},
|
|
49
52
|
"dependencies": {
|
|
50
53
|
"@decimalturn/toml-patch": "^1.0.5",
|
|
@@ -3,42 +3,53 @@
|
|
|
3
3
|
-- appname (e.g. "excel")
|
|
4
4
|
-- addin: posix full path to addin (e.g. "...")
|
|
5
5
|
-- command: macro to execute in addin (e.g. "Build.ImportGraph")
|
|
6
|
+
-- keep_open: "1" to leave the workbook/app open after the macro, "0" to close
|
|
6
7
|
-- ...args: arguments to pass to macro (up to 10)
|
|
7
8
|
|
|
8
9
|
on run argv
|
|
9
10
|
set output to ""
|
|
10
11
|
|
|
11
|
-
if (count of argv) >=
|
|
12
|
+
if (count of argv) >= 4 and (count of argv) <= 14 then
|
|
12
13
|
set appname to (item 1 of argv)
|
|
13
14
|
set addin to POSIX file (item 2 of argv)
|
|
14
15
|
set command to (item 3 of argv)
|
|
16
|
+
set keep_open to (item 4 of argv) is "1"
|
|
15
17
|
|
|
16
18
|
set args to {}
|
|
17
|
-
repeat with index from
|
|
19
|
+
repeat with index from 5 to count of argv
|
|
18
20
|
set end of args to (item index of argv)
|
|
19
21
|
end repeat
|
|
20
22
|
|
|
21
23
|
if appname is "excel" then
|
|
22
24
|
set workbook_name to name of (info for addin)
|
|
23
25
|
|
|
26
|
+
set excel_was_open to application "Microsoft Excel" is running
|
|
27
|
+
|
|
24
28
|
tell application "Microsoft Excel"
|
|
25
29
|
set workbook_was_open to (exists workbook workbook_name)
|
|
26
30
|
if not workbook_was_open then
|
|
27
31
|
open workbook workbook file name addin without notify
|
|
28
32
|
end if
|
|
29
33
|
|
|
30
|
-
set output to
|
|
34
|
+
set output to my run_excel_macro(command, args)
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
-- A workbook that was already open is never closed by us.
|
|
37
|
+
-- Otherwise close it unless keep_open was requested.
|
|
38
|
+
if not workbook_was_open and not keep_open then
|
|
33
39
|
close workbook workbook_name saving yes
|
|
34
40
|
end if
|
|
35
41
|
end tell
|
|
42
|
+
|
|
43
|
+
-- Quit Excel only if we launched it AND we are not keeping the file open.
|
|
44
|
+
if not excel_was_open and not keep_open then
|
|
45
|
+
tell application "Microsoft Excel" to quit
|
|
46
|
+
end if
|
|
36
47
|
end if
|
|
37
48
|
else
|
|
38
|
-
if (count of argv) <
|
|
39
|
-
set output to
|
|
49
|
+
if (count of argv) < 4 then
|
|
50
|
+
set output to "ERROR #1: Invalid Input (appname, file, macro, and keep_open are required)"
|
|
40
51
|
else
|
|
41
|
-
set output to
|
|
52
|
+
set output to "ERROR #2: Invalid Input (only 10 arguments are supported)"
|
|
42
53
|
end if
|
|
43
54
|
end if
|
|
44
55
|
|