vbapm 0.6.15 → 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 +86 -0
- package/addins/build/vbapm.xlam +0 -0
- package/lib/actions/add-source.d.ts +11 -0
- package/lib/actions/export-project.d.ts +2 -0
- package/lib/actions/update-project.d.ts +7 -0
- package/lib/add-source-BOumGmx7.js +17 -0
- package/lib/addin.d.ts +1 -0
- package/lib/bin/vbapm-add.d.ts +2 -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-CPIRr0DV.js → create-project-BYc3XMZw.js} +1 -1
- package/lib/debug.js +1 -1
- package/lib/errors.d.ts +6 -0
- package/lib/export-project-CgFMyE-g.js +4 -0
- package/lib/export-target-C0RYJqUX.js +4 -0
- package/lib/{get-target-CH6IpAa1.js → get-target-LUoY1UWJ.js} +1 -1
- package/lib/index-C61lSPb5.js +1 -0
- package/lib/index-CBGUBgfk.js +13 -0
- package/lib/index-ClUEyMCY.js +6 -0
- package/lib/{index-Dg07BXJE.js → index-Cp8MNK26.js} +1 -1
- package/lib/{index-D-khpcjL.js → index-Dv6JxqGo.js} +9 -9
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/lib/init-project-9RKSVG_H.js +15 -0
- package/lib/installer-DPj-zT7L.js +9 -0
- package/lib/{load-from-project-Bpb6Ne_i.js → load-from-project-ClF4qaC0.js} +1 -1
- package/lib/messages.d.ts +2 -0
- package/lib/one_ini_bg.wasm +0 -0
- package/lib/project-BPmPCkUS.js +20 -0
- package/lib/run-macro-C1-aJWu5.js +1 -0
- package/lib/sat-solver-B6RXdyQs.js +1 -0
- 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/toml-patch-r8oqFm0h.js +3 -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-CASFjXAL.js +16 -0
- package/lib/vbapm-build-Bhm_pqQW.js +9 -0
- package/lib/vbapm-export-8KDCdFOz.js +9 -0
- package/lib/{vbapm-init-csKsZ87H.js → vbapm-init-Ba2xCez2.js} +1 -1
- package/lib/{vbapm-new-Dt0tX1xQ.js → vbapm-new-YQRNQ4Iq.js} +1 -1
- package/lib/{vbapm-run-Ccciwg2y.js → vbapm-run-J-R--noZ.js} +2 -2
- package/lib/{vbapm-test-u7AWC-AV.js → vbapm-test-C4KWMPLz.js} +1 -1
- package/lib/vbapm-update-DnbmW8tc.js +13 -0
- package/lib/vbapm-version-CRicT8YA.js +8 -0
- package/lib/vbapm.js +3 -1
- package/package.json +127 -137
- package/run-scripts/run.applescript +18 -7
- package/run-scripts/run.ps1 +42 -10
- package/lib/build-project-BczswKQl.js +0 -3
- package/lib/build-target-D6L5nsgt.js +0 -9
- package/lib/export-project-DQ3bfvbV.js +0 -4
- package/lib/export-target-CN6RA_mA.js +0 -4
- package/lib/index-DXFu_Z-o.js +0 -6
- package/lib/init-project-dRuDA4YO.js +0 -15
- package/lib/installer-CJlDenLg.js +0 -9
- package/lib/project-C3bWzV0O.js +0 -29
- package/lib/run-macro-D_9-BO3U.js +0 -1
- package/lib/sat-solver-5AniWyxz.js +0 -1
- package/lib/test-project-BTkTNZXs.js +0 -1
- package/lib/toml-patch.es-CxrbsPnB.js +0 -3
- package/lib/transform-target-Doak2S1q.js +0 -2
- package/lib/vbapm-build-B1OOy6VL.js +0 -9
- package/lib/vbapm-export-vvUDCDqi.js +0 -7
- package/lib/vbapm-version-Bsb-cWCD.js +0 -8
|
@@ -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))}`)};
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
Increment this project's version.
|
|
3
|
+
|
|
4
|
+
Usage: vbapm version [<increment>] [options]
|
|
5
|
+
|
|
6
|
+
Options:
|
|
7
|
+
<increment> VERSION | patch | minor | major | prepatch | preminor | premajor
|
|
8
|
+
--preid=TYPE Use TYPE for prerelease (e.g. "beta")`;exports.default=async function(e){if(e.help)return void console.log(n);const r=e._[0]||"patch",i=e.preid,t=await s(r,{preid:i});console.log(t)};
|
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]
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
Commands:
|
|
8
8
|
- new Create a new project / package in a new directory
|
|
9
9
|
- init Initialize a new project / package in the current directory
|
|
10
|
+
- add Create and register a new src file in vbaproject.toml
|
|
10
11
|
- build Build project from manifest
|
|
11
12
|
- test Run tests for built target
|
|
12
13
|
- export Export src from built target
|
|
14
|
+
- update Update VBA source in a built target
|
|
13
15
|
- run Run macro in document / add-in
|
|
14
16
|
- help Outputs this message or the help of the given command
|
|
15
17
|
|
package/package.json
CHANGED
|
@@ -1,142 +1,132 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
],
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"bin": {
|
|
12
|
-
"vbapm": "lib/vbapm.js",
|
|
13
|
-
"vba": "lib/vbapm.js"
|
|
14
|
-
},
|
|
15
|
-
"main": "lib/index.js",
|
|
16
|
-
"types": "lib/src/index.d.ts",
|
|
17
|
-
"exports": {
|
|
18
|
-
".": {
|
|
19
|
-
"require": "./lib/index.js",
|
|
20
|
-
"types": "./lib/src/index.d.ts"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"lib/",
|
|
25
|
-
"addins/build/",
|
|
26
|
-
"run-scripts/",
|
|
27
|
-
"LICENSE",
|
|
28
|
-
"README.md"
|
|
29
|
-
],
|
|
30
|
-
"engines": {
|
|
31
|
-
"node": ">=18.0.0"
|
|
32
|
-
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"format": "prettier --write \"**/*.{ts,js}\"",
|
|
35
|
-
"format:check": "prettier --check \"**/*.{ts,js}\"",
|
|
36
|
-
"test": "jest --runInBand",
|
|
37
|
-
"typecheck": "tsc",
|
|
38
|
-
"deps": "npm i",
|
|
39
|
-
"dev": "run-s deps typecheck format:check test build:cli",
|
|
40
|
-
"test:e2e": "jest --config e2e.config.cjs --runInBand",
|
|
41
|
-
"build": "rimraf lib && rollup -c rollup.config.mjs",
|
|
42
|
-
"build:lib": "run-s build && tsc -p tsconfig.build.json",
|
|
43
|
-
"build:cli": "run-s build && node scripts/ensure-vendor",
|
|
44
|
-
"build:dev": "cross-env NODE_ENV=development rollup -c rollup.config.mjs",
|
|
45
|
-
"build:addins": "cd addins && node --no-warnings ../scripts/build-addins",
|
|
46
|
-
"build:bootstrap": "cd scripts/bootstrap && node --no-warnings ../../lib/vbapm build",
|
|
47
|
-
"clean": "rimraf lib && rimraf dist && rimraf addins/build"
|
|
48
|
-
},
|
|
49
|
-
"jest": {
|
|
50
|
-
"preset": "ts-jest",
|
|
51
|
-
"testEnvironment": "node",
|
|
52
|
-
"testPathIgnorePatterns": [
|
|
53
|
-
"/node_modules/",
|
|
54
|
-
"/lib/"
|
|
2
|
+
"name": "vbapm",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "A package manager and build tool for VBA",
|
|
5
|
+
"repository": "https://github.com/vbapm/core.git",
|
|
6
|
+
"contributors": [
|
|
7
|
+
"Martin Leduc <31558169+DecimalTurn@users.noreply.github.com> (https://github.com/DecimalTurn)",
|
|
8
|
+
"Tim Hall <tim.hall.engr@gmail.com> (https://github.com/timhall)"
|
|
55
9
|
],
|
|
56
|
-
"
|
|
57
|
-
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"bin": {
|
|
12
|
+
"vbapm": "lib/vbapm.js",
|
|
13
|
+
"vba": "lib/vbapm.js"
|
|
58
14
|
},
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
"
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
15
|
+
"main": "lib/index.js",
|
|
16
|
+
"types": "lib/src/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"require": "./lib/index.js",
|
|
20
|
+
"types": "./lib/src/index.d.ts"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"lib/",
|
|
25
|
+
"addins/build/",
|
|
26
|
+
"run-scripts/",
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"README.md"
|
|
29
|
+
],
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18.14.0"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"format": "prettier --write \"**/*.{ts,js}\"",
|
|
35
|
+
"format:check": "prettier --check \"**/*.{ts,js}\"",
|
|
36
|
+
"test": "jest --runInBand",
|
|
37
|
+
"typecheck": "tsc",
|
|
38
|
+
"deps": "npm i",
|
|
39
|
+
"dev": "run-s deps typecheck format:check test build:cli",
|
|
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",
|
|
43
|
+
"build": "rimraf lib && rollup -c rollup.config.mjs",
|
|
44
|
+
"build:lib": "run-s build && tsc -p tsconfig.build.json",
|
|
45
|
+
"build:cli": "run-s build && node scripts/ensure-vendor",
|
|
46
|
+
"build:dev": "cross-env NODE_ENV=development rollup -c rollup.config.mjs",
|
|
47
|
+
"build:addins": "cd addins && node --no-warnings ../scripts/build-addins",
|
|
48
|
+
"build:bootstrap": "cd scripts/bootstrap && node --no-warnings ../../lib/vbapm build",
|
|
49
|
+
"clean": "rimraf lib && rimraf dist && rimraf addins/build",
|
|
50
|
+
"deploy:dev": "npm run build:dev && powershell -ExecutionPolicy Bypass -File ./installer/devinstall.ps1"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@decimalturn/toml-patch": "^1.0.5",
|
|
54
|
+
"@timhall/ansi-colors": "^5.0.0",
|
|
55
|
+
"@timhall/dedent": "^0.10.0",
|
|
56
|
+
"archiver": "^7.0.1",
|
|
57
|
+
"conf": "^3",
|
|
58
|
+
"date-fns": "^4.0.0",
|
|
59
|
+
"debug": "^4",
|
|
60
|
+
"decompress": "^4",
|
|
61
|
+
"editorconfig": "^3.0.0",
|
|
62
|
+
"env-paths": "^2",
|
|
63
|
+
"fs-extra": "^7",
|
|
64
|
+
"isomorphic-git": "^1.37.1",
|
|
65
|
+
"logic-solver": "^2",
|
|
66
|
+
"meant": "^2.0.0",
|
|
67
|
+
"mri": "^1",
|
|
68
|
+
"node-fetch": "^2",
|
|
69
|
+
"open": "^11.0.0",
|
|
70
|
+
"pretty-hrtime": "^1",
|
|
71
|
+
"sanitize-filename": "^1",
|
|
72
|
+
"semver": "^7.0.0",
|
|
73
|
+
"tmp": "^0.2.5",
|
|
74
|
+
"walk-sync": "^4.0.1",
|
|
75
|
+
"xml-js": "^1.6"
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
79
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
80
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
81
|
+
"@rollup/plugin-replace": "^6.0.2",
|
|
82
|
+
"@rollup/plugin-terser": "^1.0.0",
|
|
83
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
84
|
+
"@types/archiver": "^7.0.0",
|
|
85
|
+
"@types/fs-extra": "^5",
|
|
86
|
+
"@types/jest": "^30",
|
|
87
|
+
"@types/node": "^24.0.0",
|
|
88
|
+
"@types/node-fetch": "^2.6.13",
|
|
89
|
+
"@types/semver": "^7.0.0",
|
|
90
|
+
"@types/tmp": "^0.2.0",
|
|
91
|
+
"aws-sdk": "^2.562.0",
|
|
92
|
+
"builtin-modules": "^5.0.0",
|
|
93
|
+
"cross-env": "^10.0.0",
|
|
94
|
+
"dotenv": "^17.0.0",
|
|
95
|
+
"jest": "^30",
|
|
96
|
+
"mustache": "^4.0.0",
|
|
97
|
+
"npm-run-all2": "^8.0.0",
|
|
98
|
+
"prettier": "^3",
|
|
99
|
+
"rimraf": "^6.1.3",
|
|
100
|
+
"rollup": "^4.34.9",
|
|
101
|
+
"ts-jest": "^29",
|
|
102
|
+
"tslib": "^2.0.0",
|
|
103
|
+
"typescript": "^5",
|
|
104
|
+
"url-join": "^5.0.0"
|
|
105
|
+
},
|
|
106
|
+
"overrides": {
|
|
107
|
+
"minimatch": "^10.2.1"
|
|
108
|
+
},
|
|
109
|
+
"json-comments": {
|
|
110
|
+
"tips": "You may install the JsonComments plugin to enable commenting functionality for JSON files, see: https://github.com/zhangfisher/json_comments_extension",
|
|
111
|
+
"package.json": {
|
|
112
|
+
"scripts.format": "Formats all .ts and .js files using Prettier",
|
|
113
|
+
"scripts.format:check": "Checks all .ts and .js files with Prettier",
|
|
114
|
+
"scripts.test": "Runs Jest tests in a single thread",
|
|
115
|
+
"scripts.typecheck": "Runs the TypeScript compiler to check for type errors",
|
|
116
|
+
"scripts.test:e2e": "Runs end-to-end tests using a specific Jest configuration",
|
|
117
|
+
"scripts.build:lib": "Core build: rollup bundle + .d.ts generation (used by both npm and standalone channels)",
|
|
118
|
+
"scripts.build:cli": "Standalone CLI build: rollup bundle (no sourcemaps, no .d.ts) + fetch vendored Node binary",
|
|
119
|
+
"scripts.build:dev": "Allows to quickly rebuild the project in development mode with environment variables set for easier debugging of the js/ts code",
|
|
120
|
+
"scripts.build:addins": "Builds the add-ins by running a custom build script in the addins directory",
|
|
121
|
+
"scripts.build:bootstrap": "Update the bootstrap file (used to build the addin) by using the latest addin build (inception!)",
|
|
122
|
+
"scripts.clean": "Removes generated files from lib, dist, and addins/build directories",
|
|
123
|
+
"devDependencies.cross-env": "Used to set environment variables in a cross-platform-compatible way for build scripts",
|
|
124
|
+
"jest.transformIgnorePatterns": "@decimalturn/toml-patch v1+ is ESM-only. Jest (running in CJS mode via ts-jest) skips transforming node_modules by default, which causes 'Unexpected token export' errors. This pattern excludes toml-patch from that skip list so ts-jest can downcompile it to CJS at test time.",
|
|
125
|
+
"jest.transform": "Required alongside transformIgnorePatterns: overrides the default ts-jest transform to add allowJs:true so ts-jest can process the plain .js ESM dist file of @decimalturn/toml-patch.",
|
|
126
|
+
"overrides": "Pins vulnerable transitive dependencies to patched versions to remove critical npm audit findings without large upstream upgrades.",
|
|
127
|
+
"overrides.minimist": "Prototype pollution fix, mainly needed for ts-jest/handlebars transitive chain.",
|
|
128
|
+
"overrides.underscore": "Arbitrary code execution mitigation, mainly needed for logic-solver transitive dependency.",
|
|
129
|
+
"overrides.shell-quote": "Command injection advisory mitigation, mainly needed for npm-run-all transitive dependency."
|
|
130
|
+
}
|
|
140
131
|
}
|
|
141
|
-
}
|
|
142
132
|
}
|
|
@@ -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
|
|
package/run-scripts/run.ps1
CHANGED
|
@@ -8,6 +8,8 @@ param(
|
|
|
8
8
|
[Parameter(Position=2)]
|
|
9
9
|
[string]$Command,
|
|
10
10
|
|
|
11
|
+
[switch]$KeepOpen,
|
|
12
|
+
|
|
11
13
|
[Parameter(Position=3, ValueFromRemainingArguments=$true)]
|
|
12
14
|
[string[]]$MacroArgs
|
|
13
15
|
)
|
|
@@ -90,6 +92,7 @@ function RunMacro {
|
|
|
90
92
|
|
|
91
93
|
class Excel {
|
|
92
94
|
hidden [object]$App
|
|
95
|
+
hidden [bool]$BackgroundBuild = $false
|
|
93
96
|
hidden [bool]$ExcelWasOpen = $false
|
|
94
97
|
hidden [object]$Workbook
|
|
95
98
|
hidden [bool]$WorkbookWasOpen = $false
|
|
@@ -106,13 +109,29 @@ class Excel {
|
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
hidden [void] OpenExcel() {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
# When VBA_BACKGROUND_BUILD is set, always create a new hidden instance
|
|
113
|
+
# instead of attaching to an already-running (visible) Excel process.
|
|
114
|
+
# This prevents the application window from flashing during automated runs.
|
|
115
|
+
$this.BackgroundBuild = $env:VBA_BACKGROUND_BUILD -match '^(1|true|yes)$'
|
|
116
|
+
|
|
117
|
+
if (-not $this.BackgroundBuild) {
|
|
118
|
+
try {
|
|
119
|
+
$this.App = [System.Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application")
|
|
120
|
+
$this.ExcelWasOpen = $true
|
|
121
|
+
} catch {
|
|
122
|
+
# Excel not running; fall through to create a new instance
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (-not $this.ExcelWasOpen) {
|
|
113
127
|
try {
|
|
114
128
|
$this.App = New-Object -ComObject "Excel.Application"
|
|
115
|
-
$this.App.Visible = $false
|
|
129
|
+
$this.App.Visible = if ($this.BackgroundBuild) { $false } else { $true }
|
|
130
|
+
$this.App.ScreenUpdating = $false
|
|
131
|
+
$this.App.DisplayStatusBar = $false
|
|
132
|
+
$this.App.PrintCommunication = $false
|
|
133
|
+
$this.App.EnableAnimations = $false
|
|
134
|
+
$this.App.EnableEvents = $false
|
|
116
135
|
} catch {
|
|
117
136
|
Fail "ERROR #5: Failed to open Excel - $($_.Exception.Message)"
|
|
118
137
|
}
|
|
@@ -147,17 +166,29 @@ class Excel {
|
|
|
147
166
|
# Open the workbook
|
|
148
167
|
try {
|
|
149
168
|
$this.Workbook = $this.App.Workbooks.Open($Path)
|
|
169
|
+
# Workbooks.Open() can flip Excel back to visible; re-enforce
|
|
170
|
+
# invisible mode if we created this instance for automation.
|
|
171
|
+
# Also apply workbook-level performance flags now that a workbook is open.
|
|
172
|
+
if ($this.BackgroundBuild) {
|
|
173
|
+
$this.App.Visible = $false
|
|
174
|
+
try { $this.App.Calculation = -4135 } catch {} # xlCalculationManual — requires an open workbook
|
|
175
|
+
|
|
176
|
+
}
|
|
150
177
|
} catch {
|
|
151
178
|
Fail "ERROR #6: Failed to open workbook - $($_.Exception.Message)"
|
|
152
179
|
}
|
|
153
180
|
}
|
|
154
181
|
|
|
155
|
-
[void] Dispose() {
|
|
156
|
-
|
|
182
|
+
[void] Dispose([bool]$KeepOpen) {
|
|
183
|
+
# A file that was open before we started is never closed by us
|
|
184
|
+
$closeWorkbook = -not $this.WorkbookWasOpen -and -not $KeepOpen
|
|
185
|
+
|
|
186
|
+
if ($closeWorkbook -and $null -ne $this.Workbook) {
|
|
157
187
|
$this.Workbook.Close($true)
|
|
158
188
|
$this.Workbook = $null
|
|
159
189
|
}
|
|
160
|
-
if
|
|
190
|
+
# Quit Excel only if we launched it AND we are not keeping the file open
|
|
191
|
+
if (-not $this.ExcelWasOpen -and -not $KeepOpen -and $null -ne $this.App) {
|
|
161
192
|
$this.App.Quit()
|
|
162
193
|
[System.Runtime.InteropServices.Marshal]::ReleaseComObject($this.App) | Out-Null
|
|
163
194
|
$this.App = $null
|
|
@@ -174,6 +205,7 @@ function Run {
|
|
|
174
205
|
[string]$AppName,
|
|
175
206
|
[string]$FilePath,
|
|
176
207
|
[string]$MacroName,
|
|
208
|
+
[bool]$KeepOpen,
|
|
177
209
|
[string[]]$MacroArgValues
|
|
178
210
|
)
|
|
179
211
|
|
|
@@ -183,7 +215,7 @@ function Run {
|
|
|
183
215
|
try {
|
|
184
216
|
$result = $excel.Run($FilePath, $MacroName, $MacroArgValues)
|
|
185
217
|
} finally {
|
|
186
|
-
$excel.Dispose()
|
|
218
|
+
$excel.Dispose($KeepOpen)
|
|
187
219
|
}
|
|
188
220
|
}
|
|
189
221
|
default {
|
|
@@ -214,5 +246,5 @@ foreach ($arg in $MacroArgs) {
|
|
|
214
246
|
$UnescapedArgs += Unescape $arg
|
|
215
247
|
}
|
|
216
248
|
|
|
217
|
-
Run $AppName $File $Command $UnescapedArgs
|
|
249
|
+
Run $AppName $File $Command $KeepOpen.IsPresent $UnescapedArgs
|
|
218
250
|
exit 0
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("./installer-CJlDenLg.js"),r=require("./project-C3bWzV0O.js"),t=require("./build-target-D6L5nsgt.js");require("assert"),require("./transform-target-Doak2S1q.js"),require("fs");var i=require("./get-target-CH6IpAa1.js");exports.buildProject=async function(n={}){e.env.reporter.log(e.Message.BuildProjectLoading,"[1/3] Loading project...");const a=await r.loadProject(),{target:s,blankTarget:o}=i.getTarget(a,n.target),g=await r.fetchDependencies(a),c=a.packages.map(e=>{const t=r.toDependency(e);return r.isRegistryDependency(t)?`${e.id} registry+${t.registry}`:`${e.id} ${e.source}`});e.env.reporter.log(e.Message.BuildTargetBuilding,e.dedent`
|
|
2
|
-
\n[2/3] Building target "${s.type}" for "${a.manifest.name}"...
|
|
3
|
-
${c.length?`\nDependencies:\n${c.join("\n")}`:""}`),await t.buildTarget(s,{project:a,dependencies:g,blankTarget:o},n);const d=!a.hasDirtyLockfile;return e.env.reporter.log(e.Message.BuildLockfileWriting,"\n[3/3] Writing lockfile..."+(d?" (skipped, no changes)":"")),d||await r.writeLockfile(a.paths.root,a),e.join(a.paths.dir,"build",s.filename)};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";var t=require("./installer-CJlDenLg.js"),a=require("./transform-target-Doak2S1q.js");require("assert");var r=require("./load-from-project-Bpb6Ne_i.js"),e=require("path"),i=require("./project-C3bWzV0O.js");const o=t=>/1004/.test(t),n=(a,r)=>t.dedent`
|
|
2
|
-
Failed to build target "${a.name}", it is currently open.
|
|
3
|
-
|
|
4
|
-
Please close "${r}" and try again.
|
|
5
|
-
`;async function s(a,r){if(!await t.pathExistsExports.pathExists(r.path))throw new t.CliError(t.ErrorCode.TargetNotFound,`Target "${r.name}" not found at "${r.path}".`);const e=t.join(a.paths.staging,r.filename);try{await t.mkdirsExports.ensureDir(a.paths.staging),await i.zip(r.path,e)}catch(a){throw new t.CliError(t.ErrorCode.TargetCreateFailed,`Failed to create project for target "${r.name}".`,a)}return e}exports.buildTarget=async function(i,p,c={}){const{project:l}=p;let m;try{m=p.blankTarget?await a.createDocument(l,i,{staging:!0}):await s(l,i)}catch(a){if(!t.isRunError(a)||!a.result.errors.some(o))throw a;const r=t.join(l.paths.build,i.filename);throw new t.CliError(t.ErrorCode.TargetIsOpen,n(i,r))}await async function(i,o,n,s={}){const{project:p,dependencies:c}=o,l=t.join(p.paths.staging,"import");await t.mkdirsExports.ensureDir(l),await t.emptyExports.emptyDir(l);const m=await r.loadFromProject(p,c,s),w=await async function(a,r){const i=await t.parallel(a.components,async a=>{const i=t.join(r,a.filename);if(await t.writeFile(i,a.code),a.binaryPath){const i=t.join(r,e.basename(a.binaryPath));if(!a.details.binary)throw new Error(`Binary data missing for component "${a.name}"`);await t.writeFile(i,a.details.binary)}return{name:a.name,path:i}});return{name:a.name,components:i,references:a.references}}(m,l);try{await a.importGraph(p,i,w,n,s)}catch(a){throw new t.CliError(t.ErrorCode.TargetImportFailed,`Failed to import project for target "${i.name}".`,a)}finally{await t.removeExports.remove(l)}}(i,p,m,c);try{await async function(a,r){const e=t.join(a.paths.backup,r.filename),i=t.join(a.paths.build,r.filename);await t.pathExistsExports.pathExists(e)&&await t.removeExports.remove(e);if(await t.pathExistsExports.pathExists(i)){await t.mkdirsExports.ensureDir(a.paths.backup);try{await t.moveExports.move(i,e)}catch(a){throw new t.CliError(t.ErrorCode.TargetIsOpen,n(r,i))}}}(l,i);const a=t.join(l.paths.build,i.filename);await t.moveExports.move(m,a)}catch(a){throw await async function(a,r){const e=t.join(a.paths.backup,r.filename),i=t.join(a.paths.build,r.filename);if(!await t.pathExistsExports.pathExists(e))return;try{await t.copyExports.copy(e,i)}catch(a){throw new t.CliError(t.ErrorCode.TargetRestoreFailed,t.dedent`
|
|
6
|
-
Failed to automatically restore backup from "${e}" to "${i}".
|
|
7
|
-
|
|
8
|
-
The previous version can be moved back manually, if desired.
|
|
9
|
-
`,a)}}(l,i),a}finally{await t.removeExports.remove(m)}};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("./installer-CJlDenLg.js"),t=require("./transform-target-Doak2S1q.js"),r=require("./project-C3bWzV0O.js");require("assert"),require("fs");var o=require("./export-target-CN6RA_mA.js");exports.exportProject=async function(a={}){e.env.reporter.log(e.Message.ExportProjectLoading,"[1/3] Loading project...");const i=await r.loadProject();if(!a.target&&!i.manifest.target)throw new e.CliError(e.ErrorCode.ExportNoTarget,e.dedent`
|
|
2
|
-
No default target found for project,
|
|
3
|
-
use --target TYPE to export from a specific target.
|
|
4
|
-
`);let n,s=!1;if(i.manifest.target)a.target&&a.target!==i.manifest.target.type||(n=i.manifest.target);else{const t=a.target,r=i.manifest.name;n={type:t,name:r,path:`targets/${t}`,filename:`${e.sanitize(r)}.${t}`},s=!0}if(!n)throw new e.CliError(e.ErrorCode.ExportNoMatching,`No matching target found for type "${a.target}" in project.`);const p=await r.fetchDependencies(i);let g;try{a.completed?g=a.completed:(g=e.join(i.paths.staging,"export"),e.env.reporter.log(e.Message.ExportToStaging,`\n[2/3] Exporting src from "${n.filename}"`),await e.mkdirsExports.ensureDir(g),await e.emptyExports.emptyDir(g),await t.exportTo(i,n,g,a)),e.env.reporter.log(e.Message.ExportToProject,"\n[3/3] Updating project"),await o.exportTarget(n,{project:i,dependencies:p,blankTarget:s},g)}catch(e){throw e}finally{g&&await e.removeExports.remove(g)}};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("./installer-CJlDenLg.js"),n=require("./project-C3bWzV0O.js"),t=require("path"),r=require("./load-from-project-Bpb6Ne_i.js"),o=require("./transform-target-Doak2S1q.js");async function a(t,r){for(const n of r.components.added){const r={name:n.name,path:e.join(t.paths.dir,`src/${n.filename}`)};t.manifest.src.push(r)}for(const e of r.components.removed){const n=t.manifest.src.findIndex(n=>n.name===e.name);t.manifest.src.splice(n,1)}for(let e of r.references.added)t.manifest.references.push(e);for(const e of r.references.removed){const n=t.manifest.references.findIndex(n=>n.name===e.name);t.manifest.references.splice(n,1)}await n.writeManifest(t.manifest,t.paths.dir)}async function s(n,r){const o=t.dirname(n);if(await e.mkdirsExports.ensureDir(o),await e.writeFile(n,r.code),r.binaryPath){if(!r.details.binary)throw new Error(`Binary data missing for component "${r.name}"`);await e.writeFile(e.join(o,r.binaryPath),r.details.binary)}}require("assert");const i=[".frx"];async function c(n){const a=o.walk(n,{directories:!1}).filter(e=>"project.json"!==e&&!e.startsWith("target")&&!e.startsWith("staged")&&!(e=>!(""!==t.extname(e)))(e)).map(t=>e.join(n,t)),{name:s,references:c}=await async function(n){const t=e.join(n,"project.json");if(!await e.pathExistsExports.pathExists(t))return{name:"VBAProject",references:[]};return await e.jsonfileExports.readJson(t)}(n),m={},d=a.filter(e=>{if(!function(e){return i.includes(t.extname(e))}(e))return!0;const n=p(e);return m[n]=e,!1}),f=await e.parallel(d,async n=>{const o=p(n),a=r.extensionToType[t.extname(n)],s=await e.readFile(n),i=m[o]&&await e.readFile(m[o]);if(!a)throw new e.CliError(e.ErrorCode.ComponentUnrecognized,`Unrecognized component extension "${t.extname(n)}" (at "${n}").`);return new r.Component(a,s,{binary:i})},{progress:e.env.reporter.progress("Loading exported components")});return f.sort(r.byComponentName),{name:s,components:f,references:c,fromDependencies:{components:new Map,references:new Map}}}function p(e){return t.basename(e,t.extname(e))}async function m(r,a,s){let i=e.join(r.paths.build,a.filename);const c=e.join(s,"target");if(!await e.pathExistsExports.pathExists(i))throw new e.CliError(e.ErrorCode.ExportTargetNotFound,e.dedent`
|
|
2
|
-
Could not find built target for type "${a.type}"
|
|
3
|
-
(checked "${i}").
|
|
4
|
-
`);if(!e.env.isWindows){const n=e.join(s,"staged",a.filename);await e.pathExistsExports.pathExists(n)||(await e.mkdirsExports.ensureDir(t.dirname(n)),await e.copyExports.copy(i,n)),i=n}return await e.mkdirsExports.ensureDir(c),await n.unzip(i,c,{filter:o.filterTarget,map:o.mapTarget}),c}exports.exportTarget=async function(n,t,i){const{project:p,dependencies:d,blankTarget:f}=t;let l;f||(l=await m(p,n,i));const u=await r.loadFromProject(p,d),w=await c(i),h=function(e,n){const t={components:{added:[],changed:[],removed:[]},references:{added:[],changed:[],removed:[]}},o={components:new Map,references:new Map};for(const n of e.components)o.components.set(n.name,n);for(const n of e.references)o.references.set(n.name,n);for(const r of n.components){const n=r.name,a=o.components.get(n);o.components.delete(n),a&&e.fromDependencies.components.has(a)||(a?r.code!==a.code&&(r.details.path=a.details.path,t.components.changed.push(r)):t.components.added.push(r))}for(const e of o.components.values())t.components.removed.push(e);t.components.added.sort(r.byComponentName),t.components.changed.sort(r.byComponentName),t.components.removed.sort(r.byComponentName);for(const r of n.references){const n=r.name,a=o.references.get(n);o.references.delete(n),a&&e.fromDependencies.references.has(a)||(a?r.guid===a.guid&&r.major===a.major&&r.minor===a.minor||t.references.changed.push(r):t.references.added.push(r))}for(const e of o.references.values())t.references.removed.push(e);return t}(u,await o.toSrc(w));await async function(n,t){const r=e.env.reporter.progress("Updating src files"),o=r.start,i=r.done;r.start=()=>{},r.done=()=>{},o(),await e.parallel(t.components.changed,e=>s(e.details.path,e),{progress:r}),await e.parallel(t.components.added,async t=>{const r=e.join(n.paths.dir,"src",t.filename);t.details.path=r,await s(r,t)},{progress:r}),await e.parallel(t.components.removed,async n=>{await e.removeExports.remove(n.details.path)},{progress:r}),await a(n,t),i()}(p,h),f||(await e.removeExports.remove(n.path),await e.copyExports.copy(l,n.path)),await e.removeExports.remove(i)},exports.extractTarget=m;
|