@jujulego/jill 2.5.1 → 3.0.0-alpha.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.
- package/dist/commands/exec.d.ts +3 -2
- package/dist/commons/logger/thread.gateway.d.ts +0 -1
- package/dist/{core.plugin-D4KeO5G0.js → core.plugin-CxgfxFUI.js} +202 -215
- package/dist/core.plugin-CxgfxFUI.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/{ink-command-dQCqkmg0.js → ink-command-CsbkuRbm.js} +108 -119
- package/dist/ink-command-CsbkuRbm.js.map +1 -0
- package/dist/inversify.config.d.ts +1 -1
- package/dist/{jill.application-BEjmcH4e.js → jill.application-DNJpmnCF.js} +71 -70
- package/dist/jill.application-DNJpmnCF.js.map +1 -0
- package/dist/main.js +2 -2
- package/dist/main.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/json.d.ts +0 -1
- package/dist/utils/worker-cache.d.ts +0 -1
- package/dist/{workspace-tree-BJ9EO1FB.js → workspace-tree-VWKE0B6b.js} +117 -117
- package/dist/{workspace-tree-BJ9EO1FB.js.map → workspace-tree-VWKE0B6b.js.map} +1 -1
- package/package.json +26 -28
- package/dist/core.plugin-D4KeO5G0.js.map +0 -1
- package/dist/ink-command-dQCqkmg0.js.map +0 -1
- package/dist/jill.application-BEjmcH4e.js.map +0 -1
|
@@ -594,7 +594,7 @@ and limitations under the License.
|
|
|
594
594
|
}
|
|
595
595
|
return provider.OrdinaryOwnMetadataKeys(O, P);
|
|
596
596
|
}
|
|
597
|
-
// 6 ECMAScript Data
|
|
597
|
+
// 6 ECMAScript Data Types and Values
|
|
598
598
|
// https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values
|
|
599
599
|
function Type(x) {
|
|
600
600
|
if (x === null) return 1 /* Null */ ;
|
|
@@ -654,19 +654,19 @@ and limitations under the License.
|
|
|
654
654
|
case 5 /* Number */ :
|
|
655
655
|
return input;
|
|
656
656
|
}
|
|
657
|
-
var hint =
|
|
657
|
+
var hint = "string" ;
|
|
658
658
|
var exoticToPrim = GetMethod(input, toPrimitiveSymbol);
|
|
659
659
|
if (exoticToPrim !== undefined) {
|
|
660
660
|
var result = exoticToPrim.call(input, hint);
|
|
661
661
|
if (IsObject(result)) throw new TypeError();
|
|
662
662
|
return result;
|
|
663
663
|
}
|
|
664
|
-
return OrdinaryToPrimitive(input
|
|
664
|
+
return OrdinaryToPrimitive(input);
|
|
665
665
|
}
|
|
666
666
|
// 7.1.1.1 OrdinaryToPrimitive(O, hint)
|
|
667
667
|
// https://tc39.github.io/ecma262/#sec-ordinarytoprimitive
|
|
668
668
|
function OrdinaryToPrimitive(O, hint) {
|
|
669
|
-
|
|
669
|
+
var valueOf, result; {
|
|
670
670
|
var toString_1 = O.toString;
|
|
671
671
|
if (IsCallable(toString_1)) {
|
|
672
672
|
var result = toString_1.call(O);
|
|
@@ -677,17 +677,6 @@ and limitations under the License.
|
|
|
677
677
|
var result = valueOf.call(O);
|
|
678
678
|
if (!IsObject(result)) return result;
|
|
679
679
|
}
|
|
680
|
-
} else {
|
|
681
|
-
var valueOf = O.valueOf;
|
|
682
|
-
if (IsCallable(valueOf)) {
|
|
683
|
-
var result = valueOf.call(O);
|
|
684
|
-
if (!IsObject(result)) return result;
|
|
685
|
-
}
|
|
686
|
-
var toString_2 = O.toString;
|
|
687
|
-
if (IsCallable(toString_2)) {
|
|
688
|
-
var result = toString_2.call(O);
|
|
689
|
-
if (!IsObject(result)) return result;
|
|
690
|
-
}
|
|
691
680
|
}
|
|
692
681
|
throw new TypeError();
|
|
693
682
|
}
|
|
@@ -704,7 +693,7 @@ and limitations under the License.
|
|
|
704
693
|
// 7.1.14 ToPropertyKey(argument)
|
|
705
694
|
// https://tc39.github.io/ecma262/#sec-topropertykey
|
|
706
695
|
function ToPropertyKey(argument) {
|
|
707
|
-
var key = ToPrimitive(argument
|
|
696
|
+
var key = ToPrimitive(argument);
|
|
708
697
|
if (IsSymbol(key)) return key;
|
|
709
698
|
return ToString(key);
|
|
710
699
|
}
|
|
@@ -1049,8 +1038,8 @@ and limitations under the License.
|
|
|
1049
1038
|
var provider = {
|
|
1050
1039
|
isProviderFor: function(O, P) {
|
|
1051
1040
|
var metadataPropertySet = metadataOwner.get(O);
|
|
1052
|
-
if (!IsUndefined(metadataPropertySet)) {
|
|
1053
|
-
return
|
|
1041
|
+
if (!IsUndefined(metadataPropertySet) && metadataPropertySet.has(P)) {
|
|
1042
|
+
return true;
|
|
1054
1043
|
}
|
|
1055
1044
|
if (getOwnMetadataKeys(O, P).length) {
|
|
1056
1045
|
if (IsUndefined(metadataPropertySet)) {
|
|
@@ -1091,10 +1080,10 @@ and limitations under the License.
|
|
|
1091
1080
|
|
|
1092
1081
|
// Utils
|
|
1093
1082
|
async function dynamicImport(filepath) {
|
|
1094
|
-
return import(/* webpackIgnore: true */ process.platform ===
|
|
1083
|
+
return import(/* webpackIgnore: true */ process.platform === 'win32' ? `file://${filepath}` : filepath);
|
|
1095
1084
|
}
|
|
1096
1085
|
function fixDefaultExport(mod) {
|
|
1097
|
-
return
|
|
1086
|
+
return 'default' in mod ? mod.default : mod;
|
|
1098
1087
|
}
|
|
1099
1088
|
|
|
1100
1089
|
// Container
|
|
@@ -1109,7 +1098,7 @@ const { lazyInject, lazyInjectNamed } = fixDefaultExport(getDecorators)(containe
|
|
|
1109
1098
|
return (cls)=>{
|
|
1110
1099
|
decorate(injectable(), cls);
|
|
1111
1100
|
container.bind(cls).toSelf().inSingletonScope().onActivation((ctx, service)=>{
|
|
1112
|
-
if (
|
|
1101
|
+
if ('onServiceActivate' in service) {
|
|
1113
1102
|
service.onServiceActivate(ctx);
|
|
1114
1103
|
}
|
|
1115
1104
|
return service;
|
|
@@ -1119,9 +1108,9 @@ const { lazyInject, lazyInjectNamed } = fixDefaultExport(getDecorators)(containe
|
|
|
1119
1108
|
}
|
|
1120
1109
|
|
|
1121
1110
|
// Constants
|
|
1122
|
-
const LOG_BROADCAST_CHANNEL = Symbol.for(
|
|
1111
|
+
const LOG_BROADCAST_CHANNEL = Symbol.for('jujulego:jill:log-broadcast-channel');
|
|
1123
1112
|
// Parameters
|
|
1124
|
-
container.bind(LOG_BROADCAST_CHANNEL).toConstantValue(
|
|
1113
|
+
container.bind(LOG_BROADCAST_CHANNEL).toConstantValue('jujulego:jill:logger');
|
|
1125
1114
|
|
|
1126
1115
|
class ThreadGateway {
|
|
1127
1116
|
// Constructor
|
|
@@ -1153,7 +1142,7 @@ ThreadGateway = _([
|
|
|
1153
1142
|
], ThreadGateway);
|
|
1154
1143
|
|
|
1155
1144
|
// Utils
|
|
1156
|
-
const jillLogFormat = qlevelColor(quick.wrap(chalkTemplateStderr).function`#?:${qprop(
|
|
1145
|
+
const jillLogFormat = qlevelColor(quick.wrap(chalkTemplateStderr).function`#?:${qprop('label')}{grey [#$]} ?#${qprop('message')}#?:${qprop('error')}\n#!error$?#`);
|
|
1157
1146
|
class LogGateway {
|
|
1158
1147
|
// Lifecycle
|
|
1159
1148
|
onServiceActivate({ container }) {
|
|
@@ -1206,7 +1195,7 @@ class ContextService {
|
|
|
1206
1195
|
// Constructor
|
|
1207
1196
|
constructor(logger){
|
|
1208
1197
|
this._storage = new AsyncLocalStorage();
|
|
1209
|
-
this._logger = logger.child(withLabel(
|
|
1198
|
+
this._logger = logger.child(withLabel('context'));
|
|
1210
1199
|
this.reset();
|
|
1211
1200
|
}
|
|
1212
1201
|
// Methods
|
|
@@ -1216,7 +1205,7 @@ class ContextService {
|
|
|
1216
1205
|
_getContext() {
|
|
1217
1206
|
const ctx = this._storage.getStore();
|
|
1218
1207
|
if (!ctx) {
|
|
1219
|
-
this._logger.warning(
|
|
1208
|
+
this._logger.warning('Trying to access uninitialized context');
|
|
1220
1209
|
return {};
|
|
1221
1210
|
}
|
|
1222
1211
|
return ctx;
|
|
@@ -1256,26 +1245,26 @@ ContextService = _([
|
|
|
1256
1245
|
], ContextService);
|
|
1257
1246
|
|
|
1258
1247
|
// Symbols
|
|
1259
|
-
const CONFIG_OPTIONS = Symbol(
|
|
1248
|
+
const CONFIG_OPTIONS = Symbol('jujulego:jill:config-options');
|
|
1260
1249
|
// Constants
|
|
1261
1250
|
const VERBOSITY_LEVEL = {
|
|
1262
|
-
1:
|
|
1263
|
-
2:
|
|
1251
|
+
1: 'verbose',
|
|
1252
|
+
2: 'debug'
|
|
1264
1253
|
};
|
|
1265
1254
|
// Options
|
|
1266
1255
|
function applyConfigOptions(parser) {
|
|
1267
|
-
return parser.option(
|
|
1268
|
-
alias:
|
|
1269
|
-
type:
|
|
1270
|
-
description:
|
|
1256
|
+
return parser.option('verbose', {
|
|
1257
|
+
alias: 'v',
|
|
1258
|
+
type: 'count',
|
|
1259
|
+
description: 'Set verbosity level',
|
|
1271
1260
|
coerce: (cnt)=>VERBOSITY_LEVEL[Math.min(cnt, 2)]
|
|
1272
|
-
}).option(
|
|
1273
|
-
alias:
|
|
1274
|
-
type:
|
|
1275
|
-
description:
|
|
1276
|
-
}).option(
|
|
1277
|
-
type:
|
|
1278
|
-
description:
|
|
1261
|
+
}).option('jobs', {
|
|
1262
|
+
alias: 'j',
|
|
1263
|
+
type: 'number',
|
|
1264
|
+
description: 'Set maximum parallel job number'
|
|
1265
|
+
}).option('hooks', {
|
|
1266
|
+
type: 'boolean',
|
|
1267
|
+
description: 'Run hook scripts'
|
|
1279
1268
|
});
|
|
1280
1269
|
}
|
|
1281
1270
|
container.bind(CONFIG_OPTIONS).toDynamicValue(()=>{
|
|
@@ -1285,15 +1274,15 @@ container.bind(CONFIG_OPTIONS).toDynamicValue(()=>{
|
|
|
1285
1274
|
}).inSingletonScope();
|
|
1286
1275
|
|
|
1287
1276
|
// Constants
|
|
1288
|
-
const CURRENT =
|
|
1277
|
+
const CURRENT = 'current';
|
|
1289
1278
|
|
|
1290
1279
|
// Symbols
|
|
1291
|
-
const MODULE = Symbol(
|
|
1292
|
-
const REGISTRY = Symbol(
|
|
1280
|
+
const MODULE = Symbol('jujulego:jill:module');
|
|
1281
|
+
const REGISTRY = Symbol('jujulego:jill:registry');
|
|
1293
1282
|
// Utils
|
|
1294
1283
|
function getRegistry(target) {
|
|
1295
1284
|
const registry = Reflect.getMetadata(REGISTRY, target);
|
|
1296
|
-
if (typeof registry !==
|
|
1285
|
+
if (typeof registry !== 'function') {
|
|
1297
1286
|
throw new Error(`No registry found in ${target.name}`);
|
|
1298
1287
|
}
|
|
1299
1288
|
return registry;
|
|
@@ -1305,7 +1294,7 @@ function getModule(target, assert = false) {
|
|
|
1305
1294
|
let module = Reflect.getMetadata(MODULE, target);
|
|
1306
1295
|
if (!module || !(module instanceof ContainerModule)) {
|
|
1307
1296
|
const registry = Reflect.getMetadata(REGISTRY, target);
|
|
1308
|
-
if (typeof registry !==
|
|
1297
|
+
if (typeof registry !== 'function') {
|
|
1309
1298
|
if (assert) {
|
|
1310
1299
|
throw new Error(`No module found in ${target.name}`);
|
|
1311
1300
|
}
|
|
@@ -1350,13 +1339,13 @@ function applyMiddlewares(parser, middlewares) {
|
|
|
1350
1339
|
}
|
|
1351
1340
|
|
|
1352
1341
|
// Symbols
|
|
1353
|
-
const COMMAND_OPTS = Symbol(
|
|
1354
|
-
const COMMAND = Symbol(
|
|
1355
|
-
const COMMAND_MODULE = Symbol(
|
|
1342
|
+
const COMMAND_OPTS = Symbol('jujulego:jill:command-opts');
|
|
1343
|
+
const COMMAND = Symbol('jujulego:jill:command');
|
|
1344
|
+
const COMMAND_MODULE = Symbol('jujulego:jill:command-module');
|
|
1356
1345
|
// Utils
|
|
1357
1346
|
function getCommandOpts(target) {
|
|
1358
1347
|
const opts = Reflect.getMetadata(COMMAND_OPTS, target);
|
|
1359
|
-
if (typeof opts !==
|
|
1348
|
+
if (typeof opts !== 'object') {
|
|
1360
1349
|
throw new Error(`No command options found in ${target.name}`);
|
|
1361
1350
|
}
|
|
1362
1351
|
return opts;
|
|
@@ -1382,7 +1371,7 @@ function buildCommandModule(cmd, opts) {
|
|
|
1382
1371
|
} catch (err) {
|
|
1383
1372
|
if (err.message) {
|
|
1384
1373
|
const logger = container.get(Logger);
|
|
1385
|
-
logger.error(
|
|
1374
|
+
logger.error('Error while running command:', err);
|
|
1386
1375
|
}
|
|
1387
1376
|
throw new ExitException(1);
|
|
1388
1377
|
}
|
|
@@ -1394,7 +1383,7 @@ function Command(opts) {
|
|
|
1394
1383
|
return (target)=>{
|
|
1395
1384
|
decorate(injectable(), target);
|
|
1396
1385
|
Reflect.defineMetadata(COMMAND_OPTS, opts, target);
|
|
1397
|
-
const cmd = opts.command.split(
|
|
1386
|
+
const cmd = opts.command.split(' ')[0];
|
|
1398
1387
|
setRegistry(target, (bind)=>{
|
|
1399
1388
|
bind(target).toSelf();
|
|
1400
1389
|
bind(COMMAND).toDynamicValue(({ container })=>container.getAsync(target)).whenTargetNamed(cmd);
|
|
@@ -1407,22 +1396,22 @@ function Command(opts) {
|
|
|
1407
1396
|
}
|
|
1408
1397
|
|
|
1409
1398
|
// Symbols
|
|
1410
|
-
const AJV = Symbol(
|
|
1399
|
+
const AJV = Symbol('jujulego:jill:Ajv');
|
|
1411
1400
|
// Setup
|
|
1412
1401
|
container.bind(AJV).toDynamicValue(({ container })=>{
|
|
1413
1402
|
const logger = container.get(Logger);
|
|
1414
1403
|
return new Ajv.default({
|
|
1415
1404
|
allErrors: true,
|
|
1416
|
-
logger: logger.child(withLabel(
|
|
1417
|
-
strict: process.env.NODE_ENV ===
|
|
1405
|
+
logger: logger.child(withLabel('ajv')),
|
|
1406
|
+
strict: process.env.NODE_ENV === 'development' ? 'log' : true
|
|
1418
1407
|
});
|
|
1419
1408
|
}).inSingletonScope();
|
|
1420
1409
|
|
|
1421
1410
|
function isCacheUpdate(msg) {
|
|
1422
|
-
return typeof msg ===
|
|
1411
|
+
return typeof msg === 'object' && msg !== null && 'key' in msg && 'value' in msg;
|
|
1423
1412
|
}
|
|
1424
1413
|
// Chanel
|
|
1425
|
-
const channel = new BroadcastChannel(
|
|
1414
|
+
const channel = new BroadcastChannel('jujulego:jill:worker-cache');
|
|
1426
1415
|
channel.unref();
|
|
1427
1416
|
channel.onmessage = (arg)=>{
|
|
1428
1417
|
const msg = arg;
|
|
@@ -1479,32 +1468,32 @@ var schema = {
|
|
|
1479
1468
|
};
|
|
1480
1469
|
|
|
1481
1470
|
// Symbols
|
|
1482
|
-
const CONFIG_EXPLORER = Symbol(
|
|
1483
|
-
const CONFIG_VALIDATOR = Symbol(
|
|
1471
|
+
const CONFIG_EXPLORER = Symbol('jujulego:jill:config-explorer');
|
|
1472
|
+
const CONFIG_VALIDATOR = Symbol('jujulego:jill:config-validator');
|
|
1484
1473
|
// Setup
|
|
1485
1474
|
container.bind(CONFIG_VALIDATOR).toDynamicValue(({ container })=>{
|
|
1486
1475
|
const ajv = container.get(AJV);
|
|
1487
1476
|
return ajv.compile(schema);
|
|
1488
1477
|
}).inSingletonScope();
|
|
1489
1478
|
container.bind(CONFIG_EXPLORER).toDynamicValue(()=>{
|
|
1490
|
-
return cosmiconfig(
|
|
1491
|
-
searchStrategy:
|
|
1479
|
+
return cosmiconfig('jill', {
|
|
1480
|
+
searchStrategy: 'global',
|
|
1492
1481
|
loaders: {
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1482
|
+
'.cjs': (filepath)=>dynamicImport(filepath).then((mod)=>mod.default),
|
|
1483
|
+
'.js': (filepath)=>dynamicImport(filepath).then((mod)=>mod.default),
|
|
1484
|
+
'.json': defaultLoaders['.json'],
|
|
1485
|
+
'.yaml': defaultLoaders['.yaml'],
|
|
1486
|
+
'.yml': defaultLoaders['.yml'],
|
|
1498
1487
|
noExt: defaultLoaders.noExt
|
|
1499
1488
|
}
|
|
1500
1489
|
});
|
|
1501
1490
|
}).inSingletonScope();
|
|
1502
1491
|
|
|
1503
1492
|
// Symbols
|
|
1504
|
-
const CONFIG = Symbol(
|
|
1493
|
+
const CONFIG = Symbol('jujulego:jill:config');
|
|
1505
1494
|
// Loader
|
|
1506
1495
|
async function configLoader() {
|
|
1507
|
-
const logger = container.get(Logger).child(withLabel(
|
|
1496
|
+
const logger = container.get(Logger).child(withLabel('config'));
|
|
1508
1497
|
const options = container.get(CONFIG_OPTIONS);
|
|
1509
1498
|
const explorer = container.get(CONFIG_EXPLORER);
|
|
1510
1499
|
const validator = container.get(CONFIG_VALIDATOR);
|
|
@@ -1522,8 +1511,8 @@ async function configLoader() {
|
|
|
1522
1511
|
if (!validator(config)) {
|
|
1523
1512
|
const ajv = container.get(AJV);
|
|
1524
1513
|
const errors = ajv.errorsText(validator.errors, {
|
|
1525
|
-
separator:
|
|
1526
|
-
dataVar:
|
|
1514
|
+
separator: '\n- ',
|
|
1515
|
+
dataVar: 'config'
|
|
1527
1516
|
});
|
|
1528
1517
|
logger.error(`Errors in config file:\n- ${errors}`);
|
|
1529
1518
|
throw new ExitException(1);
|
|
@@ -1541,20 +1530,20 @@ async function configLoader() {
|
|
|
1541
1530
|
logger.debug`Loaded config:\n#!json:${config}`;
|
|
1542
1531
|
return config;
|
|
1543
1532
|
}
|
|
1544
|
-
container.bind(CONFIG).toDynamicValue(async ()=>await workerCache(
|
|
1533
|
+
container.bind(CONFIG).toDynamicValue(async ()=>await workerCache('jujulego:jill:config', configLoader)).inSingletonScope();
|
|
1545
1534
|
|
|
1546
1535
|
class PluginLoaderService {
|
|
1547
1536
|
// Constructor
|
|
1548
1537
|
constructor(_config, logger){
|
|
1549
1538
|
this._config = _config;
|
|
1550
|
-
this._logger = logger.child(withLabel(
|
|
1539
|
+
this._logger = logger.child(withLabel('plugin'));
|
|
1551
1540
|
}
|
|
1552
1541
|
// Methods
|
|
1553
1542
|
async _importPlugin(filepath) {
|
|
1554
1543
|
this._logger.verbose`Loading plugin ${filepath}`;
|
|
1555
1544
|
// Load plugin
|
|
1556
1545
|
let plugin = await dynamicImport(filepath);
|
|
1557
|
-
while(plugin && typeof plugin ===
|
|
1546
|
+
while(plugin && typeof plugin === 'object' && 'default' in plugin){
|
|
1558
1547
|
plugin = plugin.default;
|
|
1559
1548
|
}
|
|
1560
1549
|
if (!plugin) {
|
|
@@ -1588,17 +1577,17 @@ function linesFrom(task, stream) {
|
|
|
1588
1577
|
return inner;
|
|
1589
1578
|
}
|
|
1590
1579
|
// Listen to stream
|
|
1591
|
-
let current =
|
|
1580
|
+
let current = '';
|
|
1592
1581
|
const stop = task.on(`stream.${stream}`, (chunk)=>{
|
|
1593
|
-
const data = current + chunk.data.toString(
|
|
1582
|
+
const data = current + chunk.data.toString('utf-8');
|
|
1594
1583
|
const lines = data.split(/\r?\n/);
|
|
1595
|
-
current = lines.pop() ??
|
|
1584
|
+
current = lines.pop() ?? '';
|
|
1596
1585
|
for (const line of lines){
|
|
1597
1586
|
inner.next(line);
|
|
1598
1587
|
}
|
|
1599
1588
|
});
|
|
1600
1589
|
// Listen to end of task
|
|
1601
|
-
once$(task,
|
|
1590
|
+
once$(task, 'completed', ()=>{
|
|
1602
1591
|
stop();
|
|
1603
1592
|
if (current) {
|
|
1604
1593
|
inner.next(current);
|
|
@@ -1609,7 +1598,7 @@ function linesFrom(task, stream) {
|
|
|
1609
1598
|
|
|
1610
1599
|
// Utils
|
|
1611
1600
|
function isCommandCtx(ctx) {
|
|
1612
|
-
return
|
|
1601
|
+
return 'workspace' in ctx && 'command' in ctx;
|
|
1613
1602
|
}
|
|
1614
1603
|
// Class
|
|
1615
1604
|
class CommandTask extends SpawnTask {
|
|
@@ -1617,7 +1606,7 @@ class CommandTask extends SpawnTask {
|
|
|
1617
1606
|
constructor(workspace, command, args, opts = {}){
|
|
1618
1607
|
let cmd = command;
|
|
1619
1608
|
if (opts.superCommand) {
|
|
1620
|
-
if (typeof opts.superCommand ===
|
|
1609
|
+
if (typeof opts.superCommand === 'string') {
|
|
1621
1610
|
opts.superCommand = [
|
|
1622
1611
|
opts.superCommand
|
|
1623
1612
|
];
|
|
@@ -1638,7 +1627,7 @@ class CommandTask extends SpawnTask {
|
|
|
1638
1627
|
...opts,
|
|
1639
1628
|
cwd: workspace.cwd,
|
|
1640
1629
|
env: {
|
|
1641
|
-
FORCE_COLOR:
|
|
1630
|
+
FORCE_COLOR: '1',
|
|
1642
1631
|
...opts.env
|
|
1643
1632
|
}
|
|
1644
1633
|
});
|
|
@@ -1648,8 +1637,8 @@ class CommandTask extends SpawnTask {
|
|
|
1648
1637
|
// Methods
|
|
1649
1638
|
_logStreams() {
|
|
1650
1639
|
// TODO: clean up this subscriptions
|
|
1651
|
-
linesFrom(this,
|
|
1652
|
-
linesFrom(this,
|
|
1640
|
+
linesFrom(this, 'stdout').subscribe((line)=>this._logger.info(line));
|
|
1641
|
+
linesFrom(this, 'stderr').subscribe((line)=>this._logger.info(line));
|
|
1653
1642
|
}
|
|
1654
1643
|
}
|
|
1655
1644
|
|
|
@@ -1660,21 +1649,21 @@ function capitalize(txt) {
|
|
|
1660
1649
|
function splitCommandLine(line) {
|
|
1661
1650
|
line = line.trim();
|
|
1662
1651
|
const parts = [];
|
|
1663
|
-
let current_cote =
|
|
1652
|
+
let current_cote = '';
|
|
1664
1653
|
let last = 0;
|
|
1665
1654
|
for(let i = 1; i < line.length; ++i){
|
|
1666
1655
|
const c = line[i];
|
|
1667
1656
|
if (current_cote) {
|
|
1668
1657
|
if (c === current_cote) {
|
|
1669
|
-
current_cote =
|
|
1658
|
+
current_cote = '';
|
|
1670
1659
|
}
|
|
1671
1660
|
} else {
|
|
1672
1661
|
if ([
|
|
1673
1662
|
'"',
|
|
1674
|
-
|
|
1663
|
+
'\''
|
|
1675
1664
|
].includes(c)) {
|
|
1676
1665
|
current_cote = c;
|
|
1677
|
-
} else if (c ===
|
|
1666
|
+
} else if (c === ' ') {
|
|
1678
1667
|
parts.push(line.slice(last, i));
|
|
1679
1668
|
last = i + 1;
|
|
1680
1669
|
}
|
|
@@ -1686,7 +1675,7 @@ function splitCommandLine(line) {
|
|
|
1686
1675
|
|
|
1687
1676
|
// Utils
|
|
1688
1677
|
function isScriptCtx(ctx) {
|
|
1689
|
-
return
|
|
1678
|
+
return 'workspace' in ctx && 'script' in ctx;
|
|
1690
1679
|
}
|
|
1691
1680
|
// Class
|
|
1692
1681
|
class ScriptTask extends GroupTask {
|
|
@@ -1712,10 +1701,10 @@ class ScriptTask extends GroupTask {
|
|
|
1712
1701
|
}
|
|
1713
1702
|
// Create command task for script
|
|
1714
1703
|
const [command, ...commandArgs] = splitCommandLine(line);
|
|
1715
|
-
if (command ===
|
|
1704
|
+
if (command === 'jill') {
|
|
1716
1705
|
this._logger.debug(`Interpreting ${line}`);
|
|
1717
|
-
const argv = commandArgs.map((arg)=>arg.replace(/^["'](.+)["']$/,
|
|
1718
|
-
const { JillApplication } = await import('./jill.application-
|
|
1706
|
+
const argv = commandArgs.map((arg)=>arg.replace(/^["'](.+)["']$/, '$1'));
|
|
1707
|
+
const { JillApplication } = await import('./jill.application-DNJpmnCF.js').then(function (n) { return n.j; });
|
|
1719
1708
|
const app = container.get(JillApplication);
|
|
1720
1709
|
const tasks = await app.tasksOf(argv, {
|
|
1721
1710
|
project: this.project,
|
|
@@ -1736,9 +1725,9 @@ class ScriptTask extends GroupTask {
|
|
|
1736
1725
|
...args
|
|
1737
1726
|
], {
|
|
1738
1727
|
logger: this._logger,
|
|
1739
|
-
superCommand: pm ===
|
|
1740
|
-
|
|
1741
|
-
|
|
1728
|
+
superCommand: pm === 'yarn' ? [
|
|
1729
|
+
'yarn',
|
|
1730
|
+
'exec'
|
|
1742
1731
|
] : undefined
|
|
1743
1732
|
}));
|
|
1744
1733
|
return set;
|
|
@@ -1773,31 +1762,31 @@ class ScriptTask extends GroupTask {
|
|
|
1773
1762
|
}
|
|
1774
1763
|
async *_orchestrate() {
|
|
1775
1764
|
if (!this._scriptTasks) {
|
|
1776
|
-
throw new Error(
|
|
1765
|
+
throw new Error('ScriptTask needs to be prepared. Call prepare before starting it');
|
|
1777
1766
|
}
|
|
1778
1767
|
// Run pre-hook
|
|
1779
1768
|
if (this._preHookTasks) {
|
|
1780
1769
|
yield* this._preHookTasks;
|
|
1781
1770
|
if (await this._hasFailed(this._preHookTasks)) {
|
|
1782
|
-
return this.setStatus(
|
|
1771
|
+
return this.setStatus('failed');
|
|
1783
1772
|
}
|
|
1784
1773
|
}
|
|
1785
1774
|
// Run script
|
|
1786
1775
|
yield* this._scriptTasks;
|
|
1787
1776
|
if (await this._hasFailed(this._scriptTasks)) {
|
|
1788
|
-
return this.setStatus(
|
|
1777
|
+
return this.setStatus('failed');
|
|
1789
1778
|
}
|
|
1790
1779
|
// Run post-hook
|
|
1791
1780
|
if (this._postHookTasks) {
|
|
1792
1781
|
yield* this._postHookTasks;
|
|
1793
1782
|
if (await this._hasFailed(this._postHookTasks)) {
|
|
1794
|
-
return this.setStatus(
|
|
1783
|
+
return this.setStatus('failed');
|
|
1795
1784
|
}
|
|
1796
1785
|
}
|
|
1797
|
-
this.setStatus(
|
|
1786
|
+
this.setStatus('done');
|
|
1798
1787
|
}
|
|
1799
1788
|
async _hasFailed(set) {
|
|
1800
|
-
const results = await waitFor$(set,
|
|
1789
|
+
const results = await waitFor$(set, 'finished');
|
|
1801
1790
|
return results.failed > 0;
|
|
1802
1791
|
}
|
|
1803
1792
|
_stop() {
|
|
@@ -1821,7 +1810,7 @@ class ScriptTask extends GroupTask {
|
|
|
1821
1810
|
}
|
|
1822
1811
|
|
|
1823
1812
|
// Symbols
|
|
1824
|
-
const TASK_MANAGER = Symbol(
|
|
1813
|
+
const TASK_MANAGER = Symbol('jujulego:jill:TaskManager');
|
|
1825
1814
|
// Service
|
|
1826
1815
|
container.bind(TASK_MANAGER).toDynamicValue(({ container })=>{
|
|
1827
1816
|
const config = container.get(CONFIG);
|
|
@@ -1847,7 +1836,7 @@ function List({ items, headers }) {
|
|
|
1847
1836
|
children: capitalize(key)
|
|
1848
1837
|
}),
|
|
1849
1838
|
items.map((item, idx)=>/*#__PURE__*/ jsx(Text, {
|
|
1850
|
-
children: item[key] ||
|
|
1839
|
+
children: item[key] || ' '
|
|
1851
1840
|
}, idx))
|
|
1852
1841
|
]
|
|
1853
1842
|
}, key))
|
|
@@ -1882,14 +1871,14 @@ function TaskSpinner({ task }) {
|
|
|
1882
1871
|
const [time, setTime] = useState(task.duration);
|
|
1883
1872
|
// Effects
|
|
1884
1873
|
useLayoutEffect(()=>{
|
|
1885
|
-
return task.on(
|
|
1874
|
+
return task.on('status', (event)=>{
|
|
1886
1875
|
setStatus(event.status);
|
|
1887
1876
|
});
|
|
1888
1877
|
}, [
|
|
1889
1878
|
task
|
|
1890
1879
|
]);
|
|
1891
1880
|
useLayoutEffect(()=>{
|
|
1892
|
-
return task.on(
|
|
1881
|
+
return task.on('completed', ({ duration })=>{
|
|
1893
1882
|
setTime(duration);
|
|
1894
1883
|
});
|
|
1895
1884
|
}, [
|
|
@@ -1898,14 +1887,14 @@ function TaskSpinner({ task }) {
|
|
|
1898
1887
|
// Render
|
|
1899
1888
|
const isScriptChild = isCommandCtx(task.context) && task.group && isScriptCtx(task.group.context);
|
|
1900
1889
|
switch(status){
|
|
1901
|
-
case
|
|
1902
|
-
case
|
|
1903
|
-
case
|
|
1890
|
+
case 'blocked':
|
|
1891
|
+
case 'ready':
|
|
1892
|
+
case 'starting':
|
|
1904
1893
|
return /*#__PURE__*/ jsxs(Box, {
|
|
1905
1894
|
children: [
|
|
1906
1895
|
/*#__PURE__*/ jsx(Text, {
|
|
1907
1896
|
color: "grey",
|
|
1908
|
-
children:
|
|
1897
|
+
children: '\u00B7'
|
|
1909
1898
|
}),
|
|
1910
1899
|
/*#__PURE__*/ jsx(Box, {
|
|
1911
1900
|
paddingLeft: 1,
|
|
@@ -1919,17 +1908,17 @@ function TaskSpinner({ task }) {
|
|
|
1919
1908
|
})
|
|
1920
1909
|
]
|
|
1921
1910
|
});
|
|
1922
|
-
case
|
|
1911
|
+
case 'running':
|
|
1923
1912
|
return /*#__PURE__*/ jsxs(Box, {
|
|
1924
1913
|
children: [
|
|
1925
1914
|
/*#__PURE__*/ jsx(Text, {
|
|
1926
|
-
color: isScriptChild ?
|
|
1915
|
+
color: isScriptChild ? 'dim' : undefined,
|
|
1927
1916
|
children: /*#__PURE__*/ jsx(Spinner, {})
|
|
1928
1917
|
}),
|
|
1929
1918
|
/*#__PURE__*/ jsx(Box, {
|
|
1930
1919
|
paddingLeft: 1,
|
|
1931
1920
|
children: /*#__PURE__*/ jsx(Text, {
|
|
1932
|
-
color: isScriptChild ?
|
|
1921
|
+
color: isScriptChild ? 'dim' : undefined,
|
|
1933
1922
|
wrap: "truncate",
|
|
1934
1923
|
children: /*#__PURE__*/ jsx(TaskName, {
|
|
1935
1924
|
task: task
|
|
@@ -1938,7 +1927,7 @@ function TaskSpinner({ task }) {
|
|
|
1938
1927
|
})
|
|
1939
1928
|
]
|
|
1940
1929
|
});
|
|
1941
|
-
case
|
|
1930
|
+
case 'done':
|
|
1942
1931
|
return /*#__PURE__*/ jsxs(Box, {
|
|
1943
1932
|
children: [
|
|
1944
1933
|
/*#__PURE__*/ jsx(Text, {
|
|
@@ -1948,7 +1937,7 @@ function TaskSpinner({ task }) {
|
|
|
1948
1937
|
/*#__PURE__*/ jsx(Box, {
|
|
1949
1938
|
paddingLeft: 1,
|
|
1950
1939
|
children: /*#__PURE__*/ jsx(Text, {
|
|
1951
|
-
color: isScriptChild ?
|
|
1940
|
+
color: isScriptChild ? 'dim' : undefined,
|
|
1952
1941
|
wrap: "truncate",
|
|
1953
1942
|
children: /*#__PURE__*/ jsx(TaskName, {
|
|
1954
1943
|
task: task
|
|
@@ -1959,7 +1948,7 @@ function TaskSpinner({ task }) {
|
|
|
1959
1948
|
paddingLeft: 1,
|
|
1960
1949
|
flexShrink: 0,
|
|
1961
1950
|
children: /*#__PURE__*/ jsxs(Text, {
|
|
1962
|
-
color: isScriptChild ?
|
|
1951
|
+
color: isScriptChild ? 'grey' : 'dim',
|
|
1963
1952
|
children: [
|
|
1964
1953
|
"(took ",
|
|
1965
1954
|
ms(time),
|
|
@@ -1969,7 +1958,7 @@ function TaskSpinner({ task }) {
|
|
|
1969
1958
|
})
|
|
1970
1959
|
]
|
|
1971
1960
|
});
|
|
1972
|
-
case
|
|
1961
|
+
case 'failed':
|
|
1973
1962
|
return /*#__PURE__*/ jsxs(Box, {
|
|
1974
1963
|
children: [
|
|
1975
1964
|
/*#__PURE__*/ jsx(Text, {
|
|
@@ -1979,7 +1968,7 @@ function TaskSpinner({ task }) {
|
|
|
1979
1968
|
/*#__PURE__*/ jsx(Box, {
|
|
1980
1969
|
paddingLeft: 1,
|
|
1981
1970
|
children: /*#__PURE__*/ jsx(Text, {
|
|
1982
|
-
color: isScriptChild ?
|
|
1971
|
+
color: isScriptChild ? 'dim' : undefined,
|
|
1983
1972
|
wrap: "truncate",
|
|
1984
1973
|
children: /*#__PURE__*/ jsx(TaskName, {
|
|
1985
1974
|
task: task
|
|
@@ -1990,7 +1979,7 @@ function TaskSpinner({ task }) {
|
|
|
1990
1979
|
paddingLeft: 1,
|
|
1991
1980
|
flexShrink: 0,
|
|
1992
1981
|
children: /*#__PURE__*/ jsxs(Text, {
|
|
1993
|
-
color: isScriptChild ?
|
|
1982
|
+
color: isScriptChild ? 'grey' : 'dim',
|
|
1994
1983
|
children: [
|
|
1995
1984
|
"(took ",
|
|
1996
1985
|
ms(time),
|
|
@@ -2024,7 +2013,7 @@ function StaticLogs() {
|
|
|
2024
2013
|
gateway.clear();
|
|
2025
2014
|
// Add custom transport
|
|
2026
2015
|
const off = gateway.subscribe((log)=>{
|
|
2027
|
-
write(jillLogFormat(log) +
|
|
2016
|
+
write(jillLogFormat(log) + '\n');
|
|
2028
2017
|
});
|
|
2029
2018
|
return ()=>{
|
|
2030
2019
|
off();
|
|
@@ -2050,11 +2039,11 @@ function Layout({ children }) {
|
|
|
2050
2039
|
}
|
|
2051
2040
|
|
|
2052
2041
|
// Constants
|
|
2053
|
-
const INK_APP = Symbol.for(
|
|
2042
|
+
const INK_APP = Symbol.for('jujulego:jill:ink-app');
|
|
2054
2043
|
// Setup
|
|
2055
2044
|
container.bind(INK_APP).toDynamicValue(()=>{
|
|
2056
2045
|
if (!wt.isMainThread) {
|
|
2057
|
-
throw new Error(
|
|
2046
|
+
throw new Error('Ink should only be used in main thread');
|
|
2058
2047
|
}
|
|
2059
2048
|
return render(/*#__PURE__*/ jsx(Layout, {}));
|
|
2060
2049
|
}).inSingletonScope();
|
|
@@ -2079,4 +2068,4 @@ InkCommand = _([
|
|
|
2079
2068
|
], InkCommand);
|
|
2080
2069
|
|
|
2081
2070
|
export { splitCommandLine as A, workerCache as B, CONFIG as C, ContextService as D, ExitException as E, applyConfigOptions as F, InkCommand as I, Layout as L, Middleware as M, PluginLoaderService as P, Service as S, TaskName as T, List as a, TaskSpinner as b, COMMAND as c, COMMAND_MODULE as d, buildCommandModule as e, Command as f, getCommandOpts as g, applyMiddlewares as h, getRegistry as i, getModule as j, setModule as k, CURRENT as l, container as m, lazyInject as n, lazyInjectNamed as o, isCommandCtx as p, CommandTask as q, isScriptCtx as r, setRegistry as s, ScriptTask as t, TASK_MANAGER as u, linesFrom as v, dynamicImport as w, fixDefaultExport as x, printJson as y, capitalize as z };
|
|
2082
|
-
//# sourceMappingURL=ink-command-
|
|
2071
|
+
//# sourceMappingURL=ink-command-CsbkuRbm.js.map
|