@intelligentgraphics/ig.gfx.packager 3.0.9 → 3.0.10

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 (37) hide show
  1. package/build/cli-cb85e4b5.js +1393 -0
  2. package/build/cli-cb85e4b5.js.map +1 -0
  3. package/build/dependencies-2565d80c.js +133 -0
  4. package/build/dependencies-2565d80c.js.map +1 -0
  5. package/build/generateIndex-f386d332.js +257 -0
  6. package/build/generateIndex-f386d332.js.map +1 -0
  7. package/build/generateParameterType-151ab313.js +75 -0
  8. package/build/generateParameterType-151ab313.js.map +1 -0
  9. package/build/index-67a112b8.js +312 -0
  10. package/build/index-67a112b8.js.map +1 -0
  11. package/build/index-7a955335.js +479 -0
  12. package/build/{index-a48c5d0a.js.map → index-7a955335.js.map} +1 -1
  13. package/build/index.mjs +1 -1
  14. package/build/index.mjs.map +1 -1
  15. package/build/postinstall-962af586.js +67 -0
  16. package/build/{postinstall-9990fb31.js.map → postinstall-962af586.js.map} +1 -1
  17. package/build/publishNpm-1838e45c.js +134 -0
  18. package/build/{publishNpm-74a96626.js.map → publishNpm-1838e45c.js.map} +1 -1
  19. package/build/versionFile-cf6657c8.js +384 -0
  20. package/build/versionFile-cf6657c8.js.map +1 -0
  21. package/package.json +4 -6
  22. package/readme.md +81 -2
  23. package/build/cli-17d957b0.js +0 -2531
  24. package/build/cli-17d957b0.js.map +0 -1
  25. package/build/dependencies-51916db0.js +0 -149
  26. package/build/dependencies-51916db0.js.map +0 -1
  27. package/build/generateIndex-59993f0f.js +0 -266
  28. package/build/generateIndex-59993f0f.js.map +0 -1
  29. package/build/generateParameterType-d3ab08fd.js +0 -74
  30. package/build/generateParameterType-d3ab08fd.js.map +0 -1
  31. package/build/index-a48c5d0a.js +0 -480
  32. package/build/index-ac2cd050.js +0 -308
  33. package/build/index-ac2cd050.js.map +0 -1
  34. package/build/postinstall-9990fb31.js +0 -64
  35. package/build/publishNpm-74a96626.js +0 -133
  36. package/build/versionFile-68e35b54.js +0 -370
  37. package/build/versionFile-68e35b54.js.map +0 -1
