@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
package/dist/utils/json.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
1
|
import { type Serializable } from 'node:worker_threads';
|
|
3
2
|
import { type Awaitable } from '@/src/types.ts';
|
|
4
3
|
export declare function workerCache<R extends Serializable>(key: Serializable, compute: () => Awaitable<R>): Promise<R>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ } from '@swc/helpers/_/_ts_decorate';
|
|
2
2
|
import { Logger, withLabel } from '@jujulego/logger';
|
|
3
|
-
import { S as Service, u as TASK_MANAGER, n as lazyInject, C as CONFIG, m as container, q as CommandTask, t as ScriptTask, M as Middleware, D as ContextService, l as CURRENT, o as lazyInjectNamed, E as ExitException, i as getRegistry, k as setModule } from './ink-command-
|
|
3
|
+
import { S as Service, u as TASK_MANAGER, n as lazyInject, C as CONFIG, m as container, q as CommandTask, t as ScriptTask, M as Middleware, D as ContextService, l as CURRENT, o as lazyInjectNamed, E as ExitException, i as getRegistry, k as setModule } from './ink-command-CsbkuRbm.js';
|
|
4
4
|
import { _ as _$1 } from '@swc/helpers/_/_ts_param';
|
|
5
5
|
import { inject, injectable, ContainerModule, id } from 'inversify';
|
|
6
6
|
import symbols from 'log-symbols';
|
|
@@ -28,22 +28,22 @@ async function* combine(...generators) {
|
|
|
28
28
|
async function* streamLines(task, stream) {
|
|
29
29
|
// Abort
|
|
30
30
|
const off = off$();
|
|
31
|
-
once$(task,
|
|
31
|
+
once$(task, 'completed', off);
|
|
32
32
|
// Stream
|
|
33
|
-
let current =
|
|
33
|
+
let current = '';
|
|
34
34
|
try {
|
|
35
35
|
for await (const chunk of iterate$(task, `stream.${stream}`, {
|
|
36
36
|
off
|
|
37
37
|
})){
|
|
38
|
-
const data = current + chunk.data.toString(
|
|
38
|
+
const data = current + chunk.data.toString('utf-8');
|
|
39
39
|
const lines = data.split(/\r?\n/);
|
|
40
|
-
current = lines.pop() ??
|
|
40
|
+
current = lines.pop() ?? '';
|
|
41
41
|
for (const line of lines){
|
|
42
42
|
yield line;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
} catch (err) {
|
|
46
|
-
if (err.message !==
|
|
46
|
+
if (err.message !== 'Unsubscribed !') {
|
|
47
47
|
throw err;
|
|
48
48
|
}
|
|
49
49
|
if (current) {
|
|
@@ -71,14 +71,14 @@ class GitService {
|
|
|
71
71
|
...options
|
|
72
72
|
};
|
|
73
73
|
// Create task
|
|
74
|
-
const task = new SpawnTask(
|
|
74
|
+
const task = new SpawnTask('git', [
|
|
75
75
|
cmd,
|
|
76
76
|
...args
|
|
77
77
|
], {
|
|
78
78
|
command: cmd,
|
|
79
79
|
hidden: true
|
|
80
80
|
}, opts);
|
|
81
|
-
task.on(
|
|
81
|
+
task.on('stream', ({ data })=>opts.logger.debug(data.toString('utf-8')));
|
|
82
82
|
this.manager.add(task);
|
|
83
83
|
return task;
|
|
84
84
|
}
|
|
@@ -88,7 +88,7 @@ class GitService {
|
|
|
88
88
|
* @param args
|
|
89
89
|
* @param options
|
|
90
90
|
*/ branch(args, options) {
|
|
91
|
-
return this.command(
|
|
91
|
+
return this.command('branch', args, options);
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* Runs git diff
|
|
@@ -96,7 +96,7 @@ class GitService {
|
|
|
96
96
|
* @param args
|
|
97
97
|
* @param options
|
|
98
98
|
*/ diff(args, options) {
|
|
99
|
-
return this.command(
|
|
99
|
+
return this.command('diff', args, options);
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* Runs git tag
|
|
@@ -104,7 +104,7 @@ class GitService {
|
|
|
104
104
|
* @param args
|
|
105
105
|
* @param options
|
|
106
106
|
*/ tag(args, options) {
|
|
107
|
-
return this.command(
|
|
107
|
+
return this.command('tag', args, options);
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
110
|
* Uses git diff to detect if given files have been affected since given reference
|
|
@@ -115,13 +115,13 @@ class GitService {
|
|
|
115
115
|
*/ isAffected(reference, files = [], opts) {
|
|
116
116
|
return new Promise((resolve, reject)=>{
|
|
117
117
|
const task = this.diff([
|
|
118
|
-
|
|
118
|
+
'--quiet',
|
|
119
119
|
reference,
|
|
120
|
-
|
|
120
|
+
'--',
|
|
121
121
|
...files
|
|
122
122
|
], opts);
|
|
123
|
-
once$(task,
|
|
124
|
-
once$(task,
|
|
123
|
+
once$(task, 'status.done', ()=>resolve(false));
|
|
124
|
+
once$(task, 'status.failed', ()=>{
|
|
125
125
|
if (task.exitCode) {
|
|
126
126
|
resolve(true);
|
|
127
127
|
} else {
|
|
@@ -137,12 +137,12 @@ class GitService {
|
|
|
137
137
|
* @param opts
|
|
138
138
|
*/ async listBranches(args = [], opts) {
|
|
139
139
|
const task = this.branch([
|
|
140
|
-
|
|
140
|
+
'-l',
|
|
141
141
|
...args
|
|
142
142
|
], opts);
|
|
143
143
|
const result = [];
|
|
144
|
-
for await (const line of streamLines(task,
|
|
145
|
-
result.push(line.replace(/^[ *] /,
|
|
144
|
+
for await (const line of streamLines(task, 'stdout')){
|
|
145
|
+
result.push(line.replace(/^[ *] /, ''));
|
|
146
146
|
}
|
|
147
147
|
return result;
|
|
148
148
|
}
|
|
@@ -153,11 +153,11 @@ class GitService {
|
|
|
153
153
|
* @param opts
|
|
154
154
|
*/ async listTags(args = [], opts) {
|
|
155
155
|
const task = this.tag([
|
|
156
|
-
|
|
156
|
+
'-l',
|
|
157
157
|
...args
|
|
158
158
|
], opts);
|
|
159
159
|
const result = [];
|
|
160
|
-
for await (const line of streamLines(task,
|
|
160
|
+
for await (const line of streamLines(task, 'stdout')){
|
|
161
161
|
result.push(line);
|
|
162
162
|
}
|
|
163
163
|
return result;
|
|
@@ -183,14 +183,14 @@ class AffectedFilter {
|
|
|
183
183
|
// Format revision
|
|
184
184
|
let result = this.format;
|
|
185
185
|
result = result.replace(/(?<!\\)((?:\\\\)*)%name/g, `$1${wks.name}`);
|
|
186
|
-
result = result.replace(/\\(.)/g,
|
|
186
|
+
result = result.replace(/\\(.)/g, '$1');
|
|
187
187
|
// Ask git to complete it
|
|
188
188
|
const sortArgs = this.sort ? [
|
|
189
|
-
|
|
189
|
+
'--sort',
|
|
190
190
|
this.sort
|
|
191
191
|
] : [];
|
|
192
192
|
// - search in branches
|
|
193
|
-
if (result.includes(
|
|
193
|
+
if (result.includes('*')) {
|
|
194
194
|
const branches = await this._git.listBranches([
|
|
195
195
|
...sortArgs,
|
|
196
196
|
result
|
|
@@ -203,7 +203,7 @@ class AffectedFilter {
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
// - search in tags
|
|
206
|
-
if (result.includes(
|
|
206
|
+
if (result.includes('*')) {
|
|
207
207
|
const tags = await this._git.listTags([
|
|
208
208
|
...sortArgs,
|
|
209
209
|
result
|
|
@@ -218,7 +218,7 @@ class AffectedFilter {
|
|
|
218
218
|
if (result !== this.format) {
|
|
219
219
|
logger.verbose`Resolved ${this.format} into ${result}`;
|
|
220
220
|
}
|
|
221
|
-
if (result.includes(
|
|
221
|
+
if (result.includes('*')) {
|
|
222
222
|
logger.warning(`No revision found matching ${result}, using fallback ${this.fallback}`);
|
|
223
223
|
return this.fallback;
|
|
224
224
|
}
|
|
@@ -307,10 +307,10 @@ class Workspace {
|
|
|
307
307
|
}
|
|
308
308
|
// Methods
|
|
309
309
|
_satisfies(from, range) {
|
|
310
|
-
if (range.startsWith(
|
|
310
|
+
if (range.startsWith('file:')) {
|
|
311
311
|
return path.resolve(from.cwd, range.substring(5)) === this.cwd;
|
|
312
312
|
}
|
|
313
|
-
if (range.startsWith(
|
|
313
|
+
if (range.startsWith('workspace:')) {
|
|
314
314
|
range = range.substring(10);
|
|
315
315
|
}
|
|
316
316
|
return !this.version || satisfies(this.version, range);
|
|
@@ -318,11 +318,11 @@ class Workspace {
|
|
|
318
318
|
async _buildDependencies(task, opts) {
|
|
319
319
|
// Generators
|
|
320
320
|
const generators = [];
|
|
321
|
-
switch(opts.buildDeps ??
|
|
322
|
-
case
|
|
321
|
+
switch(opts.buildDeps ?? 'all'){
|
|
322
|
+
case 'all':
|
|
323
323
|
generators.unshift(this.devDependencies());
|
|
324
324
|
// eslint-disable-next no-fallthrough
|
|
325
|
-
case
|
|
325
|
+
case 'prod':
|
|
326
326
|
generators.unshift(this.dependencies());
|
|
327
327
|
}
|
|
328
328
|
// Build deps
|
|
@@ -373,13 +373,13 @@ class Workspace {
|
|
|
373
373
|
}
|
|
374
374
|
async *dependencies() {
|
|
375
375
|
if (!this.manifest.dependencies) return;
|
|
376
|
-
for await (const ws of this._loadDependencies(this.manifest.dependencies,
|
|
376
|
+
for await (const ws of this._loadDependencies(this.manifest.dependencies, 'dependency')){
|
|
377
377
|
yield ws;
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
async *devDependencies() {
|
|
381
381
|
if (!this.manifest.devDependencies) return;
|
|
382
|
-
for await (const ws of this._loadDependencies(this.manifest.devDependencies,
|
|
382
|
+
for await (const ws of this._loadDependencies(this.manifest.devDependencies, 'devDependency')){
|
|
383
383
|
yield ws;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
@@ -388,9 +388,9 @@ class Workspace {
|
|
|
388
388
|
const task = new CommandTask(this, command, args, {
|
|
389
389
|
...opts,
|
|
390
390
|
logger: this._logger.child(withLabel(`${this.name}$${command}`)),
|
|
391
|
-
superCommand: pm ===
|
|
392
|
-
|
|
393
|
-
|
|
391
|
+
superCommand: pm === 'yarn' ? [
|
|
392
|
+
'yarn',
|
|
393
|
+
'exec'
|
|
394
394
|
] : undefined
|
|
395
395
|
});
|
|
396
396
|
await this._buildDependencies(task, opts);
|
|
@@ -416,9 +416,9 @@ class Workspace {
|
|
|
416
416
|
return task;
|
|
417
417
|
}
|
|
418
418
|
async build(opts = {}) {
|
|
419
|
-
const task = await this.run(opts?.buildScript ??
|
|
419
|
+
const task = await this.run(opts?.buildScript ?? 'build', [], opts);
|
|
420
420
|
if (!task) {
|
|
421
|
-
this._logger.warning(
|
|
421
|
+
this._logger.warning('Will not be built (no build script)');
|
|
422
422
|
}
|
|
423
423
|
return task;
|
|
424
424
|
}
|
|
@@ -476,11 +476,11 @@ class Project {
|
|
|
476
476
|
}
|
|
477
477
|
// Methods
|
|
478
478
|
async _loadManifest(dir) {
|
|
479
|
-
const file = path.resolve(this.root, dir,
|
|
479
|
+
const file = path.resolve(this.root, dir, 'package.json');
|
|
480
480
|
const relative = path.relative(this.root, path.dirname(file));
|
|
481
|
-
const logger = this._logger.child(withLabel(relative ? `project@${relative}` :
|
|
482
|
-
logger.debug(
|
|
483
|
-
const data = await fs.promises.readFile(file,
|
|
481
|
+
const logger = this._logger.child(withLabel(relative ? `project@${relative}` : 'project'));
|
|
482
|
+
logger.debug('Loading package.json ...');
|
|
483
|
+
const data = await fs.promises.readFile(file, 'utf-8');
|
|
484
484
|
const mnf = JSON.parse(data);
|
|
485
485
|
normalize(mnf, (msg)=>logger.verbose(msg));
|
|
486
486
|
return mnf;
|
|
@@ -503,23 +503,23 @@ class Project {
|
|
|
503
503
|
const files = await this._scurry.readdir(this.root, {
|
|
504
504
|
withFileTypes: false
|
|
505
505
|
});
|
|
506
|
-
if (files.includes(
|
|
506
|
+
if (files.includes('yarn.lock')) {
|
|
507
507
|
this._logger.debug`Detected yarn in #!cwd:${this.root}`;
|
|
508
|
-
this._packageManager =
|
|
509
|
-
} else if (files.includes(
|
|
508
|
+
this._packageManager = 'yarn';
|
|
509
|
+
} else if (files.includes('package-lock.json')) {
|
|
510
510
|
this._logger.debug`Detected npm in #!cwd:${this.root}`;
|
|
511
|
-
this._packageManager =
|
|
511
|
+
this._packageManager = 'npm';
|
|
512
512
|
} else {
|
|
513
513
|
this._logger.debug`No package manager recognized in #!cwd:${this.root}, defaults to npm`;
|
|
514
|
-
this._packageManager =
|
|
514
|
+
this._packageManager = 'npm';
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
517
|
return this._packageManager;
|
|
518
518
|
}
|
|
519
519
|
async mainWorkspace() {
|
|
520
520
|
if (!this._mainWorkspace) {
|
|
521
|
-
const manifest = await this._loadManifest(
|
|
522
|
-
this._mainWorkspace = new Workspace(
|
|
521
|
+
const manifest = await this._loadManifest('.');
|
|
522
|
+
this._mainWorkspace = new Workspace('.', manifest, this);
|
|
523
523
|
this._names.set(this._mainWorkspace.name, this._mainWorkspace);
|
|
524
524
|
}
|
|
525
525
|
return this._mainWorkspace;
|
|
@@ -556,7 +556,7 @@ class Project {
|
|
|
556
556
|
yield await this._loadWorkspace(dir.fullpath());
|
|
557
557
|
}
|
|
558
558
|
} catch (error) {
|
|
559
|
-
if (error.code ===
|
|
559
|
+
if (error.code === 'ENOENT') {
|
|
560
560
|
continue;
|
|
561
561
|
}
|
|
562
562
|
throw error;
|
|
@@ -597,17 +597,17 @@ Project = _([
|
|
|
597
597
|
], Project);
|
|
598
598
|
|
|
599
599
|
// Constants
|
|
600
|
-
const MANIFEST =
|
|
600
|
+
const MANIFEST = 'package.json';
|
|
601
601
|
const LOCK_FILES = [
|
|
602
|
-
|
|
603
|
-
|
|
602
|
+
'package-lock.json',
|
|
603
|
+
'yarn.lock'
|
|
604
604
|
];
|
|
605
605
|
class ProjectRepository {
|
|
606
606
|
// Constructor
|
|
607
607
|
constructor(logger){
|
|
608
608
|
this._cache = new Map();
|
|
609
609
|
this._roots = new Map();
|
|
610
|
-
this._logger = logger.child(withLabel(
|
|
610
|
+
this._logger = logger.child(withLabel('projects'));
|
|
611
611
|
}
|
|
612
612
|
// Methods
|
|
613
613
|
async isProjectRoot(dir) {
|
|
@@ -682,17 +682,17 @@ class LoadProject {
|
|
|
682
682
|
}
|
|
683
683
|
// Methods
|
|
684
684
|
builder(parser) {
|
|
685
|
-
return parser.option(
|
|
686
|
-
alias:
|
|
687
|
-
type:
|
|
688
|
-
description:
|
|
689
|
-
}).option(
|
|
685
|
+
return parser.option('project', {
|
|
686
|
+
alias: 'p',
|
|
687
|
+
type: 'string',
|
|
688
|
+
description: 'Project root directory'
|
|
689
|
+
}).option('package-manager', {
|
|
690
690
|
choices: [
|
|
691
|
-
|
|
692
|
-
|
|
691
|
+
'yarn',
|
|
692
|
+
'npm'
|
|
693
693
|
],
|
|
694
|
-
type:
|
|
695
|
-
description:
|
|
694
|
+
type: 'string',
|
|
695
|
+
description: 'Force package manager'
|
|
696
696
|
});
|
|
697
697
|
}
|
|
698
698
|
async handler(args) {
|
|
@@ -719,7 +719,7 @@ container.bind(Project).toDynamicValue(({ container })=>{
|
|
|
719
719
|
const ctx = container.get(ContextService);
|
|
720
720
|
const prj = ctx.project;
|
|
721
721
|
if (!prj) {
|
|
722
|
-
throw new Error(
|
|
722
|
+
throw new Error('Cannot inject current project, it not yet defined');
|
|
723
723
|
}
|
|
724
724
|
return prj;
|
|
725
725
|
}).whenTargetNamed(CURRENT);
|
|
@@ -732,10 +732,10 @@ class LoadWorkspace {
|
|
|
732
732
|
}
|
|
733
733
|
// Methods
|
|
734
734
|
builder(parser) {
|
|
735
|
-
return parser.option(
|
|
736
|
-
alias:
|
|
737
|
-
type:
|
|
738
|
-
desc:
|
|
735
|
+
return parser.option('workspace', {
|
|
736
|
+
alias: 'w',
|
|
737
|
+
type: 'string',
|
|
738
|
+
desc: 'Workspace to use'
|
|
739
739
|
});
|
|
740
740
|
}
|
|
741
741
|
async handler(args) {
|
|
@@ -750,8 +750,8 @@ class LoadWorkspace {
|
|
|
750
750
|
}
|
|
751
751
|
}
|
|
752
752
|
if (!workspace) {
|
|
753
|
-
this.logger.error(`${symbols.error} Workspace "${args.workspace ||
|
|
754
|
-
throw new ExitException(1,
|
|
753
|
+
this.logger.error(`${symbols.error} Workspace "${args.workspace || '.'}" not found`);
|
|
754
|
+
throw new ExitException(1, 'Workspace not found');
|
|
755
755
|
} else {
|
|
756
756
|
this.context.workspace = workspace;
|
|
757
757
|
}
|
|
@@ -773,7 +773,7 @@ container.bind(Workspace).toDynamicValue(({ container })=>{
|
|
|
773
773
|
const ctx = container.get(ContextService);
|
|
774
774
|
const wks = ctx.workspace;
|
|
775
775
|
if (!wks) {
|
|
776
|
-
throw new Error(
|
|
776
|
+
throw new Error('Cannot inject current workspace, it not yet defined');
|
|
777
777
|
}
|
|
778
778
|
return wks;
|
|
779
779
|
}).whenTargetNamed(CURRENT);
|
|
@@ -809,7 +809,7 @@ class TaskSyntaxError extends Error {
|
|
|
809
809
|
class TaskExpressionService {
|
|
810
810
|
// Statics
|
|
811
811
|
static isTaskNode(node) {
|
|
812
|
-
return
|
|
812
|
+
return 'script' in node;
|
|
813
813
|
}
|
|
814
814
|
static{
|
|
815
815
|
this._sequenceOperatorWarn = true;
|
|
@@ -822,47 +822,47 @@ class TaskExpressionService {
|
|
|
822
822
|
_lexer() {
|
|
823
823
|
return moo.states({
|
|
824
824
|
task: {
|
|
825
|
-
lparen:
|
|
825
|
+
lparen: '(',
|
|
826
826
|
whitespace: /[ \t]+/,
|
|
827
827
|
script: {
|
|
828
828
|
match: /[-_:a-zA-Z0-9]+/,
|
|
829
|
-
push:
|
|
829
|
+
push: 'operatorOrArgument'
|
|
830
830
|
},
|
|
831
831
|
string: [
|
|
832
832
|
{
|
|
833
833
|
match: /'(?:\\['\\]|[^\r\n'\\])+'/,
|
|
834
|
-
push:
|
|
835
|
-
value: (x)=>x.slice(1, -1).replace(/\\(['\\])/g,
|
|
834
|
+
push: 'operator',
|
|
835
|
+
value: (x)=>x.slice(1, -1).replace(/\\(['\\])/g, '$1')
|
|
836
836
|
},
|
|
837
837
|
{
|
|
838
838
|
match: /"(?:\\["\\]|[^\r\n"\\])+"/,
|
|
839
|
-
push:
|
|
840
|
-
value: (x)=>x.slice(1, -1).replace(/\\(["\\])/g,
|
|
839
|
+
push: 'operator',
|
|
840
|
+
value: (x)=>x.slice(1, -1).replace(/\\(["\\])/g, '$1')
|
|
841
841
|
}
|
|
842
842
|
]
|
|
843
843
|
},
|
|
844
844
|
operator: {
|
|
845
|
-
rparen:
|
|
845
|
+
rparen: ')',
|
|
846
846
|
whitespace: /[ \t]+/,
|
|
847
847
|
operator: {
|
|
848
848
|
match: [
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
849
|
+
'->',
|
|
850
|
+
'&&',
|
|
851
|
+
'//',
|
|
852
|
+
'||'
|
|
853
853
|
],
|
|
854
854
|
pop: 1
|
|
855
855
|
}
|
|
856
856
|
},
|
|
857
857
|
operatorOrArgument: {
|
|
858
|
-
rparen:
|
|
858
|
+
rparen: ')',
|
|
859
859
|
whitespace: /[ \t]+/,
|
|
860
860
|
operator: {
|
|
861
861
|
match: [
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
862
|
+
'->',
|
|
863
|
+
'&&',
|
|
864
|
+
'//',
|
|
865
|
+
'||'
|
|
866
866
|
],
|
|
867
867
|
pop: 1
|
|
868
868
|
},
|
|
@@ -872,11 +872,11 @@ class TaskExpressionService {
|
|
|
872
872
|
},
|
|
873
873
|
{
|
|
874
874
|
match: /'(?:\\['\\]|[^\r\n'\\])+'/,
|
|
875
|
-
value: (x)=>x.slice(1, -1).replace(/\\(['\\])/g,
|
|
875
|
+
value: (x)=>x.slice(1, -1).replace(/\\(['\\])/g, '$1')
|
|
876
876
|
},
|
|
877
877
|
{
|
|
878
878
|
match: /"(?:\\["\\]|[^\r\n"\\])+"/,
|
|
879
|
-
value: (x)=>x.slice(1, -1).replace(/\\(["\\])/g,
|
|
879
|
+
value: (x)=>x.slice(1, -1).replace(/\\(["\\])/g, '$1')
|
|
880
880
|
}
|
|
881
881
|
]
|
|
882
882
|
}
|
|
@@ -886,23 +886,23 @@ class TaskExpressionService {
|
|
|
886
886
|
let node = null;
|
|
887
887
|
for (const token of lexer){
|
|
888
888
|
// Ignore whitespaces
|
|
889
|
-
if (token.type ===
|
|
889
|
+
if (token.type === 'whitespace') {
|
|
890
890
|
continue;
|
|
891
891
|
}
|
|
892
892
|
// rparen = end of group
|
|
893
|
-
if (token.type ===
|
|
893
|
+
if (token.type === 'rparen') {
|
|
894
894
|
break;
|
|
895
895
|
}
|
|
896
896
|
// Handle argument
|
|
897
|
-
if (token.type ===
|
|
897
|
+
if (token.type === 'argument') {
|
|
898
898
|
if (!node) {
|
|
899
|
-
throw new TaskSyntaxError(lexer.formatError(token,
|
|
899
|
+
throw new TaskSyntaxError(lexer.formatError(token, 'Unexpected argument'));
|
|
900
900
|
} else if (TaskExpressionService.isTaskNode(node)) {
|
|
901
901
|
node.args.push(token.value);
|
|
902
902
|
} else {
|
|
903
903
|
const lastTask = node.tasks[node.tasks.length - 1];
|
|
904
904
|
if (!lastTask || !TaskExpressionService.isTaskNode(lastTask)) {
|
|
905
|
-
throw new TaskSyntaxError(lexer.formatError(token,
|
|
905
|
+
throw new TaskSyntaxError(lexer.formatError(token, 'Unexpected argument'));
|
|
906
906
|
} else {
|
|
907
907
|
lastTask.args.push(token.value);
|
|
908
908
|
}
|
|
@@ -910,10 +910,10 @@ class TaskExpressionService {
|
|
|
910
910
|
continue;
|
|
911
911
|
}
|
|
912
912
|
// Handle operator
|
|
913
|
-
if (token.type ===
|
|
913
|
+
if (token.type === 'operator') {
|
|
914
914
|
const operator = token.value;
|
|
915
915
|
if (!node) {
|
|
916
|
-
throw new TaskSyntaxError(lexer.formatError(token,
|
|
916
|
+
throw new TaskSyntaxError(lexer.formatError(token, 'Unexpected operator'));
|
|
917
917
|
} else if (TaskExpressionService.isTaskNode(node)) {
|
|
918
918
|
node = {
|
|
919
919
|
operator,
|
|
@@ -936,30 +936,30 @@ class TaskExpressionService {
|
|
|
936
936
|
}
|
|
937
937
|
// Build "child"
|
|
938
938
|
let child;
|
|
939
|
-
if (token.type ===
|
|
939
|
+
if (token.type === 'script') {
|
|
940
940
|
child = {
|
|
941
941
|
script: token.value,
|
|
942
942
|
args: []
|
|
943
943
|
};
|
|
944
|
-
} else if (token.type ===
|
|
944
|
+
} else if (token.type === 'string') {
|
|
945
945
|
const [script, ...args] = token.value.split(/ +/);
|
|
946
946
|
child = {
|
|
947
947
|
script,
|
|
948
948
|
args
|
|
949
949
|
};
|
|
950
|
-
} else if (token.type ===
|
|
950
|
+
} else if (token.type === 'lparen') {
|
|
951
951
|
const res = this._nextNode(lexer, i + 1);
|
|
952
952
|
if (!res) {
|
|
953
|
-
throw new TaskSyntaxError(lexer.formatError(token,
|
|
953
|
+
throw new TaskSyntaxError(lexer.formatError(token, 'Empty group found'));
|
|
954
954
|
}
|
|
955
955
|
child = res;
|
|
956
956
|
} else {
|
|
957
|
-
throw new TaskSyntaxError(lexer.formatError(token,
|
|
957
|
+
throw new TaskSyntaxError(lexer.formatError(token, 'Unexpected token'));
|
|
958
958
|
}
|
|
959
959
|
if (!node) {
|
|
960
960
|
node = child;
|
|
961
961
|
} else if (TaskExpressionService.isTaskNode(node)) {
|
|
962
|
-
throw new TaskSyntaxError(lexer.formatError(token,
|
|
962
|
+
throw new TaskSyntaxError(lexer.formatError(token, 'Unexpected token, expected an operator'));
|
|
963
963
|
} else {
|
|
964
964
|
node.tasks.push(child);
|
|
965
965
|
}
|
|
@@ -983,7 +983,7 @@ class TaskExpressionService {
|
|
|
983
983
|
return tree;
|
|
984
984
|
}
|
|
985
985
|
*extractScripts(node) {
|
|
986
|
-
if (
|
|
986
|
+
if ('roots' in node) {
|
|
987
987
|
for (const child of node.roots){
|
|
988
988
|
yield* this.extractScripts(child);
|
|
989
989
|
}
|
|
@@ -1004,24 +1004,24 @@ class TaskExpressionService {
|
|
|
1004
1004
|
return task;
|
|
1005
1005
|
} else {
|
|
1006
1006
|
let group;
|
|
1007
|
-
if (node.operator ===
|
|
1008
|
-
group = new ParallelGroup(
|
|
1007
|
+
if (node.operator === '//') {
|
|
1008
|
+
group = new ParallelGroup('In parallel', {
|
|
1009
1009
|
workspace
|
|
1010
1010
|
}, {
|
|
1011
1011
|
logger: this._logger
|
|
1012
1012
|
});
|
|
1013
|
-
} else if (node.operator ===
|
|
1014
|
-
group = new FallbackGroup(
|
|
1013
|
+
} else if (node.operator === '||') {
|
|
1014
|
+
group = new FallbackGroup('Fallbacks', {
|
|
1015
1015
|
workspace
|
|
1016
1016
|
}, {
|
|
1017
1017
|
logger: this._logger
|
|
1018
1018
|
});
|
|
1019
1019
|
} else {
|
|
1020
|
-
if (node.operator ===
|
|
1021
|
-
this._logger.warn(
|
|
1020
|
+
if (node.operator === '->' && TaskExpressionService._sequenceOperatorWarn) {
|
|
1021
|
+
this._logger.warn('Sequence operator -> is deprecated in favor of &&. It will be removed in a next major release.');
|
|
1022
1022
|
TaskExpressionService._sequenceOperatorWarn = true;
|
|
1023
1023
|
}
|
|
1024
|
-
group = new SequenceGroup(
|
|
1024
|
+
group = new SequenceGroup('In sequence', {
|
|
1025
1025
|
workspace
|
|
1026
1026
|
}, {
|
|
1027
1027
|
logger: this._logger
|
|
@@ -1041,11 +1041,11 @@ TaskExpressionService = _([
|
|
|
1041
1041
|
|
|
1042
1042
|
// Utils
|
|
1043
1043
|
const style = (dev)=>({
|
|
1044
|
-
color: dev ?
|
|
1044
|
+
color: dev ? 'blue' : ''
|
|
1045
1045
|
});
|
|
1046
1046
|
// Component
|
|
1047
1047
|
function WorkspaceTree(props) {
|
|
1048
|
-
const { workspace: wks, dev = false, level =
|
|
1048
|
+
const { workspace: wks, dev = false, level = '' } = props;
|
|
1049
1049
|
// State
|
|
1050
1050
|
const [deps, setDeps] = useState([]);
|
|
1051
1051
|
// Effects
|
|
@@ -1088,9 +1088,9 @@ function WorkspaceTree(props) {
|
|
|
1088
1088
|
/*#__PURE__*/ jsxs(Text, {
|
|
1089
1089
|
...style(dev),
|
|
1090
1090
|
children: [
|
|
1091
|
-
idx === deps.length - 1 ?
|
|
1091
|
+
idx === deps.length - 1 ? '└' : '├',
|
|
1092
1092
|
"─",
|
|
1093
|
-
|
|
1093
|
+
' '
|
|
1094
1094
|
]
|
|
1095
1095
|
}),
|
|
1096
1096
|
/*#__PURE__*/ jsx(WorkspaceTree, {
|
|
@@ -1102,8 +1102,8 @@ function WorkspaceTree(props) {
|
|
|
1102
1102
|
/*#__PURE__*/ jsxs(Text, {
|
|
1103
1103
|
...style(dev),
|
|
1104
1104
|
children: [
|
|
1105
|
-
idx === deps.length - 1 ?
|
|
1106
|
-
|
|
1105
|
+
idx === deps.length - 1 ? ' ' : '│',
|
|
1106
|
+
' '
|
|
1107
1107
|
]
|
|
1108
1108
|
})
|
|
1109
1109
|
]
|
|
@@ -1117,4 +1117,4 @@ function WorkspaceTree(props) {
|
|
|
1117
1117
|
}
|
|
1118
1118
|
|
|
1119
1119
|
export { AffectedFilter as A, GitService as G, LoadProject as L, Pipeline as P, ScriptsFilter as S, TaskExpressionService as T, WorkspaceTree as W, PrivateFilter as a, LazyCurrentProject as b, LoadWorkspace as c, LazyCurrentWorkspace as d, PluginModule as e, Plugin as f, Project as g, ProjectRepository as h, Workspace as i, combine as j, TaskExpressionError as k, TaskSyntaxError as l, streamLines as s };
|
|
1120
|
-
//# sourceMappingURL=workspace-tree-
|
|
1120
|
+
//# sourceMappingURL=workspace-tree-VWKE0B6b.js.map
|