@ms-cloudpack/cli 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +32 -1
- package/CHANGELOG.md +14 -2
- package/lib/commands/start/TaskRunner.d.ts +1 -17
- package/lib/commands/start/TaskRunner.js +0 -13
- package/lib/commands/start/TaskRunner.js.map +1 -1
- package/lib/commands/start/createBundleTask.d.ts +3 -0
- package/lib/commands/start/createBundleTask.js +65 -0
- package/lib/commands/start/createBundleTask.js.map +1 -0
- package/lib/commands/start/startApiServer.d.ts +1 -48
- package/lib/commands/start/startApiServer.js +62 -48
- package/lib/commands/start/startApiServer.js.map +1 -1
- package/lib/commands/start/startAppServer.d.ts +1 -3
- package/lib/commands/start/startAppServer.js.map +1 -1
- package/lib/commands/start/startBundleServer.d.ts +1 -7
- package/lib/commands/start/startBundleServer.js +19 -124
- package/lib/commands/start/startBundleServer.js.map +1 -1
- package/lib/commands/start/startWatcher.d.ts +4 -0
- package/lib/commands/start/startWatcher.js +52 -0
- package/lib/commands/start/startWatcher.js.map +1 -0
- package/lib/commands/start/taskRunner.test.js.map +1 -1
- package/lib/commands/start/types.d.ts +76 -0
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +1 -2
- package/lib/commands/start/bundleTask.d.ts +0 -16
- package/lib/commands/start/bundleTask.js +0 -32
- package/lib/commands/start/bundleTask.js.map +0 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,38 @@
|
|
|
2
2
|
"name": "@ms-cloudpack/cli",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Tue,
|
|
5
|
+
"date": "Tue, 20 Sep 2022 08:13:37 GMT",
|
|
6
|
+
"tag": "@ms-cloudpack/cli_v0.10.0",
|
|
7
|
+
"version": "0.10.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "dake.3601@gmail.com",
|
|
12
|
+
"package": "@ms-cloudpack/cli",
|
|
13
|
+
"commit": "d5ebdee5d00d56b153b4de0851665cb02189694a",
|
|
14
|
+
"comment": "Only one watcher per bundle task"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"minor": [
|
|
18
|
+
{
|
|
19
|
+
"author": "dake.3601@gmail.com",
|
|
20
|
+
"package": "@ms-cloudpack/cli",
|
|
21
|
+
"commit": "bc64187802ecacd4098c99cdf308aa6bd2fc6f7f",
|
|
22
|
+
"comment": "Improved task watcher and data flow"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"none": [
|
|
26
|
+
{
|
|
27
|
+
"author": "elcraig@microsoft.com",
|
|
28
|
+
"package": "@ms-cloudpack/cli",
|
|
29
|
+
"commit": "52b4314b694af37388821ff5b8a3b16f61b8dc8f",
|
|
30
|
+
"comment": "Hoist commonly used devDependencies to the repo root"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"date": "Tue, 13 Sep 2022 08:15:44 GMT",
|
|
6
37
|
"tag": "@ms-cloudpack/cli_v0.9.0",
|
|
7
38
|
"version": "0.9.0",
|
|
8
39
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
# Change Log - @ms-cloudpack/cli
|
|
2
2
|
|
|
3
|
-
This log was last generated on Tue,
|
|
3
|
+
This log was last generated on Tue, 20 Sep 2022 08:13:37 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.10.0
|
|
8
|
+
|
|
9
|
+
Tue, 20 Sep 2022 08:13:37 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Improved task watcher and data flow (dake.3601@gmail.com)
|
|
14
|
+
|
|
15
|
+
### Patches
|
|
16
|
+
|
|
17
|
+
- Only one watcher per bundle task (dake.3601@gmail.com)
|
|
18
|
+
|
|
7
19
|
## 0.9.0
|
|
8
20
|
|
|
9
|
-
Tue, 13 Sep 2022 08:15:
|
|
21
|
+
Tue, 13 Sep 2022 08:15:44 GMT
|
|
10
22
|
|
|
11
23
|
### Minor changes
|
|
12
24
|
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
name: string;
|
|
3
|
-
id: string;
|
|
4
|
-
execute: () => Promise<TReturn>;
|
|
5
|
-
}
|
|
6
|
-
export interface TaskOptions {
|
|
7
|
-
rerun?: boolean;
|
|
8
|
-
}
|
|
1
|
+
import type { Task, TaskOptions } from './types.js';
|
|
9
2
|
/**
|
|
10
3
|
* TaskRunner class manages the state of Tasks.
|
|
11
4
|
* This class is to be called by the api server.
|
|
@@ -23,13 +16,4 @@ export declare class TaskRunner {
|
|
|
23
16
|
* Rerun flag forces the Task to be run again.
|
|
24
17
|
*/
|
|
25
18
|
add<TReturn>(task: Task<TReturn>, options?: TaskOptions): Promise<TReturn>;
|
|
26
|
-
/**
|
|
27
|
-
* Returns result from completed Task with id.
|
|
28
|
-
* TODO: rename to getResult?
|
|
29
|
-
*/
|
|
30
|
-
get<TReturn>(id: string): TReturn | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* Returns if Task with id is pending.
|
|
33
|
-
*/
|
|
34
|
-
pending<TReturn>(id: string): Promise<TReturn> | undefined;
|
|
35
19
|
}
|
|
@@ -71,18 +71,5 @@ export class TaskRunner {
|
|
|
71
71
|
this._completedTasks.delete(id);
|
|
72
72
|
return resultPromise;
|
|
73
73
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Returns result from completed Task with id.
|
|
76
|
-
* TODO: rename to getResult?
|
|
77
|
-
*/
|
|
78
|
-
get(id) {
|
|
79
|
-
return this._completedTasks.get(id);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Returns if Task with id is pending.
|
|
83
|
-
*/
|
|
84
|
-
pending(id) {
|
|
85
|
-
return this._pendingTasks.get(id);
|
|
86
|
-
}
|
|
87
74
|
}
|
|
88
75
|
//# sourceMappingURL=TaskRunner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskRunner.js","sourceRoot":"","sources":["../../../src/commands/start/TaskRunner.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"TaskRunner.js","sourceRoot":"","sources":["../../../src/commands/start/TaskRunner.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAI7B,MAAM,GAAG,GAAG,CAAC,GAAG,QAAmB,EAAE,EAAE;IACrC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,QAAQ,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,UAAU;IAQrB;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9C,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;QACjC,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;IAClC,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAU,IAAmB,EAAE,OAAqB;QACrD,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QACnC,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;QAEhC,2DAA2D;QAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAwB,CAAC;QACnE,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,KAAK,EAAE;YAClC,GAAG,CAAC,sCAAsC,IAAI,IAAI,EAAE,GAAG,CAAC,CAAC;YACzD,OAAO,OAAO,CAAC,OAAO,CAAC,M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AE,CAAC;QAEL,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;QAC1C,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAEhC,OAAO,aAAa,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { BundleRequest, BundleTaskOptions, Task } from './types.js';
|
|
2
|
+
export declare function bundle(bundleRequest: BundleRequest, force?: boolean): Promise<BundleRequest>;
|
|
3
|
+
export declare function createBundleTask(bundleRequest: BundleRequest, options?: BundleTaskOptions): Task<BundleRequest>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { bundlePackage } from '@ms-cloudpack/bundler';
|
|
2
|
+
import { readJson, writeJson } from '@ms-cloudpack/json-utilities';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import fsExtra from 'fs-extra';
|
|
5
|
+
const { ensureDir } = fsExtra;
|
|
6
|
+
const log = (...messages) => {
|
|
7
|
+
console.log(`BundleTask:`, ...messages);
|
|
8
|
+
};
|
|
9
|
+
export async function bundle(bundleRequest, force) {
|
|
10
|
+
const { packagePath, outputPath, isExternal } = bundleRequest;
|
|
11
|
+
// Rehydrate the result if not incremental.
|
|
12
|
+
if (isExternal && !force) {
|
|
13
|
+
bundleRequest.result = await readJson(path.join(outputPath, 'result.json'));
|
|
14
|
+
}
|
|
15
|
+
const isCacheUsable = bundleRequest.result?.errors?.length === 0;
|
|
16
|
+
// Only use cached result if it's successful.
|
|
17
|
+
if (!isCacheUsable) {
|
|
18
|
+
bundleRequest.result = await bundlePackage({
|
|
19
|
+
packagePath,
|
|
20
|
+
outputPath,
|
|
21
|
+
outputType: 'library',
|
|
22
|
+
incremental: !isExternal,
|
|
23
|
+
});
|
|
24
|
+
// Write the result to disk.
|
|
25
|
+
if (isExternal) {
|
|
26
|
+
await writeJson(path.join(outputPath, 'result.json'), bundleRequest.result);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
log(`Bundle cached, returning: "${bundleRequest.packageName}@${bundleRequest.version}"`);
|
|
31
|
+
}
|
|
32
|
+
return bundleRequest;
|
|
33
|
+
}
|
|
34
|
+
export function createBundleTask(bundleRequest, options) {
|
|
35
|
+
const { id, packageName, version, outputPath, packagePath } = bundleRequest;
|
|
36
|
+
const { force, rebuild } = options || {};
|
|
37
|
+
return {
|
|
38
|
+
name: `Bundle ${packageName}@${version}`,
|
|
39
|
+
id,
|
|
40
|
+
async execute() {
|
|
41
|
+
let bundleResult = bundleRequest;
|
|
42
|
+
await ensureDir(outputPath);
|
|
43
|
+
log(`Finished ensureDir: "${packageName}@${version}"`);
|
|
44
|
+
if (rebuild && bundleRequest.result?.rebuild) {
|
|
45
|
+
bundleResult.result = await bundleRequest.result.rebuild();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
bundleResult = await bundle(bundleRequest, force);
|
|
49
|
+
}
|
|
50
|
+
return bundleResult;
|
|
51
|
+
},
|
|
52
|
+
getStartDescription: () => ({
|
|
53
|
+
id,
|
|
54
|
+
name: `Bundle ${packageName}@${version}`,
|
|
55
|
+
inputPath: packagePath || '',
|
|
56
|
+
outputPath,
|
|
57
|
+
}),
|
|
58
|
+
getEndDescription: (taskResult) => ({
|
|
59
|
+
id,
|
|
60
|
+
errors: taskResult?.result?.errors,
|
|
61
|
+
warnings: taskResult?.result?.warnings,
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=createBundleTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createBundleTask.js","sourceRoot":"","sources":["../../../src/commands/start/createBundleTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,IAAI,MAAM,MAAM,CAA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E,GAAG,aAAa,CAAC;IAC5E,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAEzC,OAAO;QACL,IAAI,EAAE,UAAU,WAAW,IAAI,OAAO,EAAE;QACxC,EAAE;QACF,KAAK,CAAC,OAAO;YACX,IAAI,YAAY,GAAG,aAAa,CAAC;YAEjC,MAAM,SAAS,CAAC,UAAU,CAAC,CAAC;YAE5B,GAAG,CAAC,wBAAwB,WAAW,IAAI,OAAO,GAAG,CAAC,CAAC;YAEvD,IAAI,OAAO,IAAI,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE;gBAC5C,YAAY,CAAC,MAAM,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;aAC5D;iBAAM;gBACL,YAAY,GAAG,MAAM,MAAM,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;aACnD;YAED,OAAO,YAAY,CAAC;QACtB,CAAC;QACD,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC;YAC1B,EAAE;YACF,IAAI,EAAE,UAAU,WAAW,IAAI,OAAO,EAAE;YACxC,SAAS,EAAE,WAAW,IAAI,EAAE;YAC5B,UAAU;SACX,CAAC;QACF,iBAAiB,EAAE,CAAC,UAAU,EAAE,EAAE,CAChC,CAAC;YACC,EAAE;YACF,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM;YAClC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ;SAChB,CAAA;KAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -1,51 +1,4 @@
|
|
|
1
|
-
import type { Session } from './types.js';
|
|
2
|
-
import type { Task, TaskOptions } from './TaskRunner.js';
|
|
3
|
-
export interface SessionStats {
|
|
4
|
-
status: 'idle' | 'pending';
|
|
5
|
-
remainingTasks: number;
|
|
6
|
-
totalTasks: number;
|
|
7
|
-
totalErrors: number;
|
|
8
|
-
totalWarnings: number;
|
|
9
|
-
}
|
|
10
|
-
export interface ApiServer {
|
|
11
|
-
url: string;
|
|
12
|
-
port: number;
|
|
13
|
-
notifyReload: () => void;
|
|
14
|
-
reportStart: (options: TaskStartDescription) => void;
|
|
15
|
-
reportEnd: (options: TaskEndDescription) => void;
|
|
16
|
-
addTask: <TReturn>(task: Task<TReturn>, options?: TaskOptions) => Promise<TReturn>;
|
|
17
|
-
/**
|
|
18
|
-
* Gets the result of a completed task.
|
|
19
|
-
*/
|
|
20
|
-
getTask: <TReturn>(id: string) => TReturn | undefined;
|
|
21
|
-
pendingTask: <TReturn>(id: string) => Promise<TReturn> | undefined;
|
|
22
|
-
close: () => Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
export interface TaskError {
|
|
25
|
-
message: string;
|
|
26
|
-
pluginName: string;
|
|
27
|
-
stack: string;
|
|
28
|
-
fileLocation: string;
|
|
29
|
-
lineNumber: number;
|
|
30
|
-
columnNumber: number;
|
|
31
|
-
}
|
|
32
|
-
export interface TaskStartDescription {
|
|
33
|
-
id: string;
|
|
34
|
-
name: string;
|
|
35
|
-
inputPath: string;
|
|
36
|
-
outputPath: string;
|
|
37
|
-
}
|
|
38
|
-
export interface TaskEndDescription {
|
|
39
|
-
id: string;
|
|
40
|
-
errors?: TaskError[];
|
|
41
|
-
warnings?: TaskError[];
|
|
42
|
-
}
|
|
43
|
-
export interface TaskDescription extends TaskStartDescription, TaskEndDescription {
|
|
44
|
-
status: 'pending' | 'complete';
|
|
45
|
-
startTime: number;
|
|
46
|
-
durationMilliseconds?: number;
|
|
47
|
-
lastUpdated?: number;
|
|
48
|
-
}
|
|
1
|
+
import type { ApiServer, Session } from './types.js';
|
|
49
2
|
/**
|
|
50
3
|
* The api server handles the data pub/sub (for things like reporting build status)
|
|
51
4
|
* and hosting the dashboard verb backend (for executing actions like loading vscode,
|
|
@@ -31,6 +31,47 @@ export async function startApiServer({ session }) {
|
|
|
31
31
|
};
|
|
32
32
|
const allTasks = new Map();
|
|
33
33
|
const taskRunner = new TaskRunner();
|
|
34
|
+
function reportStart(taskStart) {
|
|
35
|
+
const previousResult = allTasks.get(taskStart.id);
|
|
36
|
+
const now = new Date().getTime();
|
|
37
|
+
if (!previousResult) {
|
|
38
|
+
sessionStats.totalTasks++;
|
|
39
|
+
}
|
|
40
|
+
if (previousResult?.status === 'complete') {
|
|
41
|
+
sessionStats.totalErrors -= previousResult.errors?.length || 0;
|
|
42
|
+
sessionStats.totalWarnings -= previousResult.warnings?.length || 0;
|
|
43
|
+
}
|
|
44
|
+
sessionStats.remainingTasks++;
|
|
45
|
+
sessionStats.status = 'pending';
|
|
46
|
+
allTasks.set(taskStart.id, {
|
|
47
|
+
...taskStart,
|
|
48
|
+
status: 'pending',
|
|
49
|
+
startTime: now,
|
|
50
|
+
});
|
|
51
|
+
bus.publish([session.id, 'status'], sessionStats);
|
|
52
|
+
bus.publish([session.id, 'status-details'], { tasks: Array.from(allTasks.values()) });
|
|
53
|
+
}
|
|
54
|
+
function reportEnd(taskEnd) {
|
|
55
|
+
const previousResult = allTasks.get(taskEnd.id);
|
|
56
|
+
const now = new Date().getTime();
|
|
57
|
+
if (previousResult) {
|
|
58
|
+
sessionStats.remainingTasks--;
|
|
59
|
+
sessionStats.totalErrors += taskEnd.errors?.length || 0;
|
|
60
|
+
sessionStats.totalWarnings += taskEnd.warnings?.length || 0;
|
|
61
|
+
allTasks.set(taskEnd.id, {
|
|
62
|
+
...previousResult,
|
|
63
|
+
...taskEnd,
|
|
64
|
+
status: 'complete',
|
|
65
|
+
durationMilliseconds: now - previousResult.startTime,
|
|
66
|
+
lastUpdated: now,
|
|
67
|
+
});
|
|
68
|
+
if (sessionStats.remainingTasks === 0) {
|
|
69
|
+
sessionStats.status = 'idle';
|
|
70
|
+
}
|
|
71
|
+
bus.publish([session.id, 'status'], sessionStats);
|
|
72
|
+
bus.publish([session.id, 'status-details'], { tasks: Array.from(allTasks.values()) });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
34
75
|
bus.publish([session.id, 'status'], sessionStats);
|
|
35
76
|
// Create a websocket server which listens for subscriptions and verb requests,
|
|
36
77
|
// and broadcasts the data to all connected clients.
|
|
@@ -109,55 +150,28 @@ export async function startApiServer({ session }) {
|
|
|
109
150
|
}
|
|
110
151
|
});
|
|
111
152
|
},
|
|
112
|
-
reportStart(taskStart) {
|
|
113
|
-
const previousResult = allTasks.get(taskStart.id);
|
|
114
|
-
const now = new Date().getTime();
|
|
115
|
-
if (!previousResult) {
|
|
116
|
-
sessionStats.totalTasks++;
|
|
117
|
-
}
|
|
118
|
-
if (previousResult?.status === 'complete') {
|
|
119
|
-
sessionStats.totalErrors -= previousResult.errors?.length || 0;
|
|
120
|
-
sessionStats.totalWarnings -= previousResult.warnings?.length || 0;
|
|
121
|
-
}
|
|
122
|
-
sessionStats.remainingTasks++;
|
|
123
|
-
sessionStats.status = 'pending';
|
|
124
|
-
allTasks.set(taskStart.id, {
|
|
125
|
-
...taskStart,
|
|
126
|
-
status: 'pending',
|
|
127
|
-
startTime: now,
|
|
128
|
-
});
|
|
129
|
-
bus.publish([session.id, 'status'], sessionStats);
|
|
130
|
-
bus.publish([session.id, 'status-details'], { tasks: Array.from(allTasks.values()) });
|
|
131
|
-
},
|
|
132
|
-
reportEnd: (end) => {
|
|
133
|
-
const previousResult = allTasks.get(end.id);
|
|
134
|
-
const now = new Date().getTime();
|
|
135
|
-
if (previousResult) {
|
|
136
|
-
sessionStats.remainingTasks--;
|
|
137
|
-
sessionStats.totalErrors += end.errors?.length || 0;
|
|
138
|
-
sessionStats.totalWarnings += end.warnings?.length || 0;
|
|
139
|
-
allTasks.set(end.id, {
|
|
140
|
-
...previousResult,
|
|
141
|
-
...end,
|
|
142
|
-
status: 'complete',
|
|
143
|
-
durationMilliseconds: now - previousResult.startTime,
|
|
144
|
-
lastUpdated: now,
|
|
145
|
-
});
|
|
146
|
-
if (sessionStats.remainingTasks === 0) {
|
|
147
|
-
sessionStats.status = 'idle';
|
|
148
|
-
}
|
|
149
|
-
bus.publish([session.id, 'status'], sessionStats);
|
|
150
|
-
bus.publish([session.id, 'status-details'], { tasks: Array.from(allTasks.values()) });
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
153
|
addTask: (task, options) => {
|
|
154
|
-
return taskRunner.add(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
154
|
+
return taskRunner.add({
|
|
155
|
+
...task,
|
|
156
|
+
execute: async () => {
|
|
157
|
+
reportStart({
|
|
158
|
+
...task.getStartDescription?.(),
|
|
159
|
+
id: task.id,
|
|
160
|
+
});
|
|
161
|
+
let taskResult;
|
|
162
|
+
try {
|
|
163
|
+
taskResult = await task.execute();
|
|
164
|
+
}
|
|
165
|
+
catch (err) {
|
|
166
|
+
// no-op
|
|
167
|
+
}
|
|
168
|
+
reportEnd({
|
|
169
|
+
...task.getEndDescription?.(taskResult),
|
|
170
|
+
id: task.id,
|
|
171
|
+
});
|
|
172
|
+
return taskResult;
|
|
173
|
+
},
|
|
174
|
+
}, options);
|
|
161
175
|
},
|
|
162
176
|
close: () => new Promise((resolve, reject) => server.close((err) => (err ? reject(err) : resolve()))),
|
|
163
177
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startApiServer.js","sourceRoot":"","sources":["../../../src/commands/start/startApiServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,SAAS,EAAE,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"startApiServer.js","sourceRoot":"","sources":["../../../src/commands/start/startApiServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,SAAS,EAAE,EAAE,eAAe,EAAE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,CAAC;oBAEH,IAAI,UAAU,CAAC;oBAEf,IAAI;wBACF,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;qBACnC;oBAAC,OAAO,GAAG,EAAE;wBACZ,QAAQ;qBACT;oBAED,SAAS,CAAC;wBACR,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC,UAAU,CAAC;wBACvC,EAAE,EAAE,IAAI,CAAC,EAAE;qBACU,CAAC,CAAC;oBAEzB,OAAO,UAAU,CAAC;gBACpB,CAAC;aACF,EACD,OAAO,CACR,CAAC;QACJ,CAAC;QAED,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;KAC5G,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { Session } from './types.js';
|
|
2
|
-
import type { ApiServer } from './startApiServer.js';
|
|
3
|
-
import type { BundleServer } from './startBundleServer.js';
|
|
1
|
+
import type { ApiServer, BundleServer, Session } from './types.js';
|
|
4
2
|
/**
|
|
5
3
|
* The app server hosts the appropriate routes for the web app, primarily returning html content
|
|
6
4
|
* which loads resources from the bundle server.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startAppServer.js","sourceRoot":"","sources":["../../../src/commands/start/startAppServer.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAkB,MAAM,iCAAiC,CAAC;AACtG,OAAO,EAAE,gBAAgB,EAA+B,MAAM,kCAAkC,CAAC;
|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ASJ;IACC,GAAG,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IACxC,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IACxC,GAAG,CAAC,MAAM,CAAC,yBAAyB,EAAE,yBAAyB,CAAC,CAAC;IACjE,GAAG,CAAC,MAAM,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;IAE/C,GAAG,CAAC,MAAM,CAAC,sBAAsB,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IAC/C,GAAG,CAAC,MAAM,CAAC,mBAAmB,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IAE/C,GAAG,CAAC,IAAI,CACN;QACE,iBAAiB;QACjB,QAAQ;QACR,QAAQ;QACR,UAAU,KAAK,UAAU;QACzB,4BAA4B,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,WAAW;QACzE,WAAW,EAAE,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,8BAA8B,SAAS,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;QACtG,SAAS;QACT,QAAQ;QACR,uBAAuB;QACvB,WAAW,EAAE,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,8BAA8B,SAAS,mBAAmB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;QAC5G,SAAS;QACT,SAAS;KACV,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import type { Session } from './types.js';
|
|
2
|
-
import type { ApiServer } from './startApiServer.js';
|
|
3
|
-
export interface BundleServer {
|
|
4
|
-
url: string;
|
|
5
|
-
port: number;
|
|
6
|
-
close: () => Promise<void>;
|
|
7
|
-
}
|
|
1
|
+
import type { ApiServer, BundleServer, Session } from './types.js';
|
|
8
2
|
/**
|
|
9
3
|
* The bundle server handles package requests and returns bundled resources.
|
|
10
4
|
* Resources are bundled on demand and cached locally to avoid re-bundling
|
|
@@ -2,14 +2,12 @@ import { createExpressApp } from '@ms-cloudpack/create-express-app';
|
|
|
2
2
|
import { isExternalPackage } from '@ms-cloudpack/package-utilities';
|
|
3
3
|
import { isFolder, slash } from '@ms-cloudpack/path-utilities';
|
|
4
4
|
import filenamify from 'filenamify';
|
|
5
|
-
import fsExtra from 'fs-extra';
|
|
6
5
|
import hash from 'object-hash';
|
|
7
6
|
import os from 'os';
|
|
8
7
|
import path from 'path';
|
|
9
8
|
import { parseRequestInfo } from './parseRequestInfo.js';
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
const { ensureDir } = fsExtra;
|
|
9
|
+
import { createBundleTask } from './createBundleTask.js';
|
|
10
|
+
import { startWatcher } from './startWatcher.js';
|
|
13
11
|
// const bundleLookupPath = path.join(os.tmpdir(), 'cloudpack-output', 'all-bundles.json');
|
|
14
12
|
const log = (...messages) => {
|
|
15
13
|
console.log(`BundleServer:`, ...messages);
|
|
@@ -23,10 +21,11 @@ const error = (...messages) => {
|
|
|
23
21
|
* on each request.
|
|
24
22
|
*/
|
|
25
23
|
export async function startBundleServer({ session, apiServer, }) {
|
|
24
|
+
const watcher = startWatcher(apiServer);
|
|
26
25
|
const { server, port } = await createExpressApp([5500, 5501, 5502, 5503], (app) => {
|
|
27
26
|
// Set up the express app routes.
|
|
28
27
|
app.get('*', (req, res) => {
|
|
29
|
-
handleRequest(req, res, session, apiServer).catch((err) => {
|
|
28
|
+
handleRequest(req, res, session, apiServer, watcher).catch((err) => {
|
|
30
29
|
error(err?.stack || err);
|
|
31
30
|
res.status(500).send(`Error bundling: ${err}`);
|
|
32
31
|
});
|
|
@@ -40,7 +39,7 @@ export async function startBundleServer({ session, apiServer, }) {
|
|
|
40
39
|
url,
|
|
41
40
|
};
|
|
42
41
|
}
|
|
43
|
-
async function handleRequest(req, res, session, apiServer) {
|
|
42
|
+
async function handleRequest(req, res, session, apiServer, watcher) {
|
|
44
43
|
const { resolveMap } = session;
|
|
45
44
|
const requestPath = slash(req.path.substring(1));
|
|
46
45
|
const { packageName, version, filePath } = parseRequestInfo(requestPath);
|
|
@@ -83,61 +82,20 @@ async function handleRequest(req, res, session, apiServer) {
|
|
|
83
82
|
// Derive where the output should be.
|
|
84
83
|
const outputPath = path.join(os.tmpdir(), 'cloudpack-output', `${filenamify(packageName)}-${version}-${bundleId}`);
|
|
85
84
|
// Set up for bundling.
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
// Start tracking work.
|
|
101
|
-
apiServer.reportStart({
|
|
102
|
-
id: bundleId,
|
|
103
|
-
name: `Bundle ${packageName}@${version}`,
|
|
104
|
-
inputPath: packagePath || '',
|
|
105
|
-
outputPath,
|
|
106
|
-
});
|
|
107
|
-
try {
|
|
108
|
-
log(`No previous task result found, bundling: "${packageName}@${version}"`);
|
|
109
|
-
await ensureDir(outputPath);
|
|
110
|
-
log(`Finished ensureDir: "${packageName}@${version}"`);
|
|
111
|
-
log(`Trying to bundle "${packageName}@${version}"`);
|
|
112
|
-
await apiServer.addTask({
|
|
113
|
-
name: `Bundle ${packageName}@${version}`,
|
|
114
|
-
id: bundleId,
|
|
115
|
-
execute: () => bundleTask(bundleRequest, force),
|
|
116
|
-
}, { rerun });
|
|
117
|
-
}
|
|
118
|
-
catch (_) {
|
|
119
|
-
/* no-op */
|
|
120
|
-
}
|
|
121
|
-
// TODO: if moved to a function, this would be the return value
|
|
122
|
-
taskResult = bundleRequest;
|
|
123
|
-
// TODO: errors and warnings typings don't match up. We need to reconcile.
|
|
124
|
-
apiServer.reportEnd({
|
|
125
|
-
id: bundleId,
|
|
126
|
-
errors: bundleRequest.result?.errors,
|
|
127
|
-
warnings: bundleRequest.result?.warnings,
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
log(`Bundle cached, returning: "${packageName}@${version}${filePath}"`);
|
|
132
|
-
}
|
|
133
|
-
if (!taskResult) {
|
|
134
|
-
res.status(500).send(`Result not found for "${bundleId}". This is likely a bug with cloudpack.`);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
// If this is a pre-built local package we haven't set up for incremental builds, set it up.
|
|
138
|
-
if (!isExternal && !taskResult.dispose) {
|
|
139
|
-
initializeFileWatcher(bundleId, outputPath, taskResult, apiServer);
|
|
140
|
-
}
|
|
85
|
+
const rerun = !isFolder(outputPath) || force;
|
|
86
|
+
const taskResult = {
|
|
87
|
+
id: bundleId,
|
|
88
|
+
packageName,
|
|
89
|
+
version,
|
|
90
|
+
packagePath,
|
|
91
|
+
outputPath,
|
|
92
|
+
isExternal,
|
|
93
|
+
};
|
|
94
|
+
log(`Trying to bundle "${packageName}@${version}"`);
|
|
95
|
+
const bundleTask = createBundleTask(taskResult, { force });
|
|
96
|
+
await apiServer.addTask(bundleTask, { rerun });
|
|
97
|
+
// Set up the task's watcher
|
|
98
|
+
watcher.watch(taskResult);
|
|
141
99
|
// At this point we should have a Task completed.
|
|
142
100
|
if ((taskResult.result?.errors?.length || 0) > 0) {
|
|
143
101
|
res.status(500).type('json').send(taskResult);
|
|
@@ -151,67 +109,4 @@ async function handleRequest(req, res, session, apiServer) {
|
|
|
151
109
|
res.sendFile(path.join(outputPath, filePath));
|
|
152
110
|
}
|
|
153
111
|
}
|
|
154
|
-
function initializeFileWatcher(bundleId, outputPath, bundleRequest, apiServer) {
|
|
155
|
-
const { id, packageName, packagePath, version } = bundleRequest;
|
|
156
|
-
let bundleOutput = bundleRequest.result;
|
|
157
|
-
log(`Initializing file watcher for ${packageName}@${version}`);
|
|
158
|
-
// TODO: This is a bit of a hack. We should be able to use the watch API, but it doesn't seem to work.
|
|
159
|
-
const watcher = chokidar.watch(path.join(packagePath, 'src')).on('change', (event) => {
|
|
160
|
-
if (!apiServer.pendingTask(id)) {
|
|
161
|
-
bundleRequest.isRebuildRequired = true;
|
|
162
|
-
log(`Detected change "${event}", rebuilding "${packageName}@${version}"`);
|
|
163
|
-
(async () => {
|
|
164
|
-
do {
|
|
165
|
-
bundleRequest.isRebuildRequired = false;
|
|
166
|
-
log(`[Start] >> Bundling "${packageName}@${version}" to "${outputPath}"`);
|
|
167
|
-
// Start tracking work.
|
|
168
|
-
apiServer.reportStart({
|
|
169
|
-
id: bundleId,
|
|
170
|
-
name: `Rebundle ${packageName}@${version}`,
|
|
171
|
-
inputPath: packagePath,
|
|
172
|
-
outputPath,
|
|
173
|
-
});
|
|
174
|
-
if (!bundleOutput?.rebuild) {
|
|
175
|
-
bundleOutput = (await apiServer.addTask({
|
|
176
|
-
name: `Bundle ${packageName}@${version}`,
|
|
177
|
-
id: bundleId,
|
|
178
|
-
execute: () => bundleTask(bundleRequest),
|
|
179
|
-
}))?.result;
|
|
180
|
-
}
|
|
181
|
-
else if (bundleOutput?.rebuild) {
|
|
182
|
-
bundleOutput = await bundleOutput.rebuild();
|
|
183
|
-
}
|
|
184
|
-
// TODO: Fix typings
|
|
185
|
-
apiServer.reportEnd({
|
|
186
|
-
id: bundleId,
|
|
187
|
-
errors: bundleOutput?.errors,
|
|
188
|
-
warnings: bundleOutput?.warnings,
|
|
189
|
-
});
|
|
190
|
-
log(`[ End ] << Bundled "${packageName}@${version}" (${bundleOutput?.outputFiles?.length || 0} file(s), ${bundleOutput?.errors?.length || 0} errors)`);
|
|
191
|
-
} while (bundleRequest.isRebuildRequired);
|
|
192
|
-
if (!bundleOutput?.errors?.length) {
|
|
193
|
-
log(`Notifying rebuild: ${packageName}@${version}`);
|
|
194
|
-
apiServer.notifyReload();
|
|
195
|
-
}
|
|
196
|
-
})().catch((err) => {
|
|
197
|
-
error(`Error rebuilding "${packageName}@${version}":`, err?.stack || err);
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
// A change was made while we were bundling. We need to wait for the current
|
|
202
|
-
// bundle to finish before we can rebuild.
|
|
203
|
-
bundleRequest.isRebuildRequired = true;
|
|
204
|
-
log(`Detected change "${event}", already waiting for "${packageName}@${version}"`);
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
bundleRequest.dispose = async () => {
|
|
208
|
-
try {
|
|
209
|
-
await watcher.close();
|
|
210
|
-
}
|
|
211
|
-
catch {
|
|
212
|
-
// ignore
|
|
213
|
-
}
|
|
214
|
-
bundleOutput?.dispose?.();
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
112
|
//# sourceMappingURL=startBundleServer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startBundleServer.js","sourceRoot":"","sources":["../../../src/commands/start/startBundleServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA6C,MAAM,kCAAkC,CAAC;AAC/G,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"startBundleServer.js","sourceRoot":"","sources":["../../../src/commands/start/startBundleServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA6C,MAAM,kCAAkC,CAAC;AAC/G,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAA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E,QAAQ;QACZ,WAAW;QACX,OAAO;QACP,WAAW;QACX,UAAU;QACV,UAAU;KACX,CAAC;IAEF,GAAG,CAAC,qBAAqB,WAAW,IAAI,OAAO,GAAG,CAAC,CAAC;IACpD,MAAM,UAAU,GAAwB,gBAAgB,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAChF,MAAM,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAE/C,4BAA4B;IAC5B,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAE1B,iDAAiD;IACjD,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE;QAChD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KAC/C;SAAM;QACL,GAAG,CAAC,sBAAsB,WAAW,IAAI,OAAO,GAAG,QAAQ,GAAG,CAAC,CAAC;QAChE,4BAA4B;QAC5B,IAAI,UAAU,EAAE;YACd,GAAG,CAAC,SAAS,CAAC,eAAe,EAAE,0BAA0B,CAAC,CAAC;SAC5D;QAED,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;KAC/C;AACH,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import chokidar from 'chokidar';
|
|
3
|
+
import { createBundleTask } from './createBundleTask.js';
|
|
4
|
+
const log = (...messages) => {
|
|
5
|
+
console.log(`BundleWatcher:`, ...messages);
|
|
6
|
+
};
|
|
7
|
+
const error = (...messages) => {
|
|
8
|
+
console.error(`BundleWatcher:`, ...messages);
|
|
9
|
+
};
|
|
10
|
+
export function startWatcher(apiServer) {
|
|
11
|
+
const watched = new Set();
|
|
12
|
+
return {
|
|
13
|
+
watch: (bundleRequest) => {
|
|
14
|
+
// Have a single watcher per bundle request.
|
|
15
|
+
if (watched.has(bundleRequest.id)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
watched.add(bundleRequest.id);
|
|
19
|
+
const { packageName, version, packagePath, outputPath } = bundleRequest;
|
|
20
|
+
log(`Initializing file watcher for ${packageName}@${version}`);
|
|
21
|
+
// TODO: This is a bit of a hack. We should be able to use the watch API, but it doesn't seem to work.
|
|
22
|
+
const watcher = chokidar.watch(path.join(packagePath, 'src')).on('change', async (event) => {
|
|
23
|
+
log(`Detected change "${event}", rebuilding "${packageName}@${version}"`);
|
|
24
|
+
log(`[Start] >> Bundling "${packageName}@${version}" to "${outputPath}"`);
|
|
25
|
+
// Start tracking work.
|
|
26
|
+
try {
|
|
27
|
+
bundleRequest.result = (await apiServer.addTask(createBundleTask(bundleRequest, { rebuild: true }), { rerun: true })).result;
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
// TODO: Handle errors.
|
|
31
|
+
error(`Error rebuilding "${packageName}@${version}":`, err?.stack || err);
|
|
32
|
+
}
|
|
33
|
+
log(`[ End ] << Bundled "${packageName}@${version}" (${bundleRequest.result?.outputFiles?.length || 0} file(s), ${bundleRequest.result?.errors?.length || 0} errors)`);
|
|
34
|
+
if (!bundleRequest.result?.errors?.length) {
|
|
35
|
+
log(`Notifying rebuild: ${packageName}@${version}`);
|
|
36
|
+
apiServer.notifyReload();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
bundleRequest.dispose = async () => {
|
|
40
|
+
try {
|
|
41
|
+
await watcher.close();
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// ignore
|
|
45
|
+
}
|
|
46
|
+
watched.delete(bundleRequest.id);
|
|
47
|
+
bundleRequest.result?.dispose?.();
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=startWatcher.js.map
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../../src/commands/start/taskRunner.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"taskRunner.test.js","sourceRoot":"","sources":["../../../src/commands/start/taskRunner.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,MAAM,KAAK,GAAwB;IACjC;QACE,IAAI,EAAE,QAAQ;QACd,EAAE,EAAE,GAAG;QACP,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,OAAO,CAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;KACjE;IACD;QACE,IAAI,EAAE,QAAQ;QACd,EAAE,EAAE,GAAG;QACP,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,OAAO,CAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC;KAClE;CACF,CAAC;AAEF,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;QAEpC,MAAM,CAAC,MAAM,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,KAAK,IAAI,EAAE;QAC5D,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;QAEpC,MAAM,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAE/B,8CAA8C;QAC9C,4CAA4C;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AC,kBAAkB,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,KAAK,IAAI,EAAE;QACxD,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;QAEpC,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAE3C,MAAM,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAE7D,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACtC,MAAM,CAAC,MAAM,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,UAAU,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ResolveMap } from '@ms-cloudpack/package-utilities';
|
|
2
|
+
import type { BundlerResult } from '@ms-cloudpack/bundler-types';
|
|
2
3
|
export interface Session {
|
|
3
4
|
/**
|
|
4
5
|
* The session id, used for identifying
|
|
@@ -27,3 +28,78 @@ export interface Session {
|
|
|
27
28
|
*/
|
|
28
29
|
resolveMap: ResolveMap;
|
|
29
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Tracks a given bundle request and its result.
|
|
33
|
+
*/
|
|
34
|
+
export interface BundleRequest {
|
|
35
|
+
id: string;
|
|
36
|
+
packageName: string;
|
|
37
|
+
version: string;
|
|
38
|
+
packagePath: string;
|
|
39
|
+
outputPath: string;
|
|
40
|
+
isExternal: boolean;
|
|
41
|
+
result?: BundlerResult;
|
|
42
|
+
isRebuildRequired?: boolean;
|
|
43
|
+
dispose?: () => Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
export interface BundleTaskOptions {
|
|
46
|
+
force?: boolean;
|
|
47
|
+
rebuild?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface BundleServer {
|
|
50
|
+
url: string;
|
|
51
|
+
port: number;
|
|
52
|
+
close: () => Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
export interface SessionStats {
|
|
55
|
+
status: 'idle' | 'pending';
|
|
56
|
+
remainingTasks: number;
|
|
57
|
+
totalTasks: number;
|
|
58
|
+
totalErrors: number;
|
|
59
|
+
totalWarnings: number;
|
|
60
|
+
}
|
|
61
|
+
export interface ApiServer {
|
|
62
|
+
url: string;
|
|
63
|
+
port: number;
|
|
64
|
+
notifyReload: () => void;
|
|
65
|
+
addTask: <TReturn>(task: Task<TReturn>, options?: TaskOptions) => Promise<TReturn>;
|
|
66
|
+
close: () => Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
export interface Watcher {
|
|
69
|
+
watch: (bundleRequest: BundleRequest) => void;
|
|
70
|
+
}
|
|
71
|
+
export interface TaskError {
|
|
72
|
+
message: string;
|
|
73
|
+
pluginName: string;
|
|
74
|
+
stack: string;
|
|
75
|
+
fileLocation: string;
|
|
76
|
+
lineNumber: number;
|
|
77
|
+
columnNumber: number;
|
|
78
|
+
}
|
|
79
|
+
export interface TaskStartDescription {
|
|
80
|
+
id: string;
|
|
81
|
+
name?: string;
|
|
82
|
+
inputPath?: string;
|
|
83
|
+
outputPath?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface TaskEndDescription {
|
|
86
|
+
id: string;
|
|
87
|
+
errors?: TaskError[];
|
|
88
|
+
warnings?: TaskError[];
|
|
89
|
+
}
|
|
90
|
+
export interface TaskDescription extends TaskStartDescription, TaskEndDescription {
|
|
91
|
+
status: 'pending' | 'complete';
|
|
92
|
+
startTime: number;
|
|
93
|
+
durationMilliseconds?: number;
|
|
94
|
+
lastUpdated?: number;
|
|
95
|
+
}
|
|
96
|
+
export interface Task<TReturn> {
|
|
97
|
+
name: string;
|
|
98
|
+
id: string;
|
|
99
|
+
execute: () => Promise<TReturn | undefined>;
|
|
100
|
+
getStartDescription?: () => TaskStartDescription;
|
|
101
|
+
getEndDescription?: (result: TReturn | undefined) => TaskEndDescription;
|
|
102
|
+
}
|
|
103
|
+
export interface TaskOptions {
|
|
104
|
+
rerun?: boolean;
|
|
105
|
+
}
|
package/lib/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "The Cloudpack command line interface - a tool for managing fast inner and outer looping in web apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"@ms-cloudpack/eslint-config-base": "*",
|
|
39
39
|
"@ms-cloudpack/scripts": "*",
|
|
40
40
|
"@types/chokidar": "2.1.3",
|
|
41
|
-
"@types/fs-extra": "9.0.13",
|
|
42
41
|
"@types/glob": "8.0.0",
|
|
43
42
|
"@types/object-hash": "2.2.1",
|
|
44
43
|
"@types/uuid": "8.3.4"
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { BundlerResult } from '@ms-cloudpack/bundler-types';
|
|
2
|
-
/**
|
|
3
|
-
* Tracks a given bundle request and its result.
|
|
4
|
-
*/
|
|
5
|
-
export interface BundleRequest {
|
|
6
|
-
id: string;
|
|
7
|
-
packageName: string;
|
|
8
|
-
version: string;
|
|
9
|
-
packagePath: string;
|
|
10
|
-
outputPath: string;
|
|
11
|
-
isExternal: boolean;
|
|
12
|
-
result?: BundlerResult;
|
|
13
|
-
isRebuildRequired?: boolean;
|
|
14
|
-
dispose?: () => Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
export declare function bundleTask(bundleRequest: BundleRequest, force?: boolean): Promise<BundleRequest>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { bundlePackage } from '@ms-cloudpack/bundler';
|
|
2
|
-
import { readJson, writeJson } from '@ms-cloudpack/json-utilities';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
const log = (...messages) => {
|
|
5
|
-
console.log(`BundleTask:`, ...messages);
|
|
6
|
-
};
|
|
7
|
-
export async function bundleTask(bundleRequest, force) {
|
|
8
|
-
const { packagePath, outputPath, isExternal } = bundleRequest;
|
|
9
|
-
// Rehydrate the result if not incremental.
|
|
10
|
-
if (isExternal && !force) {
|
|
11
|
-
bundleRequest.result = await readJson(path.join(outputPath, 'result.json'));
|
|
12
|
-
}
|
|
13
|
-
const isCacheUsable = bundleRequest.result?.errors?.length === 0;
|
|
14
|
-
// Only use cached result if it's successful.
|
|
15
|
-
if (!isCacheUsable) {
|
|
16
|
-
bundleRequest.result = await bundlePackage({
|
|
17
|
-
packagePath,
|
|
18
|
-
outputPath,
|
|
19
|
-
outputType: 'library',
|
|
20
|
-
incremental: !isExternal,
|
|
21
|
-
});
|
|
22
|
-
// Write the result to disk.
|
|
23
|
-
if (isExternal) {
|
|
24
|
-
await writeJson(path.join(outputPath, 'result.json'), bundleRequest.result);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
log(`Bundle cached, returning: "${bundleRequest.packageName}@${bundleRequest.version}"`);
|
|
29
|
-
}
|
|
30
|
-
return bundleRequest;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=bundleTask.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundleTask.js","sourceRoot":"","sources":["../../../src/commands/start/bundleTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,GAAG,GAAG,CAAC,GAAG,QAAmB,EAAE,EAAE;IACrC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,QAAQ,CAAC,CAAC;AAC1C,CAAC,CAAC;AAkBF,MAAM,CAA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