@@ -0,0 +1,1393 @@
1
+ import updateNotifier from 'update-notifier';
2
+ import * as fs$1 from 'fs';
3
+ import fs__default from 'fs';
4
+ import * as path$1 from 'path';
5
+ import path__default from 'path';
6
+ import yargs from 'yargs/yargs';
7
+ import { fileURLToPath } from 'url';
8
+ import glob from 'glob';
9
+ import 'resolve';
10
+ import { writePackageSync } from 'write-pkg';
11
+ import 'node:path';
12
+ import 'node:fs';
13
+ import require$$0 from 'assert';
14
+ import require$$2 from 'events';
15
+ import 'core-js/modules/es.typed-array.set.js';
16
+ import require$$6 from 'util';
17
+ import axios from 'axios';
18
+ import inquirer from 'inquirer';
19
+
20
+ const stripUtf8Bom = (text)=>{
21
+ // Catches EFBBBF (UTF-8 BOM) because the buffer-to-string
22
+ // conversion translates it to FEFF (UTF-16 BOM).
23
+ if (text.charCodeAt(0) === 0xfeff) {
24
+ return text.slice(1);
25
+ }
26
+ return text;
27
+ };
28
+
29
+ const readNpmManifest = (directory)=>{
30
+ const packageJsonPath = path$1.join(directory, "package.json");
31
+ const packageJson = stripUtf8Bom(fs$1.readFileSync(packageJsonPath, {
32
+ encoding: "utf8"
33
+ }));
34
+ return JSON.parse(packageJson);
35
+ };
36
+ const writeNpmManifest = (directory, packageJson)=>{
37
+ const packageJsonPath = path$1.join(directory, "package.json");
38
+ writePackageSync(packageJsonPath, packageJson);
39
+ };
40
+
41
+ const getNodeErrorCode = (error)=>{
42
+ if (error !== null && typeof error === "object" && error.code !== undefined) {
43
+ return error.code;
44
+ }
45
+ };
46
+ /**
47
+ * No such file or directory: Commonly raised by fs operations to indicate that a component of the specified pathname does not exist. No entity (file or directory) could be found by the given path.
48
+ *
49
+ * @param {unknown} error
50
+ */ const isErrorENOENT = (error)=>getNodeErrorCode(error) === "ENOENT";
51
+
52
+ // Functionality related to working with a single package.
53
+ const PACKAGE_FILE = "_Package.json";
54
+ const INDEX_FILE = "_Index.json";
55
+ const ANIMATION_FILE_SUFFIX = ".animation.json";
56
+ const getCreatorIndexParameterPrimaryJSType = (type)=>{
57
+ switch(type){
58
+ case "LengthM":
59
+ case "ArcDEG":
60
+ case "Integer":
61
+ case "Int":
62
+ case "Float":
63
+ return "number";
64
+ case "Boolean":
65
+ case "Bool":
66
+ return "boolean";
67
+ case "String":
68
+ case "Material":
69
+ case "Geometry":
70
+ case "Animation":
71
+ case "Interactor":
72
+ case "Evaluator":
73
+ default:
74
+ return "string";
75
+ }
76
+ };
77
+ const parseCreatorPackageName = (manifest)=>{
78
+ const [domain, ...subdomainParts] = manifest.Package.split(".");
79
+ return {
80
+ domain,
81
+ subdomain: subdomainParts.join(".")
82
+ };
83
+ };
84
+ /**
85
+ * Detects the package at the given directory.
86
+ *
87
+ * @param {string} directory
88
+ * @returns {PackageLocation}
89
+ */ const detectPackage = (workspace, directory)=>{
90
+ directory = path$1.resolve(workspace.path, directory);
91
+ const scriptsPath = path$1.join(directory, "Scripts");
92
+ const tsPath = path$1.join(directory, "ts");
93
+ let location;
94
+ if (fs$1.existsSync(scriptsPath)) {
95
+ location = {
96
+ _kind: "PackageLocation",
97
+ path: directory,
98
+ scriptsDir: scriptsPath,
99
+ manifestDir: scriptsPath
100
+ };
101
+ } else if (fs$1.existsSync(tsPath)) {
102
+ location = {
103
+ _kind: "PackageLocation",
104
+ path: directory,
105
+ scriptsDir: tsPath,
106
+ manifestDir: directory
107
+ };
108
+ } else {
109
+ location = {
110
+ _kind: "PackageLocation",
111
+ path: directory,
112
+ scriptsDir: directory,
113
+ manifestDir: directory
114
+ };
115
+ }
116
+ try {
117
+ readPackageCreatorManifest(location);
118
+ } catch (err) {
119
+ if (isErrorENOENT(err)) {
120
+ throw new Error(`No _Package.json found in ${location.manifestDir}`);
121
+ }
122
+ throw err;
123
+ }
124
+ return location;
125
+ };
126
+ const readPackageCreatorManifest = (location)=>{
127
+ const packageJsonPath = path$1.join(location.manifestDir, PACKAGE_FILE);
128
+ const packageJson = stripUtf8Bom(fs$1.readFileSync(packageJsonPath, {
129
+ encoding: "utf8"
130
+ }));
131
+ const result = JSON.parse(packageJson);
132
+ return {
133
+ ...result,
134
+ Scope: result.Scope || result.Package
135
+ };
136
+ };
137
+ const writePackageCreatorManifest = (location, creatorPackage)=>{
138
+ const packageJsonPath = path$1.join(location.manifestDir, PACKAGE_FILE);
139
+ fs$1.writeFileSync(packageJsonPath, JSON.stringify(creatorPackage, null, "\t") + "\n");
140
+ };
141
+ const getPackageCreatorIndexPath = (location)=>path$1.join(location.manifestDir, INDEX_FILE);
142
+ const readPackageCreatorIndex = (location)=>{
143
+ try {
144
+ const indexPath = getPackageCreatorIndexPath(location);
145
+ const index = stripUtf8Bom(fs$1.readFileSync(indexPath, {
146
+ encoding: "utf8"
147
+ }));
148
+ return JSON.parse(index);
149
+ } catch (err) {
150
+ if (isErrorENOENT(err)) {
151
+ return undefined;
152
+ }
153
+ throw err;
154
+ }
155
+ };
156
+ const writePackageCreatorIndex = (location, index)=>{
157
+ const indexPath = getPackageCreatorIndexPath(location);
158
+ fs$1.writeFileSync(indexPath, JSON.stringify(index, null, "\t") + "\n");
159
+ };
160
+ const readPackageNpmManifest = (location)=>{
161
+ try {
162
+ return readNpmManifest(location.manifestDir);
163
+ } catch (err) {
164
+ if (isErrorENOENT(err)) {
165
+ return undefined;
166
+ }
167
+ throw err;
168
+ }
169
+ };
170
+ const writePackageNpmManifest = (location, packageJson)=>{
171
+ writeNpmManifest(location.manifestDir, packageJson);
172
+ };
173
+ const readPackageAnimationList = (location)=>{
174
+ const directoryContent = fs$1.readdirSync(location.manifestDir);
175
+ const animationPathList = [];
176
+ for (const entry of directoryContent){
177
+ if (entry.endsWith(ANIMATION_FILE_SUFFIX)) {
178
+ const animationPath = path$1.join(location.manifestDir, entry);
179
+ animationPathList.push(animationPath);
180
+ }
181
+ }
182
+ return animationPathList;
183
+ };
184
+ const getPackageReleasesDirectory = (location)=>path$1.join(location.path, "Releases");
185
+
186
+ // Functionality related to working with a workspace consisting of multiple packages.
187
+ const detectWorkspace = (directory)=>{
188
+ directory = path$1.resolve(process.cwd(), directory);
189
+ return {
190
+ _kind: "WorkspaceLocation",
191
+ path: directory
192
+ };
193
+ };
194
+ const readWorkspaceNpmManifest = (workspace)=>{
195
+ try {
196
+ return readNpmManifest(workspace.path);
197
+ } catch (err) {
198
+ if (isErrorENOENT(err)) {
199
+ throw new Error(`Expected a package.json file to exist in ${workspace.path}. See packager readme for instructions on how to create the package.json.`);
200
+ }
201
+ throw err;
202
+ }
203
+ };
204
+ const writeWorkspaceNpmManifest = (workspace, packageJson)=>writeNpmManifest(workspace.path, packageJson);
205
+ const getWorkspaceOutputPath = (workspace)=>path$1.join(workspace.path, "bin");
206
+ const getWorkspaceLibPath = (workspace)=>path$1.join(workspace.path, "lib");
207
+ function* iterateWorkspacePackages(workspace) {
208
+ const entries = fs$1.readdirSync(workspace.path, {
209
+ withFileTypes: true
210
+ });
211
+ for (const entry of entries){
212
+ if (!entry.isDirectory()) {
213
+ continue;
214
+ }
215
+ try {
216
+ yield detectPackage(workspace, entry.name);
217
+ } catch {}
218
+ }
219
+ }
220
+
221
+ const getPackageTypescriptFiles = (location)=>glob.sync("**/*.ts", {
222
+ absolute: true,
223
+ cwd: location.scriptsDir,
224
+ ignore: "node_modules/**/*"
225
+ });
226
+
227
+ var writeFileAtomicExports = {};
228
+ var writeFileAtomic = {
229
+ get exports () {
230
+ return writeFileAtomicExports;
231
+ },
232
+ set exports (v){
233
+ writeFileAtomicExports = v;
234
+ }
235
+ };
236
+
237
+ var imurmurhashExports = {};
238
+ var imurmurhash = {
239
+ get exports () {
240
+ return imurmurhashExports;
241
+ },
242
+ set exports (v){
243
+ imurmurhashExports = v;
244
+ }
245
+ };
246
+
247
+ (function(module) {
248
+ (function() {
249
+ var cache;
250
+ // Call this function without `new` to use the cached object (good for
251
+ // single-threaded environments), or with `new` to create a new object.
252
+ //
253
+ // @param {string} key A UTF-16 or ASCII string
254
+ // @param {number} seed An optional positive integer
255
+ // @return {object} A MurmurHash3 object for incremental hashing
256
+ function MurmurHash3(key, seed) {
257
+ var m = this instanceof MurmurHash3 ? this : cache;
258
+ m.reset(seed);
259
+ if (typeof key === 'string' && key.length > 0) {
260
+ m.hash(key);
261
+ }
262
+ if (m !== this) {
263
+ return m;
264
+ }
265
+ }
266
+ // Incrementally add a string to this hash
267
+ //
268
+ // @param {string} key A UTF-16 or ASCII string
269
+ // @return {object} this
270
+ MurmurHash3.prototype.hash = function(key) {
271
+ var h1, k1, i, top, len;
272
+ len = key.length;
273
+ this.len += len;
274
+ k1 = this.k1;
275
+ i = 0;
276
+ switch(this.rem){
277
+ case 0:
278
+ k1 ^= len > i ? key.charCodeAt(i++) & 0xffff : 0;
279
+ case 1:
280
+ k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 8 : 0;
281
+ case 2:
282
+ k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 16 : 0;
283
+ case 3:
284
+ k1 ^= len > i ? (key.charCodeAt(i) & 0xff) << 24 : 0;
285
+ k1 ^= len > i ? (key.charCodeAt(i++) & 0xff00) >> 8 : 0;
286
+ }
287
+ this.rem = len + this.rem & 3; // & 3 is same as % 4
288
+ len -= this.rem;
289
+ if (len > 0) {
290
+ h1 = this.h1;
291
+ while(1){
292
+ k1 = k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000 & 0xffffffff;
293
+ k1 = k1 << 15 | k1 >>> 17;
294
+ k1 = k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000 & 0xffffffff;
295
+ h1 ^= k1;
296
+ h1 = h1 << 13 | h1 >>> 19;
297
+ h1 = h1 * 5 + 0xe6546b64 & 0xffffffff;
298
+ if (i >= len) {
299
+ break;
300
+ }
301
+ k1 = key.charCodeAt(i++) & 0xffff ^ (key.charCodeAt(i++) & 0xffff) << 8 ^ (key.charCodeAt(i++) & 0xffff) << 16;
302
+ top = key.charCodeAt(i++);
303
+ k1 ^= (top & 0xff) << 24 ^ (top & 0xff00) >> 8;
304
+ }
305
+ k1 = 0;
306
+ switch(this.rem){
307
+ case 3:
308
+ k1 ^= (key.charCodeAt(i + 2) & 0xffff) << 16;
309
+ case 2:
310
+ k1 ^= (key.charCodeAt(i + 1) & 0xffff) << 8;
311
+ case 1:
312
+ k1 ^= key.charCodeAt(i) & 0xffff;
313
+ }
314
+ this.h1 = h1;
315
+ }
316
+ this.k1 = k1;
317
+ return this;
318
+ };
319
+ // Get the result of this hash
320
+ //
321
+ // @return {number} The 32-bit hash
322
+ MurmurHash3.prototype.result = function() {
323
+ var k1, h1;
324
+ k1 = this.k1;
325
+ h1 = this.h1;
326
+ if (k1 > 0) {
327
+ k1 = k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000 & 0xffffffff;
328
+ k1 = k1 << 15 | k1 >>> 17;
329
+ k1 = k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000 & 0xffffffff;
330
+ h1 ^= k1;
331
+ }
332
+ h1 ^= this.len;
333
+ h1 ^= h1 >>> 16;
334
+ h1 = h1 * 0xca6b + (h1 & 0xffff) * 0x85eb0000 & 0xffffffff;
335
+ h1 ^= h1 >>> 13;
336
+ h1 = h1 * 0xae35 + (h1 & 0xffff) * 0xc2b20000 & 0xffffffff;
337
+ h1 ^= h1 >>> 16;
338
+ return h1 >>> 0;
339
+ };
340
+ // Reset the hash object for reuse
341
+ //
342
+ // @param {number} seed An optional positive integer
343
+ MurmurHash3.prototype.reset = function(seed) {
344
+ this.h1 = typeof seed === 'number' ? seed : 0;
345
+ this.rem = this.k1 = this.len = 0;
346
+ return this;
347
+ };
348
+ // A cached object to use. This can be safely used if you're in a single-
349
+ // threaded environment, otherwise you need to create new hashes to use.
350
+ cache = new MurmurHash3();
351
+ {
352
+ module.exports = MurmurHash3;
353
+ }
354
+ })();
355
+ })(imurmurhash);
356
+
357
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
358
+
359
+ var signalExitExports = {};
360
+ var signalExit = {
361
+ get exports () {
362
+ return signalExitExports;
363
+ },
364
+ set exports (v){
365
+ signalExitExports = v;
366
+ }
367
+ };
368
+
369
+ var signalsExports = {};
370
+ var signals$1 = {
371
+ get exports () {
372
+ return signalsExports;
373
+ },
374
+ set exports (v){
375
+ signalsExports = v;
376
+ }
377
+ };
378
+
379
+ var hasRequiredSignals;
380
+ function requireSignals() {
381
+ if (hasRequiredSignals) return signalsExports;
382
+ hasRequiredSignals = 1;
383
+ (function(module) {
384
+ // This is not the set of all possible signals.
385
+ //
386
+ // It IS, however, the set of all signals that trigger
387
+ // an exit on either Linux or BSD systems. Linux is a
388
+ // superset of the signal names supported on BSD, and
389
+ // the unknown signals just fail to register, so we can
390
+ // catch that easily enough.
391
+ //
392
+ // Don't bother with SIGKILL. It's uncatchable, which
393
+ // means that we can't fire any callbacks anyway.
394
+ //
395
+ // If a user does happen to register a handler on a non-
396
+ // fatal signal like SIGWINCH or something, and then
397
+ // exit, it'll end up firing `process.emit('exit')`, so
398
+ // the handler will be fired anyway.
399
+ //
400
+ // SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
401
+ // artificially, inherently leave the process in a
402
+ // state from which it is not safe to try and enter JS
403
+ // listeners.
404
+ module.exports = [
405
+ 'SIGABRT',
406
+ 'SIGALRM',
407
+ 'SIGHUP',
408
+ 'SIGINT',
409
+ 'SIGTERM'
410
+ ];
411
+ if (process.platform !== 'win32') {
412
+ module.exports.push('SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT');
413
+ }
414
+ if (process.platform === 'linux') {
415
+ module.exports.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT', 'SIGUNUSED');
416
+ }
417
+ })(signals$1);
418
+ return signalsExports;
419
+ }
420
+
421
+ // Note: since nyc uses this module to output coverage, any lines
422
+ // that are in the direct sync flow of nyc's outputCoverage are
423
+ // ignored, since we can never get coverage for them.
424
+ // grab a reference to node's real process object right away
425
+ var process$1 = commonjsGlobal.process;
426
+ const processOk = function(process) {
427
+ return process && typeof process === 'object' && typeof process.removeListener === 'function' && typeof process.emit === 'function' && typeof process.reallyExit === 'function' && typeof process.listeners === 'function' && typeof process.kill === 'function' && typeof process.pid === 'number' && typeof process.on === 'function';
428
+ };
429
+ // some kind of non-node environment, just no-op
430
+ /* istanbul ignore if */ if (!processOk(process$1)) {
431
+ signalExit.exports = function() {
432
+ return function() {};
433
+ };
434
+ } else {
435
+ var assert = require$$0;
436
+ var signals = requireSignals();
437
+ var isWin = /^win/i.test(process$1.platform);
438
+ var EE = require$$2;
439
+ /* istanbul ignore if */ if (typeof EE !== 'function') {
440
+ EE = EE.EventEmitter;
441
+ }
442
+ var emitter;
443
+ if (process$1.__signal_exit_emitter__) {
444
+ emitter = process$1.__signal_exit_emitter__;
445
+ } else {
446
+ emitter = process$1.__signal_exit_emitter__ = new EE();
447
+ emitter.count = 0;
448
+ emitter.emitted = {};
449
+ }
450
+ // Because this emitter is a global, we have to check to see if a
451
+ // previous version of this library failed to enable infinite listeners.
452
+ // I know what you're about to say. But literally everything about
453
+ // signal-exit is a compromise with evil. Get used to it.
454
+ if (!emitter.infinite) {
455
+ emitter.setMaxListeners(Infinity);
456
+ emitter.infinite = true;
457
+ }
458
+ signalExit.exports = function(cb, opts) {
459
+ /* istanbul ignore if */ if (!processOk(commonjsGlobal.process)) {
460
+ return function() {};
461
+ }
462
+ assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler');
463
+ if (loaded === false) {
464
+ load();
465
+ }
466
+ var ev = 'exit';
467
+ if (opts && opts.alwaysLast) {
468
+ ev = 'afterexit';
469
+ }
470
+ var remove = function() {
471
+ emitter.removeListener(ev, cb);
472
+ if (emitter.listeners('exit').length === 0 && emitter.listeners('afterexit').length === 0) {
473
+ unload();
474
+ }
475
+ };
476
+ emitter.on(ev, cb);
477
+ return remove;
478
+ };
479
+ var unload = function unload() {
480
+ if (!loaded || !processOk(commonjsGlobal.process)) {
481
+ return;
482
+ }
483
+ loaded = false;
484
+ signals.forEach(function(sig) {
485
+ try {
486
+ process$1.removeListener(sig, sigListeners[sig]);
487
+ } catch (er) {}
488
+ });
489
+ process$1.emit = originalProcessEmit;
490
+ process$1.reallyExit = originalProcessReallyExit;
491
+ emitter.count -= 1;
492
+ };
493
+ signalExitExports.unload = unload;
494
+ var emit = function emit(event, code, signal) {
495
+ /* istanbul ignore if */ if (emitter.emitted[event]) {
496
+ return;
497
+ }
498
+ emitter.emitted[event] = true;
499
+ emitter.emit(event, code, signal);
500
+ };
501
+ // { <signal>: <listener fn>, ... }
502
+ var sigListeners = {};
503
+ signals.forEach(function(sig) {
504
+ sigListeners[sig] = function listener() {
505
+ /* istanbul ignore if */ if (!processOk(commonjsGlobal.process)) {
506
+ return;
507
+ }
508
+ // If there are no other listeners, an exit is coming!
509
+ // Simplest way: remove us and then re-send the signal.
510
+ // We know that this will kill the process, so we can
511
+ // safely emit now.
512
+ var listeners = process$1.listeners(sig);
513
+ if (listeners.length === emitter.count) {
514
+ unload();
515
+ emit('exit', null, sig);
516
+ /* istanbul ignore next */ emit('afterexit', null, sig);
517
+ /* istanbul ignore next */ if (isWin && sig === 'SIGHUP') {
518
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
519
+ // so use a supported signal instead
520
+ sig = 'SIGINT';
521
+ }
522
+ /* istanbul ignore next */ process$1.kill(process$1.pid, sig);
523
+ }
524
+ };
525
+ });
526
+ signalExitExports.signals = function() {
527
+ return signals;
528
+ };
529
+ var loaded = false;
530
+ var load = function load() {
531
+ if (loaded || !processOk(commonjsGlobal.process)) {
532
+ return;
533
+ }
534
+ loaded = true;
535
+ // This is the number of onSignalExit's that are in play.
536
+ // It's important so that we can count the correct number of
537
+ // listeners on signals, and don't wait for the other one to
538
+ // handle it instead of us.
539
+ emitter.count += 1;
540
+ signals = signals.filter(function(sig) {
541
+ try {
542
+ process$1.on(sig, sigListeners[sig]);
543
+ return true;
544
+ } catch (er) {
545
+ return false;
546
+ }
547
+ });
548
+ process$1.emit = processEmit;
549
+ process$1.reallyExit = processReallyExit;
550
+ };
551
+ signalExitExports.load = load;
552
+ var originalProcessReallyExit = process$1.reallyExit;
553
+ var processReallyExit = function processReallyExit(code) {
554
+ /* istanbul ignore if */ if (!processOk(commonjsGlobal.process)) {
555
+ return;
556
+ }
557
+ process$1.exitCode = code || /* istanbul ignore next */ 0;
558
+ emit('exit', process$1.exitCode, null);
559
+ /* istanbul ignore next */ emit('afterexit', process$1.exitCode, null);
560
+ /* istanbul ignore next */ originalProcessReallyExit.call(process$1, process$1.exitCode);
561
+ };
562
+ var originalProcessEmit = process$1.emit;
563
+ var processEmit = function processEmit(ev, arg) {
564
+ if (ev === 'exit' && processOk(commonjsGlobal.process)) {
565
+ /* istanbul ignore else */ if (arg !== undefined) {
566
+ process$1.exitCode = arg;
567
+ }
568
+ var ret = originalProcessEmit.apply(this, arguments);
569
+ /* istanbul ignore next */ emit('exit', process$1.exitCode, null);
570
+ /* istanbul ignore next */ emit('afterexit', process$1.exitCode, null);
571
+ /* istanbul ignore next */ return ret;
572
+ } else {
573
+ return originalProcessEmit.apply(this, arguments);
574
+ }
575
+ };
576
+ }
577
+
578
+ var isTypedarray = isTypedArray$2;
579
+ isTypedArray$2.strict = isStrictTypedArray;
580
+ isTypedArray$2.loose = isLooseTypedArray;
581
+ var toString = Object.prototype.toString;
582
+ var names = {
583
+ '[object Int8Array]': true,
584
+ '[object Int16Array]': true,
585
+ '[object Int32Array]': true,
586
+ '[object Uint8Array]': true,
587
+ '[object Uint8ClampedArray]': true,
588
+ '[object Uint16Array]': true,
589
+ '[object Uint32Array]': true,
590
+ '[object Float32Array]': true,
591
+ '[object Float64Array]': true
592
+ };
593
+ function isTypedArray$2(arr) {
594
+ return isStrictTypedArray(arr) || isLooseTypedArray(arr);
595
+ }
596
+ function isStrictTypedArray(arr) {
597
+ return arr instanceof Int8Array || arr instanceof Int16Array || arr instanceof Int32Array || arr instanceof Uint8Array || arr instanceof Uint8ClampedArray || arr instanceof Uint16Array || arr instanceof Uint32Array || arr instanceof Float32Array || arr instanceof Float64Array;
598
+ }
599
+ function isLooseTypedArray(arr) {
600
+ return names[toString.call(arr)];
601
+ }
602
+
603
+ var isTypedArray$1 = isTypedarray.strict;
604
+ var typedarrayToBuffer = function typedarrayToBuffer(arr) {
605
+ if (isTypedArray$1(arr)) {
606
+ // To avoid a copy, use the typed array's underlying ArrayBuffer to back new Buffer
607
+ var buf = Buffer.from(arr.buffer);
608
+ if (arr.byteLength !== arr.buffer.byteLength) {
609
+ // Respect the "view", i.e. byteOffset and byteLength, without doing a copy
610
+ buf = buf.slice(arr.byteOffset, arr.byteOffset + arr.byteLength);
611
+ }
612
+ return buf;
613
+ } else {
614
+ // Pass through all other types to `Buffer.from`
615
+ return Buffer.from(arr);
616
+ }
617
+ };
618
+
619
+ writeFileAtomic.exports = writeFile;
620
+ writeFileAtomicExports.sync = writeFileSync;
621
+ writeFileAtomicExports._getTmpname = getTmpname // for testing
622
+ ;
623
+ writeFileAtomicExports._cleanupOnExit = cleanupOnExit;
624
+ const fs = fs__default;
625
+ const MurmurHash3 = imurmurhashExports;
626
+ const onExit = signalExitExports;
627
+ const path = path__default;
628
+ const isTypedArray = isTypedarray;
629
+ const typedArrayToBuffer = typedarrayToBuffer;
630
+ const { promisify } = require$$6;
631
+ const activeFiles = {};
632
+ // if we run inside of a worker_thread, `process.pid` is not unique
633
+ /* istanbul ignore next */ const threadId = function getId() {
634
+ try {
635
+ const workerThreads = require('worker_threads');
636
+ /// if we are in main thread, this is set to `0`
637
+ return workerThreads.threadId;
638
+ } catch (e) {
639
+ // worker_threads are not available, fallback to 0
640
+ return 0;
641
+ }
642
+ }();
643
+ let invocations = 0;
644
+ function getTmpname(filename) {
645
+ return filename + '.' + MurmurHash3(__filename).hash(String(process.pid)).hash(String(threadId)).hash(String(++invocations)).result();
646
+ }
647
+ function cleanupOnExit(tmpfile) {
648
+ return ()=>{
649
+ try {
650
+ fs.unlinkSync(typeof tmpfile === 'function' ? tmpfile() : tmpfile);
651
+ } catch (_) {}
652
+ };
653
+ }
654
+ function serializeActiveFile(absoluteName) {
655
+ return new Promise((resolve)=>{
656
+ // make a queue if it doesn't already exist
657
+ if (!activeFiles[absoluteName]) activeFiles[absoluteName] = [];
658
+ activeFiles[absoluteName].push(resolve) // add this job to the queue
659
+ ;
660
+ if (activeFiles[absoluteName].length === 1) resolve() // kick off the first one
661
+ ;
662
+ });
663
+ }
664
+ // https://github.com/isaacs/node-graceful-fs/blob/master/polyfills.js#L315-L342
665
+ function isChownErrOk(err) {
666
+ if (err.code === 'ENOSYS') {
667
+ return true;
668
+ }
669
+ const nonroot = !process.getuid || process.getuid() !== 0;
670
+ if (nonroot) {
671
+ if (err.code === 'EINVAL' || err.code === 'EPERM') {
672
+ return true;
673
+ }
674
+ }
675
+ return false;
676
+ }
677
+ async function writeFileAsync(filename, data, options = {}) {
678
+ if (typeof options === 'string') {
679
+ options = {
680
+ encoding: options
681
+ };
682
+ }
683
+ let fd;
684
+ let tmpfile;
685
+ /* istanbul ignore next -- The closure only gets called when onExit triggers */ const removeOnExitHandler = onExit(cleanupOnExit(()=>tmpfile));
686
+ const absoluteName = path.resolve(filename);
687
+ try {
688
+ await serializeActiveFile(absoluteName);
689
+ const truename = await promisify(fs.realpath)(filename).catch(()=>filename);
690
+ tmpfile = getTmpname(truename);
691
+ if (!options.mode || !options.chown) {
692
+ // Either mode or chown is not explicitly set
693
+ // Default behavior is to copy it from original file
694
+ const stats = await promisify(fs.stat)(truename).catch(()=>{});
695
+ if (stats) {
696
+ if (options.mode == null) {
697
+ options.mode = stats.mode;
698
+ }
699
+ if (options.chown == null && process.getuid) {
700
+ options.chown = {
701
+ uid: stats.uid,
702
+ gid: stats.gid
703
+ };
704
+ }
705
+ }
706
+ }
707
+ fd = await promisify(fs.open)(tmpfile, 'w', options.mode);
708
+ if (options.tmpfileCreated) {
709
+ await options.tmpfileCreated(tmpfile);
710
+ }
711
+ if (isTypedArray(data)) {
712
+ data = typedArrayToBuffer(data);
713
+ }
714
+ if (Buffer.isBuffer(data)) {
715
+ await promisify(fs.write)(fd, data, 0, data.length, 0);
716
+ } else if (data != null) {
717
+ await promisify(fs.write)(fd, String(data), 0, String(options.encoding || 'utf8'));
718
+ }
719
+ if (options.fsync !== false) {
720
+ await promisify(fs.fsync)(fd);
721
+ }
722
+ await promisify(fs.close)(fd);
723
+ fd = null;
724
+ if (options.chown) {
725
+ await promisify(fs.chown)(tmpfile, options.chown.uid, options.chown.gid).catch((err)=>{
726
+ if (!isChownErrOk(err)) {
727
+ throw err;
728
+ }
729
+ });
730
+ }
731
+ if (options.mode) {
732
+ await promisify(fs.chmod)(tmpfile, options.mode).catch((err)=>{
733
+ if (!isChownErrOk(err)) {
734
+ throw err;
735
+ }
736
+ });
737
+ }
738
+ await promisify(fs.rename)(tmpfile, truename);
739
+ } finally{
740
+ if (fd) {
741
+ await promisify(fs.close)(fd).catch(/* istanbul ignore next */ ()=>{});
742
+ }
743
+ removeOnExitHandler();
744
+ await promisify(fs.unlink)(tmpfile).catch(()=>{});
745
+ activeFiles[absoluteName].shift() // remove the element added by serializeSameFile
746
+ ;
747
+ if (activeFiles[absoluteName].length > 0) {
748
+ activeFiles[absoluteName][0]() // start next job if one is pending
749
+ ;
750
+ } else delete activeFiles[absoluteName];
751
+ }
752
+ }
753
+ function writeFile(filename, data, options, callback) {
754
+ if (options instanceof Function) {
755
+ callback = options;
756
+ options = {};
757
+ }
758
+ const promise = writeFileAsync(filename, data, options);
759
+ if (callback) {
760
+ promise.then(callback, callback);
761
+ }
762
+ return promise;
763
+ }
764
+ function writeFileSync(filename, data, options) {
765
+ if (typeof options === 'string') options = {
766
+ encoding: options
767
+ };
768
+ else if (!options) options = {};
769
+ try {
770
+ filename = fs.realpathSync(filename);
771
+ } catch (ex) {
772
+ // it's ok, it'll happen on a not yet existing file
773
+ }
774
+ const tmpfile = getTmpname(filename);
775
+ if (!options.mode || !options.chown) {
776
+ // Either mode or chown is not explicitly set
777
+ // Default behavior is to copy it from original file
778
+ try {
779
+ const stats = fs.statSync(filename);
780
+ options = Object.assign({}, options);
781
+ if (!options.mode) {
782
+ options.mode = stats.mode;
783
+ }
784
+ if (!options.chown && process.getuid) {
785
+ options.chown = {
786
+ uid: stats.uid,
787
+ gid: stats.gid
788
+ };
789
+ }
790
+ } catch (ex) {
791
+ // ignore stat errors
792
+ }
793
+ }
794
+ let fd;
795
+ const cleanup = cleanupOnExit(tmpfile);
796
+ const removeOnExitHandler = onExit(cleanup);
797
+ let threw = true;
798
+ try {
799
+ fd = fs.openSync(tmpfile, 'w', options.mode || 0o666);
800
+ if (options.tmpfileCreated) {
801
+ options.tmpfileCreated(tmpfile);
802
+ }
803
+ if (isTypedArray(data)) {
804
+ data = typedArrayToBuffer(data);
805
+ }
806
+ if (Buffer.isBuffer(data)) {
807
+ fs.writeSync(fd, data, 0, data.length, 0);
808
+ } else if (data != null) {
809
+ fs.writeSync(fd, String(data), 0, String(options.encoding || 'utf8'));
810
+ }
811
+ if (options.fsync !== false) {
812
+ fs.fsyncSync(fd);
813
+ }
814
+ fs.closeSync(fd);
815
+ fd = null;
816
+ if (options.chown) {
817
+ try {
818
+ fs.chownSync(tmpfile, options.chown.uid, options.chown.gid);
819
+ } catch (err) {
820
+ if (!isChownErrOk(err)) {
821
+ throw err;
822
+ }
823
+ }
824
+ }
825
+ if (options.mode) {
826
+ try {
827
+ fs.chmodSync(tmpfile, options.mode);
828
+ } catch (err) {
829
+ if (!isChownErrOk(err)) {
830
+ throw err;
831
+ }
832
+ }
833
+ }
834
+ fs.renameSync(tmpfile, filename);
835
+ threw = false;
836
+ } finally{
837
+ if (fd) {
838
+ try {
839
+ fs.closeSync(fd);
840
+ } catch (ex) {
841
+ // ignore close errors at this stage, error may have closed fd already.
842
+ }
843
+ }
844
+ removeOnExitHandler();
845
+ if (threw) {
846
+ cleanup();
847
+ }
848
+ }
849
+ }
850
+
851
+ var CreatorWorkspaceGeometryFileType;
852
+ (function(CreatorWorkspaceGeometryFileType) {
853
+ CreatorWorkspaceGeometryFileType["StandardObj"] = "standard.obj";
854
+ CreatorWorkspaceGeometryFileType["StandardCtm"] = "standard.ctm";
855
+ CreatorWorkspaceGeometryFileType["StandardNormals"] = "normals_std.png";
856
+ CreatorWorkspaceGeometryFileType["DeformationGlb"] = "deformation.glb";
857
+ })(CreatorWorkspaceGeometryFileType || (CreatorWorkspaceGeometryFileType = {}));
858
+
859
+ const PLUGIN_ID = "0feba3a0-b6d1-11e6-9598-0800200c9a66";
860
+ /**
861
+ * Starts an IG.Asset.Server session and returns the sessionId
862
+ *
863
+ * @param {SessionStartParams} params
864
+ * @returns
865
+ */ const startSession = async ({ url , authentication , ...params })=>{
866
+ const payload = {
867
+ ...params,
868
+ user: undefined,
869
+ password: undefined,
870
+ license: undefined,
871
+ plugin: PLUGIN_ID
872
+ };
873
+ if (authentication.type === "credentials") {
874
+ payload.user = authentication.username;
875
+ payload.password = authentication.password;
876
+ } else if (authentication.type === "license") {
877
+ payload.license = authentication.license;
878
+ }
879
+ const { data: { session: sessionId , state , response } } = await axios.post(`Session/Start2`, JSON.stringify(payload), {
880
+ baseURL: url
881
+ });
882
+ if (state !== "SUCCESS") {
883
+ let message = `Could not start session. IG.Asset.Server responded with ${state}`;
884
+ if (response) {
885
+ message += `: ${response}`;
886
+ }
887
+ throw new Error(message);
888
+ }
889
+ return {
890
+ _kind: "AssetService",
891
+ url,
892
+ sessionId,
893
+ domain: params.domain,
894
+ subDomain: params.subDomain
895
+ };
896
+ };
897
+ const closeSession = async (session)=>{
898
+ await axios.get(`Session/Close/${session.sessionId}`, {
899
+ baseURL: session.url
900
+ });
901
+ };
902
+ const uploadPackage = async (session, { name , version }, zipFilePath)=>{
903
+ try {
904
+ await uploadPackageToUrl(session.url, `UploadPackage/${session.sessionId}/${name}_${version}`, zipFilePath);
905
+ } catch (err) {
906
+ await uploadPackageToUrl(session.url, `UploadPackage/${session.sessionId}/${name}_${version}/`, zipFilePath);
907
+ }
908
+ };
909
+ const uploadPackageToUrl = async (url, path, zipFilePath)=>{
910
+ const { data , status } = await axios.post(path, fs$1.createReadStream(zipFilePath), {
911
+ baseURL: url
912
+ });
913
+ let objectBody;
914
+ if (typeof data === "string") {
915
+ try {
916
+ objectBody = JSON.parse(data);
917
+ } catch (err) {}
918
+ } else if (typeof data === "object") {
919
+ objectBody = data;
920
+ }
921
+ if (objectBody !== undefined) {
922
+ if ("state" in objectBody && objectBody.state !== "SUCCESS") {
923
+ throw new Error(objectBody.response ?? objectBody.state);
924
+ }
925
+ }
926
+ if (status >= 400) {
927
+ if (objectBody !== undefined) {
928
+ let text_1 = "";
929
+ for(const key in objectBody){
930
+ text_1 += key + ": \n";
931
+ if (typeof objectBody[key] === "object") {
932
+ text_1 += JSON.stringify(objectBody[key], undefined, 2);
933
+ } else {
934
+ text_1 += objectBody[key];
935
+ }
936
+ text_1 += "\n\n";
937
+ }
938
+ throw new Error(text_1);
939
+ }
940
+ throw new Error(data);
941
+ }
942
+ return data;
943
+ };
944
+ const getExistingPackages = async (session)=>{
945
+ const { data } = await axios.get(`Script/GetInformation/${session.sessionId}`, {
946
+ baseURL: session.url,
947
+ validateStatus: (status)=>status === 404 || status === 200
948
+ }).catch((err)=>{
949
+ throw new Error(`Failed to get existing packages: ${err.message}`);
950
+ });
951
+ return data;
952
+ };
953
+
954
+ const createDefaultPrompter = ()=>{
955
+ return {
956
+ confirm: async (message)=>{
957
+ const { confirm } = await inquirer.prompt([
958
+ {
959
+ type: "confirm",
960
+ message,
961
+ name: "confirm"
962
+ }
963
+ ]);
964
+ return confirm;
965
+ },
966
+ ask: async (question)=>{
967
+ const { answer } = await inquirer.prompt([
968
+ {
969
+ type: "list",
970
+ message: question.message,
971
+ name: "answer",
972
+ choices: question.options,
973
+ default: question.default
974
+ }
975
+ ]);
976
+ return answer;
977
+ }
978
+ };
979
+ };
980
+
981
+ const __filename$1 = fileURLToPath(import.meta.url);
982
+ const __dirname = path$1.dirname(__filename$1);
983
+ const pjson = JSON.parse(fs$1.readFileSync(path$1.join(__dirname, "..", "package.json"), "utf8"));
984
+ const captureError = (err)=>{
985
+ console.log("");
986
+ if (process.env.NODE_ENV !== "production") {
987
+ console.error(err);
988
+ } else {
989
+ console.error("Stopped execution because of the following error: " + err.message);
990
+ }
991
+ process.exit(1);
992
+ };
993
+ const buildOptions = {
994
+ outDir: {
995
+ description: "Output directory",
996
+ type: "string",
997
+ default: "bin",
998
+ coerce: (input)=>input === undefined || input === null ? undefined : path$1.resolve(process.cwd(), input)
999
+ },
1000
+ minimize: {
1001
+ description: "Minify output",
1002
+ type: "boolean",
1003
+ default: true
1004
+ },
1005
+ cwd: {
1006
+ description: "Working directory",
1007
+ type: "string",
1008
+ default: process.cwd()
1009
+ },
1010
+ clean: {
1011
+ description: "Empty output dir before compiling",
1012
+ type: "boolean",
1013
+ default: false
1014
+ },
1015
+ docs: {
1016
+ type: "boolean",
1017
+ default: false
1018
+ }
1019
+ };
1020
+ const preCommandCheck = async (workspaceLocation)=>{
1021
+ var _repositoryPackage_dependencies, _repositoryPackage_devDependencies;
1022
+ const executedLocalPackager = __filename$1.startsWith(workspaceLocation.path);
1023
+ const repositoryPackage = readWorkspaceNpmManifest(workspaceLocation);
1024
+ if ((repositoryPackage == null ? void 0 : (_repositoryPackage_dependencies = repositoryPackage.dependencies) == null ? void 0 : _repositoryPackage_dependencies["@intelligentgraphics/ig.gfx.packager"]) || (repositoryPackage == null ? void 0 : (_repositoryPackage_devDependencies = repositoryPackage.devDependencies) == null ? void 0 : _repositoryPackage_devDependencies["@intelligentgraphics/ig.gfx.packager"])) {
1025
+ const parts = [
1026
+ "Detected locally installed ig.gfx.packager."
1027
+ ];
1028
+ if (executedLocalPackager) {
1029
+ parts.push('Run "npm install -g @intelligentgraphics/ig.gfx.packager@latest" to install the global version, if it is not yet installed.');
1030
+ }
1031
+ parts.push('Run "npm uninstall @intelligentgraphics/ig.gfx.packager" to remove the local version.');
1032
+ console.error(parts.join("\n"));
1033
+ process.exit(1);
1034
+ }
1035
+ if (executedLocalPackager) {
1036
+ console.error(`Detected locally installed ig.gfx.packager.
1037
+ Run "npm install -g @intelligentgraphics/ig.gfx.packager@latest" to install the global version, if it is not yet installed.
1038
+ Run "npm install" to get rid of the local packager version.`);
1039
+ process.exit(1);
1040
+ }
1041
+ const notifier = updateNotifier({
1042
+ pkg: pjson,
1043
+ shouldNotifyInNpmScript: true,
1044
+ updateCheckInterval: 1000 * 60
1045
+ });
1046
+ notifier.notify({
1047
+ isGlobal: true,
1048
+ defer: true
1049
+ });
1050
+ if (repositoryPackage === undefined) {
1051
+ throw new Error("Could not load package.json file in current directory");
1052
+ }
1053
+ repositoryPackage.scripts ??= {};
1054
+ repositoryPackage.scripts.postinstall = "packager postinstall";
1055
+ writeWorkspaceNpmManifest(workspaceLocation, repositoryPackage);
1056
+ };
1057
+ const yargsInstance = yargs(process.argv.slice(2));
1058
+ const resolvePackagesWithTypescriptFromMaybePatterns = (args = [], workspace)=>{
1059
+ const folders = new Map();
1060
+ for (const arg of args){
1061
+ glob.sync(arg, {
1062
+ cwd: workspace.path,
1063
+ absolute: true
1064
+ }).forEach((folder)=>{
1065
+ try {
1066
+ const location = detectPackage(workspace, folder);
1067
+ if (getPackageTypescriptFiles(location).length === 0) {
1068
+ return;
1069
+ }
1070
+ folders.set(folder, location);
1071
+ } catch (err) {}
1072
+ });
1073
+ }
1074
+ return Array.from(folders.values());
1075
+ };
1076
+ yargsInstance.command("build [directories...]", "Builds the specified directories", (argv)=>argv.options(buildOptions), async ({ directories =[] , ...options })=>{
1077
+ const workspace = detectWorkspace(options.cwd);
1078
+ const folders = resolvePackagesWithTypescriptFromMaybePatterns(directories, workspace);
1079
+ await preCommandCheck(workspace);
1080
+ if (folders.length === 0) {
1081
+ return console.log("No build targets found. Please check wether a folder with the provided name exists and wether it has _Package.json.");
1082
+ }
1083
+ const { buildFolders } = await import('./index-67a112b8.js').then(function (n) { return n.i; });
1084
+ await buildFolders({
1085
+ ...options,
1086
+ packages: folders,
1087
+ workspace
1088
+ }).catch(captureError);
1089
+ });
1090
+ yargsInstance.command("publish [directory]", "Publishes the specified directory", (argv)=>argv.options({
1091
+ ...buildOptions,
1092
+ noUpload: {
1093
+ type: "boolean",
1094
+ default: false,
1095
+ description: "Only zip built files and do not upload them"
1096
+ },
1097
+ domain: {
1098
+ type: "string",
1099
+ description: "Overwrite the publish domain. Defaults to the one in the _Package.json"
1100
+ },
1101
+ subdomain: {
1102
+ type: "string",
1103
+ description: "Overwrite the publish subdomain. Defaults to the one in the _Package.json"
1104
+ },
1105
+ newVersion: {
1106
+ type: "string",
1107
+ description: "The name of the new version",
1108
+ default: process.env.VERSION,
1109
+ required: true
1110
+ },
1111
+ address: {
1112
+ type: "string",
1113
+ description: "Address",
1114
+ default: "localhost"
1115
+ },
1116
+ service: {
1117
+ type: "string",
1118
+ description: "IG.Asset.Server url",
1119
+ default: process.env.IG_GFX_ASSET_SERVICE,
1120
+ required: true
1121
+ },
1122
+ user: {
1123
+ type: "string",
1124
+ description: "User",
1125
+ default: process.env.IG_GFX_USER
1126
+ },
1127
+ password: {
1128
+ type: "string",
1129
+ description: "Password",
1130
+ default: process.env.IG_GFX_PWD
1131
+ },
1132
+ docs: {
1133
+ type: "boolean",
1134
+ default: false,
1135
+ description: "Generate typedoc documentation"
1136
+ },
1137
+ pushOnly: {
1138
+ type: "boolean",
1139
+ default: false,
1140
+ description: "Try to upload an existing zip file without building and validating the version number"
1141
+ },
1142
+ license: {
1143
+ type: "string",
1144
+ description: "Path to a license file",
1145
+ default: process.env.IG_GFX_LICENSE
1146
+ },
1147
+ skipDependencies: {
1148
+ type: "boolean",
1149
+ default: false,
1150
+ description: "Skip dependency checks"
1151
+ }
1152
+ }), async ({ directory , user , password , service , license , ...options })=>{
1153
+ const workspace = detectWorkspace(options.cwd);
1154
+ const folder = detectPackage(workspace, directory);
1155
+ await preCommandCheck(workspace);
1156
+ if (!options.noUpload) {
1157
+ if (!service) {
1158
+ captureError(new Error('The IG.Asset.Server url has to either be provided using the option --service or through the "IG_GFX_ASSET_SERVICE" environment variable'));
1159
+ return;
1160
+ }
1161
+ if (!license && (!user || !password)) {
1162
+ captureError(new Error(`Expected authentication to be provided through either of the following methods:
1163
+ - as a path to a license file using the --license option or the IG_GFX_LICENSE environment variable
1164
+ - as a username and password using the --user and --password options, or the IG_GFX_USER and IG_GFX_PWD environment variables`));
1165
+ return;
1166
+ }
1167
+ if (license && !license.endsWith(".iglic")) {
1168
+ captureError(new Error(`Expected the license path to end with the extension .iglic. Received the path "${license}". You may need to reload your environment variables by restarting the program you're using to execute the packager.`));
1169
+ return;
1170
+ }
1171
+ }
1172
+ let authentication;
1173
+ if (license) {
1174
+ const fullLicensePath = path$1.resolve(process.cwd(), license);
1175
+ try {
1176
+ const content = fs$1.readFileSync(fullLicensePath);
1177
+ authentication = {
1178
+ type: "license",
1179
+ license: content.toString("base64")
1180
+ };
1181
+ } catch (err) {
1182
+ if ((err == null ? void 0 : err.code) === "ENOENT") {
1183
+ captureError(new Error(`Expected to find a license file at path: ${fullLicensePath}`));
1184
+ return;
1185
+ }
1186
+ captureError(new Error(`Failed to read license file at path: ${fullLicensePath}`));
1187
+ return;
1188
+ }
1189
+ } else if (user && password) {
1190
+ console.log(`Detected usage of username and password authentication. Please migrate to the new license file based authentication.`);
1191
+ authentication = {
1192
+ type: "credentials",
1193
+ username: user,
1194
+ password
1195
+ };
1196
+ }
1197
+ const { releaseFolder } = await import('./index-7a955335.js');
1198
+ const prompter = createDefaultPrompter();
1199
+ const fullOptions = {
1200
+ ...options,
1201
+ authentication,
1202
+ service: service,
1203
+ directory: folder,
1204
+ banner: true,
1205
+ prompter,
1206
+ newVersion: options.newVersion,
1207
+ workspace
1208
+ };
1209
+ await releaseFolder(fullOptions).catch(captureError);
1210
+ });
1211
+ yargsInstance.command("testConnection [directory]", "Tests connection to asset service", (argv)=>argv.options({
1212
+ domain: {
1213
+ type: "string",
1214
+ description: "Overwrite the publish domain. Defaults to the one in the _Package.json"
1215
+ },
1216
+ subdomain: {
1217
+ type: "string",
1218
+ description: "Overwrite the publish subdomain. Defaults to the one in the _Package.json"
1219
+ },
1220
+ address: {
1221
+ type: "string",
1222
+ description: "Address",
1223
+ default: "localhost"
1224
+ },
1225
+ service: {
1226
+ type: "string",
1227
+ description: "IG.Asset.Server url",
1228
+ default: process.env.IG_GFX_ASSET_SERVICE,
1229
+ required: true
1230
+ },
1231
+ user: {
1232
+ type: "string",
1233
+ description: "User",
1234
+ default: process.env.IG_GFX_USER
1235
+ },
1236
+ password: {
1237
+ type: "string",
1238
+ description: "Password",
1239
+ default: process.env.IG_GFX_PWD
1240
+ },
1241
+ license: {
1242
+ type: "string",
1243
+ description: "Path to a license file",
1244
+ default: process.env.IG_GFX_LICENSE
1245
+ }
1246
+ }), async ({ user , password , service , license , subdomain , domain , address , directory })=>{
1247
+ if (!service) {
1248
+ captureError(new Error('The IG.Asset.Server url has to either be provided using the option --service or through the "IG_GFX_ASSET_SERVICE" environment variable'));
1249
+ return;
1250
+ }
1251
+ if (!license && (!user || !password)) {
1252
+ captureError(new Error(`Expected authentication to be provided through either of the following methods:
1253
+ - as a path to a license file using the --license option or the IG_GFX_LICENSE environment variable
1254
+ - as a username and password using the --user and --password options, or the IG_GFX_USER and IG_GFX_PWD environment variables`));
1255
+ return;
1256
+ }
1257
+ if (license && !license.endsWith(".iglic")) {
1258
+ captureError(new Error(`Expected the license path to end with the extension .iglic. Received the path "${license}". You may need to reload your environment variables by restarting the program you're using to execute the packager.`));
1259
+ return;
1260
+ }
1261
+ let authentication;
1262
+ if (license) {
1263
+ const fullLicensePath = path$1.resolve(process.cwd(), license);
1264
+ try {
1265
+ const content = fs$1.readFileSync(fullLicensePath);
1266
+ authentication = {
1267
+ type: "license",
1268
+ license: content.toString("base64")
1269
+ };
1270
+ } catch (err) {
1271
+ if ((err == null ? void 0 : err.code) === "ENOENT") {
1272
+ captureError(new Error(`Expected to find a license file at path: ${fullLicensePath}`));
1273
+ return;
1274
+ }
1275
+ captureError(new Error(`Failed to read license file at path: ${fullLicensePath}`));
1276
+ return;
1277
+ }
1278
+ } else if (user && password) {
1279
+ console.log(`Detected usage of username and password authentication. Please migrate to the new license file based authentication.`);
1280
+ authentication = {
1281
+ type: "credentials",
1282
+ username: user,
1283
+ password
1284
+ };
1285
+ }
1286
+ if (authentication === undefined) {
1287
+ throw new Error(`Expected authentication to be available`);
1288
+ }
1289
+ if (typeof directory === "string") {
1290
+ const workspace = detectWorkspace(process.cwd());
1291
+ const folder = detectPackage(workspace, directory);
1292
+ const manifest = readPackageCreatorManifest(folder);
1293
+ const parsedName = parseCreatorPackageName(manifest);
1294
+ if (domain === undefined) {
1295
+ domain = parsedName.domain;
1296
+ }
1297
+ if (subdomain === undefined) {
1298
+ subdomain = parsedName.subdomain;
1299
+ }
1300
+ }
1301
+ if (domain === undefined || subdomain === undefined) {
1302
+ throw new Error(`Expected either domain and subdomain to be provided through options or to be executed for a specific package directory`);
1303
+ }
1304
+ const session = await startSession({
1305
+ url: service,
1306
+ address,
1307
+ domain,
1308
+ subDomain: subdomain,
1309
+ authentication
1310
+ });
1311
+ await closeSession(session);
1312
+ console.log(`Asset service session successfully started and closed`);
1313
+ });
1314
+ yargsInstance.command({
1315
+ command: "generateIndex [directory]",
1316
+ builder: (argv)=>argv.option("ignore", {
1317
+ type: "array",
1318
+ default: [],
1319
+ description: "Files to ignore while generating index"
1320
+ }).option("strictOptional", {
1321
+ type: "boolean",
1322
+ default: false,
1323
+ description: "Marks non optional parameter object properties as required"
1324
+ }),
1325
+ handler: async ({ directory , ignore , strictOptional })=>{
1326
+ const workspace = detectWorkspace(process.cwd());
1327
+ await preCommandCheck(workspace);
1328
+ const { generateIndex } = await import('./generateIndex-f386d332.js');
1329
+ const location = detectPackage(workspace, directory);
1330
+ generateIndex({
1331
+ location,
1332
+ ignore,
1333
+ strictOptional
1334
+ });
1335
+ },
1336
+ describe: "Generates an index file for a package based on typescript types"
1337
+ });
1338
+ yargsInstance.command({
1339
+ command: "generateParameterType [directory] [name]",
1340
+ handler: async ({ directory , name })=>{
1341
+ const workspace = detectWorkspace(process.cwd());
1342
+ await preCommandCheck(workspace);
1343
+ const { generateParameterType } = await import('./generateParameterType-151ab313.js');
1344
+ const location = detectPackage(workspace, directory);
1345
+ generateParameterType({
1346
+ location,
1347
+ name
1348
+ });
1349
+ },
1350
+ describe: "Generates a parameter type for an interactor or evaluator"
1351
+ });
1352
+ yargsInstance.command({
1353
+ command: "postinstall",
1354
+ builder: (argv)=>argv,
1355
+ handler: async ()=>{
1356
+ const { executePostInstall } = await import('./postinstall-962af586.js');
1357
+ executePostInstall(detectWorkspace(process.cwd()));
1358
+ },
1359
+ describe: "Runs postinstall tasks"
1360
+ });
1361
+ yargsInstance.command({
1362
+ command: "publishNpm [directory]",
1363
+ builder: (argv)=>argv.options({
1364
+ newVersion: {
1365
+ type: "string",
1366
+ description: "Name of the new version",
1367
+ default: process.env.VERSION,
1368
+ required: true
1369
+ },
1370
+ dryRun: {
1371
+ type: "boolean"
1372
+ }
1373
+ }),
1374
+ handler: async ({ directory , newVersion , dryRun })=>{
1375
+ const workspace = detectWorkspace(process.cwd());
1376
+ const { publishToNpm } = await import('./publishNpm-1838e45c.js');
1377
+ await publishToNpm({
1378
+ workspace,
1379
+ location: detectPackage(workspace, directory),
1380
+ version: newVersion,
1381
+ dryRun
1382
+ }).catch(captureError);
1383
+ },
1384
+ describe: "Publishes the package to npm"
1385
+ });
1386
+ yargsInstance.demandCommand().pkgConf("packager").showHelpOnFail(false).version(pjson.version).argv;
1387
+
1388
+ var cli = /*#__PURE__*/Object.freeze({
1389
+ __proto__: null
1390
+ });
1391
+
1392
+ export { INDEX_FILE as I, PACKAGE_FILE as P, readPackageAnimationList as a, readPackageCreatorIndex as b, readWorkspaceNpmManifest as c, getPackageReleasesDirectory as d, getExistingPackages as e, closeSession as f, getWorkspaceOutputPath as g, getPackageTypescriptFiles as h, isErrorENOENT as i, writePackageCreatorIndex as j, getCreatorIndexParameterPrimaryJSType as k, getWorkspaceLibPath as l, readNpmManifest as m, stripUtf8Bom as n, readPackageNpmManifest as o, parseCreatorPackageName as p, writePackageNpmManifest as q, readPackageCreatorManifest as r, startSession as s, iterateWorkspacePackages as t, uploadPackage as u, cli as v, writePackageCreatorManifest as w };
1393
+ //# sourceMappingURL=cli-cb85e4b5.js.map