@ms-cloudpack/cli 0.2.11 → 0.3.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 +58 -1
- package/CHANGELOG.md +28 -2
- package/lib/commands/start/createSession.js +7 -3
- package/lib/commands/start/createSession.js.map +1 -1
- package/lib/commands/start/start.js +14 -5
- package/lib/commands/start/start.js.map +1 -1
- package/lib/commands/start/startApiServer.d.ts +55 -0
- package/lib/commands/start/startApiServer.js +100 -0
- package/lib/commands/start/startApiServer.js.map +1 -0
- package/lib/commands/start/startAppServer.d.ts +7 -1
- package/lib/commands/start/startAppServer.js +51 -17
- package/lib/commands/start/startAppServer.js.map +1 -1
- package/lib/commands/start/startBundleServer.d.ts +14 -3
- package/lib/commands/start/startBundleServer.js +163 -38
- package/lib/commands/start/startBundleServer.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +7 -3
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,64 @@
|
|
|
2
2
|
"name": "@ms-cloudpack/cli",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Sat, 06 Aug 2022 08:15:24 GMT",
|
|
6
|
+
"tag": "@ms-cloudpack/cli_v0.3.0",
|
|
7
|
+
"version": "0.3.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "dzearing@microsoft.com",
|
|
12
|
+
"package": "@ms-cloudpack/cli",
|
|
13
|
+
"commit": "70b5e51ee1e2bbb80d6b6fef1dbbf819d3634a0b",
|
|
14
|
+
"comment": "Adding api server and overlay integration."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@ms-cloudpack/cli",
|
|
19
|
+
"comment": "Bump @ms-cloudpack/bundler to v0.3.0",
|
|
20
|
+
"commit": "b51ce22d9bb8d691916c1d41cf201b76ebd82bfa"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Fri, 05 Aug 2022 08:12:21 GMT",
|
|
27
|
+
"tag": "@ms-cloudpack/cli_v0.2.13",
|
|
28
|
+
"version": "0.2.13",
|
|
29
|
+
"comments": {
|
|
30
|
+
"patch": [
|
|
31
|
+
{
|
|
32
|
+
"author": "beachball",
|
|
33
|
+
"package": "@ms-cloudpack/cli",
|
|
34
|
+
"comment": "Bump @ms-cloudpack/bundler to v0.2.1",
|
|
35
|
+
"commit": "8aaedf79e1b7b0b33f19ab560f233bc9bd27b5e5"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"author": "beachball",
|
|
39
|
+
"package": "@ms-cloudpack/cli",
|
|
40
|
+
"comment": "Bump @ms-cloudpack/package-utilities to v0.6.0",
|
|
41
|
+
"commit": "8aaedf79e1b7b0b33f19ab560f233bc9bd27b5e5"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"date": "Tue, 02 Aug 2022 22:33:42 GMT",
|
|
48
|
+
"tag": "@ms-cloudpack/cli_v0.2.12",
|
|
49
|
+
"version": "0.2.12",
|
|
50
|
+
"comments": {
|
|
51
|
+
"patch": [
|
|
52
|
+
{
|
|
53
|
+
"author": "beachball",
|
|
54
|
+
"package": "@ms-cloudpack/cli",
|
|
55
|
+
"comment": "Bump @ms-cloudpack/bundler to v0.2.0",
|
|
56
|
+
"commit": "2c583353dd5eda02c356dac916a43bd2bc8bd510"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"date": "Tue, 02 Aug 2022 20:37:37 GMT",
|
|
6
63
|
"tag": "@ms-cloudpack/cli_v0.2.11",
|
|
7
64
|
"version": "0.2.11",
|
|
8
65
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,38 @@
|
|
|
1
1
|
# Change Log - @ms-cloudpack/cli
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Sat, 06 Aug 2022 08:15:24 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.3.0
|
|
8
|
+
|
|
9
|
+
Sat, 06 Aug 2022 08:15:24 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Adding api server and overlay integration. (dzearing@microsoft.com)
|
|
14
|
+
- Bump @ms-cloudpack/bundler to v0.3.0
|
|
15
|
+
|
|
16
|
+
## 0.2.13
|
|
17
|
+
|
|
18
|
+
Fri, 05 Aug 2022 08:12:21 GMT
|
|
19
|
+
|
|
20
|
+
### Patches
|
|
21
|
+
|
|
22
|
+
- Bump @ms-cloudpack/bundler to v0.2.1
|
|
23
|
+
- Bump @ms-cloudpack/package-utilities to v0.6.0
|
|
24
|
+
|
|
25
|
+
## 0.2.12
|
|
26
|
+
|
|
27
|
+
Tue, 02 Aug 2022 22:33:42 GMT
|
|
28
|
+
|
|
29
|
+
### Patches
|
|
30
|
+
|
|
31
|
+
- Bump @ms-cloudpack/bundler to v0.2.0
|
|
32
|
+
|
|
7
33
|
## 0.2.11
|
|
8
34
|
|
|
9
|
-
Tue, 02 Aug 2022 20:37:
|
|
35
|
+
Tue, 02 Aug 2022 20:37:37 GMT
|
|
10
36
|
|
|
11
37
|
### Patches
|
|
12
38
|
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { v4 as uuid } from 'uuid';
|
|
2
|
-
import { createResolveMap } from '@ms-cloudpack/package-utilities';
|
|
2
|
+
import { createResolveMap, resolve } from '@ms-cloudpack/package-utilities';
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
const dashboardPackageName = '@ms-cloudpack/overlay';
|
|
7
|
+
const dashboardPackagePath = (await resolve(dashboardPackageName, path.dirname(fileURLToPath(import.meta.url)))) || '';
|
|
5
8
|
export async function createSession(options) {
|
|
6
9
|
const { appPath } = options;
|
|
7
10
|
const id = uuid();
|
|
8
11
|
// Grab the installed dependency locations.
|
|
9
12
|
console.log(`Resolving dependencies...`);
|
|
10
|
-
const
|
|
13
|
+
const startTime = new Date().getTime();
|
|
14
|
+
const resolveMap = await createResolveMap({ appPath, additionalPaths: [dashboardPackagePath] });
|
|
11
15
|
fs.writeFileSync(path.join(process.cwd(), 'resolve-map.json'), JSON.stringify(resolveMap, null, 2));
|
|
12
|
-
console.log(`Resolved dependencies. (${Object.keys(resolveMap).length} total)`);
|
|
16
|
+
console.log(`Resolved dependencies. (${Object.keys(resolveMap).length} total, ${new Date().getTime() - startTime}ms)`);
|
|
13
17
|
return {
|
|
14
18
|
id,
|
|
15
19
|
appPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSession.js","sourceRoot":"","sources":["../../../src/commands/start/createSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"createSession.js","sourceRoot":"","sources":["../../../src/commands/start/createSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AACrD,MAAM,oBAAoB,GAAG,CAAC,MAAM,OAAO,CAAC,oBAAoB,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAMvH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAuB;IACzD,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5B,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC;IAElB,2CAA2C;IAC3C,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAEzC,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IACvC,MAAM,UAAU,GAAG,MAAM,gBAAgB,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;IAEhG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,kBAAkB,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAEpG,OAAO,CAAC,GAAG,CACT,2BAA2B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,WAAW,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,SAAS,KAAK,CAC1G,CAAC;IAEF,OAAO;QACL,EAAE;QACF,OAAO;QACP,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS;QACf,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { createSession } from './createSession.js';
|
|
|
2
2
|
import { startBundleServer } from './startBundleServer.js';
|
|
3
3
|
import { startAppServer } from './startAppServer.js';
|
|
4
4
|
import { openBrowser } from './openBrowser.js';
|
|
5
|
+
import { startApiServer } from './startApiServer.js';
|
|
5
6
|
/**
|
|
6
7
|
* Defines the "start" verb entry point.
|
|
7
8
|
*/
|
|
@@ -9,12 +10,20 @@ export async function start() {
|
|
|
9
10
|
const appPath = process.cwd();
|
|
10
11
|
// Initialize session definition.
|
|
11
12
|
const session = await createSession({ appPath });
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
//
|
|
13
|
+
// Start api server for tracking status and handling remote requests.
|
|
14
|
+
const apiServer = await startApiServer({ session });
|
|
15
|
+
// Then start bundle and app servers for hosting the app.
|
|
16
|
+
const bundleServer = await startBundleServer({ session, apiServer });
|
|
17
|
+
const appServer = await startAppServer({
|
|
18
|
+
session,
|
|
19
|
+
bundleServer,
|
|
20
|
+
apiServer,
|
|
21
|
+
});
|
|
22
|
+
// Setup cleanup and close things on completion.
|
|
15
23
|
process.on('SIGINT', async function () {
|
|
16
|
-
bundleServer.close();
|
|
17
|
-
appServer.close();
|
|
24
|
+
await bundleServer.close();
|
|
25
|
+
await appServer.close();
|
|
26
|
+
await apiServer.close();
|
|
18
27
|
process.exit(0);
|
|
19
28
|
});
|
|
20
29
|
// Open the browser.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK;IACzB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE9B,iCAAiC;IACjC,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IAEjD,qEAAqE;IACrE,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IAEpD,yDAAyD;IACzD,MAAM,YAAY,GAAG,MAAM,iBAAiB,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IACrE,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC;QACrC,OAAO;QACP,YAAY;QACZ,SAAS;KACV,CAAC,CAAC;IAEH,gDAAgD;IAChD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK;QACxB,MAAM,YAAY,CAAC,KAAK,EAAE,CAAC;QAC3B,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;QACxB,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,oBAAoB;IACpB,WAAW,CAAC,oBAAoB,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Session } from './types.js';
|
|
2
|
+
import { type BundlerResult } from '@ms-cloudpack/bundler-types';
|
|
3
|
+
export interface ReportStartOptions {
|
|
4
|
+
sessionId: string;
|
|
5
|
+
bundleId: string;
|
|
6
|
+
packageName: string;
|
|
7
|
+
packageVersion: string;
|
|
8
|
+
packagePath: string;
|
|
9
|
+
outputPath: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ReportEndOptions {
|
|
12
|
+
sessionId: string;
|
|
13
|
+
bundleId: string;
|
|
14
|
+
resultType: 'cached' | 'bundled';
|
|
15
|
+
result: BundlerResult | undefined;
|
|
16
|
+
}
|
|
17
|
+
export declare type SessionStatus = 'unknown' | 'idle' | 'building' | 'success' | 'warning' | 'error' | 'cancelled';
|
|
18
|
+
export interface SessionStats {
|
|
19
|
+
sessionId: string;
|
|
20
|
+
status: SessionStatus;
|
|
21
|
+
totalPendingJobs: number;
|
|
22
|
+
totalSuccessJobs: number;
|
|
23
|
+
totalErrorJobs: number;
|
|
24
|
+
totalWarningJobs: number;
|
|
25
|
+
pendingJobs: ReportStartOptions[];
|
|
26
|
+
allJobs: Record<string, {
|
|
27
|
+
start: ReportStartOptions;
|
|
28
|
+
end: ReportEndOptions;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
31
|
+
export interface ApiServer {
|
|
32
|
+
url: string;
|
|
33
|
+
port: number;
|
|
34
|
+
notifyReload: () => void;
|
|
35
|
+
reportStart: (options: ReportStartOptions) => void;
|
|
36
|
+
reportEnd: (options: ReportEndOptions) => void;
|
|
37
|
+
close: () => void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The api server handles the data pub/sub (for things like reporting build status)
|
|
41
|
+
* and hosting the dashboard verb backend (for executing actions like loading vscode,
|
|
42
|
+
* changing dependencies, connecting new projects to the running session, etc.)
|
|
43
|
+
*
|
|
44
|
+
* Each time `cloudpack start` is run, an api server will start up for that session. The
|
|
45
|
+
* hosted web page will have a "cloudpack-api-server" header which points
|
|
46
|
+
* to the websocket server.
|
|
47
|
+
*
|
|
48
|
+
* The bundle server will call the api server to publish build status updates.
|
|
49
|
+
*
|
|
50
|
+
* The app server will burn the api server url on the host html, so that client-side
|
|
51
|
+
* javascript can connect and subscribe to page changes.
|
|
52
|
+
*/
|
|
53
|
+
export declare function startApiServer({ session }: {
|
|
54
|
+
session: Session;
|
|
55
|
+
}): Promise<ApiServer>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import getPort from 'get-port';
|
|
2
|
+
import WebSocket, { WebSocketServer } from 'ws';
|
|
3
|
+
import { createDataBus } from '@ms-cloudpack/data-bus';
|
|
4
|
+
/**
|
|
5
|
+
* The api server handles the data pub/sub (for things like reporting build status)
|
|
6
|
+
* and hosting the dashboard verb backend (for executing actions like loading vscode,
|
|
7
|
+
* changing dependencies, connecting new projects to the running session, etc.)
|
|
8
|
+
*
|
|
9
|
+
* Each time `cloudpack start` is run, an api server will start up for that session. The
|
|
10
|
+
* hosted web page will have a "cloudpack-api-server" header which points
|
|
11
|
+
* to the websocket server.
|
|
12
|
+
*
|
|
13
|
+
* The bundle server will call the api server to publish build status updates.
|
|
14
|
+
*
|
|
15
|
+
* The app server will burn the api server url on the host html, so that client-side
|
|
16
|
+
* javascript can connect and subscribe to page changes.
|
|
17
|
+
*/
|
|
18
|
+
export async function startApiServer({ session }) {
|
|
19
|
+
const port = await getPort({ port: [9890, 9891, 9892, 9893] });
|
|
20
|
+
const bus = createDataBus();
|
|
21
|
+
const sessionStats = {
|
|
22
|
+
status: 'success',
|
|
23
|
+
pendingJobCount: 0,
|
|
24
|
+
completeJobCount: 0,
|
|
25
|
+
totalErrorCount: 0,
|
|
26
|
+
totalWarningCount: 0,
|
|
27
|
+
};
|
|
28
|
+
const allJobs = {};
|
|
29
|
+
bus.publish([session.id, 'status'], sessionStats);
|
|
30
|
+
// Create a websocket server which listens for subscriptions and verb requests,
|
|
31
|
+
// and broadcasts the data to all connected clients.
|
|
32
|
+
const server = new WebSocketServer({ port }, () => {
|
|
33
|
+
// console.log(`ApiServer: Started on port ${port}`);
|
|
34
|
+
}).on('connection', (socket) => {
|
|
35
|
+
const disposables = [];
|
|
36
|
+
// console.log('ApiServer: Client connected');
|
|
37
|
+
socket
|
|
38
|
+
.on('message', async (rawData) => {
|
|
39
|
+
const request = JSON.parse(rawData.toString());
|
|
40
|
+
// console.log(`ApiServer: Received message: ${JSON.stringify(request, null, 2)}`);
|
|
41
|
+
switch (request.type) {
|
|
42
|
+
case 'subscribe': {
|
|
43
|
+
disposables.push(bus.subscribe(request.data.path,
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
+
(data) => {
|
|
46
|
+
socket.send(JSON.stringify({ type: 'notify', data }, null, 2));
|
|
47
|
+
}));
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
.on('close', () => {
|
|
53
|
+
disposables.forEach((d) => d());
|
|
54
|
+
// console.log('ApiServer: Client disconnected');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
url: `ws://localhost:${port}`,
|
|
59
|
+
port,
|
|
60
|
+
notifyReload: () => {
|
|
61
|
+
server.clients.forEach((socket) => {
|
|
62
|
+
if (socket.readyState === WebSocket.OPEN) {
|
|
63
|
+
socket.send(JSON.stringify({
|
|
64
|
+
type: 'reload',
|
|
65
|
+
data: { sessionId: session.id },
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
reportStart(start) {
|
|
71
|
+
const previousResult = allJobs[start.bundleId]?.end?.result;
|
|
72
|
+
if (previousResult) {
|
|
73
|
+
sessionStats.totalErrorCount -= previousResult.errors?.length || 0;
|
|
74
|
+
sessionStats.totalWarningCount -= previousResult.warnings?.length || 0;
|
|
75
|
+
sessionStats.completeJobCount--;
|
|
76
|
+
}
|
|
77
|
+
sessionStats.status = 'building';
|
|
78
|
+
allJobs[start.bundleId] = { start, end: undefined };
|
|
79
|
+
sessionStats.pendingJobCount++;
|
|
80
|
+
bus.publish([session.id, 'status'], sessionStats);
|
|
81
|
+
},
|
|
82
|
+
reportEnd: (end) => {
|
|
83
|
+
sessionStats.pendingJobCount--;
|
|
84
|
+
sessionStats.completeJobCount++;
|
|
85
|
+
sessionStats.totalErrorCount += end.result?.errors?.length || 0;
|
|
86
|
+
sessionStats.totalWarningCount += end.result?.warnings?.length || 0;
|
|
87
|
+
if (sessionStats.pendingJobCount === 0) {
|
|
88
|
+
sessionStats.status = sessionStats.totalErrorCount
|
|
89
|
+
? 'error'
|
|
90
|
+
: sessionStats.totalWarningCount
|
|
91
|
+
? 'warning'
|
|
92
|
+
: 'success';
|
|
93
|
+
}
|
|
94
|
+
allJobs[end.bundleId].end = end;
|
|
95
|
+
bus.publish([session.id, 'status'], sessionStats);
|
|
96
|
+
},
|
|
97
|
+
close: () => server.close(),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=startApiServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startApiServer.js","sourceRoot":"","sources":["../../../src/commands/start/startApiServer.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,SAAS,EAAE,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AA4CvD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EAAE,OAAO,EAAwB;IACpE,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;IAC5B,MAAM,YAAY,GAMd;QACF,MAAM,EAAE,SAAS;QACjB,eAAe,EAAE,CAAC;QAClB,gBAAgB,EAAE,CAAC;QACnB,eAAe,EAAE,CAAC;QAClB,iBAAiB,EAAE,CAAC;KACrB,CAAC;IACF,MAAM,OAAO,GAAqF,EAAE,CAAC;IAErG,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC;IAElD,+EAA+E;IAC/E,oDAAoD;IACpD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE;QAChD,qDAAqD;IACvD,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,EA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AC,QAAQ,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;YAEhC,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC;QACpD,CAAC;QAED,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE;KAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import type { Session } from './types.js';
|
|
3
|
+
import type { ApiServer } from './startApiServer.js';
|
|
4
|
+
import type { BundleServer } from './startBundleServer.js';
|
|
3
5
|
/**
|
|
4
6
|
* The app server hosts the appropriate routes for the web app, primarily returning html content
|
|
5
7
|
* which loads resources from the bundle server.
|
|
@@ -8,7 +10,11 @@ import type { Session } from './types.js';
|
|
|
8
10
|
* can support whichever routes the app needs, while the bundle server can provide package
|
|
9
11
|
* assets in various forms using its own routing.
|
|
10
12
|
*/
|
|
11
|
-
export declare function startAppServer(session
|
|
13
|
+
export declare function startAppServer({ session, bundleServer, apiServer, }: {
|
|
14
|
+
session: Session;
|
|
15
|
+
bundleServer: BundleServer;
|
|
16
|
+
apiServer: ApiServer;
|
|
17
|
+
}): Promise<{
|
|
12
18
|
close: () => import("http").Server;
|
|
13
19
|
port: number;
|
|
14
20
|
}>;
|
|
@@ -3,6 +3,10 @@ import path from 'path';
|
|
|
3
3
|
import { slash } from '@ms-cloudpack/path-utilities';
|
|
4
4
|
import { createImportMap, getPackageDefinition } from '@ms-cloudpack/package-utilities';
|
|
5
5
|
import { createExpressApp } from '@ms-cloudpack/create-express-app';
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
7
|
+
const log = (messages) => {
|
|
8
|
+
// console.log(`BundleServer:`, ...messages);
|
|
9
|
+
};
|
|
6
10
|
/**
|
|
7
11
|
* The app server hosts the appropriate routes for the web app, primarily returning html content
|
|
8
12
|
* which loads resources from the bundle server.
|
|
@@ -11,32 +15,41 @@ import { createExpressApp } from '@ms-cloudpack/create-express-app';
|
|
|
11
15
|
* can support whichever routes the app needs, while the bundle server can provide package
|
|
12
16
|
* assets in various forms using its own routing.
|
|
13
17
|
*/
|
|
14
|
-
export async function startAppServer(session,
|
|
15
|
-
const importMap = await createImportMap(session.resolveMap,
|
|
18
|
+
export async function startAppServer({ session, bundleServer, apiServer, }) {
|
|
19
|
+
const importMap = await createImportMap(session.resolveMap, bundleServer.url);
|
|
16
20
|
const definition = await getPackageDefinition(session.appPath, true);
|
|
21
|
+
const dashboardClientScript = importMap.imports['@ms-cloudpack/overlay'];
|
|
22
|
+
const dashboardScript = importMap.imports['@ms-cloudpack/overlay'];
|
|
17
23
|
const { server, port } = await createExpressApp([5000, 5001, 5002, 5003], (app) => {
|
|
18
24
|
// Set up the express app routes.
|
|
19
|
-
app
|
|
25
|
+
app
|
|
26
|
+
.get('/__/dashboard', (req, res) => {
|
|
27
|
+
sendHtmlResponse({
|
|
28
|
+
session,
|
|
29
|
+
title: 'Cloudpack dashboard',
|
|
30
|
+
importMap,
|
|
31
|
+
apiServer,
|
|
32
|
+
bodyScripts: [dashboardClientScript, dashboardScript],
|
|
33
|
+
res,
|
|
34
|
+
});
|
|
35
|
+
})
|
|
36
|
+
.get('*', async (req, res) => {
|
|
20
37
|
if (!definition) {
|
|
21
38
|
res.status(500).send(`There was no package.json located at "${session.appPath}".`);
|
|
22
39
|
return;
|
|
23
40
|
}
|
|
24
41
|
const requestPath = slash(req.path.substring(1));
|
|
25
42
|
const requestExt = path.extname(requestPath);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<body>
|
|
37
|
-
<script type="module" src="${entryScript}"></script>
|
|
38
|
-
</body>
|
|
39
|
-
</html>`);
|
|
43
|
+
const entryScript = `${bundleServer.url}/${definition.name}@${definition.version}/lib/index.js`;
|
|
44
|
+
log(`App server: Request: ${requestPath}, ext: ${requestExt}, ${port}`);
|
|
45
|
+
sendHtmlResponse({
|
|
46
|
+
session,
|
|
47
|
+
title: definition.name || '',
|
|
48
|
+
importMap,
|
|
49
|
+
apiServer,
|
|
50
|
+
bodyScripts: [dashboardClientScript, entryScript],
|
|
51
|
+
res,
|
|
52
|
+
});
|
|
40
53
|
});
|
|
41
54
|
});
|
|
42
55
|
return {
|
|
@@ -44,4 +57,25 @@ export async function startAppServer(session, bundleServerUrl) {
|
|
|
44
57
|
port,
|
|
45
58
|
};
|
|
46
59
|
}
|
|
60
|
+
function sendHtmlResponse({ session, title, importMap, apiServer, headScripts, bodyScripts, res, }) {
|
|
61
|
+
res.header('Content-Type', 'text/html');
|
|
62
|
+
res.header('Cache-Control', 'no-cache');
|
|
63
|
+
res.header('Content-Security-Policy', `connect-src 'self' ws:;`);
|
|
64
|
+
res.header('Access-Control-Allow-Origin', '*');
|
|
65
|
+
res.cookie('cloudpack-session-id', session.id);
|
|
66
|
+
res.cookie('cloudpack-api-url', apiServer.url);
|
|
67
|
+
res.send([
|
|
68
|
+
`<!DOCTYPE html>`,
|
|
69
|
+
`<html>`,
|
|
70
|
+
`<head>`,
|
|
71
|
+
`<title>${title}</title>`,
|
|
72
|
+
`<script type="importmap">${JSON.stringify(importMap, null, 2)}</script>`,
|
|
73
|
+
headScripts?.map((scriptUrl) => `<script type="module" src="${scriptUrl}"></script>`).join('\n') || '',
|
|
74
|
+
`</head>`,
|
|
75
|
+
`<body>`,
|
|
76
|
+
bodyScripts?.map((scriptUrl) => `<script type="module" src="${scriptUrl}" async></script>`).join('\n') || '',
|
|
77
|
+
`</body>`,
|
|
78
|
+
`</html>`,
|
|
79
|
+
].join('\n'));
|
|
80
|
+
}
|
|
47
81
|
//# sourceMappingURL=startAppServer.js.map
|
|
@@ -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,oBAAoB,
|
|
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,oBAAoB,EAAkB,MAAM,iCAAiC,CAAC;AACxG,OAAO,EAAE,gBAAgB,EAA+B,MAAM,kCAAkC,CAAC;AAKjG,6DAA6D;AAC7D,MAAM,GAAG,GAAG,CAAC,QAAiB,EAAE,EAAE;IAChC,6CAA6C;AAC/C,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,OAAO,EACP,YAAY,EACZ,SAAS,GAKV;IACC,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC;IAC9E,MAAM,UAAU,GAAG,MAAM,oBAAoB,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACrE,MAAM,qBAAqB,GAAG,SAAS,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACzE,MAAM,eAAe,GAAG,SAAS,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAEnE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,gBAAgB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE;QAChF,iCAAiC;QACjC,GAAG;aACA,GAAG,CAAC,eAAe,EAAE,CAAC,GAAY,EAAE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AG,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,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,5 +1,16 @@
|
|
|
1
1
|
import type { Session } from './types.js';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import type { ApiServer } from './startApiServer.js';
|
|
3
|
+
export interface BundleServer {
|
|
4
|
+
url: string;
|
|
4
5
|
port: number;
|
|
5
|
-
|
|
6
|
+
close: () => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The bundle server handles package requests and returns bundled resources.
|
|
10
|
+
* Resources are bundled on demand and cached locally to avoid re-bundling
|
|
11
|
+
* on each request.
|
|
12
|
+
*/
|
|
13
|
+
export declare function startBundleServer({ session, apiServer, }: {
|
|
14
|
+
session: Session;
|
|
15
|
+
apiServer: ApiServer;
|
|
16
|
+
}): Promise<BundleServer>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { bundlePackage } from '@ms-cloudpack/bundler';
|
|
2
2
|
import { createExpressApp } from '@ms-cloudpack/create-express-app';
|
|
3
|
-
import { readJson,
|
|
3
|
+
import { readJson, writeJson } from '@ms-cloudpack/json-utilities';
|
|
4
4
|
import { isExternalPackage } from '@ms-cloudpack/package-utilities';
|
|
5
5
|
import { isFolder, slash } from '@ms-cloudpack/path-utilities';
|
|
6
6
|
import filenamify from 'filenamify';
|
|
@@ -9,10 +9,19 @@ import hash from 'object-hash';
|
|
|
9
9
|
import os from 'os';
|
|
10
10
|
import path from 'path';
|
|
11
11
|
import { parseRequestInfo } from './parseRequestInfo.js';
|
|
12
|
+
import chokidar from 'chokidar';
|
|
12
13
|
const { ensureDir } = fsExtra;
|
|
13
|
-
const bundleLookupPath = path.join(os.tmpdir(), 'cloudpack-output', 'all-bundles.json');
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
// const bundleLookupPath = path.join(os.tmpdir(), 'cloudpack-output', 'all-bundles.json');
|
|
15
|
+
const log = (...messages) => {
|
|
16
|
+
console.log(`BundleServer:`, ...messages);
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The bundle server handles package requests and returns bundled resources.
|
|
20
|
+
* Resources are bundled on demand and cached locally to avoid re-bundling
|
|
21
|
+
* on each request.
|
|
22
|
+
*/
|
|
23
|
+
export async function startBundleServer({ session, apiServer, }) {
|
|
24
|
+
const createdBundles = {};
|
|
16
25
|
const pendingBundles = {};
|
|
17
26
|
const { resolveMap } = session;
|
|
18
27
|
const { server, port } = await createExpressApp([5500, 5501, 5502, 5503], (app) => {
|
|
@@ -25,10 +34,10 @@ export async function startBundleServer(session) {
|
|
|
25
34
|
? packageEntry?.path
|
|
26
35
|
: packageEntry?.scopedVersions?.[version]?.path;
|
|
27
36
|
const force = req.query.force !== undefined;
|
|
28
|
-
|
|
37
|
+
log(`Request: "${packageName}@${version}${filePath}"`);
|
|
29
38
|
// If the package is missing, invalid arguments.
|
|
30
39
|
if (!requestPath || !packageName) {
|
|
31
|
-
|
|
40
|
+
log(`Response (400): "${packageName}@${version}${filePath}"`);
|
|
32
41
|
res.status(400).send(`Requests must be in the format "/{packageName}@{version}/path/file.ext".`);
|
|
33
42
|
return;
|
|
34
43
|
}
|
|
@@ -36,7 +45,7 @@ export async function startBundleServer(session) {
|
|
|
36
45
|
if (!version) {
|
|
37
46
|
const resolvedPackage = resolveMap[packageName];
|
|
38
47
|
if (!resolvedPackage) {
|
|
39
|
-
|
|
48
|
+
log(`Response (404): Unrecognized package "${packageName}"`);
|
|
40
49
|
res.status(404).send(`Unrecognized package "${packageName}".`);
|
|
41
50
|
return;
|
|
42
51
|
}
|
|
@@ -45,7 +54,7 @@ export async function startBundleServer(session) {
|
|
|
45
54
|
}
|
|
46
55
|
// If it's an unrecognized package, 404.
|
|
47
56
|
if (!packagePath) {
|
|
48
|
-
|
|
57
|
+
log(`BundleServer: Response (404): "${packageName}@${version}${filePath}"`);
|
|
49
58
|
res
|
|
50
59
|
.status(404)
|
|
51
60
|
.send(`The requested package "${packageName}@${version}${filePath}" was not found in the resolve map.`);
|
|
@@ -61,7 +70,7 @@ export async function startBundleServer(session) {
|
|
|
61
70
|
// Derive where the output should be.
|
|
62
71
|
const outputPath = path.join(os.tmpdir(), 'cloudpack-output', `${filenamify(packageName)}-${version}-${bundleId}`);
|
|
63
72
|
let action = createdBundles[bundleId];
|
|
64
|
-
// Clear the created bundle if the folder doesn't exist.
|
|
73
|
+
// Clear the created bundle if we think the bundle was created, but the folder doesn't exist.
|
|
65
74
|
if (action && !isFolder(outputPath)) {
|
|
66
75
|
action = undefined;
|
|
67
76
|
delete createdBundles[bundleId];
|
|
@@ -72,67 +81,183 @@ export async function startBundleServer(session) {
|
|
|
72
81
|
// Either latch on to a pending request or create a new one.
|
|
73
82
|
if (!pendingAction) {
|
|
74
83
|
pendingAction = pendingBundles[bundleId] = new Promise((resolve) => {
|
|
84
|
+
const bundleRequest = {
|
|
85
|
+
id: bundleId,
|
|
86
|
+
packageName,
|
|
87
|
+
version: version,
|
|
88
|
+
packagePath,
|
|
89
|
+
outputPath,
|
|
90
|
+
isExternal,
|
|
91
|
+
};
|
|
75
92
|
// Async helper so that we can await and call resolve.
|
|
76
93
|
async function createBundle() {
|
|
94
|
+
// Start tracking work.
|
|
95
|
+
apiServer.reportStart({
|
|
96
|
+
sessionId: session.id,
|
|
97
|
+
bundleId,
|
|
98
|
+
packageName,
|
|
99
|
+
packageVersion: version,
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
101
|
+
packagePath: packagePath,
|
|
102
|
+
outputPath,
|
|
103
|
+
});
|
|
77
104
|
try {
|
|
78
|
-
|
|
105
|
+
log(`No previous action found, bundling: "${packageName}@${version}"`);
|
|
79
106
|
await ensureDir(outputPath);
|
|
107
|
+
log(`Finished ensureDir: "${packageName}@${version}"`);
|
|
80
108
|
// This check shouldn't be required because we throw above if packagePath is undefined,
|
|
81
109
|
// but TypeScript insists it is necessary.
|
|
82
110
|
if (packagePath) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
packageName: packageName,
|
|
92
|
-
packageVersion: version,
|
|
93
|
-
packagePath,
|
|
94
|
-
outputPath,
|
|
95
|
-
result: bundlerResult.errors?.length == 0 ? 'success' : 'errors',
|
|
96
|
-
errors: bundlerResult.errors,
|
|
97
|
-
warnings: bundlerResult.warnings,
|
|
98
|
-
};
|
|
111
|
+
log(`Trying to bundle "${packageName}@${version}"`);
|
|
112
|
+
await bundle(bundleRequest, force);
|
|
113
|
+
// If this is going to be incremental, start a watcher to re-bundle when source
|
|
114
|
+
// changes.
|
|
115
|
+
if (!isExternal) {
|
|
116
|
+
initializeFileWatcher(session, bundleId, outputPath, bundleRequest, pendingBundles, apiServer);
|
|
117
|
+
log(`Bundle complete: ${outputPath}`);
|
|
118
|
+
}
|
|
99
119
|
}
|
|
100
120
|
}
|
|
101
|
-
|
|
102
|
-
|
|
121
|
+
catch (_) {
|
|
122
|
+
/* no-op */
|
|
103
123
|
}
|
|
104
|
-
return createdBundles[bundleId];
|
|
105
124
|
}
|
|
106
125
|
// Call the async function and tie it in with the promise.
|
|
107
|
-
createBundle().then(
|
|
126
|
+
createBundle().then(() => {
|
|
127
|
+
// If an existing bundle was created, dispose.
|
|
128
|
+
if (createdBundles[bundleId]) {
|
|
129
|
+
createdBundles[bundleId].dispose?.();
|
|
130
|
+
}
|
|
131
|
+
createdBundles[bundleId] = bundleRequest;
|
|
132
|
+
delete pendingBundles[bundleId];
|
|
133
|
+
apiServer.reportEnd({
|
|
134
|
+
sessionId: session.id,
|
|
135
|
+
bundleId,
|
|
136
|
+
resultType: 'bundled',
|
|
137
|
+
result: bundleRequest.result,
|
|
138
|
+
});
|
|
139
|
+
resolve(bundleRequest);
|
|
140
|
+
});
|
|
108
141
|
});
|
|
109
142
|
}
|
|
110
143
|
else {
|
|
111
|
-
|
|
144
|
+
log(`BundleServer: Previous action found, waiting: "${packageName}@${version}${filePath}"`);
|
|
112
145
|
}
|
|
113
146
|
action = await pendingAction;
|
|
114
147
|
}
|
|
115
148
|
else {
|
|
116
|
-
|
|
149
|
+
log(`BundleServer: Bundle cached, returning: "${packageName}@${version}${filePath}"`);
|
|
150
|
+
}
|
|
151
|
+
// If this is a pre-built local package we haven't set up for incremental builds, set it up.
|
|
152
|
+
if (!isExternal && !action.dispose) {
|
|
153
|
+
initializeFileWatcher(session, bundleId, outputPath, action, pendingBundles, apiServer);
|
|
117
154
|
}
|
|
118
|
-
// At this point we should have an action
|
|
119
|
-
if (action.result
|
|
155
|
+
// At this point we should have an action completed.
|
|
156
|
+
if ((action.result?.errors?.length || 0) > 0) {
|
|
120
157
|
res.status(500).type('json').send(action);
|
|
121
158
|
}
|
|
122
159
|
else {
|
|
123
|
-
|
|
160
|
+
log(`BundleServer: Bundle returning: "${packageName}@${version}${filePath}"`);
|
|
124
161
|
// Try to return the result.
|
|
162
|
+
if (isExternal) {
|
|
163
|
+
res.setHeader('Cache-Control', 'public, max-age=31536000');
|
|
164
|
+
}
|
|
125
165
|
res.sendFile(path.join(outputPath, filePath));
|
|
126
166
|
}
|
|
127
167
|
});
|
|
128
168
|
});
|
|
129
|
-
|
|
169
|
+
const url = `http://localhost:${port}`;
|
|
170
|
+
log(`BundleServer: started (${url})`);
|
|
130
171
|
return {
|
|
131
|
-
close: () => {
|
|
132
|
-
|
|
172
|
+
close: async () => {
|
|
173
|
+
// await writeJson(bundleLookupPath, createdBundles);
|
|
133
174
|
server.close();
|
|
134
175
|
},
|
|
135
176
|
port,
|
|
177
|
+
url,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
async function bundle(bundleRequest, force) {
|
|
181
|
+
const { packagePath, outputPath, isExternal } = bundleRequest;
|
|
182
|
+
// Rehydrate the result if not incremental.
|
|
183
|
+
if (isExternal && !force) {
|
|
184
|
+
bundleRequest.result = await readJson(path.join(outputPath, 'result.json'));
|
|
185
|
+
}
|
|
186
|
+
const isCacheUsable = bundleRequest.result?.errors?.length === 0;
|
|
187
|
+
// Only use cached result if it's successful.
|
|
188
|
+
if (!isCacheUsable) {
|
|
189
|
+
bundleRequest.result = await bundlePackage({
|
|
190
|
+
packagePath,
|
|
191
|
+
outputPath,
|
|
192
|
+
outputType: 'library',
|
|
193
|
+
incremental: !isExternal,
|
|
194
|
+
});
|
|
195
|
+
// Write the result to disk.
|
|
196
|
+
if (isExternal) {
|
|
197
|
+
await writeJson(path.join(outputPath, 'result.json'), bundleRequest.result);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
log(`Bundle cached, returning: "${bundleRequest.packageName}@${bundleRequest.version}"`);
|
|
202
|
+
}
|
|
203
|
+
return bundleRequest;
|
|
204
|
+
}
|
|
205
|
+
function initializeFileWatcher(session, bundleId, outputPath, bundleRequest, pendingBundles, apiServer) {
|
|
206
|
+
const { id, packageName, packagePath, version } = bundleRequest;
|
|
207
|
+
let bundleOutput = bundleRequest.result;
|
|
208
|
+
log(`Initializing file watcher for ${packageName}@${version}`);
|
|
209
|
+
// TODO: This is a bit of a hack. We should be able to use the watch API, but it doesn't seem to work.
|
|
210
|
+
const watcher = chokidar.watch(path.join(packagePath, 'src')).on('change', (event) => {
|
|
211
|
+
if (!pendingBundles[id]) {
|
|
212
|
+
bundleRequest.isRebuildRequired = true;
|
|
213
|
+
log(`Detected change "${event}", rebuilding "${packageName}@${version}"`);
|
|
214
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
215
|
+
pendingBundles[id] = new Promise(async (resolveIncremental) => {
|
|
216
|
+
do {
|
|
217
|
+
bundleRequest.isRebuildRequired = false;
|
|
218
|
+
log(`[Start] >> Bundling "${packageName}@${version}"`);
|
|
219
|
+
// Start tracking work.
|
|
220
|
+
apiServer.reportStart({
|
|
221
|
+
sessionId: session.id,
|
|
222
|
+
bundleId,
|
|
223
|
+
packageName,
|
|
224
|
+
packageVersion: version,
|
|
225
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
226
|
+
packagePath: packagePath,
|
|
227
|
+
outputPath,
|
|
228
|
+
});
|
|
229
|
+
if (!bundleOutput?.rebuild) {
|
|
230
|
+
bundleOutput = (await bundle(bundleRequest)).result;
|
|
231
|
+
}
|
|
232
|
+
else if (bundleOutput?.rebuild) {
|
|
233
|
+
bundleOutput = await bundleOutput.rebuild();
|
|
234
|
+
}
|
|
235
|
+
apiServer.reportEnd({
|
|
236
|
+
sessionId: session.id,
|
|
237
|
+
bundleId,
|
|
238
|
+
resultType: 'bundled',
|
|
239
|
+
result: bundleOutput,
|
|
240
|
+
});
|
|
241
|
+
log(`[ End ] << Bundled "${packageName}@${version}" (${bundleOutput?.outputFiles?.length || 0} file(s), ${bundleOutput?.errors?.length || 0} errors)`);
|
|
242
|
+
} while (bundleRequest.isRebuildRequired);
|
|
243
|
+
delete pendingBundles[id];
|
|
244
|
+
if (!bundleOutput?.errors?.length) {
|
|
245
|
+
log(`Notifying rebuild: ${packageName}@${version}`);
|
|
246
|
+
apiServer.notifyReload();
|
|
247
|
+
}
|
|
248
|
+
resolveIncremental(bundleRequest);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
// A change was made while we were bundling. We need to wait for the current
|
|
253
|
+
// bundle to finish before we can rebuild.
|
|
254
|
+
bundleRequest.isRebuildRequired = true;
|
|
255
|
+
log(`Detected change "${event}", already waiting for "${packageName}@${version}"`);
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
bundleRequest.dispose = () => {
|
|
259
|
+
watcher.close();
|
|
260
|
+
bundleOutput?.dispose?.();
|
|
136
261
|
};
|
|
137
262
|
}
|
|
138
263
|
//# sourceMappingURL=startBundleServer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startBundleServer.js","sourceRoot":"","sources":["../../../src/commands/start/startBundleServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"startBundleServer.js","sourceRoot":"","sources":["../../../src/commands/start/startBundleServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAgB,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AA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M,EAAE,MAAM,IAAI,CAClC,UAAU,CACX,CAAC;iBACH,QAAQ,aAAa,CAAC,iBAAiB,EAAE;gBAE1C,OAAO,cAAc,CAAC,EAAE,CAAC,CAAC;gBAC1B,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE;oBACjC,GAAG,CAAC,sBAAsB,WAAW,IAAI,OAAO,EAAE,CAAC,CAAC;oBACpD,SAAS,CAAC,YAAY,EAAE,CAAC;iBAC1B;gBAED,kBAAkB,CAAC,aAAa,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,4EAA4E;YAC5E,0CAA0C;YAC1C,aAAa,CAAC,iBAAiB,GAAG,IAAI,CAAC;YAEvC,GAAG,CAAC,oBAAoB,KAAK,2BAA2B,WAAW,IAAI,OAAO,GAAG,CAAC,CAAC;SACpF;IACH,CAAC,CAAC,CAAC;IAEH,aAAa,CAAC,OAAO,GAAG,GAAG,EAAE;QAC3B,OAAO,CAAC,KAAK,EAAE,CAAC;QAEhB,YAAY,EAAE,OAAO,EAAE,EAAE,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC"}
|
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.3.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",
|
|
@@ -16,11 +16,14 @@
|
|
|
16
16
|
"cloudpack": "./lib/cloudpack.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@ms-cloudpack/bundler": "^0.
|
|
19
|
+
"@ms-cloudpack/bundler": "^0.3.0",
|
|
20
20
|
"@ms-cloudpack/create-express-app": "^0.1.0",
|
|
21
|
+
"@ms-cloudpack/data-bus": "^0.0.2",
|
|
21
22
|
"@ms-cloudpack/json-utilities": "^0.0.3",
|
|
22
|
-
"@ms-cloudpack/
|
|
23
|
+
"@ms-cloudpack/overlay": "^0.0.2",
|
|
24
|
+
"@ms-cloudpack/package-utilities": "^0.6.0",
|
|
23
25
|
"@ms-cloudpack/path-utilities": "^0.3.1",
|
|
26
|
+
"chokidar": "^3.5.3",
|
|
24
27
|
"commander": "^9.1.0",
|
|
25
28
|
"filenamify": "^5.1.0",
|
|
26
29
|
"fs-extra": "^10.1.0",
|
|
@@ -33,6 +36,7 @@
|
|
|
33
36
|
"@ms-cloudpack/bundler-types": "*",
|
|
34
37
|
"@ms-cloudpack/eslint-config-base": "*",
|
|
35
38
|
"@ms-cloudpack/scripts": "*",
|
|
39
|
+
"@types/chokidar": "^2.1.3",
|
|
36
40
|
"@types/fs-extra": "9.0.13",
|
|
37
41
|
"@types/glob": "7.2.0",
|
|
38
42
|
"@types/object-hash": "2.2.1",
|