@shopify/cli 3.59.3 → 3.60.1

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.
Files changed (156) hide show
  1. package/dist/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +1 -1
  2. package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/proxy.rb +1 -1
  3. package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/syncer/extension_serve_job.rb +1 -18
  4. package/dist/assets/cli-ruby/lib/shopify_cli/theme/repl/auth_middleware.rb +1 -1
  5. package/dist/assets/cli-ruby/test/shopify-cli/theme/dev_server/proxy_test.rb +21 -8
  6. package/dist/{chokidar-DGBVSVUZ.js → chokidar-DOC6OXDL.js} +3 -3
  7. package/dist/chunk-23EONB5V.js +2488 -0
  8. package/dist/{chunk-AXXAG7WU.js → chunk-3JLUTHGR.js} +1 -1
  9. package/dist/{chunk-7ZP3BQHT.js → chunk-3MBQVTEX.js} +1 -1
  10. package/dist/{chunk-3MMF34G4.js → chunk-4AOK4O3R.js} +14196 -14093
  11. package/dist/{chunk-53M3MKPI.js → chunk-4LDHNDYE.js} +5 -5
  12. package/dist/{chunk-PAZZ5BCS.js → chunk-5AS274TH.js} +2 -2
  13. package/dist/{chunk-7D6QIBBS.js → chunk-5R5555YE.js} +2 -2
  14. package/dist/{chunk-SIH2DDL6.js → chunk-6HKMY2UF.js} +3 -3
  15. package/dist/{chunk-FS2KWH4D.js → chunk-6IDIGZKI.js} +3 -3
  16. package/dist/{chunk-WD7SEY5L.js → chunk-76FPU4Y4.js} +6 -6
  17. package/dist/{chunk-GG6BKQB7.js → chunk-7DPKKYLI.js} +4 -4
  18. package/dist/{chunk-WBWFZ6IT.js → chunk-7P2SWIQY.js} +1 -1
  19. package/dist/{chunk-LIWGTANH.js → chunk-A63WAXQ5.js} +2 -2
  20. package/dist/{chunk-SMULJJG3.js → chunk-BE73NZXB.js} +1 -1
  21. package/dist/{chunk-DLDVLYHU.js → chunk-BKLNHG3A.js} +20 -16
  22. package/dist/{chunk-JCAIZOYO.js → chunk-FBB6KUZG.js} +1 -1
  23. package/dist/{chunk-SA32EMWV.js → chunk-FQIRJADJ.js} +1 -1
  24. package/dist/{chunk-YLPWACJJ.js → chunk-FWGRGI4R.js} +1 -1
  25. package/dist/{chunk-M336AND6.js → chunk-G6FN5VUE.js} +2 -2
  26. package/dist/{chunk-566AK3QG.js → chunk-GXPKATXW.js} +1 -1
  27. package/dist/{chunk-MWCOJGV6.js → chunk-GZXEPYCR.js} +2 -2
  28. package/dist/{chunk-IUKVZDDI.js → chunk-I5U2GOJX.js} +3 -3
  29. package/dist/{chunk-764QFYJX.js → chunk-IDJLU3F6.js} +4 -4
  30. package/dist/{chunk-YNJ3FUKX.js → chunk-IKV3JAIE.js} +4 -4
  31. package/dist/{chunk-TKNIQF4H.js → chunk-IN5IG3IS.js} +2 -2
  32. package/dist/{chunk-CXG2USMP.js → chunk-IUHH3PST.js} +1 -1
  33. package/dist/{chunk-Q3AO7F62.js → chunk-KDOLMUJB.js} +1 -1
  34. package/dist/{chunk-HVHJU6BK.js → chunk-KPUG3N6O.js} +7 -7
  35. package/dist/{chunk-6MJ52OLD.js → chunk-LKGDG6WW.js} +1 -1
  36. package/dist/{chunk-GPBOTRYV.js → chunk-M2LKXZGR.js} +9 -9
  37. package/dist/{chunk-BVGYIZ3O.js → chunk-M63RTPGR.js} +0 -7
  38. package/dist/chunk-MSXPXGEQ.js +176 -0
  39. package/dist/{chunk-SDNI4T2T.js → chunk-OK6RFX7A.js} +14 -13
  40. package/dist/{chunk-QI5VKSMW.js → chunk-OVPEO3GL.js} +2 -2
  41. package/dist/{chunk-FWZYDOOO.js → chunk-QE677YMX.js} +2 -2
  42. package/dist/{chunk-NLMW7YYN.js → chunk-QGJ5DP4W.js} +5 -5
  43. package/dist/{chunk-24FJTPDB.js → chunk-QNRAAJ6E.js} +4 -4
  44. package/dist/{chunk-WI3E2P3B.js → chunk-QTHWTF4X.js} +2 -2
  45. package/dist/{chunk-4N5YPEOH.js → chunk-QU5QY6ID.js} +4 -4
  46. package/dist/{chunk-OIWSTE6V.js → chunk-R2FRHR2E.js} +3 -3
  47. package/dist/{chunk-CYG4QPQ3.js → chunk-RQ24VTW4.js} +1 -1
  48. package/dist/{chunk-ZQSNWZD4.js → chunk-S42TVKB4.js} +3 -3
  49. package/dist/{chunk-BEYT7IAV.js → chunk-SQR2WUOU.js} +14 -10
  50. package/dist/{chunk-37WSDC6Z.js → chunk-STBFB2GC.js} +3 -3
  51. package/dist/{chunk-7SNGGY5B.js → chunk-TMGCRPEZ.js} +1 -1
  52. package/dist/{chunk-3CU2FNWB.js → chunk-TZ5DL7CA.js} +3 -3
  53. package/dist/{chunk-PNZIXRIF.js → chunk-UJNJ5XCL.js} +9 -2487
  54. package/dist/{chunk-TOONJ2CA.js → chunk-UQNUIOTG.js} +2 -2
  55. package/dist/{chunk-LOF3ZXQM.js → chunk-VNBOO6TJ.js} +64 -2
  56. package/dist/{chunk-RRHAA7U3.js → chunk-VQWQFBVA.js} +2 -2
  57. package/dist/{chunk-QBOF3CYT.js → chunk-WC5J3EVR.js} +5 -5
  58. package/dist/{chunk-P52UWCZD.js → chunk-WCNR75S2.js} +1 -1
  59. package/dist/{chunk-HEOKQONH.js → chunk-WWX3LICJ.js} +14 -11
  60. package/dist/{chunk-OVCQRTZZ.js → chunk-Z3ORRLFL.js} +3 -3
  61. package/dist/{chunk-LJA4EOTX.js → chunk-ZDPFPYD3.js} +5 -5
  62. package/dist/cli/commands/auth/logout.js +28 -28
  63. package/dist/cli/commands/auth/logout.test.js +30 -30
  64. package/dist/cli/commands/debug/command-flags.js +26 -26
  65. package/dist/cli/commands/demo/catalog.js +28 -28
  66. package/dist/cli/commands/demo/generate-file.js +29 -29
  67. package/dist/cli/commands/demo/index.js +27 -27
  68. package/dist/cli/commands/demo/print-ai-prompt.js +29 -29
  69. package/dist/cli/commands/docs/generate.js +26 -26
  70. package/dist/cli/commands/docs/generate.js.map +1 -1
  71. package/dist/cli/commands/docs/generate.test.js +30 -27
  72. package/dist/cli/commands/help.js +26 -26
  73. package/dist/cli/commands/hydrogen/init.js +26 -26
  74. package/dist/cli/commands/kitchen-sink/async.js +27 -27
  75. package/dist/cli/commands/kitchen-sink/async.test.js +28 -28
  76. package/dist/cli/commands/kitchen-sink/index.js +29 -29
  77. package/dist/cli/commands/kitchen-sink/index.test.js +30 -30
  78. package/dist/cli/commands/kitchen-sink/prompts.js +27 -27
  79. package/dist/cli/commands/kitchen-sink/prompts.test.js +28 -28
  80. package/dist/cli/commands/kitchen-sink/static.js +27 -27
  81. package/dist/cli/commands/kitchen-sink/static.test.js +28 -28
  82. package/dist/cli/commands/search.js +27 -27
  83. package/dist/cli/commands/upgrade.js +26 -26
  84. package/dist/cli/commands/upgrade.test.js +4 -4
  85. package/dist/cli/commands/version.js +27 -27
  86. package/dist/cli/commands/version.test.js +28 -28
  87. package/dist/cli/services/commands/search.js +16 -17
  88. package/dist/cli/services/commands/search.test.js +17 -18
  89. package/dist/cli/services/commands/version.js +19 -19
  90. package/dist/cli/services/commands/version.test.js +21 -21
  91. package/dist/cli/services/demo.js +17 -18
  92. package/dist/cli/services/demo.test.js +18 -19
  93. package/dist/cli/services/kitchen-sink/async.js +16 -17
  94. package/dist/cli/services/kitchen-sink/prompts.js +16 -17
  95. package/dist/cli/services/kitchen-sink/static.js +16 -17
  96. package/dist/cli/services/upgrade.js +18 -18
  97. package/dist/cli/services/upgrade.test.js +21 -21
  98. package/dist/{constants-OQPDSWGZ.js → constants-3B4PKIC7.js} +4 -4
  99. package/dist/{custom-oclif-loader-C3NJVUH5.js → custom-oclif-loader-SV4V5NXW.js} +15 -16
  100. package/dist/data/app_block_entry.json +13 -0
  101. package/dist/data/default_setting_values.json +24 -0
  102. package/dist/data/filters.json +5818 -0
  103. package/dist/data/latest.json +2 -0
  104. package/dist/data/local_block_entry.json +25 -0
  105. package/dist/data/manifest_theme.json +17 -0
  106. package/dist/data/manifest_theme_app_extension.json +10 -0
  107. package/dist/data/objects.json +21250 -0
  108. package/dist/data/section.json +241 -0
  109. package/dist/data/setting.json +913 -0
  110. package/dist/data/settings.json +10 -0
  111. package/dist/data/shopify_system_translations.json +1882 -0
  112. package/dist/data/tags.json +1273 -0
  113. package/dist/data/targetted_block_entry.json +15 -0
  114. package/dist/data/theme_block.json +123 -0
  115. package/dist/data/theme_block_entry.json +14 -0
  116. package/dist/data/theme_settings.json +83 -0
  117. package/dist/data/translations.json +56 -0
  118. package/dist/{del-HVOV3MSN.js → del-5I7QSZXM.js} +7 -8
  119. package/dist/{devtools-SPNRC62Y.js → devtools-KQM4GF6J.js} +1 -1
  120. package/dist/error-handler-WRZSR3LR.js +37 -0
  121. package/dist/hooks/init.js +15 -16
  122. package/dist/hooks/postrun.js +23 -23
  123. package/dist/hooks/prerun.js +19 -19
  124. package/dist/{http-proxy-UXKO35LH.js → http-proxy-42DFA6MY.js} +2 -2
  125. package/dist/index.js +7843 -7196
  126. package/dist/{lib-2EBQB76J.js → lib-AAMRQUES.js} +3 -3
  127. package/dist/lib-KV4KCWH7.js +11 -0
  128. package/dist/{local-LOUQD2TP.js → local-A6DCNVDB.js} +15 -16
  129. package/dist/{magic-string.es-XWLPTYL2.js → magic-string.es-6WMSFIAX.js} +1 -1
  130. package/dist/{multipart-parser-KUMTOIY4.js → multipart-parser-O2BQODS2.js} +2 -2
  131. package/dist/{node-package-manager-HN2BURTH.js → node-package-manager-CLN2ZN2M.js} +17 -17
  132. package/dist/npa-VW3Y6UCQ.js +2262 -0
  133. package/dist/{open-4QOBUNAV.js → open-B7XFJJCK.js} +2 -2
  134. package/dist/out-MH5VOFOS.js +6 -0
  135. package/dist/{path-NJJ6ID3F.js → path-HO4HBKK5.js} +3 -3
  136. package/dist/system-OPIC6REP.js +28 -0
  137. package/dist/templates/ui-extensions/projects/web_pixel_extension/package.json.liquid +1 -1
  138. package/dist/templates/ui-extensions/projects/web_pixel_extension/src/index.liquid +1 -1
  139. package/dist/tsconfig.tsbuildinfo +1 -1
  140. package/dist/{ui-36MRS2GL.js → ui-WTE37V74.js} +15 -16
  141. package/oclif.manifest.json +99 -30
  142. package/package.json +7 -6
  143. package/dist/assets/cli-ruby/test/shopify-cli/theme/extension/syncer_test.rb +0 -82
  144. package/dist/chunk-F6GZ5SSL.js +0 -69
  145. package/dist/error-handler-WFXXE3PZ.js +0 -37
  146. package/dist/favicon-4808307e.ico +0 -0
  147. package/dist/index-878807df.js +0 -5
  148. package/dist/index-a69a7f3d.js +0 -7
  149. package/dist/index-e6f8190d.js +0 -953
  150. package/dist/lib-ZHR6CBL4.js +0 -12
  151. package/dist/out-K5X4ON7U.js +0 -6
  152. package/dist/package-9a1ede4a.json +0 -268
  153. package/dist/shell-FSGSHXVH.js +0 -2517
  154. package/dist/style-49513a24.css +0 -58
  155. package/dist/system-PSH5D5DY.js +0 -29
  156. package/dist/yarn-e8df42e5.js +0 -31
@@ -1,2517 +0,0 @@
1
- import {
2
- require_glob
3
- } from "./chunk-3CU2FNWB.js";
4
- import "./chunk-6MJ52OLD.js";
5
- import "./chunk-F6GZ5SSL.js";
6
- import {
7
- __commonJS,
8
- __esm,
9
- __glob,
10
- __require,
11
- init_cjs_shims
12
- } from "./chunk-BVGYIZ3O.js";
13
-
14
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/common.js
15
- var require_common = __commonJS({
16
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/common.js"(exports) {
17
- "use strict";
18
- init_cjs_shims();
19
- var os = __require("os");
20
- var fs = __require("fs");
21
- var glob = require_glob();
22
- var shell = require_shell();
23
- var shellMethods = Object.create(shell);
24
- exports.extend = Object.assign;
25
- var isElectron = Boolean(process.versions.electron);
26
- var DEFAULT_CONFIG = {
27
- fatal: false,
28
- globOptions: {},
29
- maxdepth: 255,
30
- noglob: false,
31
- silent: false,
32
- verbose: false,
33
- execPath: null,
34
- bufLength: 64 * 1024
35
- // 64KB
36
- };
37
- var config = {
38
- reset: function() {
39
- Object.assign(this, DEFAULT_CONFIG);
40
- if (!isElectron) {
41
- this.execPath = process.execPath;
42
- }
43
- },
44
- resetForTesting: function() {
45
- this.reset();
46
- this.silent = true;
47
- }
48
- };
49
- config.reset();
50
- exports.config = config;
51
- var state = {
52
- error: null,
53
- errorCode: 0,
54
- currentCmd: "shell.js"
55
- };
56
- exports.state = state;
57
- delete process.env.OLDPWD;
58
- function isObject(a) {
59
- return typeof a === "object" && a !== null;
60
- }
61
- exports.isObject = isObject;
62
- function log() {
63
- if (!config.silent) {
64
- console.error.apply(console, arguments);
65
- }
66
- }
67
- exports.log = log;
68
- function convertErrorOutput(msg) {
69
- if (typeof msg !== "string") {
70
- throw new TypeError("input must be a string");
71
- }
72
- return msg.replace(/\\/g, "/");
73
- }
74
- exports.convertErrorOutput = convertErrorOutput;
75
- function error(msg, _code, options) {
76
- if (typeof msg !== "string")
77
- throw new Error("msg must be a string");
78
- var DEFAULT_OPTIONS = {
79
- continue: false,
80
- code: 1,
81
- prefix: state.currentCmd + ": ",
82
- silent: false
83
- };
84
- if (typeof _code === "number" && isObject(options)) {
85
- options.code = _code;
86
- } else if (isObject(_code)) {
87
- options = _code;
88
- } else if (typeof _code === "number") {
89
- options = { code: _code };
90
- } else if (typeof _code !== "number") {
91
- options = {};
92
- }
93
- options = Object.assign({}, DEFAULT_OPTIONS, options);
94
- if (!state.errorCode)
95
- state.errorCode = options.code;
96
- var logEntry = convertErrorOutput(options.prefix + msg);
97
- state.error = state.error ? state.error + "\n" : "";
98
- state.error += logEntry;
99
- if (config.fatal)
100
- throw new Error(logEntry);
101
- if (msg.length > 0 && !options.silent)
102
- log(logEntry);
103
- if (!options.continue) {
104
- throw {
105
- msg: "earlyExit",
106
- retValue: new ShellString("", state.error, state.errorCode)
107
- };
108
- }
109
- }
110
- exports.error = error;
111
- function ShellString(stdout, stderr, code) {
112
- var that;
113
- if (stdout instanceof Array) {
114
- that = stdout;
115
- that.stdout = stdout.join("\n");
116
- if (stdout.length > 0)
117
- that.stdout += "\n";
118
- } else {
119
- that = new String(stdout);
120
- that.stdout = stdout;
121
- }
122
- that.stderr = stderr;
123
- that.code = code;
124
- pipeMethods.forEach(function(cmd) {
125
- that[cmd] = shellMethods[cmd].bind(that);
126
- });
127
- return that;
128
- }
129
- exports.ShellString = ShellString;
130
- function parseOptions(opt, map, errorOptions) {
131
- if (typeof opt !== "string" && !isObject(opt)) {
132
- throw new Error("options must be strings or key-value pairs");
133
- } else if (!isObject(map)) {
134
- throw new Error("parseOptions() internal error: map must be an object");
135
- } else if (errorOptions && !isObject(errorOptions)) {
136
- throw new Error("parseOptions() internal error: errorOptions must be object");
137
- }
138
- if (opt === "--") {
139
- return {};
140
- }
141
- var options = {};
142
- Object.keys(map).forEach(function(letter) {
143
- var optName = map[letter];
144
- if (optName[0] !== "!") {
145
- options[optName] = false;
146
- }
147
- });
148
- if (opt === "")
149
- return options;
150
- if (typeof opt === "string") {
151
- if (opt[0] !== "-") {
152
- throw new Error("Options string must start with a '-'");
153
- }
154
- var chars = opt.slice(1).split("");
155
- chars.forEach(function(c) {
156
- if (c in map) {
157
- var optionName = map[c];
158
- if (optionName[0] === "!") {
159
- options[optionName.slice(1)] = false;
160
- } else {
161
- options[optionName] = true;
162
- }
163
- } else {
164
- error("option not recognized: " + c, errorOptions || {});
165
- }
166
- });
167
- } else {
168
- Object.keys(opt).forEach(function(key) {
169
- var c = key[1];
170
- if (c in map) {
171
- var optionName = map[c];
172
- options[optionName] = opt[key];
173
- } else {
174
- error("option not recognized: " + c, errorOptions || {});
175
- }
176
- });
177
- }
178
- return options;
179
- }
180
- exports.parseOptions = parseOptions;
181
- function expand(list) {
182
- if (!Array.isArray(list)) {
183
- throw new TypeError("must be an array");
184
- }
185
- var expanded = [];
186
- list.forEach(function(listEl) {
187
- if (typeof listEl !== "string") {
188
- expanded.push(listEl);
189
- } else {
190
- var ret;
191
- try {
192
- ret = glob.sync(listEl, config.globOptions);
193
- ret = ret.length > 0 ? ret : [listEl];
194
- } catch (e) {
195
- ret = [listEl];
196
- }
197
- expanded = expanded.concat(ret);
198
- }
199
- });
200
- return expanded;
201
- }
202
- exports.expand = expand;
203
- var buffer = typeof Buffer.alloc === "function" ? function(len) {
204
- return Buffer.alloc(len || config.bufLength);
205
- } : function(len) {
206
- return new Buffer(len || config.bufLength);
207
- };
208
- exports.buffer = buffer;
209
- function unlinkSync(file) {
210
- try {
211
- fs.unlinkSync(file);
212
- } catch (e) {
213
- if (e.code === "EPERM") {
214
- fs.chmodSync(file, "0666");
215
- fs.unlinkSync(file);
216
- } else {
217
- throw e;
218
- }
219
- }
220
- }
221
- exports.unlinkSync = unlinkSync;
222
- function statFollowLinks() {
223
- return fs.statSync.apply(fs, arguments);
224
- }
225
- exports.statFollowLinks = statFollowLinks;
226
- function statNoFollowLinks() {
227
- return fs.lstatSync.apply(fs, arguments);
228
- }
229
- exports.statNoFollowLinks = statNoFollowLinks;
230
- function randomFileName() {
231
- function randomHash(count) {
232
- if (count === 1) {
233
- return parseInt(16 * Math.random(), 10).toString(16);
234
- }
235
- var hash = "";
236
- for (var i = 0; i < count; i++) {
237
- hash += randomHash(1);
238
- }
239
- return hash;
240
- }
241
- return "shelljs_" + randomHash(20);
242
- }
243
- exports.randomFileName = randomFileName;
244
- function wrap(cmd, fn, options) {
245
- options = options || {};
246
- return function() {
247
- var retValue = null;
248
- state.currentCmd = cmd;
249
- state.error = null;
250
- state.errorCode = 0;
251
- try {
252
- var args = [].slice.call(arguments, 0);
253
- if (config.verbose) {
254
- console.error.apply(console, [cmd].concat(args));
255
- }
256
- state.pipedValue = this && typeof this.stdout === "string" ? this.stdout : "";
257
- if (options.unix === false) {
258
- retValue = fn.apply(this, args);
259
- } else {
260
- if (isObject(args[0]) && args[0].constructor.name === "Object") {
261
- } else if (args.length === 0 || typeof args[0] !== "string" || args[0].length <= 1 || args[0][0] !== "-") {
262
- args.unshift("");
263
- }
264
- args = args.reduce(function(accum, cur) {
265
- if (Array.isArray(cur)) {
266
- return accum.concat(cur);
267
- }
268
- accum.push(cur);
269
- return accum;
270
- }, []);
271
- args = args.map(function(arg) {
272
- if (isObject(arg) && arg.constructor.name === "String") {
273
- return arg.toString();
274
- }
275
- return arg;
276
- });
277
- var homeDir = os.homedir();
278
- args = args.map(function(arg) {
279
- if (typeof arg === "string" && arg.slice(0, 2) === "~/" || arg === "~") {
280
- return arg.replace(/^~/, homeDir);
281
- }
282
- return arg;
283
- });
284
- if (!config.noglob && options.allowGlobbing === true) {
285
- args = args.slice(0, options.globStart).concat(expand(args.slice(options.globStart)));
286
- }
287
- try {
288
- if (isObject(options.cmdOptions)) {
289
- args[0] = parseOptions(args[0], options.cmdOptions);
290
- }
291
- retValue = fn.apply(this, args);
292
- } catch (e) {
293
- if (e.msg === "earlyExit") {
294
- retValue = e.retValue;
295
- } else {
296
- throw e;
297
- }
298
- }
299
- }
300
- } catch (e) {
301
- if (!state.error) {
302
- e.name = "ShellJSInternalError";
303
- throw e;
304
- }
305
- if (config.fatal)
306
- throw e;
307
- }
308
- if (options.wrapOutput && (typeof retValue === "string" || Array.isArray(retValue))) {
309
- retValue = new ShellString(retValue, state.error, state.errorCode);
310
- }
311
- state.currentCmd = "shell.js";
312
- return retValue;
313
- };
314
- }
315
- exports.wrap = wrap;
316
- function _readFromPipe() {
317
- return state.pipedValue;
318
- }
319
- exports.readFromPipe = _readFromPipe;
320
- var DEFAULT_WRAP_OPTIONS = {
321
- allowGlobbing: true,
322
- canReceivePipe: false,
323
- cmdOptions: null,
324
- globStart: 1,
325
- pipeOnly: false,
326
- wrapOutput: true,
327
- unix: true
328
- };
329
- var pipeMethods = [];
330
- function _register(name, implementation, wrapOptions) {
331
- wrapOptions = wrapOptions || {};
332
- Object.keys(wrapOptions).forEach(function(option) {
333
- if (!DEFAULT_WRAP_OPTIONS.hasOwnProperty(option)) {
334
- throw new Error("Unknown option '" + option + "'");
335
- }
336
- if (typeof wrapOptions[option] !== typeof DEFAULT_WRAP_OPTIONS[option]) {
337
- throw new TypeError("Unsupported type '" + typeof wrapOptions[option] + "' for option '" + option + "'");
338
- }
339
- });
340
- wrapOptions = Object.assign({}, DEFAULT_WRAP_OPTIONS, wrapOptions);
341
- if (shell.hasOwnProperty(name)) {
342
- throw new Error("Command `" + name + "` already exists");
343
- }
344
- if (wrapOptions.pipeOnly) {
345
- wrapOptions.canReceivePipe = true;
346
- shellMethods[name] = wrap(name, implementation, wrapOptions);
347
- } else {
348
- shell[name] = wrap(name, implementation, wrapOptions);
349
- }
350
- if (wrapOptions.canReceivePipe) {
351
- pipeMethods.push(name);
352
- }
353
- }
354
- exports.register = _register;
355
- }
356
- });
357
-
358
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/cat.js
359
- var require_cat = __commonJS({
360
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/cat.js"(exports, module) {
361
- init_cjs_shims();
362
- var common = require_common();
363
- var fs = __require("fs");
364
- common.register("cat", _cat, {
365
- canReceivePipe: true,
366
- cmdOptions: {
367
- "n": "number"
368
- }
369
- });
370
- function _cat(options, files) {
371
- var cat = common.readFromPipe();
372
- if (!files && !cat)
373
- common.error("no paths given");
374
- files = [].slice.call(arguments, 1);
375
- files.forEach(function(file) {
376
- if (!fs.existsSync(file)) {
377
- common.error("no such file or directory: " + file);
378
- } else if (common.statFollowLinks(file).isDirectory()) {
379
- common.error(file + ": Is a directory");
380
- }
381
- cat += fs.readFileSync(file, "utf8");
382
- });
383
- if (options.number) {
384
- cat = addNumbers(cat);
385
- }
386
- return cat;
387
- }
388
- module.exports = _cat;
389
- function addNumbers(cat) {
390
- var lines = cat.split("\n");
391
- var lastLine = lines.pop();
392
- lines = lines.map(function(line, i) {
393
- return numberedLine(i + 1, line);
394
- });
395
- if (lastLine.length) {
396
- lastLine = numberedLine(lines.length + 1, lastLine);
397
- }
398
- lines.push(lastLine);
399
- return lines.join("\n");
400
- }
401
- function numberedLine(n, line) {
402
- var number = (" " + n).slice(-6) + " ";
403
- return number + line;
404
- }
405
- }
406
- });
407
-
408
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/cd.js
409
- var require_cd = __commonJS({
410
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/cd.js"(exports, module) {
411
- init_cjs_shims();
412
- var os = __require("os");
413
- var common = require_common();
414
- common.register("cd", _cd, {});
415
- function _cd(options, dir) {
416
- if (!dir)
417
- dir = os.homedir();
418
- if (dir === "-") {
419
- if (!process.env.OLDPWD) {
420
- common.error("could not find previous directory");
421
- } else {
422
- dir = process.env.OLDPWD;
423
- }
424
- }
425
- try {
426
- var curDir = process.cwd();
427
- process.chdir(dir);
428
- process.env.OLDPWD = curDir;
429
- } catch (e) {
430
- var err;
431
- try {
432
- common.statFollowLinks(dir);
433
- err = "not a directory: " + dir;
434
- } catch (e2) {
435
- err = "no such file or directory: " + dir;
436
- }
437
- if (err)
438
- common.error(err);
439
- }
440
- return "";
441
- }
442
- module.exports = _cd;
443
- }
444
- });
445
-
446
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/chmod.js
447
- var require_chmod = __commonJS({
448
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/chmod.js"(exports, module) {
449
- init_cjs_shims();
450
- var common = require_common();
451
- var fs = __require("fs");
452
- var path = __require("path");
453
- var PERMS = function(base) {
454
- return {
455
- OTHER_EXEC: base.EXEC,
456
- OTHER_WRITE: base.WRITE,
457
- OTHER_READ: base.READ,
458
- GROUP_EXEC: base.EXEC << 3,
459
- GROUP_WRITE: base.WRITE << 3,
460
- GROUP_READ: base.READ << 3,
461
- OWNER_EXEC: base.EXEC << 6,
462
- OWNER_WRITE: base.WRITE << 6,
463
- OWNER_READ: base.READ << 6,
464
- // Literal octal numbers are apparently not allowed in "strict" javascript.
465
- STICKY: parseInt("01000", 8),
466
- SETGID: parseInt("02000", 8),
467
- SETUID: parseInt("04000", 8),
468
- TYPE_MASK: parseInt("0770000", 8)
469
- };
470
- }({
471
- EXEC: 1,
472
- WRITE: 2,
473
- READ: 4
474
- });
475
- common.register("chmod", _chmod, {});
476
- function _chmod(options, mode, filePattern) {
477
- if (!filePattern) {
478
- if (options.length > 0 && options.charAt(0) === "-") {
479
- [].unshift.call(arguments, "");
480
- } else {
481
- common.error("You must specify a file.");
482
- }
483
- }
484
- options = common.parseOptions(options, {
485
- "R": "recursive",
486
- "c": "changes",
487
- "v": "verbose"
488
- });
489
- filePattern = [].slice.call(arguments, 2);
490
- var files;
491
- if (options.recursive) {
492
- files = [];
493
- filePattern.forEach(function addFile(expandedFile) {
494
- var stat = common.statNoFollowLinks(expandedFile);
495
- if (!stat.isSymbolicLink()) {
496
- files.push(expandedFile);
497
- if (stat.isDirectory()) {
498
- fs.readdirSync(expandedFile).forEach(function(child) {
499
- addFile(expandedFile + "/" + child);
500
- });
501
- }
502
- }
503
- });
504
- } else {
505
- files = filePattern;
506
- }
507
- files.forEach(function innerChmod(file) {
508
- file = path.resolve(file);
509
- if (!fs.existsSync(file)) {
510
- common.error("File not found: " + file);
511
- }
512
- if (options.recursive && common.statNoFollowLinks(file).isSymbolicLink()) {
513
- return;
514
- }
515
- var stat = common.statFollowLinks(file);
516
- var isDir = stat.isDirectory();
517
- var perms = stat.mode;
518
- var type = perms & PERMS.TYPE_MASK;
519
- var newPerms = perms;
520
- if (isNaN(parseInt(mode, 8))) {
521
- mode.split(",").forEach(function(symbolicMode) {
522
- var pattern = /([ugoa]*)([=\+-])([rwxXst]*)/i;
523
- var matches = pattern.exec(symbolicMode);
524
- if (matches) {
525
- var applyTo = matches[1];
526
- var operator = matches[2];
527
- var change = matches[3];
528
- var changeOwner = applyTo.indexOf("u") !== -1 || applyTo === "a" || applyTo === "";
529
- var changeGroup = applyTo.indexOf("g") !== -1 || applyTo === "a" || applyTo === "";
530
- var changeOther = applyTo.indexOf("o") !== -1 || applyTo === "a" || applyTo === "";
531
- var changeRead = change.indexOf("r") !== -1;
532
- var changeWrite = change.indexOf("w") !== -1;
533
- var changeExec = change.indexOf("x") !== -1;
534
- var changeExecDir = change.indexOf("X") !== -1;
535
- var changeSticky = change.indexOf("t") !== -1;
536
- var changeSetuid = change.indexOf("s") !== -1;
537
- if (changeExecDir && isDir) {
538
- changeExec = true;
539
- }
540
- var mask = 0;
541
- if (changeOwner) {
542
- mask |= (changeRead ? PERMS.OWNER_READ : 0) + (changeWrite ? PERMS.OWNER_WRITE : 0) + (changeExec ? PERMS.OWNER_EXEC : 0) + (changeSetuid ? PERMS.SETUID : 0);
543
- }
544
- if (changeGroup) {
545
- mask |= (changeRead ? PERMS.GROUP_READ : 0) + (changeWrite ? PERMS.GROUP_WRITE : 0) + (changeExec ? PERMS.GROUP_EXEC : 0) + (changeSetuid ? PERMS.SETGID : 0);
546
- }
547
- if (changeOther) {
548
- mask |= (changeRead ? PERMS.OTHER_READ : 0) + (changeWrite ? PERMS.OTHER_WRITE : 0) + (changeExec ? PERMS.OTHER_EXEC : 0);
549
- }
550
- if (changeSticky) {
551
- mask |= PERMS.STICKY;
552
- }
553
- switch (operator) {
554
- case "+":
555
- newPerms |= mask;
556
- break;
557
- case "-":
558
- newPerms &= ~mask;
559
- break;
560
- case "=":
561
- newPerms = type + mask;
562
- if (common.statFollowLinks(file).isDirectory()) {
563
- newPerms |= PERMS.SETUID + PERMS.SETGID & perms;
564
- }
565
- break;
566
- default:
567
- common.error("Could not recognize operator: `" + operator + "`");
568
- }
569
- if (options.verbose) {
570
- console.log(file + " -> " + newPerms.toString(8));
571
- }
572
- if (perms !== newPerms) {
573
- if (!options.verbose && options.changes) {
574
- console.log(file + " -> " + newPerms.toString(8));
575
- }
576
- fs.chmodSync(file, newPerms);
577
- perms = newPerms;
578
- }
579
- } else {
580
- common.error("Invalid symbolic mode change: " + symbolicMode);
581
- }
582
- });
583
- } else {
584
- newPerms = type + parseInt(mode, 8);
585
- if (common.statFollowLinks(file).isDirectory()) {
586
- newPerms |= PERMS.SETUID + PERMS.SETGID & perms;
587
- }
588
- fs.chmodSync(file, newPerms);
589
- }
590
- });
591
- return "";
592
- }
593
- module.exports = _chmod;
594
- }
595
- });
596
-
597
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/cp.js
598
- var require_cp = __commonJS({
599
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/cp.js"(exports, module) {
600
- init_cjs_shims();
601
- var fs = __require("fs");
602
- var path = __require("path");
603
- var common = require_common();
604
- common.register("cp", _cp, {
605
- cmdOptions: {
606
- "f": "!no_force",
607
- "n": "no_force",
608
- "u": "update",
609
- "R": "recursive",
610
- "r": "recursive",
611
- "L": "followsymlink",
612
- "P": "noFollowsymlink"
613
- },
614
- wrapOutput: false
615
- });
616
- function copyFileSync(srcFile, destFile, options) {
617
- if (!fs.existsSync(srcFile)) {
618
- common.error("copyFileSync: no such file or directory: " + srcFile);
619
- }
620
- var isWindows = process.platform === "win32";
621
- try {
622
- if (options.update && common.statFollowLinks(srcFile).mtime < fs.statSync(destFile).mtime) {
623
- return;
624
- }
625
- } catch (e) {
626
- }
627
- if (common.statNoFollowLinks(srcFile).isSymbolicLink() && !options.followsymlink) {
628
- try {
629
- common.statNoFollowLinks(destFile);
630
- common.unlinkSync(destFile);
631
- } catch (e) {
632
- }
633
- var symlinkFull = fs.readlinkSync(srcFile);
634
- fs.symlinkSync(symlinkFull, destFile, isWindows ? "junction" : null);
635
- } else {
636
- var buf = common.buffer();
637
- var bufLength = buf.length;
638
- var bytesRead = bufLength;
639
- var pos = 0;
640
- var fdr = null;
641
- var fdw = null;
642
- try {
643
- fdr = fs.openSync(srcFile, "r");
644
- } catch (e) {
645
- common.error("copyFileSync: could not read src file (" + srcFile + ")");
646
- }
647
- try {
648
- fdw = fs.openSync(destFile, "w");
649
- } catch (e) {
650
- common.error("copyFileSync: could not write to dest file (code=" + e.code + "):" + destFile);
651
- }
652
- while (bytesRead === bufLength) {
653
- bytesRead = fs.readSync(fdr, buf, 0, bufLength, pos);
654
- fs.writeSync(fdw, buf, 0, bytesRead);
655
- pos += bytesRead;
656
- }
657
- fs.closeSync(fdr);
658
- fs.closeSync(fdw);
659
- fs.chmodSync(destFile, common.statFollowLinks(srcFile).mode);
660
- }
661
- }
662
- function cpdirSyncRecursive(sourceDir, destDir, currentDepth, opts) {
663
- if (!opts)
664
- opts = {};
665
- if (currentDepth >= common.config.maxdepth)
666
- return;
667
- currentDepth++;
668
- var isWindows = process.platform === "win32";
669
- try {
670
- fs.mkdirSync(destDir);
671
- } catch (e) {
672
- if (e.code !== "EEXIST")
673
- throw e;
674
- }
675
- var files = fs.readdirSync(sourceDir);
676
- for (var i = 0; i < files.length; i++) {
677
- var srcFile = sourceDir + "/" + files[i];
678
- var destFile = destDir + "/" + files[i];
679
- var srcFileStat = common.statNoFollowLinks(srcFile);
680
- var symlinkFull;
681
- if (opts.followsymlink) {
682
- if (cpcheckcycle(sourceDir, srcFile)) {
683
- console.error("Cycle link found.");
684
- symlinkFull = fs.readlinkSync(srcFile);
685
- fs.symlinkSync(symlinkFull, destFile, isWindows ? "junction" : null);
686
- continue;
687
- }
688
- }
689
- if (srcFileStat.isDirectory()) {
690
- cpdirSyncRecursive(srcFile, destFile, currentDepth, opts);
691
- } else if (srcFileStat.isSymbolicLink() && !opts.followsymlink) {
692
- symlinkFull = fs.readlinkSync(srcFile);
693
- try {
694
- common.statNoFollowLinks(destFile);
695
- common.unlinkSync(destFile);
696
- } catch (e) {
697
- }
698
- fs.symlinkSync(symlinkFull, destFile, isWindows ? "junction" : null);
699
- } else if (srcFileStat.isSymbolicLink() && opts.followsymlink) {
700
- srcFileStat = common.statFollowLinks(srcFile);
701
- if (srcFileStat.isDirectory()) {
702
- cpdirSyncRecursive(srcFile, destFile, currentDepth, opts);
703
- } else {
704
- copyFileSync(srcFile, destFile, opts);
705
- }
706
- } else {
707
- if (fs.existsSync(destFile) && opts.no_force) {
708
- common.log("skipping existing file: " + files[i]);
709
- } else {
710
- copyFileSync(srcFile, destFile, opts);
711
- }
712
- }
713
- }
714
- var checkDir = common.statFollowLinks(sourceDir);
715
- fs.chmodSync(destDir, checkDir.mode);
716
- }
717
- function checkRecentCreated(sources, index) {
718
- var lookedSource = sources[index];
719
- return sources.slice(0, index).some(function(src) {
720
- return path.basename(src) === path.basename(lookedSource);
721
- });
722
- }
723
- function cpcheckcycle(sourceDir, srcFile) {
724
- var srcFileStat = common.statNoFollowLinks(srcFile);
725
- if (srcFileStat.isSymbolicLink()) {
726
- var cyclecheck = common.statFollowLinks(srcFile);
727
- if (cyclecheck.isDirectory()) {
728
- var sourcerealpath = fs.realpathSync(sourceDir);
729
- var symlinkrealpath = fs.realpathSync(srcFile);
730
- var re = new RegExp(symlinkrealpath);
731
- if (re.test(sourcerealpath)) {
732
- return true;
733
- }
734
- }
735
- }
736
- return false;
737
- }
738
- function _cp(options, sources, dest) {
739
- if (options.followsymlink) {
740
- options.noFollowsymlink = false;
741
- }
742
- if (!options.recursive && !options.noFollowsymlink) {
743
- options.followsymlink = true;
744
- }
745
- if (arguments.length < 3) {
746
- common.error("missing <source> and/or <dest>");
747
- } else {
748
- sources = [].slice.call(arguments, 1, arguments.length - 1);
749
- dest = arguments[arguments.length - 1];
750
- }
751
- var destExists = fs.existsSync(dest);
752
- var destStat = destExists && common.statFollowLinks(dest);
753
- if ((!destExists || !destStat.isDirectory()) && sources.length > 1) {
754
- common.error("dest is not a directory (too many sources)");
755
- }
756
- if (destExists && destStat.isFile() && options.no_force) {
757
- return new common.ShellString("", "", 0);
758
- }
759
- sources.forEach(function(src, srcIndex) {
760
- if (!fs.existsSync(src)) {
761
- if (src === "")
762
- src = "''";
763
- common.error("no such file or directory: " + src, { continue: true });
764
- return;
765
- }
766
- var srcStat = common.statFollowLinks(src);
767
- if (!options.noFollowsymlink && srcStat.isDirectory()) {
768
- if (!options.recursive) {
769
- common.error("omitting directory '" + src + "'", { continue: true });
770
- } else {
771
- var newDest = destStat && destStat.isDirectory() ? path.join(dest, path.basename(src)) : dest;
772
- try {
773
- common.statFollowLinks(path.dirname(dest));
774
- cpdirSyncRecursive(src, newDest, 0, { no_force: options.no_force, followsymlink: options.followsymlink });
775
- } catch (e) {
776
- common.error("cannot create directory '" + dest + "': No such file or directory");
777
- }
778
- }
779
- } else {
780
- var thisDest = dest;
781
- if (destStat && destStat.isDirectory()) {
782
- thisDest = path.normalize(dest + "/" + path.basename(src));
783
- }
784
- var thisDestExists = fs.existsSync(thisDest);
785
- if (thisDestExists && checkRecentCreated(sources, srcIndex)) {
786
- if (!options.no_force) {
787
- common.error("will not overwrite just-created '" + thisDest + "' with '" + src + "'", { continue: true });
788
- }
789
- return;
790
- }
791
- if (thisDestExists && options.no_force) {
792
- return;
793
- }
794
- if (path.relative(src, thisDest) === "") {
795
- common.error("'" + thisDest + "' and '" + src + "' are the same file", { continue: true });
796
- return;
797
- }
798
- copyFileSync(src, thisDest, options);
799
- }
800
- });
801
- return new common.ShellString("", common.state.error, common.state.errorCode);
802
- }
803
- module.exports = _cp;
804
- }
805
- });
806
-
807
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/dirs.js
808
- var require_dirs = __commonJS({
809
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/dirs.js"(exports) {
810
- init_cjs_shims();
811
- var common = require_common();
812
- var _cd = require_cd();
813
- var path = __require("path");
814
- common.register("dirs", _dirs, {
815
- wrapOutput: false
816
- });
817
- common.register("pushd", _pushd, {
818
- wrapOutput: false
819
- });
820
- common.register("popd", _popd, {
821
- wrapOutput: false
822
- });
823
- var _dirStack = [];
824
- function _isStackIndex(index) {
825
- return /^[\-+]\d+$/.test(index);
826
- }
827
- function _parseStackIndex(index) {
828
- if (_isStackIndex(index)) {
829
- if (Math.abs(index) < _dirStack.length + 1) {
830
- return /^-/.test(index) ? Number(index) - 1 : Number(index);
831
- }
832
- common.error(index + ": directory stack index out of range");
833
- } else {
834
- common.error(index + ": invalid number");
835
- }
836
- }
837
- function _actualDirStack() {
838
- return [process.cwd()].concat(_dirStack);
839
- }
840
- function _pushd(options, dir) {
841
- if (_isStackIndex(options)) {
842
- dir = options;
843
- options = "";
844
- }
845
- options = common.parseOptions(options, {
846
- "n": "no-cd",
847
- "q": "quiet"
848
- });
849
- var dirs = _actualDirStack();
850
- if (dir === "+0") {
851
- return dirs;
852
- } else if (!dir) {
853
- if (dirs.length > 1) {
854
- dirs = dirs.splice(1, 1).concat(dirs);
855
- } else {
856
- return common.error("no other directory");
857
- }
858
- } else if (_isStackIndex(dir)) {
859
- var n = _parseStackIndex(dir);
860
- dirs = dirs.slice(n).concat(dirs.slice(0, n));
861
- } else {
862
- if (options["no-cd"]) {
863
- dirs.splice(1, 0, dir);
864
- } else {
865
- dirs.unshift(dir);
866
- }
867
- }
868
- if (options["no-cd"]) {
869
- dirs = dirs.slice(1);
870
- } else {
871
- dir = path.resolve(dirs.shift());
872
- _cd("", dir);
873
- }
874
- _dirStack = dirs;
875
- return _dirs(options.quiet ? "-q" : "");
876
- }
877
- exports.pushd = _pushd;
878
- function _popd(options, index) {
879
- if (_isStackIndex(options)) {
880
- index = options;
881
- options = "";
882
- }
883
- options = common.parseOptions(options, {
884
- "n": "no-cd",
885
- "q": "quiet"
886
- });
887
- if (!_dirStack.length) {
888
- return common.error("directory stack empty");
889
- }
890
- index = _parseStackIndex(index || "+0");
891
- if (options["no-cd"] || index > 0 || _dirStack.length + index === 0) {
892
- index = index > 0 ? index - 1 : index;
893
- _dirStack.splice(index, 1);
894
- } else {
895
- var dir = path.resolve(_dirStack.shift());
896
- _cd("", dir);
897
- }
898
- return _dirs(options.quiet ? "-q" : "");
899
- }
900
- exports.popd = _popd;
901
- function _dirs(options, index) {
902
- if (_isStackIndex(options)) {
903
- index = options;
904
- options = "";
905
- }
906
- options = common.parseOptions(options, {
907
- "c": "clear",
908
- "q": "quiet"
909
- });
910
- if (options.clear) {
911
- _dirStack = [];
912
- return _dirStack;
913
- }
914
- var stack = _actualDirStack();
915
- if (index) {
916
- index = _parseStackIndex(index);
917
- if (index < 0) {
918
- index = stack.length + index;
919
- }
920
- if (!options.quiet) {
921
- common.log(stack[index]);
922
- }
923
- return stack[index];
924
- }
925
- if (!options.quiet) {
926
- common.log(stack.join(" "));
927
- }
928
- return stack;
929
- }
930
- exports.dirs = _dirs;
931
- }
932
- });
933
-
934
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/echo.js
935
- var require_echo = __commonJS({
936
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/echo.js"(exports, module) {
937
- init_cjs_shims();
938
- var format = __require("util").format;
939
- var common = require_common();
940
- common.register("echo", _echo, {
941
- allowGlobbing: false
942
- });
943
- function _echo(opts) {
944
- var messages = [].slice.call(arguments, opts ? 0 : 1);
945
- var options = {};
946
- try {
947
- options = common.parseOptions(messages[0], {
948
- "e": "escapes",
949
- "n": "no_newline"
950
- }, {
951
- silent: true
952
- });
953
- if (messages[0]) {
954
- messages.shift();
955
- }
956
- } catch (_) {
957
- common.state.error = null;
958
- }
959
- var output = format.apply(null, messages);
960
- if (!options.no_newline) {
961
- output += "\n";
962
- }
963
- process.stdout.write(output);
964
- return output;
965
- }
966
- module.exports = _echo;
967
- }
968
- });
969
-
970
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/error.js
971
- var require_error = __commonJS({
972
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/error.js"(exports, module) {
973
- init_cjs_shims();
974
- var common = require_common();
975
- function error() {
976
- return common.state.error;
977
- }
978
- module.exports = error;
979
- }
980
- });
981
-
982
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/exec-child.js
983
- var require_exec_child = __commonJS({
984
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/exec-child.js"(exports, module) {
985
- init_cjs_shims();
986
- if (__require.main !== module) {
987
- throw new Error("This file should not be required");
988
- }
989
- var childProcess = __require("child_process");
990
- var fs = __require("fs");
991
- var paramFilePath = process.argv[2];
992
- var serializedParams = fs.readFileSync(paramFilePath, "utf8");
993
- var params = JSON.parse(serializedParams);
994
- var cmd = params.command;
995
- var execOptions = params.execOptions;
996
- var pipe = params.pipe;
997
- var stdoutFile = params.stdoutFile;
998
- var stderrFile = params.stderrFile;
999
- var c = childProcess.exec(cmd, execOptions, function(err) {
1000
- if (!err) {
1001
- process.exitCode = 0;
1002
- } else if (err.code === void 0) {
1003
- process.exitCode = 1;
1004
- } else {
1005
- process.exitCode = err.code;
1006
- }
1007
- });
1008
- var stdoutStream = fs.createWriteStream(stdoutFile);
1009
- var stderrStream = fs.createWriteStream(stderrFile);
1010
- c.stdout.pipe(stdoutStream);
1011
- c.stderr.pipe(stderrStream);
1012
- c.stdout.pipe(process.stdout);
1013
- c.stderr.pipe(process.stderr);
1014
- if (pipe) {
1015
- c.stdin.end(pipe);
1016
- }
1017
- }
1018
- });
1019
-
1020
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/tempdir.js
1021
- var require_tempdir = __commonJS({
1022
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/tempdir.js"(exports, module) {
1023
- init_cjs_shims();
1024
- var common = require_common();
1025
- var os = __require("os");
1026
- var fs = __require("fs");
1027
- common.register("tempdir", _tempDir, {
1028
- allowGlobbing: false,
1029
- wrapOutput: false
1030
- });
1031
- function writeableDir(dir) {
1032
- if (!dir || !fs.existsSync(dir))
1033
- return false;
1034
- if (!common.statFollowLinks(dir).isDirectory())
1035
- return false;
1036
- var testFile = dir + "/" + common.randomFileName();
1037
- try {
1038
- fs.writeFileSync(testFile, " ");
1039
- common.unlinkSync(testFile);
1040
- return dir;
1041
- } catch (e) {
1042
- return false;
1043
- }
1044
- }
1045
- var cachedTempDir;
1046
- function _tempDir() {
1047
- if (cachedTempDir)
1048
- return cachedTempDir;
1049
- cachedTempDir = writeableDir(os.tmpdir()) || writeableDir(process.env.TMPDIR) || writeableDir(process.env.TEMP) || writeableDir(process.env.TMP) || writeableDir(process.env.Wimp$ScrapDir) || // RiscOS
1050
- writeableDir("C:\\TEMP") || // Windows
1051
- writeableDir("C:\\TMP") || // Windows
1052
- writeableDir("\\TEMP") || // Windows
1053
- writeableDir("\\TMP") || // Windows
1054
- writeableDir("/tmp") || writeableDir("/var/tmp") || writeableDir("/usr/tmp") || writeableDir(".");
1055
- return cachedTempDir;
1056
- }
1057
- function isCached() {
1058
- return cachedTempDir;
1059
- }
1060
- function clearCache() {
1061
- cachedTempDir = void 0;
1062
- }
1063
- module.exports.tempDir = _tempDir;
1064
- module.exports.isCached = isCached;
1065
- module.exports.clearCache = clearCache;
1066
- }
1067
- });
1068
-
1069
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/pwd.js
1070
- var require_pwd = __commonJS({
1071
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/pwd.js"(exports, module) {
1072
- init_cjs_shims();
1073
- var path = __require("path");
1074
- var common = require_common();
1075
- common.register("pwd", _pwd, {
1076
- allowGlobbing: false
1077
- });
1078
- function _pwd() {
1079
- var pwd = path.resolve(process.cwd());
1080
- return pwd;
1081
- }
1082
- module.exports = _pwd;
1083
- }
1084
- });
1085
-
1086
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/exec.js
1087
- var require_exec = __commonJS({
1088
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/exec.js"(exports, module) {
1089
- init_cjs_shims();
1090
- var common = require_common();
1091
- var _tempDir = require_tempdir().tempDir;
1092
- var _pwd = require_pwd();
1093
- var path = __require("path");
1094
- var fs = __require("fs");
1095
- var child = __require("child_process");
1096
- var DEFAULT_MAXBUFFER_SIZE = 20 * 1024 * 1024;
1097
- var DEFAULT_ERROR_CODE = 1;
1098
- common.register("exec", _exec, {
1099
- unix: false,
1100
- canReceivePipe: true,
1101
- wrapOutput: false
1102
- });
1103
- function execSync(cmd, opts, pipe) {
1104
- if (!common.config.execPath) {
1105
- common.error("Unable to find a path to the node binary. Please manually set config.execPath");
1106
- }
1107
- var tempDir = _tempDir();
1108
- var paramsFile = path.resolve(tempDir + "/" + common.randomFileName());
1109
- var stderrFile = path.resolve(tempDir + "/" + common.randomFileName());
1110
- var stdoutFile = path.resolve(tempDir + "/" + common.randomFileName());
1111
- opts = common.extend({
1112
- silent: common.config.silent,
1113
- cwd: _pwd().toString(),
1114
- env: process.env,
1115
- maxBuffer: DEFAULT_MAXBUFFER_SIZE,
1116
- encoding: "utf8"
1117
- }, opts);
1118
- if (fs.existsSync(paramsFile))
1119
- common.unlinkSync(paramsFile);
1120
- if (fs.existsSync(stderrFile))
1121
- common.unlinkSync(stderrFile);
1122
- if (fs.existsSync(stdoutFile))
1123
- common.unlinkSync(stdoutFile);
1124
- opts.cwd = path.resolve(opts.cwd);
1125
- var paramsToSerialize = {
1126
- command: cmd,
1127
- execOptions: opts,
1128
- pipe,
1129
- stdoutFile,
1130
- stderrFile
1131
- };
1132
- function writeFileLockedDown(filePath, data) {
1133
- fs.writeFileSync(filePath, data, {
1134
- encoding: "utf8",
1135
- mode: parseInt("600", 8)
1136
- });
1137
- }
1138
- writeFileLockedDown(stdoutFile, "");
1139
- writeFileLockedDown(stderrFile, "");
1140
- writeFileLockedDown(paramsFile, JSON.stringify(paramsToSerialize));
1141
- var execArgs = [
1142
- path.join(__dirname, "exec-child.js"),
1143
- paramsFile
1144
- ];
1145
- if (opts.silent) {
1146
- opts.stdio = "ignore";
1147
- } else {
1148
- opts.stdio = [0, 1, 2];
1149
- }
1150
- var code = 0;
1151
- try {
1152
- delete opts.shell;
1153
- child.execFileSync(common.config.execPath, execArgs, opts);
1154
- } catch (e) {
1155
- code = e.status || DEFAULT_ERROR_CODE;
1156
- }
1157
- var stdout = "";
1158
- var stderr = "";
1159
- if (opts.encoding === "buffer") {
1160
- stdout = fs.readFileSync(stdoutFile);
1161
- stderr = fs.readFileSync(stderrFile);
1162
- } else {
1163
- stdout = fs.readFileSync(stdoutFile, opts.encoding);
1164
- stderr = fs.readFileSync(stderrFile, opts.encoding);
1165
- }
1166
- try {
1167
- common.unlinkSync(paramsFile);
1168
- } catch (e) {
1169
- }
1170
- try {
1171
- common.unlinkSync(stderrFile);
1172
- } catch (e) {
1173
- }
1174
- try {
1175
- common.unlinkSync(stdoutFile);
1176
- } catch (e) {
1177
- }
1178
- if (code !== 0) {
1179
- common.error(stderr, code, { continue: true, silent: true });
1180
- }
1181
- var obj = common.ShellString(stdout, stderr, code);
1182
- return obj;
1183
- }
1184
- function execAsync(cmd, opts, pipe, callback) {
1185
- opts = common.extend({
1186
- silent: common.config.silent,
1187
- cwd: _pwd().toString(),
1188
- env: process.env,
1189
- maxBuffer: DEFAULT_MAXBUFFER_SIZE,
1190
- encoding: "utf8"
1191
- }, opts);
1192
- var c = child.exec(cmd, opts, function(err, stdout, stderr) {
1193
- if (callback) {
1194
- if (!err) {
1195
- callback(0, stdout, stderr);
1196
- } else if (err.code === void 0) {
1197
- callback(1, stdout, stderr);
1198
- } else {
1199
- callback(err.code, stdout, stderr);
1200
- }
1201
- }
1202
- });
1203
- if (pipe)
1204
- c.stdin.end(pipe);
1205
- if (!opts.silent) {
1206
- c.stdout.pipe(process.stdout);
1207
- c.stderr.pipe(process.stderr);
1208
- }
1209
- return c;
1210
- }
1211
- function _exec(command, options, callback) {
1212
- options = options || {};
1213
- if (!command)
1214
- common.error("must specify command");
1215
- var pipe = common.readFromPipe();
1216
- if (typeof options === "function") {
1217
- callback = options;
1218
- options = { async: true };
1219
- }
1220
- if (typeof options === "object" && typeof callback === "function") {
1221
- options.async = true;
1222
- }
1223
- options = common.extend({
1224
- silent: common.config.silent,
1225
- async: false
1226
- }, options);
1227
- if (options.async) {
1228
- return execAsync(command, options, pipe, callback);
1229
- } else {
1230
- return execSync(command, options, pipe);
1231
- }
1232
- }
1233
- module.exports = _exec;
1234
- }
1235
- });
1236
-
1237
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/ls.js
1238
- var require_ls = __commonJS({
1239
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/ls.js"(exports, module) {
1240
- init_cjs_shims();
1241
- var path = __require("path");
1242
- var fs = __require("fs");
1243
- var common = require_common();
1244
- var glob = require_glob();
1245
- var globPatternRecursive = path.sep + "**";
1246
- common.register("ls", _ls, {
1247
- cmdOptions: {
1248
- "R": "recursive",
1249
- "A": "all",
1250
- "L": "link",
1251
- "a": "all_deprecated",
1252
- "d": "directory",
1253
- "l": "long"
1254
- }
1255
- });
1256
- function _ls(options, paths) {
1257
- if (options.all_deprecated) {
1258
- common.log("ls: Option -a is deprecated. Use -A instead");
1259
- options.all = true;
1260
- }
1261
- if (!paths) {
1262
- paths = ["."];
1263
- } else {
1264
- paths = [].slice.call(arguments, 1);
1265
- }
1266
- var list = [];
1267
- function pushFile(abs, relName, stat) {
1268
- if (process.platform === "win32") {
1269
- relName = relName.replace(/\\/g, "/");
1270
- }
1271
- if (options.long) {
1272
- stat = stat || (options.link ? common.statFollowLinks(abs) : common.statNoFollowLinks(abs));
1273
- list.push(addLsAttributes(relName, stat));
1274
- } else {
1275
- list.push(relName);
1276
- }
1277
- }
1278
- paths.forEach(function(p) {
1279
- var stat;
1280
- try {
1281
- stat = options.link ? common.statFollowLinks(p) : common.statNoFollowLinks(p);
1282
- if (stat.isSymbolicLink()) {
1283
- try {
1284
- var _stat = common.statFollowLinks(p);
1285
- if (_stat.isDirectory()) {
1286
- stat = _stat;
1287
- }
1288
- } catch (_) {
1289
- }
1290
- }
1291
- } catch (e) {
1292
- common.error("no such file or directory: " + p, 2, { continue: true });
1293
- return;
1294
- }
1295
- if (stat.isDirectory() && !options.directory) {
1296
- if (options.recursive) {
1297
- glob.sync(p + globPatternRecursive, { dot: options.all, follow: options.link }).forEach(function(item) {
1298
- if (path.relative(p, item)) {
1299
- pushFile(item, path.relative(p, item));
1300
- }
1301
- });
1302
- } else if (options.all) {
1303
- fs.readdirSync(p).forEach(function(item) {
1304
- pushFile(path.join(p, item), item);
1305
- });
1306
- } else {
1307
- fs.readdirSync(p).forEach(function(item) {
1308
- if (item[0] !== ".") {
1309
- pushFile(path.join(p, item), item);
1310
- }
1311
- });
1312
- }
1313
- } else {
1314
- pushFile(p, p, stat);
1315
- }
1316
- });
1317
- return list;
1318
- }
1319
- function addLsAttributes(pathName, stats) {
1320
- stats.name = pathName;
1321
- stats.toString = function() {
1322
- return [this.mode, this.nlink, this.uid, this.gid, this.size, this.mtime, this.name].join(" ");
1323
- };
1324
- return stats;
1325
- }
1326
- module.exports = _ls;
1327
- }
1328
- });
1329
-
1330
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/find.js
1331
- var require_find = __commonJS({
1332
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/find.js"(exports, module) {
1333
- init_cjs_shims();
1334
- var path = __require("path");
1335
- var common = require_common();
1336
- var _ls = require_ls();
1337
- common.register("find", _find, {});
1338
- function _find(options, paths) {
1339
- if (!paths) {
1340
- common.error("no path specified");
1341
- } else if (typeof paths === "string") {
1342
- paths = [].slice.call(arguments, 1);
1343
- }
1344
- var list = [];
1345
- function pushFile(file) {
1346
- if (process.platform === "win32") {
1347
- file = file.replace(/\\/g, "/");
1348
- }
1349
- list.push(file);
1350
- }
1351
- paths.forEach(function(file) {
1352
- var stat;
1353
- try {
1354
- stat = common.statFollowLinks(file);
1355
- } catch (e) {
1356
- common.error("no such file or directory: " + file);
1357
- }
1358
- pushFile(file);
1359
- if (stat.isDirectory()) {
1360
- _ls({ recursive: true, all: true }, file).forEach(function(subfile) {
1361
- pushFile(path.join(file, subfile));
1362
- });
1363
- }
1364
- });
1365
- return list;
1366
- }
1367
- module.exports = _find;
1368
- }
1369
- });
1370
-
1371
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/grep.js
1372
- var require_grep = __commonJS({
1373
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/grep.js"(exports, module) {
1374
- init_cjs_shims();
1375
- var common = require_common();
1376
- var fs = __require("fs");
1377
- common.register("grep", _grep, {
1378
- globStart: 2,
1379
- // don't glob-expand the regex
1380
- canReceivePipe: true,
1381
- cmdOptions: {
1382
- "v": "inverse",
1383
- "l": "nameOnly",
1384
- "i": "ignoreCase"
1385
- }
1386
- });
1387
- function _grep(options, regex, files) {
1388
- var pipe = common.readFromPipe();
1389
- if (!files && !pipe)
1390
- common.error("no paths given", 2);
1391
- files = [].slice.call(arguments, 2);
1392
- if (pipe) {
1393
- files.unshift("-");
1394
- }
1395
- var grep = [];
1396
- if (options.ignoreCase) {
1397
- regex = new RegExp(regex, "i");
1398
- }
1399
- files.forEach(function(file) {
1400
- if (!fs.existsSync(file) && file !== "-") {
1401
- common.error("no such file or directory: " + file, 2, { continue: true });
1402
- return;
1403
- }
1404
- var contents = file === "-" ? pipe : fs.readFileSync(file, "utf8");
1405
- if (options.nameOnly) {
1406
- if (contents.match(regex)) {
1407
- grep.push(file);
1408
- }
1409
- } else {
1410
- var lines = contents.split("\n");
1411
- lines.forEach(function(line) {
1412
- var matched = line.match(regex);
1413
- if (options.inverse && !matched || !options.inverse && matched) {
1414
- grep.push(line);
1415
- }
1416
- });
1417
- }
1418
- });
1419
- return grep.join("\n") + "\n";
1420
- }
1421
- module.exports = _grep;
1422
- }
1423
- });
1424
-
1425
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/head.js
1426
- var require_head = __commonJS({
1427
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/head.js"(exports, module) {
1428
- init_cjs_shims();
1429
- var common = require_common();
1430
- var fs = __require("fs");
1431
- common.register("head", _head, {
1432
- canReceivePipe: true,
1433
- cmdOptions: {
1434
- "n": "numLines"
1435
- }
1436
- });
1437
- function readSomeLines(file, numLines) {
1438
- var buf = common.buffer();
1439
- var bufLength = buf.length;
1440
- var bytesRead = bufLength;
1441
- var pos = 0;
1442
- var fdr = fs.openSync(file, "r");
1443
- var numLinesRead = 0;
1444
- var ret = "";
1445
- while (bytesRead === bufLength && numLinesRead < numLines) {
1446
- bytesRead = fs.readSync(fdr, buf, 0, bufLength, pos);
1447
- var bufStr = buf.toString("utf8", 0, bytesRead);
1448
- numLinesRead += bufStr.split("\n").length - 1;
1449
- ret += bufStr;
1450
- pos += bytesRead;
1451
- }
1452
- fs.closeSync(fdr);
1453
- return ret;
1454
- }
1455
- function _head(options, files) {
1456
- var head = [];
1457
- var pipe = common.readFromPipe();
1458
- if (!files && !pipe)
1459
- common.error("no paths given");
1460
- var idx = 1;
1461
- if (options.numLines === true) {
1462
- idx = 2;
1463
- options.numLines = Number(arguments[1]);
1464
- } else if (options.numLines === false) {
1465
- options.numLines = 10;
1466
- }
1467
- files = [].slice.call(arguments, idx);
1468
- if (pipe) {
1469
- files.unshift("-");
1470
- }
1471
- var shouldAppendNewline = false;
1472
- files.forEach(function(file) {
1473
- if (file !== "-") {
1474
- if (!fs.existsSync(file)) {
1475
- common.error("no such file or directory: " + file, { continue: true });
1476
- return;
1477
- } else if (common.statFollowLinks(file).isDirectory()) {
1478
- common.error("error reading '" + file + "': Is a directory", {
1479
- continue: true
1480
- });
1481
- return;
1482
- }
1483
- }
1484
- var contents;
1485
- if (file === "-") {
1486
- contents = pipe;
1487
- } else if (options.numLines < 0) {
1488
- contents = fs.readFileSync(file, "utf8");
1489
- } else {
1490
- contents = readSomeLines(file, options.numLines);
1491
- }
1492
- var lines = contents.split("\n");
1493
- var hasTrailingNewline = lines[lines.length - 1] === "";
1494
- if (hasTrailingNewline) {
1495
- lines.pop();
1496
- }
1497
- shouldAppendNewline = hasTrailingNewline || options.numLines < lines.length;
1498
- head = head.concat(lines.slice(0, options.numLines));
1499
- });
1500
- if (shouldAppendNewline) {
1501
- head.push("");
1502
- }
1503
- return head.join("\n");
1504
- }
1505
- module.exports = _head;
1506
- }
1507
- });
1508
-
1509
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/ln.js
1510
- var require_ln = __commonJS({
1511
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/ln.js"(exports, module) {
1512
- init_cjs_shims();
1513
- var fs = __require("fs");
1514
- var path = __require("path");
1515
- var common = require_common();
1516
- common.register("ln", _ln, {
1517
- cmdOptions: {
1518
- "s": "symlink",
1519
- "f": "force"
1520
- }
1521
- });
1522
- function _ln(options, source, dest) {
1523
- if (!source || !dest) {
1524
- common.error("Missing <source> and/or <dest>");
1525
- }
1526
- source = String(source);
1527
- var sourcePath = path.normalize(source).replace(RegExp(path.sep + "$"), "");
1528
- var isAbsolute = path.resolve(source) === sourcePath;
1529
- dest = path.resolve(process.cwd(), String(dest));
1530
- if (fs.existsSync(dest)) {
1531
- if (!options.force) {
1532
- common.error("Destination file exists", { continue: true });
1533
- }
1534
- fs.unlinkSync(dest);
1535
- }
1536
- if (options.symlink) {
1537
- var isWindows = process.platform === "win32";
1538
- var linkType = isWindows ? "file" : null;
1539
- var resolvedSourcePath = isAbsolute ? sourcePath : path.resolve(process.cwd(), path.dirname(dest), source);
1540
- if (!fs.existsSync(resolvedSourcePath)) {
1541
- common.error("Source file does not exist", { continue: true });
1542
- } else if (isWindows && common.statFollowLinks(resolvedSourcePath).isDirectory()) {
1543
- linkType = "junction";
1544
- }
1545
- try {
1546
- fs.symlinkSync(linkType === "junction" ? resolvedSourcePath : source, dest, linkType);
1547
- } catch (err) {
1548
- common.error(err.message);
1549
- }
1550
- } else {
1551
- if (!fs.existsSync(source)) {
1552
- common.error("Source file does not exist", { continue: true });
1553
- }
1554
- try {
1555
- fs.linkSync(source, dest);
1556
- } catch (err) {
1557
- common.error(err.message);
1558
- }
1559
- }
1560
- return "";
1561
- }
1562
- module.exports = _ln;
1563
- }
1564
- });
1565
-
1566
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/mkdir.js
1567
- var require_mkdir = __commonJS({
1568
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/mkdir.js"(exports, module) {
1569
- init_cjs_shims();
1570
- var common = require_common();
1571
- var fs = __require("fs");
1572
- var path = __require("path");
1573
- common.register("mkdir", _mkdir, {
1574
- cmdOptions: {
1575
- "p": "fullpath"
1576
- }
1577
- });
1578
- function mkdirSyncRecursive(dir) {
1579
- var baseDir = path.dirname(dir);
1580
- if (baseDir === dir) {
1581
- common.error("dirname() failed: [" + dir + "]");
1582
- }
1583
- if (fs.existsSync(baseDir)) {
1584
- fs.mkdirSync(dir, parseInt("0777", 8));
1585
- return;
1586
- }
1587
- mkdirSyncRecursive(baseDir);
1588
- fs.mkdirSync(dir, parseInt("0777", 8));
1589
- }
1590
- function _mkdir(options, dirs) {
1591
- if (!dirs)
1592
- common.error("no paths given");
1593
- if (typeof dirs === "string") {
1594
- dirs = [].slice.call(arguments, 1);
1595
- }
1596
- dirs.forEach(function(dir) {
1597
- try {
1598
- var stat = common.statNoFollowLinks(dir);
1599
- if (!options.fullpath) {
1600
- common.error("path already exists: " + dir, { continue: true });
1601
- } else if (stat.isFile()) {
1602
- common.error("cannot create directory " + dir + ": File exists", { continue: true });
1603
- }
1604
- return;
1605
- } catch (e) {
1606
- }
1607
- var baseDir = path.dirname(dir);
1608
- if (!fs.existsSync(baseDir) && !options.fullpath) {
1609
- common.error("no such file or directory: " + baseDir, { continue: true });
1610
- return;
1611
- }
1612
- try {
1613
- if (options.fullpath) {
1614
- mkdirSyncRecursive(path.resolve(dir));
1615
- } else {
1616
- fs.mkdirSync(dir, parseInt("0777", 8));
1617
- }
1618
- } catch (e) {
1619
- var reason;
1620
- if (e.code === "EACCES") {
1621
- reason = "Permission denied";
1622
- } else if (e.code === "ENOTDIR" || e.code === "ENOENT") {
1623
- reason = "Not a directory";
1624
- } else {
1625
- throw e;
1626
- }
1627
- common.error("cannot create directory " + dir + ": " + reason, { continue: true });
1628
- }
1629
- });
1630
- return "";
1631
- }
1632
- module.exports = _mkdir;
1633
- }
1634
- });
1635
-
1636
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/rm.js
1637
- var require_rm = __commonJS({
1638
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/rm.js"(exports, module) {
1639
- init_cjs_shims();
1640
- var common = require_common();
1641
- var fs = __require("fs");
1642
- common.register("rm", _rm, {
1643
- cmdOptions: {
1644
- "f": "force",
1645
- "r": "recursive",
1646
- "R": "recursive"
1647
- }
1648
- });
1649
- function rmdirSyncRecursive(dir, force, fromSymlink) {
1650
- var files;
1651
- files = fs.readdirSync(dir);
1652
- for (var i = 0; i < files.length; i++) {
1653
- var file = dir + "/" + files[i];
1654
- var currFile = common.statNoFollowLinks(file);
1655
- if (currFile.isDirectory()) {
1656
- rmdirSyncRecursive(file, force);
1657
- } else {
1658
- if (force || isWriteable(file)) {
1659
- try {
1660
- common.unlinkSync(file);
1661
- } catch (e) {
1662
- common.error("could not remove file (code " + e.code + "): " + file, {
1663
- continue: true
1664
- });
1665
- }
1666
- }
1667
- }
1668
- }
1669
- if (fromSymlink)
1670
- return;
1671
- var result;
1672
- try {
1673
- var start = Date.now();
1674
- for (; ; ) {
1675
- try {
1676
- result = fs.rmdirSync(dir);
1677
- if (fs.existsSync(dir))
1678
- throw { code: "EAGAIN" };
1679
- break;
1680
- } catch (er) {
1681
- if (process.platform === "win32" && (er.code === "ENOTEMPTY" || er.code === "EBUSY" || er.code === "EPERM" || er.code === "EAGAIN")) {
1682
- if (Date.now() - start > 1e3)
1683
- throw er;
1684
- } else if (er.code === "ENOENT") {
1685
- break;
1686
- } else {
1687
- throw er;
1688
- }
1689
- }
1690
- }
1691
- } catch (e) {
1692
- common.error("could not remove directory (code " + e.code + "): " + dir, { continue: true });
1693
- }
1694
- return result;
1695
- }
1696
- function isWriteable(file) {
1697
- var writePermission = true;
1698
- try {
1699
- var __fd = fs.openSync(file, "a");
1700
- fs.closeSync(__fd);
1701
- } catch (e) {
1702
- writePermission = false;
1703
- }
1704
- return writePermission;
1705
- }
1706
- function handleFile(file, options) {
1707
- if (options.force || isWriteable(file)) {
1708
- common.unlinkSync(file);
1709
- } else {
1710
- common.error("permission denied: " + file, { continue: true });
1711
- }
1712
- }
1713
- function handleDirectory(file, options) {
1714
- if (options.recursive) {
1715
- rmdirSyncRecursive(file, options.force);
1716
- } else {
1717
- common.error("path is a directory", { continue: true });
1718
- }
1719
- }
1720
- function handleSymbolicLink(file, options) {
1721
- var stats;
1722
- try {
1723
- stats = common.statFollowLinks(file);
1724
- } catch (e) {
1725
- common.unlinkSync(file);
1726
- return;
1727
- }
1728
- if (stats.isFile()) {
1729
- common.unlinkSync(file);
1730
- } else if (stats.isDirectory()) {
1731
- if (file[file.length - 1] === "/") {
1732
- if (options.recursive) {
1733
- var fromSymlink = true;
1734
- rmdirSyncRecursive(file, options.force, fromSymlink);
1735
- } else {
1736
- common.error("path is a directory", { continue: true });
1737
- }
1738
- } else {
1739
- common.unlinkSync(file);
1740
- }
1741
- }
1742
- }
1743
- function handleFIFO(file) {
1744
- common.unlinkSync(file);
1745
- }
1746
- function _rm(options, files) {
1747
- if (!files)
1748
- common.error("no paths given");
1749
- files = [].slice.call(arguments, 1);
1750
- files.forEach(function(file) {
1751
- var lstats;
1752
- try {
1753
- var filepath = file[file.length - 1] === "/" ? file.slice(0, -1) : file;
1754
- lstats = common.statNoFollowLinks(filepath);
1755
- } catch (e) {
1756
- if (!options.force) {
1757
- common.error("no such file or directory: " + file, { continue: true });
1758
- }
1759
- return;
1760
- }
1761
- if (lstats.isFile()) {
1762
- handleFile(file, options);
1763
- } else if (lstats.isDirectory()) {
1764
- handleDirectory(file, options);
1765
- } else if (lstats.isSymbolicLink()) {
1766
- handleSymbolicLink(file, options);
1767
- } else if (lstats.isFIFO()) {
1768
- handleFIFO(file);
1769
- }
1770
- });
1771
- return "";
1772
- }
1773
- module.exports = _rm;
1774
- }
1775
- });
1776
-
1777
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/mv.js
1778
- var require_mv = __commonJS({
1779
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/mv.js"(exports, module) {
1780
- init_cjs_shims();
1781
- var fs = __require("fs");
1782
- var path = __require("path");
1783
- var common = require_common();
1784
- var cp = require_cp();
1785
- var rm = require_rm();
1786
- common.register("mv", _mv, {
1787
- cmdOptions: {
1788
- "f": "!no_force",
1789
- "n": "no_force"
1790
- }
1791
- });
1792
- function checkRecentCreated(sources, index) {
1793
- var lookedSource = sources[index];
1794
- return sources.slice(0, index).some(function(src) {
1795
- return path.basename(src) === path.basename(lookedSource);
1796
- });
1797
- }
1798
- function _mv(options, sources, dest) {
1799
- if (arguments.length < 3) {
1800
- common.error("missing <source> and/or <dest>");
1801
- } else if (arguments.length > 3) {
1802
- sources = [].slice.call(arguments, 1, arguments.length - 1);
1803
- dest = arguments[arguments.length - 1];
1804
- } else if (typeof sources === "string") {
1805
- sources = [sources];
1806
- } else {
1807
- common.error("invalid arguments");
1808
- }
1809
- var exists = fs.existsSync(dest);
1810
- var stats = exists && common.statFollowLinks(dest);
1811
- if ((!exists || !stats.isDirectory()) && sources.length > 1) {
1812
- common.error("dest is not a directory (too many sources)");
1813
- }
1814
- if (exists && stats.isFile() && options.no_force) {
1815
- common.error("dest file already exists: " + dest);
1816
- }
1817
- sources.forEach(function(src, srcIndex) {
1818
- if (!fs.existsSync(src)) {
1819
- common.error("no such file or directory: " + src, { continue: true });
1820
- return;
1821
- }
1822
- var thisDest = dest;
1823
- if (fs.existsSync(dest) && common.statFollowLinks(dest).isDirectory()) {
1824
- thisDest = path.normalize(dest + "/" + path.basename(src));
1825
- }
1826
- var thisDestExists = fs.existsSync(thisDest);
1827
- if (thisDestExists && checkRecentCreated(sources, srcIndex)) {
1828
- if (!options.no_force) {
1829
- common.error("will not overwrite just-created '" + thisDest + "' with '" + src + "'", { continue: true });
1830
- }
1831
- return;
1832
- }
1833
- if (fs.existsSync(thisDest) && options.no_force) {
1834
- common.error("dest file already exists: " + thisDest, { continue: true });
1835
- return;
1836
- }
1837
- if (path.resolve(src) === path.dirname(path.resolve(thisDest))) {
1838
- common.error("cannot move to self: " + src, { continue: true });
1839
- return;
1840
- }
1841
- try {
1842
- fs.renameSync(src, thisDest);
1843
- } catch (e) {
1844
- if (e.code === "EXDEV") {
1845
- cp("-r", src, thisDest);
1846
- rm("-rf", src);
1847
- }
1848
- }
1849
- });
1850
- return "";
1851
- }
1852
- module.exports = _mv;
1853
- }
1854
- });
1855
-
1856
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/popd.js
1857
- var require_popd = __commonJS({
1858
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/popd.js"() {
1859
- init_cjs_shims();
1860
- }
1861
- });
1862
-
1863
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/pushd.js
1864
- var require_pushd = __commonJS({
1865
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/pushd.js"() {
1866
- init_cjs_shims();
1867
- }
1868
- });
1869
-
1870
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/sed.js
1871
- var require_sed = __commonJS({
1872
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/sed.js"(exports, module) {
1873
- init_cjs_shims();
1874
- var common = require_common();
1875
- var fs = __require("fs");
1876
- common.register("sed", _sed, {
1877
- globStart: 3,
1878
- // don't glob-expand regexes
1879
- canReceivePipe: true,
1880
- cmdOptions: {
1881
- "i": "inplace"
1882
- }
1883
- });
1884
- function _sed(options, regex, replacement, files) {
1885
- var pipe = common.readFromPipe();
1886
- if (typeof replacement !== "string" && typeof replacement !== "function") {
1887
- if (typeof replacement === "number") {
1888
- replacement = replacement.toString();
1889
- } else {
1890
- common.error("invalid replacement string");
1891
- }
1892
- }
1893
- if (typeof regex === "string") {
1894
- regex = RegExp(regex);
1895
- }
1896
- if (!files && !pipe) {
1897
- common.error("no files given");
1898
- }
1899
- files = [].slice.call(arguments, 3);
1900
- if (pipe) {
1901
- files.unshift("-");
1902
- }
1903
- var sed = [];
1904
- files.forEach(function(file) {
1905
- if (!fs.existsSync(file) && file !== "-") {
1906
- common.error("no such file or directory: " + file, 2, { continue: true });
1907
- return;
1908
- }
1909
- var contents = file === "-" ? pipe : fs.readFileSync(file, "utf8");
1910
- var lines = contents.split("\n");
1911
- var result = lines.map(function(line) {
1912
- return line.replace(regex, replacement);
1913
- }).join("\n");
1914
- sed.push(result);
1915
- if (options.inplace) {
1916
- fs.writeFileSync(file, result, "utf8");
1917
- }
1918
- });
1919
- return sed.join("\n");
1920
- }
1921
- module.exports = _sed;
1922
- }
1923
- });
1924
-
1925
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/set.js
1926
- var require_set = __commonJS({
1927
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/set.js"(exports, module) {
1928
- init_cjs_shims();
1929
- var common = require_common();
1930
- common.register("set", _set, {
1931
- allowGlobbing: false,
1932
- wrapOutput: false
1933
- });
1934
- function _set(options) {
1935
- if (!options) {
1936
- var args = [].slice.call(arguments, 0);
1937
- if (args.length < 2)
1938
- common.error("must provide an argument");
1939
- options = args[1];
1940
- }
1941
- var negate = options[0] === "+";
1942
- if (negate) {
1943
- options = "-" + options.slice(1);
1944
- }
1945
- options = common.parseOptions(options, {
1946
- "e": "fatal",
1947
- "v": "verbose",
1948
- "f": "noglob"
1949
- });
1950
- if (negate) {
1951
- Object.keys(options).forEach(function(key) {
1952
- options[key] = !options[key];
1953
- });
1954
- }
1955
- Object.keys(options).forEach(function(key) {
1956
- if (negate !== options[key]) {
1957
- common.config[key] = options[key];
1958
- }
1959
- });
1960
- return;
1961
- }
1962
- module.exports = _set;
1963
- }
1964
- });
1965
-
1966
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/sort.js
1967
- var require_sort = __commonJS({
1968
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/sort.js"(exports, module) {
1969
- init_cjs_shims();
1970
- var common = require_common();
1971
- var fs = __require("fs");
1972
- common.register("sort", _sort, {
1973
- canReceivePipe: true,
1974
- cmdOptions: {
1975
- "r": "reverse",
1976
- "n": "numerical"
1977
- }
1978
- });
1979
- function parseNumber(str) {
1980
- var match = str.match(/^\s*(\d*)\s*(.*)$/);
1981
- return { num: Number(match[1]), value: match[2] };
1982
- }
1983
- function unixCmp(a, b) {
1984
- var aLower = a.toLowerCase();
1985
- var bLower = b.toLowerCase();
1986
- return aLower === bLower ? -1 * a.localeCompare(b) : (
1987
- // unix sort treats case opposite how javascript does
1988
- aLower.localeCompare(bLower)
1989
- );
1990
- }
1991
- function numericalCmp(a, b) {
1992
- var objA = parseNumber(a);
1993
- var objB = parseNumber(b);
1994
- if (objA.hasOwnProperty("num") && objB.hasOwnProperty("num")) {
1995
- return objA.num !== objB.num ? objA.num - objB.num : unixCmp(objA.value, objB.value);
1996
- } else {
1997
- return unixCmp(objA.value, objB.value);
1998
- }
1999
- }
2000
- function _sort(options, files) {
2001
- var pipe = common.readFromPipe();
2002
- if (!files && !pipe)
2003
- common.error("no files given");
2004
- files = [].slice.call(arguments, 1);
2005
- if (pipe) {
2006
- files.unshift("-");
2007
- }
2008
- var lines = files.reduce(function(accum, file) {
2009
- if (file !== "-") {
2010
- if (!fs.existsSync(file)) {
2011
- common.error("no such file or directory: " + file, { continue: true });
2012
- return accum;
2013
- } else if (common.statFollowLinks(file).isDirectory()) {
2014
- common.error("read failed: " + file + ": Is a directory", {
2015
- continue: true
2016
- });
2017
- return accum;
2018
- }
2019
- }
2020
- var contents = file === "-" ? pipe : fs.readFileSync(file, "utf8");
2021
- return accum.concat(contents.trimRight().split("\n"));
2022
- }, []);
2023
- var sorted = lines.sort(options.numerical ? numericalCmp : unixCmp);
2024
- if (options.reverse) {
2025
- sorted = sorted.reverse();
2026
- }
2027
- return sorted.join("\n") + "\n";
2028
- }
2029
- module.exports = _sort;
2030
- }
2031
- });
2032
-
2033
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/tail.js
2034
- var require_tail = __commonJS({
2035
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/tail.js"(exports, module) {
2036
- init_cjs_shims();
2037
- var common = require_common();
2038
- var fs = __require("fs");
2039
- common.register("tail", _tail, {
2040
- canReceivePipe: true,
2041
- cmdOptions: {
2042
- "n": "numLines"
2043
- }
2044
- });
2045
- function _tail(options, files) {
2046
- var tail = [];
2047
- var pipe = common.readFromPipe();
2048
- if (!files && !pipe)
2049
- common.error("no paths given");
2050
- var idx = 1;
2051
- if (options.numLines === true) {
2052
- idx = 2;
2053
- options.numLines = Number(arguments[1]);
2054
- } else if (options.numLines === false) {
2055
- options.numLines = 10;
2056
- }
2057
- options.numLines = -1 * Math.abs(options.numLines);
2058
- files = [].slice.call(arguments, idx);
2059
- if (pipe) {
2060
- files.unshift("-");
2061
- }
2062
- var shouldAppendNewline = false;
2063
- files.forEach(function(file) {
2064
- if (file !== "-") {
2065
- if (!fs.existsSync(file)) {
2066
- common.error("no such file or directory: " + file, { continue: true });
2067
- return;
2068
- } else if (common.statFollowLinks(file).isDirectory()) {
2069
- common.error("error reading '" + file + "': Is a directory", {
2070
- continue: true
2071
- });
2072
- return;
2073
- }
2074
- }
2075
- var contents = file === "-" ? pipe : fs.readFileSync(file, "utf8");
2076
- var lines = contents.split("\n");
2077
- if (lines[lines.length - 1] === "") {
2078
- lines.pop();
2079
- shouldAppendNewline = true;
2080
- } else {
2081
- shouldAppendNewline = false;
2082
- }
2083
- tail = tail.concat(lines.slice(options.numLines));
2084
- });
2085
- if (shouldAppendNewline) {
2086
- tail.push("");
2087
- }
2088
- return tail.join("\n");
2089
- }
2090
- module.exports = _tail;
2091
- }
2092
- });
2093
-
2094
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/test.js
2095
- var require_test = __commonJS({
2096
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/test.js"(exports, module) {
2097
- init_cjs_shims();
2098
- var common = require_common();
2099
- var fs = __require("fs");
2100
- common.register("test", _test, {
2101
- cmdOptions: {
2102
- "b": "block",
2103
- "c": "character",
2104
- "d": "directory",
2105
- "e": "exists",
2106
- "f": "file",
2107
- "L": "link",
2108
- "p": "pipe",
2109
- "S": "socket"
2110
- },
2111
- wrapOutput: false,
2112
- allowGlobbing: false
2113
- });
2114
- function _test(options, path) {
2115
- if (!path)
2116
- common.error("no path given");
2117
- var canInterpret = false;
2118
- Object.keys(options).forEach(function(key) {
2119
- if (options[key] === true) {
2120
- canInterpret = true;
2121
- }
2122
- });
2123
- if (!canInterpret)
2124
- common.error("could not interpret expression");
2125
- if (options.link) {
2126
- try {
2127
- return common.statNoFollowLinks(path).isSymbolicLink();
2128
- } catch (e) {
2129
- return false;
2130
- }
2131
- }
2132
- if (!fs.existsSync(path))
2133
- return false;
2134
- if (options.exists)
2135
- return true;
2136
- var stats = common.statFollowLinks(path);
2137
- if (options.block)
2138
- return stats.isBlockDevice();
2139
- if (options.character)
2140
- return stats.isCharacterDevice();
2141
- if (options.directory)
2142
- return stats.isDirectory();
2143
- if (options.file)
2144
- return stats.isFile();
2145
- if (options.pipe)
2146
- return stats.isFIFO();
2147
- if (options.socket)
2148
- return stats.isSocket();
2149
- return false;
2150
- }
2151
- module.exports = _test;
2152
- }
2153
- });
2154
-
2155
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/to.js
2156
- var require_to = __commonJS({
2157
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/to.js"(exports, module) {
2158
- init_cjs_shims();
2159
- var common = require_common();
2160
- var fs = __require("fs");
2161
- var path = __require("path");
2162
- common.register("to", _to, {
2163
- pipeOnly: true,
2164
- wrapOutput: false
2165
- });
2166
- function _to(options, file) {
2167
- if (!file)
2168
- common.error("wrong arguments");
2169
- if (!fs.existsSync(path.dirname(file))) {
2170
- common.error("no such file or directory: " + path.dirname(file));
2171
- }
2172
- try {
2173
- fs.writeFileSync(file, this.stdout || this.toString(), "utf8");
2174
- return this;
2175
- } catch (e) {
2176
- common.error("could not write to file (code " + e.code + "): " + file, { continue: true });
2177
- }
2178
- }
2179
- module.exports = _to;
2180
- }
2181
- });
2182
-
2183
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/toEnd.js
2184
- var require_toEnd = __commonJS({
2185
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/toEnd.js"(exports, module) {
2186
- init_cjs_shims();
2187
- var common = require_common();
2188
- var fs = __require("fs");
2189
- var path = __require("path");
2190
- common.register("toEnd", _toEnd, {
2191
- pipeOnly: true,
2192
- wrapOutput: false
2193
- });
2194
- function _toEnd(options, file) {
2195
- if (!file)
2196
- common.error("wrong arguments");
2197
- if (!fs.existsSync(path.dirname(file))) {
2198
- common.error("no such file or directory: " + path.dirname(file));
2199
- }
2200
- try {
2201
- fs.appendFileSync(file, this.stdout || this.toString(), "utf8");
2202
- return this;
2203
- } catch (e) {
2204
- common.error("could not append to file (code " + e.code + "): " + file, { continue: true });
2205
- }
2206
- }
2207
- module.exports = _toEnd;
2208
- }
2209
- });
2210
-
2211
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/touch.js
2212
- var require_touch = __commonJS({
2213
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/touch.js"(exports, module) {
2214
- init_cjs_shims();
2215
- var common = require_common();
2216
- var fs = __require("fs");
2217
- common.register("touch", _touch, {
2218
- cmdOptions: {
2219
- "a": "atime_only",
2220
- "c": "no_create",
2221
- "d": "date",
2222
- "m": "mtime_only",
2223
- "r": "reference"
2224
- }
2225
- });
2226
- function _touch(opts, files) {
2227
- if (!files) {
2228
- common.error("no files given");
2229
- } else if (typeof files === "string") {
2230
- files = [].slice.call(arguments, 1);
2231
- } else {
2232
- common.error("file arg should be a string file path or an Array of string file paths");
2233
- }
2234
- files.forEach(function(f) {
2235
- touchFile(opts, f);
2236
- });
2237
- return "";
2238
- }
2239
- function touchFile(opts, file) {
2240
- var stat = tryStatFile(file);
2241
- if (stat && stat.isDirectory()) {
2242
- return;
2243
- }
2244
- if (!stat && opts.no_create) {
2245
- return;
2246
- }
2247
- fs.closeSync(fs.openSync(file, "a"));
2248
- var now = /* @__PURE__ */ new Date();
2249
- var mtime = opts.date || now;
2250
- var atime = opts.date || now;
2251
- if (opts.reference) {
2252
- var refStat = tryStatFile(opts.reference);
2253
- if (!refStat) {
2254
- common.error("failed to get attributess of " + opts.reference);
2255
- }
2256
- mtime = refStat.mtime;
2257
- atime = refStat.atime;
2258
- } else if (opts.date) {
2259
- mtime = opts.date;
2260
- atime = opts.date;
2261
- }
2262
- if (opts.atime_only && opts.mtime_only) {
2263
- } else if (opts.atime_only) {
2264
- mtime = stat.mtime;
2265
- } else if (opts.mtime_only) {
2266
- atime = stat.atime;
2267
- }
2268
- fs.utimesSync(file, atime, mtime);
2269
- }
2270
- module.exports = _touch;
2271
- function tryStatFile(filePath) {
2272
- try {
2273
- return common.statFollowLinks(filePath);
2274
- } catch (e) {
2275
- return null;
2276
- }
2277
- }
2278
- }
2279
- });
2280
-
2281
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/uniq.js
2282
- var require_uniq = __commonJS({
2283
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/uniq.js"(exports, module) {
2284
- init_cjs_shims();
2285
- var common = require_common();
2286
- var fs = __require("fs");
2287
- function lpad(c, str) {
2288
- var res = "" + str;
2289
- if (res.length < c) {
2290
- res = Array(c - res.length + 1).join(" ") + res;
2291
- }
2292
- return res;
2293
- }
2294
- common.register("uniq", _uniq, {
2295
- canReceivePipe: true,
2296
- cmdOptions: {
2297
- "i": "ignoreCase",
2298
- "c": "count",
2299
- "d": "duplicates"
2300
- }
2301
- });
2302
- function _uniq(options, input, output) {
2303
- var pipe = common.readFromPipe();
2304
- if (!pipe) {
2305
- if (!input)
2306
- common.error("no input given");
2307
- if (!fs.existsSync(input)) {
2308
- common.error(input + ": No such file or directory");
2309
- } else if (common.statFollowLinks(input).isDirectory()) {
2310
- common.error("error reading '" + input + "'");
2311
- }
2312
- }
2313
- if (output && fs.existsSync(output) && common.statFollowLinks(output).isDirectory()) {
2314
- common.error(output + ": Is a directory");
2315
- }
2316
- var lines = (input ? fs.readFileSync(input, "utf8") : pipe).trimRight().split("\n");
2317
- var compare = function(a, b) {
2318
- return options.ignoreCase ? a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()) : a.localeCompare(b);
2319
- };
2320
- var uniqed = lines.reduceRight(function(res, e) {
2321
- if (res.length === 0) {
2322
- return [{ count: 1, ln: e }];
2323
- } else if (compare(res[0].ln, e) === 0) {
2324
- return [{ count: res[0].count + 1, ln: e }].concat(res.slice(1));
2325
- } else {
2326
- return [{ count: 1, ln: e }].concat(res);
2327
- }
2328
- }, []).filter(function(obj) {
2329
- return options.duplicates ? obj.count > 1 : true;
2330
- }).map(function(obj) {
2331
- return (options.count ? lpad(7, obj.count) + " " : "") + obj.ln;
2332
- }).join("\n") + "\n";
2333
- if (output) {
2334
- new common.ShellString(uniqed).to(output);
2335
- return "";
2336
- } else {
2337
- return uniqed;
2338
- }
2339
- }
2340
- module.exports = _uniq;
2341
- }
2342
- });
2343
-
2344
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/which.js
2345
- var require_which = __commonJS({
2346
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/src/which.js"(exports, module) {
2347
- init_cjs_shims();
2348
- var common = require_common();
2349
- var fs = __require("fs");
2350
- var path = __require("path");
2351
- common.register("which", _which, {
2352
- allowGlobbing: false,
2353
- cmdOptions: {
2354
- "a": "all"
2355
- }
2356
- });
2357
- var XP_DEFAULT_PATHEXT = ".com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh";
2358
- var FILE_EXECUTABLE_MODE = 1;
2359
- function isWindowsPlatform() {
2360
- return process.platform === "win32";
2361
- }
2362
- function splitPath(p) {
2363
- return p ? p.split(path.delimiter) : [];
2364
- }
2365
- function isExecutable(pathName) {
2366
- try {
2367
- fs.accessSync(pathName, FILE_EXECUTABLE_MODE);
2368
- } catch (err) {
2369
- return false;
2370
- }
2371
- return true;
2372
- }
2373
- function checkPath(pathName) {
2374
- return fs.existsSync(pathName) && !common.statFollowLinks(pathName).isDirectory() && (isWindowsPlatform() || isExecutable(pathName));
2375
- }
2376
- function _which(options, cmd) {
2377
- if (!cmd)
2378
- common.error("must specify command");
2379
- var isWindows = isWindowsPlatform();
2380
- var pathArray = splitPath(process.env.PATH);
2381
- var queryMatches = [];
2382
- if (cmd.indexOf("/") === -1) {
2383
- var pathExtArray = [""];
2384
- if (isWindows) {
2385
- var pathExtEnv = process.env.PATHEXT || XP_DEFAULT_PATHEXT;
2386
- pathExtArray = splitPath(pathExtEnv.toUpperCase());
2387
- }
2388
- for (var k = 0; k < pathArray.length; k++) {
2389
- if (queryMatches.length > 0 && !options.all)
2390
- break;
2391
- var attempt = path.resolve(pathArray[k], cmd);
2392
- if (isWindows) {
2393
- attempt = attempt.toUpperCase();
2394
- }
2395
- var match = attempt.match(/\.[^<>:"/\|?*.]+$/);
2396
- if (match && pathExtArray.indexOf(match[0]) >= 0) {
2397
- if (checkPath(attempt)) {
2398
- queryMatches.push(attempt);
2399
- break;
2400
- }
2401
- } else {
2402
- for (var i = 0; i < pathExtArray.length; i++) {
2403
- var ext = pathExtArray[i];
2404
- var newAttempt = attempt + ext;
2405
- if (checkPath(newAttempt)) {
2406
- queryMatches.push(newAttempt);
2407
- break;
2408
- }
2409
- }
2410
- }
2411
- }
2412
- } else if (checkPath(cmd)) {
2413
- queryMatches.push(path.resolve(cmd));
2414
- }
2415
- if (queryMatches.length > 0) {
2416
- return options.all ? queryMatches : queryMatches[0];
2417
- }
2418
- return options.all ? [] : null;
2419
- }
2420
- module.exports = _which;
2421
- }
2422
- });
2423
-
2424
- // require("./src/**/*") in ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/shell.js
2425
- var globRequire_src;
2426
- var init_ = __esm({
2427
- 'require("./src/**/*") in ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/shell.js'() {
2428
- globRequire_src = __glob({
2429
- "./src/cat.js": () => require_cat(),
2430
- "./src/cd.js": () => require_cd(),
2431
- "./src/chmod.js": () => require_chmod(),
2432
- "./src/common.js": () => require_common(),
2433
- "./src/cp.js": () => require_cp(),
2434
- "./src/dirs.js": () => require_dirs(),
2435
- "./src/echo.js": () => require_echo(),
2436
- "./src/error.js": () => require_error(),
2437
- "./src/exec-child.js": () => require_exec_child(),
2438
- "./src/exec.js": () => require_exec(),
2439
- "./src/find.js": () => require_find(),
2440
- "./src/grep.js": () => require_grep(),
2441
- "./src/head.js": () => require_head(),
2442
- "./src/ln.js": () => require_ln(),
2443
- "./src/ls.js": () => require_ls(),
2444
- "./src/mkdir.js": () => require_mkdir(),
2445
- "./src/mv.js": () => require_mv(),
2446
- "./src/popd.js": () => require_popd(),
2447
- "./src/pushd.js": () => require_pushd(),
2448
- "./src/pwd.js": () => require_pwd(),
2449
- "./src/rm.js": () => require_rm(),
2450
- "./src/sed.js": () => require_sed(),
2451
- "./src/set.js": () => require_set(),
2452
- "./src/sort.js": () => require_sort(),
2453
- "./src/tail.js": () => require_tail(),
2454
- "./src/tempdir.js": () => require_tempdir(),
2455
- "./src/test.js": () => require_test(),
2456
- "./src/to.js": () => require_to(),
2457
- "./src/toEnd.js": () => require_toEnd(),
2458
- "./src/touch.js": () => require_touch(),
2459
- "./src/uniq.js": () => require_uniq(),
2460
- "./src/which.js": () => require_which()
2461
- });
2462
- }
2463
- });
2464
-
2465
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/commands.js
2466
- var require_commands = __commonJS({
2467
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/commands.js"(exports, module) {
2468
- init_cjs_shims();
2469
- module.exports = [
2470
- "cat",
2471
- "cd",
2472
- "chmod",
2473
- "cp",
2474
- "dirs",
2475
- "echo",
2476
- "exec",
2477
- "find",
2478
- "grep",
2479
- "head",
2480
- "ln",
2481
- "ls",
2482
- "mkdir",
2483
- "mv",
2484
- "pwd",
2485
- "rm",
2486
- "sed",
2487
- "set",
2488
- "sort",
2489
- "tail",
2490
- "tempdir",
2491
- "test",
2492
- "to",
2493
- "toEnd",
2494
- "touch",
2495
- "uniq",
2496
- "which"
2497
- ];
2498
- }
2499
- });
2500
-
2501
- // ../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/shell.js
2502
- var require_shell = __commonJS({
2503
- "../../node_modules/.pnpm/shelljs@0.8.5/node_modules/shelljs/shell.js"(exports) {
2504
- init_cjs_shims();
2505
- init_();
2506
- var common = require_common();
2507
- require_commands().forEach(function(command) {
2508
- globRequire_src("./src/" + command);
2509
- });
2510
- exports.exit = process.exit;
2511
- exports.error = require_error();
2512
- exports.ShellString = common.ShellString;
2513
- exports.env = process.env;
2514
- exports.config = common.config;
2515
- }
2516
- });
2517
- export default require_shell();