@ms-cloudpack/cli 0.45.2 → 0.45.3
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/lib/commands/bundle/bundle.d.ts.map +1 -1
- package/lib/commands/bundle/bundle.js +7 -4
- package/lib/commands/bundle/bundle.js.map +1 -1
- package/lib/commands/init/bundleAndGetImports.d.ts +2 -2
- package/lib/commands/init/bundleAndGetImports.d.ts.map +1 -1
- package/lib/commands/init/bundleAndGetImports.js.map +1 -1
- package/lib/commands/init/init.d.ts +2 -1
- package/lib/commands/init/init.d.ts.map +1 -1
- package/lib/commands/init/init.js +10 -7
- package/lib/commands/init/init.js.map +1 -1
- package/lib/commands/start/appServer/getDefaultHtmlResponse.d.ts +1 -2
- package/lib/commands/start/appServer/getDefaultHtmlResponse.d.ts.map +1 -1
- package/lib/commands/start/appServer/getDefaultHtmlResponse.js.map +1 -1
- package/lib/commands/start/appServer/getHtmlResponse.d.ts +1 -2
- package/lib/commands/start/appServer/getHtmlResponse.d.ts.map +1 -1
- package/lib/commands/start/appServer/getHtmlResponse.js.map +1 -1
- package/lib/commands/start/start.d.ts.map +1 -1
- package/lib/commands/start/start.js +2 -3
- package/lib/commands/start/start.js.map +1 -1
- package/lib/commands/sync/sync.d.ts.map +1 -1
- package/lib/commands/sync/sync.js +15 -7
- package/lib/commands/sync/sync.js.map +1 -1
- package/lib/common/createPartialApiContext.d.ts +12 -2
- package/lib/common/createPartialApiContext.d.ts.map +1 -1
- package/lib/common/createPartialApiContext.js +11 -12
- package/lib/common/createPartialApiContext.js.map +1 -1
- package/lib/initTelemetry.d.ts +1 -9
- package/lib/initTelemetry.d.ts.map +1 -1
- package/lib/initTelemetry.js +4 -18
- package/lib/initTelemetry.js.map +1 -1
- package/package.json +5 -5
- package/lib/types/CreateHtmlFunction.d.ts +0 -7
- package/lib/types/CreateHtmlFunction.d.ts.map +0 -1
- package/lib/types/CreateHtmlFunction.js +0 -2
- package/lib/types/CreateHtmlFunction.js.map +0 -1
- package/lib/types/CreateHtmlOptions.d.ts +0 -21
- package/lib/types/CreateHtmlOptions.d.ts.map +0 -1
- package/lib/types/CreateHtmlOptions.js +0 -2
- package/lib/types/CreateHtmlOptions.js.map +0 -1
- package/lib/types/CreateHtmlResult.d.ts +0 -15
- package/lib/types/CreateHtmlResult.d.ts.map +0 -1
- package/lib/types/CreateHtmlResult.js +0 -2
- package/lib/types/CreateHtmlResult.js.map +0 -1
- package/lib/types/CreateHtmlScript.d.ts +0 -8
- package/lib/types/CreateHtmlScript.d.ts.map +0 -1
- package/lib/types/CreateHtmlScript.js +0 -2
- package/lib/types/CreateHtmlScript.js.map +0 -1
- package/lib/types/Watcher.d.ts +0 -5
- package/lib/types/Watcher.d.ts.map +0 -1
- package/lib/types/Watcher.js +0 -2
- package/lib/types/Watcher.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAM9D,wBAAsB,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,iBA8BxE"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { setupReporting } from '../../setupReporting.js';
|
|
2
2
|
import { ensurePackageBundled } from '@ms-cloudpack/api-server/apis';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
import { stopTelemetry } from '../../initTelemetry.js';
|
|
5
4
|
import { createPartialApiContext } from '../../common/createPartialApiContext.js';
|
|
6
5
|
export async function bundle(options, context) {
|
|
7
6
|
const { bundler: bundlerType, outdir = 'dist/browser-esm', disableSourceMaps } = options;
|
|
8
7
|
const { reporter, appPath: packagePath } = context;
|
|
9
|
-
await setupReporting(context);
|
|
10
|
-
const ctx = await createPartialApiContext(
|
|
8
|
+
const telemetryClient = await setupReporting(context);
|
|
9
|
+
const ctx = await createPartialApiContext({
|
|
10
|
+
...context,
|
|
11
|
+
telemetryClient,
|
|
12
|
+
items: ['packages', 'watcher', 'session', 'taskRunner', 'bus'],
|
|
13
|
+
});
|
|
11
14
|
const definition = await ctx.packages.get(packagePath);
|
|
12
15
|
const { result } = await ensurePackageBundled({
|
|
13
16
|
input: {
|
|
@@ -20,7 +23,7 @@ export async function bundle(options, context) {
|
|
|
20
23
|
ctx,
|
|
21
24
|
});
|
|
22
25
|
await ctx.dispose();
|
|
23
|
-
await
|
|
26
|
+
await telemetryClient.shutdown();
|
|
24
27
|
reporter.complete();
|
|
25
28
|
process.exit(result?.errors?.length === 0 ? 0 : 1);
|
|
26
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../../src/commands/bundle/bundle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../../src/commands/bundle/bundle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAAsB,EAAE,OAAoB;IACvE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;IACzF,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAEnD,MAAM,eAAe,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;IAEtD,MAAM,GAAG,GAAG,MAAM,uBAAuB,CAAC;QACxC,GAAG,OAAO;QACV,eAAe;QACf,KAAK,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC;KAC/D,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEvD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,oBAAoB,CAAC;QAC5C,KAAK,EAAE;YACL,IAAI,EAAE,UAAU,EAAE,IAAI,IAAI,WAAW;YACrC,OAAO,EAAE,UAAU,EAAE,OAAO,IAAI,OAAO;YACvC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC;YAC7C,WAAW;YACX,iBAAiB;SAClB;QACD,GAAG;KACJ,CAAC,CAAC;IAEH,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;IACpB,MAAM,eAAe,CAAC,QAAQ,EAAE,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAEpB,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,uBAAuB","sourcesContent":["import type { BundleOptions } from './types/BundleOptions.js';\nimport type { TaskContext } from '../../types/TaskContext.js';\nimport { setupReporting } from '../../setupReporting.js';\nimport { ensurePackageBundled } from '@ms-cloudpack/api-server/apis';\nimport path from 'path';\nimport { createPartialApiContext } from '../../common/createPartialApiContext.js';\n\nexport async function bundle(options: BundleOptions, context: TaskContext) {\n const { bundler: bundlerType, outdir = 'dist/browser-esm', disableSourceMaps } = options;\n const { reporter, appPath: packagePath } = context;\n\n const telemetryClient = await setupReporting(context);\n\n const ctx = await createPartialApiContext({\n ...context,\n telemetryClient,\n items: ['packages', 'watcher', 'session', 'taskRunner', 'bus'],\n });\n\n const definition = await ctx.packages.get(packagePath);\n\n const { result } = await ensurePackageBundled({\n input: {\n name: definition?.name ?? '<unknown>',\n version: definition?.version ?? '0.0.0',\n outputPath: path.resolve(packagePath, outdir),\n bundlerType,\n disableSourceMaps,\n },\n ctx,\n });\n\n await ctx.dispose();\n await telemetryClient.shutdown();\n reporter.complete();\n\n process.exit(result?.errors?.length === 0 ? 0 : 1);\n}\n\n// cspell:ignore outdir\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PackageJson, PackageDefinitionsCache, BundleMessage } from '@ms-cloudpack/bundler-types';
|
|
2
2
|
import { type TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
3
3
|
import type { CloudpackConfig } from '@ms-cloudpack/config';
|
|
4
|
-
import {
|
|
4
|
+
import { ensurePackageBundled } from '@ms-cloudpack/api-server/apis';
|
|
5
5
|
/**
|
|
6
6
|
* Bundle the package and return the imports it depends on.
|
|
7
7
|
*/
|
|
@@ -11,7 +11,7 @@ export declare function bundleAndGetImports(options: {
|
|
|
11
11
|
reporter: TaskReporter;
|
|
12
12
|
packagePath: string;
|
|
13
13
|
definition: PackageJson;
|
|
14
|
-
ctx:
|
|
14
|
+
ctx: Parameters<typeof ensurePackageBundled>[0]['ctx'];
|
|
15
15
|
}): Promise<{
|
|
16
16
|
warnings: BundleMessage[];
|
|
17
17
|
errors: BundleMessage[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundleAndGetImports.d.ts","sourceRoot":"","sources":["../../../src/commands/init/bundleAndGetImports.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACvG,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AACnF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,
|
|
1
|
+
{"version":3,"file":"bundleAndGetImports.d.ts","sourceRoot":"","sources":["../../../src/commands/init/bundleAndGetImports.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACvG,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AACnF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE;IACjD,QAAQ,EAAE,uBAAuB,CAAC;IAClC,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,YAAY,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,WAAW,CAAC;IACxB,GAAG,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;CACxD,GAAG,OAAO,CAAC;IACV,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,8DAA8D;IAC9D,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;CACnC,CAAC,CA6DD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundleAndGetImports.js","sourceRoot":"","sources":["../../../src/commands/init/bundleAndGetImports.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AAG,EAAuB;KACnD,CAAC;AACJ,CAAC","sourcesContent":["import path from 'path';\nimport { getEntriesMapFromPackage } from '@ms-cloudpack/bundler';\nimport { getBundleDetails, findImports } from '@ms-cloudpack/api-server';\nimport type { PackageJson, PackageDefinitionsCache, BundleMessage } from '@ms-cloudpack/bundler-types';\nimport { type TaskReporter, formatPackageName } from '@ms-cloudpack/task-reporter';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\nimport { ensurePackageBundled } from '@ms-cloudpack/api-server/apis';\n\n/**\n * Bundle the package and return the imports it depends on.\n */\nexport async function bundleAndGetImports(options: {\n packages: PackageDefinitionsCache;\n config: CloudpackConfig;\n reporter: TaskReporter;\n packagePath: string;\n definition: PackageJson;\n ctx: Parameters<typeof ensurePackageBundled>[0]['ctx'];\n}): Promise<{\n warnings: BundleMessage[];\n errors: BundleMessage[];\n /** Map from package name to set of required relative paths */\n imports: Map<string, Set<string>>;\n}> {\n const { packagePath, definition, packages, reporter, ctx } = options;\n const { outputLocation, isExternal } = await getBundleDetails({ packagePath }, { packages });\n const outputPath = outputLocation.path;\n\n if (!isExternal && !definition.exports) {\n console.debug(`${path.join(packagePath, 'package.json')} does not have an \"exports\" field.`);\n }\n\n const { name, version } = definition;\n\n if (!name || !version) {\n throw new Error(`Package at \"${packagePath}\" does not have a name or version.`);\n }\n\n // Determine entries.\n const entriesMap = await getEntriesMapFromPackage({ inputPath: packagePath }, { packages });\n\n if (!Object.keys(entriesMap).length) {\n return {\n imports: new Map<string, Set<string>>(),\n errors: [],\n warnings: [\n {\n text: `No valid entry points were found when evaluating ${path.join(\n packagePath,\n 'package.json',\n )}. Check that has an exports, main, or module entry and the referenced files exist.`,\n },\n ],\n };\n }\n\n const { result } = await ensurePackageBundled({\n input: {\n name,\n version,\n },\n ctx,\n });\n\n // For each outputFile, find all imports.\n let imports: Map<string, Set<string>> | undefined;\n\n await reporter.runTask(`Evaluate ${formatPackageName(definition)}`, async () => {\n imports = new Map(\n Object.entries(\n (await findImports(result?.outputFiles?.map((file) => path.resolve(outputPath, file.outputPath)) || [])) || {},\n ),\n );\n\n return {\n status: 'complete',\n };\n });\n\n return {\n warnings: result?.warnings || [],\n errors: result?.errors || [],\n imports: imports || new Map<string, Set<string>>(),\n };\n}\n"]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { TaskContext } from '../../types/TaskContext.js';
|
|
2
2
|
import type { InitOptions } from './types/InitOptions.js';
|
|
3
3
|
import type { InitSummary } from './types/InitSummary.js';
|
|
4
|
+
import type { TelemetryClient } from '@ms-cloudpack/telemetry';
|
|
4
5
|
/** Given the path, updates the Cloudpack config with overrides and project settings. */
|
|
5
6
|
export declare function init(options: InitOptions, context: TaskContext): Promise<void>;
|
|
6
7
|
/**
|
|
7
8
|
* Actual init operation (minus the completion logging).
|
|
8
9
|
* Exported for testing only.
|
|
9
10
|
*/
|
|
10
|
-
export declare function initInternal(options: InitOptions, context: TaskContext): Promise<InitSummary>;
|
|
11
|
+
export declare function initInternal(options: InitOptions, context: TaskContext, telemetryClient: TelemetryClient): Promise<InitSummary>;
|
|
11
12
|
//# sourceMappingURL=init.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAS1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,wFAAwF;AACxF,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBpF;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,WAAW,CAAC,CAmHtB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createPartialApiContext } from '../../common/createPartialApiContext.js';
|
|
2
2
|
import { writeGeneratedConfig } from '@ms-cloudpack/config';
|
|
3
|
-
import { rootSpan, stopTelemetry } from '../../initTelemetry.js';
|
|
4
3
|
import { setupReporting } from '../../setupReporting.js';
|
|
5
4
|
import { bundleAndGetImports } from './bundleAndGetImports.js';
|
|
6
5
|
import { InitSummaryData } from './InitSummaryData.js';
|
|
@@ -10,9 +9,9 @@ import { formatInitSummary } from './formatInitSummary.js';
|
|
|
10
9
|
export async function init(options, context) {
|
|
11
10
|
const { reporter } = context;
|
|
12
11
|
let hasErrors = false;
|
|
13
|
-
await setupReporting(context);
|
|
12
|
+
const telemetryClient = await setupReporting(context);
|
|
14
13
|
try {
|
|
15
|
-
const summary = await initInternal(options, context);
|
|
14
|
+
const summary = await initInternal(options, context, telemetryClient);
|
|
16
15
|
reporter.complete(formatInitSummary(summary, options));
|
|
17
16
|
hasErrors = summary.totalErrors > 0;
|
|
18
17
|
}
|
|
@@ -20,17 +19,21 @@ export async function init(options, context) {
|
|
|
20
19
|
reporter.complete(`Unexpected error: ${error.stack || error}`);
|
|
21
20
|
hasErrors = true;
|
|
22
21
|
}
|
|
23
|
-
await
|
|
22
|
+
await telemetryClient.shutdown();
|
|
24
23
|
process.exit(hasErrors ? 1 : 0);
|
|
25
24
|
}
|
|
26
25
|
/**
|
|
27
26
|
* Actual init operation (minus the completion logging).
|
|
28
27
|
* Exported for testing only.
|
|
29
28
|
*/
|
|
30
|
-
export async function initInternal(options, context) {
|
|
29
|
+
export async function initInternal(options, context, telemetryClient) {
|
|
31
30
|
const { appPath, reporter } = context;
|
|
32
31
|
const summaryData = new InitSummaryData();
|
|
33
|
-
const ctx = await createPartialApiContext(
|
|
32
|
+
const ctx = await createPartialApiContext({
|
|
33
|
+
...context,
|
|
34
|
+
telemetryClient,
|
|
35
|
+
items: ['bus', 'taskRunner', 'watcher', 'packages', 'session'],
|
|
36
|
+
});
|
|
34
37
|
const { packages, session } = ctx;
|
|
35
38
|
const { resolveMap, config } = session;
|
|
36
39
|
try {
|
|
@@ -103,7 +106,7 @@ export async function initInternal(options, context) {
|
|
|
103
106
|
summaryData.recordGeneratedChanges(changes);
|
|
104
107
|
}
|
|
105
108
|
if (options.check && (changes.length || evalErrors.length)) {
|
|
106
|
-
rootSpan
|
|
109
|
+
telemetryClient.rootSpan.addEvent('INIT_CHECK_FAILED', {
|
|
107
110
|
reason: changes.length ? 'Config needs to be updated.' : evalErrors,
|
|
108
111
|
});
|
|
109
112
|
return summaryData.summarize();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE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C,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,UAAU;qBACpE,CAAC,CAAC;oBAEH,OAAO,WAAW,CAAC,SAAS,EAAE,CAAC;iBAChC;gBAED,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;aACpC;SACF;QAED,IAAI,gBAAgB,IAAI,eAAe,CAAC,eAAe,EAAE,MAAM,EAAE;YAC/D,MAAM,oBAAoB,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;SACtD;KACF;YAAS;QACR,MAAM,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;KACvB;IAED,OAAO,WAAW,CAAC,SAAS,EAAE,CAAC;AACjC,CAAC","sourcesContent":["import type { TaskContext } from '../../types/TaskContext.js';\nimport type { InitOptions } from './types/InitOptions.js';\nimport type { InitSummary } from './types/InitSummary.js';\n\nimport { createPartialApiContext } from '../../common/createPartialApiContext.js';\nimport { writeGeneratedConfig } from '@ms-cloudpack/config';\nimport { setupReporting } from '../../setupReporting.js';\nimport { bundleAndGetImports } from './bundleAndGetImports.js';\nimport { InitSummaryData } from './InitSummaryData.js';\nimport { evaluateImportsForOverrides } from './evaluateImportsForOverrides.js';\nimport { formatInitSummary } from './formatInitSummary.js';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\n\n/** Given the path, updates the Cloudpack config with overrides and project settings. */\nexport async function init(options: InitOptions, context: TaskContext): Promise<void> {\n const { reporter } = context;\n let hasErrors = false;\n\n const telemetryClient = await setupReporting(context);\n\n try {\n const summary = await initInternal(options, context, telemetryClient);\n\n reporter.complete(formatInitSummary(summary, options));\n hasErrors = summary.totalErrors > 0;\n } catch (error) {\n reporter.complete(`Unexpected error: ${(error as Error).stack || error}`);\n hasErrors = true;\n }\n\n await telemetryClient.shutdown();\n\n process.exit(hasErrors ? 1 : 0);\n}\n\n/**\n * Actual init operation (minus the completion logging).\n * Exported for testing only.\n */\nexport async function initInternal(\n options: InitOptions,\n context: TaskContext,\n telemetryClient: TelemetryClient,\n): Promise<InitSummary> {\n const { appPath, reporter } = context;\n const summaryData = new InitSummaryData();\n const ctx = await createPartialApiContext({\n ...context,\n telemetryClient,\n items: ['bus', 'taskRunner', 'watcher', 'packages', 'session'],\n });\n const { packages, session } = ctx;\n const { resolveMap, config } = session;\n\n try {\n if (options.check && options.reset) {\n throw Error('Cannot use --check and --reset together.');\n }\n\n // If --reset is specified we ignore generated config.\n if (options.reset) {\n config.generated = {};\n }\n\n const generatedConfig = config.generated;\n\n generatedConfig.packageSettings ??= [];\n\n const packagePathsToEvaluate = new Set<string>([appPath]);\n const evaluatedPackages = new Set<string>();\n let totalChangeCount = 0;\n\n while (packagePathsToEvaluate.size) {\n const packagePath = packagePathsToEvaluate.values().next().value as string;\n\n packagePathsToEvaluate.delete(packagePath);\n\n // Skip already-visited packages.\n if (!packagePath || evaluatedPackages.has(packagePath)) {\n continue;\n }\n\n evaluatedPackages.add(packagePath);\n\n const definition = await packages.get(packagePath, { refresh: true });\n\n if (!definition) {\n // This is very weird and probably won't happen.\n console.error(`Skipping ${packagePath} evaluation because the package.json was not found or not readable.`);\n continue;\n }\n\n // Bundle the package and find the imports it depends on.\n const { errors, warnings, imports } = await bundleAndGetImports({\n packagePath,\n definition,\n packages,\n reporter,\n config,\n ctx,\n });\n\n // Record the results for the summary.\n const resultIdentifier = {\n name: definition.name || '',\n version: definition.version || '',\n path: packagePath,\n };\n\n summaryData.recordResult({\n ...resultIdentifier,\n errors,\n warnings,\n });\n\n // If no errors came from the bundle attempt, move on to evaluating the imports.\n if (errors.length === 0) {\n // Given the package imports, find the missing exports maps and update packageOverrides.\n const { changes, errors: evalErrors } = await evaluateImportsForOverrides({\n definition,\n packagePath,\n packages,\n packagePathsToEvaluate,\n evaluatedPackages,\n imports,\n generatedConfig,\n resolveMap,\n });\n\n if (evalErrors.length) {\n summaryData.recordResult({\n ...resultIdentifier,\n errors: evalErrors.map((text) => ({ text })),\n });\n } else {\n summaryData.recordGeneratedChanges(changes);\n }\n\n if (options.check && (changes.length || evalErrors.length)) {\n telemetryClient.rootSpan.addEvent('INIT_CHECK_FAILED', {\n reason: changes.length ? 'Config needs to be updated.' : evalErrors,\n });\n\n return summaryData.summarize();\n }\n\n totalChangeCount += changes.length;\n }\n }\n\n if (totalChangeCount && generatedConfig.packageSettings?.length) {\n await writeGeneratedConfig(generatedConfig, appPath);\n }\n } finally {\n await ctx.dispose?.();\n }\n\n return summaryData.summarize();\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { CreateHtmlResult } from '
|
|
2
|
-
import type { CreateHtmlOptions } from '../../../types/CreateHtmlOptions.js';
|
|
1
|
+
import type { CreateHtmlResult, CreateHtmlOptions } from '@ms-cloudpack/api-server';
|
|
3
2
|
/**
|
|
4
3
|
* Return the default HTML response.
|
|
5
4
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDefaultHtmlResponse.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/appServer/getDefaultHtmlResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"getDefaultHtmlResponse.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/appServer/getDefaultHtmlResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAEpF;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,UAAU,EAAE,EAAE,iBAAiB,GAAG,gBAAgB,CAc1F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDefaultHtmlResponse.js","sourceRoot":"","sources":["../../../../src/commands/start/appServer/getDefaultHtmlResponse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDefaultHtmlResponse.js","sourceRoot":"","sources":["../../../../src/commands/start/appServer/getDefaultHtmlResponse.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,EAAE,UAAU,EAAqB;IACtE,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC;IAE5B,OAAO;QACL,iBAAiB;QACjB,kBAAkB;QAClB,QAAQ;QACR,YAAY,IAAI,UAAU;QAC1B,SAAS;QACT,QAAQ;QACR,uBAAuB;QACvB,SAAS;QACT,SAAS;KACV,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC","sourcesContent":["import type { CreateHtmlResult, CreateHtmlOptions } from '@ms-cloudpack/api-server';\n\n/**\n * Return the default HTML response.\n */\nexport function getDefaultHtmlResponse({ definition }: CreateHtmlOptions): CreateHtmlResult {\n const { name } = definition;\n\n return [\n `<!DOCTYPE html>`,\n `<html lang=\"en\">`,\n `<head>`,\n ` <title>${name}</title>`,\n `</head>`,\n `<body>`,\n `<div id=\"root\"></div>`,\n `</body>`,\n `</html>`,\n ].join('\\n');\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { CreateHtmlResult, CustomHtmlResult } from '
|
|
2
|
-
import type { CreateHtmlOptions } from '../../../types/CreateHtmlOptions.js';
|
|
1
|
+
import type { CreateHtmlResult, CustomHtmlResult, CreateHtmlOptions } from '@ms-cloudpack/api-server';
|
|
3
2
|
/**
|
|
4
3
|
* Get the HTML response for the given route. If the route has a custom render script, use that.
|
|
5
4
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getHtmlResponse.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/appServer/getHtmlResponse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getHtmlResponse.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/appServer/getHtmlResponse.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAUlC;;GAEG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,OAAO,CAAC,gBAAgB,EAAE,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAyF/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getHtmlResponse.js","sourceRoot":"","sources":["../../../../src/commands/start/appServer/getHtmlResponse.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"getHtmlResponse.js","sourceRoot":"","sources":["../../../../src/commands/start/appServer/getHtmlResponse.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAQpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,SAAS,kBAAkB,CAAC,MAAwB;IAClD,MAAM,YAAY,GAAG,MAA0B,CAAC;IAChD,OAAO,CAAC,YAAY,CAAC,IAAI,KAAK,aAAa,IAAI,YAAY,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC;AACvG,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAA0B;IAE1B,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAC9E,IAAI,UAAU,GAAuB,sBAAsB,CAAC;IAE5D,IAAI,KAAK,CAAC,YAAY,EAAE;QACtB,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;QAC3E,IAAI,sBAAsB,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;Q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;;GAEG;AACH,SAAS,SAAS,CAAC,aAA0B,EAAE,GAAuB;IACpE,IAAI,GAAG,EAAE;QACP,MAAM,MAAM,GAAG,aAAa,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAEnE,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAC;QACvB,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC;QACjB,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;KACnC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,UAAkB;IAChC,yDAAyD;IACzD,OAAO,UAAU,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;AAC/D,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,OAA0B;IACtD,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAC1B,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,IAAI,KAAK,CAAC,YAAY,EAAE;QACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;QAE3E,IAAI;YACF,IAAI,GAAG,CAAC,MAAM,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;SAC5D;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,+BAA+B,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;SAC/D;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import path from 'path';\nimport { pathToFileURL } from 'url';\nimport type {\n CreateHtmlScript,\n CreateHtmlFunction,\n CreateHtmlResult,\n CustomHtmlResult,\n CreateHtmlOptions,\n} from '@ms-cloudpack/api-server';\nimport { getDefaultHtmlResponse } from './getDefaultHtmlResponse.js';\nimport { JSDOM } from 'jsdom';\nimport fsPromises from 'fs/promises';\n\nfunction isCustomHtmlResult(result: CreateHtmlResult): result is CustomHtmlResult {\n const customResult = result as CustomHtmlResult;\n return (customResult.type === 'static-html' || customResult.type === 'js') && !!customResult.content;\n}\n\n/**\n * Get the HTML response for the given route. If the route has a custom render script, use that.\n */\nexport async function getHtmlResponse(\n options: CreateHtmlOptions,\n): Promise<Exclude<CreateHtmlResult, string | CustomHtmlResult>> {\n const { route, session, overlayScript, entryScript, inlineScripts } = options;\n let createHtml: CreateHtmlFunction = getDefaultHtmlResponse;\n\n if (route.renderScript) {\n const renderScriptPath = path.resolve(session.appPath, route.renderScript);\n let cacheBreakerQueryParam = `?t=${Date.now()}`;\n\n try {\n const { mtime } = await fsPromises.stat(path.resolve(session.appPath, route.renderScript));\n\n cacheBreakerQueryParam = `?t=${mtime.getTime()}`;\n } catch {\n /* no-op */\n }\n\n if (isHtml(renderScriptPath)) {\n createHtml = readStaticHtml;\n } else {\n // Get the html factory function from a script default export.\n const renderScriptUrl = pathToFileURL(renderScriptPath).toString();\n\n // Note: because there isn't a way to purge the require cache, we need to add a cache breaker query param to the\n // script path to ensure we get the latest version of the script. This could be improved by using the git hash of\n // the file if it exists, or a hash of the content, or even the timestamp of the file.\n try {\n createHtml = ((await import(renderScriptUrl + cacheBreakerQueryParam)) as CreateHtmlScript).default;\n } catch (e) {\n console.error(`Error importing render script at \"${renderScriptUrl}\":`, e);\n }\n }\n\n if (!createHtml) {\n console.error(`The render script at \"${renderScriptPath}\" does not export a default function.`);\n }\n }\n\n let html = '';\n let resultType = 'html';\n let statusCode = 200;\n\n const htmlResult = await createHtml(options);\n\n if (typeof htmlResult === 'string') {\n html = htmlResult;\n } else if (isCustomHtmlResult(htmlResult)) {\n html = htmlResult.content;\n resultType = htmlResult.type;\n } else {\n html = htmlResult.html;\n statusCode = htmlResult.statusCode;\n }\n\n if (resultType === 'html') {\n try {\n const htmlDocument = new JSDOM(html);\n const { document } = htmlDocument.window;\n\n // inject the import map.\n if (entryScript || overlayScript) {\n const script = document.createElement('script');\n script.type = 'importmap';\n script.innerHTML = JSON.stringify(session.getImportMap(), null, 2);\n document.head.prepend(script);\n }\n\n for (const inlineScript of inlineScripts) {\n const script = document.createElement('script');\n script.type = 'module';\n script.innerHTML = inlineScript;\n document.head.appendChild(script);\n }\n\n // inject the overlay script.\n addScript(document.head, overlayScript);\n\n // inject the entry script.\n addScript(document.head, entryScript);\n\n html = htmlDocument.serialize();\n } catch (e) {\n console.error(`Error parsing html response for rendering route \"${route.match}\"`, e);\n }\n }\n\n return {\n html,\n statusCode,\n };\n}\n\n/**\n * Helper function to add a script to the document.\n */\nfunction addScript(parentElement: HTMLElement, url: string | undefined) {\n if (url) {\n const script = parentElement.ownerDocument.createElement('script');\n\n script.type = 'module';\n script.src = url;\n parentElement.appendChild(script);\n }\n}\n\nfunction isHtml(scriptPath: string): boolean {\n // path has an .htm or .html extension; case insensitive.\n return scriptPath.toLowerCase().match(/\\.htm(l)?$/) !== null;\n}\n\nasync function readStaticHtml(options: CreateHtmlOptions): Promise<string> {\n const { route } = options;\n let html = '';\n\n if (route.renderScript) {\n const htmlPath = path.resolve(options.session.appPath, route.renderScript);\n\n try {\n html = (await fsPromises.readFile(htmlPath, 'utf8')) || '';\n } catch (e) {\n console.error(`Error reading HTML file at \"${htmlPath}\".`, e);\n }\n }\n\n return html;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAQ5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAO9D,wDAAwD;AACxD,wBAAsB,WAAW,kBAKhC;AAqBD;;GAEG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,iBAuItE"}
|
|
@@ -5,7 +5,6 @@ import { createSession } from '../../common/createSession.js';
|
|
|
5
5
|
import { openBrowser } from './openBrowser.js';
|
|
6
6
|
import { createPackageDefinitions, readConfig } from '@ms-cloudpack/config';
|
|
7
7
|
import { PerfMarkerCliEntry, PerfMeasurementOpenBrowser } from '../../performance/markers.js';
|
|
8
|
-
import { stopTelemetry, rootSpan } from '../../initTelemetry.js';
|
|
9
8
|
import { createBundleRequestForPackage, createBundleTask } from '@ms-cloudpack/api-server';
|
|
10
9
|
import { mergeFeatures } from './mergeFeatures.js';
|
|
11
10
|
import { yellow } from '@ms-cloudpack/task-reporter';
|
|
@@ -78,7 +77,7 @@ export async function start(options, context) {
|
|
|
78
77
|
// Start api server for tracking status and handling remote requests.
|
|
79
78
|
const apiServer = await startApiServer({
|
|
80
79
|
session,
|
|
81
|
-
|
|
80
|
+
telemetryClient,
|
|
82
81
|
reporter,
|
|
83
82
|
packages,
|
|
84
83
|
});
|
|
@@ -115,7 +114,7 @@ export async function start(options, context) {
|
|
|
115
114
|
// Complete the reporting and list pending tasks as aborted.
|
|
116
115
|
reporter.complete();
|
|
117
116
|
// Flush and close telemetry.
|
|
118
|
-
await
|
|
117
|
+
await telemetryClient.shutdown();
|
|
119
118
|
};
|
|
120
119
|
cleanupFunctions.push(cleanup);
|
|
121
120
|
// Setup cleanup and close things on completion.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,M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KAAK,CAAC,cAAc,CAAC,CAAC;gBAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACjB;YAED,6FAA6F;YAC7F,OAAO,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,oBAAoB;QACpB,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC;QAE1B,WAAW,CAAC,OAAO,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;QACpE,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YAC7B,sEAAsE;YACtE,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,CAAC,CAAC;YAC1D,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;KACJ;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC;AAED,wBAAwB","sourcesContent":["import { writeJson } from '@ms-cloudpack/json-utilities';\nimport { findResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport path from 'path';\nimport { createSession } from '../../common/createSession.js';\nimport { openBrowser } from './openBrowser.js';\nimport type { Session } from '@ms-cloudpack/api-server';\nimport type { StartOptions } from './types/StartOptions.js';\nimport { createPackageDefinitions, readConfig } from '@ms-cloudpack/config';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\nimport { PerfMarkerCliEntry, PerfMeasurementOpenBrowser } from '../../performance/markers.js';\nimport { stopTelemetry, rootSpan } from '../../initTelemetry.js';\nimport { createBundleRequestForPackage, createBundleTask } from '@ms-cloudpack/api-server';\nimport { mergeFeatures } from './mergeFeatures.js';\nimport { yellow } from '@ms-cloudpack/task-reporter';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { TaskContext } from '../../types/TaskContext.js';\nimport { getStartingAppPath } from './getStartingAppPath.js';\nimport { runPrereqs } from './runPrereqs.js';\nimport { setupReporting } from '../../setupReporting.js';\n\nlet cleanupFunctions: Array<() => Promise<void>> = [];\n\n/** Stop all started cloudpack instances, for testing */\nexport async function stopServers() {\n for (const func of cleanupFunctions) {\n await func();\n }\n cleanupFunctions = [];\n}\n\nasync function createAppBundleTask(\n options: { packageName: string },\n context: { session: Session; config: CloudpackConfig; packages: PackageDefinitionsCache },\n) {\n const { packageName } = options;\n const { session } = context;\n const packageEntry = findResolveMapEntry({\n packageName,\n resolveMap: session.resolveMap,\n });\n\n if (!packageEntry) {\n throw new Error(`Could not find package ${packageName} in the resolve map.`);\n }\n const bundleRequest = await createBundleRequestForPackage({ packageEntry }, context);\n\n return createBundleTask(bundleRequest);\n}\n\n/**\n * Defines the \"start\" verb entry point.\n */\nexport async function start(options: StartOptions, context: TaskContext) {\n const { reporter, appPath: initialCwd } = context;\n const appPath = await getStartingAppPath(initialCwd, options.app);\n const config = await readConfig(appPath);\n\n const telemetryClient = await setupReporting({ appPath, config, reporter });\n\n console.log('App path:', yellow(appPath));\n\n process.chdir(appPath);\n\n runPrereqs(config, appPath);\n\n try {\n // Merge in any additional features from the command line.\n config.features = mergeFeatures({\n configFeatures: config.features,\n commandLineFeatures: options.features,\n });\n\n const enabledFeatureNames = Object.entries(config.features)\n .filter(([, value]) => value)\n .map(([key]) => key);\n\n if (enabledFeatureNames.length) {\n console.log(`Enabled features: ${enabledFeatureNames.map((f) => yellow(f)).join(', ')}`);\n }\n\n // Initialize package overrides.\n const packages = createPackageDefinitions({ config });\n\n // Make sure the package has a valid definition.\n const definition = await packages.get(appPath);\n\n if (!definition) {\n throw new Error(`There was no package.json located at \"${appPath}\".`);\n }\n\n if (!definition.name || !definition.version) {\n throw new Error(`The package.json at \"${appPath}\" did not have a name and/or version.`);\n }\n\n // Initialize session definition.\n const session = await createSession({ appPath, config, includeOverlay: true }, { reporter, packages });\n\n // Set shared telemetry attributes which will be sent with all telemetry events.\n telemetryClient.setSharedSpanAttribute('sessionId', session.id);\n\n if (options.logResolveMap) {\n // Write the resolve map to disk.\n await writeJson(path.join(appPath, 'resolve-map.json'), session.resolveMap);\n }\n\n const { startApiServer } = await import('@ms-cloudpack/api-server');\n\n // Start api server for tracking status and handling remote requests.\n const apiServer = await startApiServer({\n session,\n rootSpan,\n reporter,\n packages,\n });\n\n // Kick off bundling app package as soon as api server is ready.\n void apiServer.addTask(await createAppBundleTask({ packageName: definition.name }, { session, config, packages }));\n\n // Then start bundle and app servers for hosting the app.\n const { startBundleServer } = await import('./startBundleServer.js');\n const bundleServer = await startBundleServer({ apiServer, session, reporter, packages });\n\n // Finally start the app server.\n const { startAppServer } = await import('./appServer/startAppServer.js');\n const appServer = await startAppServer({\n session,\n definition,\n bundleServer,\n apiServer,\n config,\n reporter,\n packages,\n });\n\n const cleanup = async () => {\n for (const [name, server] of [\n ['appServer', appServer] as const,\n ['apiServer', apiServer] as const,\n ['bundleServer', bundleServer] as const,\n ]) {\n console.info(`Closing ${name}: ${server.url}`);\n try {\n await server.close();\n } catch (err) {\n console.warn('Error closing server:', err);\n }\n }\n\n // Complete the reporting and list pending tasks as aborted.\n reporter.complete();\n\n // Flush and close telemetry.\n await stopTelemetry();\n };\n\n cleanupFunctions.push(cleanup);\n\n // Setup cleanup and close things on completion.\n let sigintCount = 0;\n\n process.on('SIGINT', () => {\n sigintCount++;\n if (sigintCount > 1) {\n console.debug('Forcing exit');\n process.exit(1);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises -- handler can't be async\n cleanup().finally(() => {\n process.exit(0);\n });\n });\n\n // Open the browser.\n const url = appServer.url;\n\n performance.measure(PerfMeasurementOpenBrowser, PerfMarkerCliEntry);\n openBrowser(url).catch((err) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n console.warn('Error opening browser:', err?.stack || err);\n console.warn('Please open the browser manually to:', url);\n });\n } catch (err) {\n console.error(err);\n reporter.complete();\n process.exit(1);\n }\n}\n\n// cspell:ignore Prereqs\n"]}
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC9F,OAAO,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAGrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,IAAI,gBAAgB,GAA+B,EAAE,CAAC;AAEtD,wDAAwD;AACxD,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE;QACnC,MAAM,IAAI,EAAE,CAAC;KACd;IACD,gBAAgB,GAAG,EAAE,CAAC;AACxB,CAAC;AAED,KAAK,UAAU,mBAAmB,CAChC,OAAgC,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,CAAC,CAAC;KACjB;AACH,CAAC;AAED,wBAAwB","sourcesContent":["import { writeJson } from '@ms-cloudpack/json-utilities';\nimport { findResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport path from 'path';\nimport { createSession } from '../../common/createSession.js';\nimport { openBrowser } from './openBrowser.js';\nimport type { Session } from '@ms-cloudpack/api-server';\nimport type { StartOptions } from './types/StartOptions.js';\nimport { createPackageDefinitions, readConfig } from '@ms-cloudpack/config';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\nimport { PerfMarkerCliEntry, PerfMeasurementOpenBrowser } from '../../performance/markers.js';\nimport { createBundleRequestForPackage, createBundleTask } from '@ms-cloudpack/api-server';\nimport { mergeFeatures } from './mergeFeatures.js';\nimport { yellow } from '@ms-cloudpack/task-reporter';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { TaskContext } from '../../types/TaskContext.js';\nimport { getStartingAppPath } from './getStartingAppPath.js';\nimport { runPrereqs } from './runPrereqs.js';\nimport { setupReporting } from '../../setupReporting.js';\n\nlet cleanupFunctions: Array<() => Promise<void>> = [];\n\n/** Stop all started cloudpack instances, for testing */\nexport async function stopServers() {\n for (const func of cleanupFunctions) {\n await func();\n }\n cleanupFunctions = [];\n}\n\nasync function createAppBundleTask(\n options: { packageName: string },\n context: { session: Session; config: CloudpackConfig; packages: PackageDefinitionsCache },\n) {\n const { packageName } = options;\n const { session } = context;\n const packageEntry = findResolveMapEntry({\n packageName,\n resolveMap: session.resolveMap,\n });\n\n if (!packageEntry) {\n throw new Error(`Could not find package ${packageName} in the resolve map.`);\n }\n const bundleRequest = await createBundleRequestForPackage({ packageEntry }, context);\n\n return createBundleTask(bundleRequest);\n}\n\n/**\n * Defines the \"start\" verb entry point.\n */\nexport async function start(options: StartOptions, context: TaskContext) {\n const { reporter, appPath: initialCwd } = context;\n const appPath = await getStartingAppPath(initialCwd, options.app);\n const config = await readConfig(appPath);\n\n const telemetryClient = await setupReporting({ appPath, config, reporter });\n\n console.log('App path:', yellow(appPath));\n\n process.chdir(appPath);\n\n runPrereqs(config, appPath);\n\n try {\n // Merge in any additional features from the command line.\n config.features = mergeFeatures({\n configFeatures: config.features,\n commandLineFeatures: options.features,\n });\n\n const enabledFeatureNames = Object.entries(config.features)\n .filter(([, value]) => value)\n .map(([key]) => key);\n\n if (enabledFeatureNames.length) {\n console.log(`Enabled features: ${enabledFeatureNames.map((f) => yellow(f)).join(', ')}`);\n }\n\n // Initialize package overrides.\n const packages = createPackageDefinitions({ config });\n\n // Make sure the package has a valid definition.\n const definition = await packages.get(appPath);\n\n if (!definition) {\n throw new Error(`There was no package.json located at \"${appPath}\".`);\n }\n\n if (!definition.name || !definition.version) {\n throw new Error(`The package.json at \"${appPath}\" did not have a name and/or version.`);\n }\n\n // Initialize session definition.\n const session = await createSession({ appPath, config, includeOverlay: true }, { reporter, packages });\n\n // Set shared telemetry attributes which will be sent with all telemetry events.\n telemetryClient.setSharedSpanAttribute('sessionId', session.id);\n\n if (options.logResolveMap) {\n // Write the resolve map to disk.\n await writeJson(path.join(appPath, 'resolve-map.json'), session.resolveMap);\n }\n\n const { startApiServer } = await import('@ms-cloudpack/api-server');\n\n // Start api server for tracking status and handling remote requests.\n const apiServer = await startApiServer({\n session,\n telemetryClient,\n reporter,\n packages,\n });\n\n // Kick off bundling app package as soon as api server is ready.\n void apiServer.addTask(await createAppBundleTask({ packageName: definition.name }, { session, config, packages }));\n\n // Then start bundle and app servers for hosting the app.\n const { startBundleServer } = await import('./startBundleServer.js');\n const bundleServer = await startBundleServer({ apiServer, session, reporter, packages });\n\n // Finally start the app server.\n const { startAppServer } = await import('./appServer/startAppServer.js');\n const appServer = await startAppServer({\n session,\n definition,\n bundleServer,\n apiServer,\n config,\n reporter,\n packages,\n });\n\n const cleanup = async () => {\n for (const [name, server] of [\n ['appServer', appServer] as const,\n ['apiServer', apiServer] as const,\n ['bundleServer', bundleServer] as const,\n ]) {\n console.info(`Closing ${name}: ${server.url}`);\n try {\n await server.close();\n } catch (err) {\n console.warn('Error closing server:', err);\n }\n }\n\n // Complete the reporting and list pending tasks as aborted.\n reporter.complete();\n\n // Flush and close telemetry.\n await telemetryClient.shutdown();\n };\n\n cleanupFunctions.push(cleanup);\n\n // Setup cleanup and close things on completion.\n let sigintCount = 0;\n\n process.on('SIGINT', () => {\n sigintCount++;\n if (sigintCount > 1) {\n console.debug('Forcing exit');\n process.exit(1);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises -- handler can't be async\n cleanup().finally(() => {\n process.exit(0);\n });\n });\n\n // Open the browser.\n const url = appServer.url;\n\n performance.measure(PerfMeasurementOpenBrowser, PerfMarkerCliEntry);\n openBrowser(url).catch((err) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n console.warn('Error opening browser:', err?.stack || err);\n console.warn('Please open the browser manually to:', url);\n });\n } catch (err) {\n console.error(err);\n reporter.complete();\n process.exit(1);\n }\n}\n\n// cspell:ignore Prereqs\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAQ1D,wBAAsB,IAAI,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,iBAiD5F"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { red } from '@ms-cloudpack/task-reporter';
|
|
2
|
-
import { stopTelemetry } from '../../initTelemetry.js';
|
|
3
2
|
import { setupReporting } from '../../setupReporting.js';
|
|
4
3
|
import { syncDownload, syncUpload } from '@ms-cloudpack/api-server/apis';
|
|
5
4
|
import { createPartialApiContext } from '../../common/createPartialApiContext.js';
|
|
@@ -7,8 +6,10 @@ import { isCIBuild } from '../../utilities/isCIBuild.js';
|
|
|
7
6
|
export async function sync({ upload, nonInteractiveLogin }, context) {
|
|
8
7
|
let hasErrors = false;
|
|
9
8
|
let message = undefined;
|
|
9
|
+
let telemetryClient;
|
|
10
|
+
let disposeContext = undefined;
|
|
10
11
|
try {
|
|
11
|
-
await setupReporting(context);
|
|
12
|
+
telemetryClient = await setupReporting(context);
|
|
12
13
|
const { config } = context;
|
|
13
14
|
const remoteCacheConfig = config.remoteCache;
|
|
14
15
|
if (!remoteCacheConfig) {
|
|
@@ -18,18 +19,24 @@ export async function sync({ upload, nonInteractiveLogin }, context) {
|
|
|
18
19
|
const input = {
|
|
19
20
|
isInteractiveLogin: !(isCIBuild() || nonInteractiveLogin),
|
|
20
21
|
};
|
|
21
|
-
let disposeContext = undefined;
|
|
22
22
|
if (upload) {
|
|
23
|
-
const ctx = await createPartialApiContext(
|
|
23
|
+
const ctx = await createPartialApiContext({
|
|
24
|
+
...context,
|
|
25
|
+
telemetryClient,
|
|
26
|
+
items: ['bus', 'taskRunner', 'watcher', 'packages', 'session'],
|
|
27
|
+
});
|
|
24
28
|
disposeContext = ctx.dispose;
|
|
25
29
|
await syncUpload({ input, ctx });
|
|
26
30
|
}
|
|
27
31
|
else {
|
|
28
|
-
const ctx = await createPartialApiContext(
|
|
32
|
+
const ctx = await createPartialApiContext({
|
|
33
|
+
...context,
|
|
34
|
+
telemetryClient,
|
|
35
|
+
items: ['packages', 'session'],
|
|
36
|
+
});
|
|
29
37
|
disposeContext = ctx.dispose;
|
|
30
38
|
await syncDownload({ input, ctx });
|
|
31
39
|
}
|
|
32
|
-
await disposeContext?.();
|
|
33
40
|
hasErrors = context.reporter.hasErrors();
|
|
34
41
|
}
|
|
35
42
|
catch (error) {
|
|
@@ -37,8 +44,9 @@ export async function sync({ upload, nonInteractiveLogin }, context) {
|
|
|
37
44
|
hasErrors = true;
|
|
38
45
|
}
|
|
39
46
|
finally {
|
|
47
|
+
await disposeContext?.();
|
|
40
48
|
context.reporter.complete(hasErrors ? red(message) : message);
|
|
41
|
-
await
|
|
49
|
+
await telemetryClient?.shutdown();
|
|
42
50
|
process.exit(hasErrors ? 1 : 0);
|
|
43
51
|
}
|
|
44
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAGlD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGzD,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAe,EAAE,OAAoB;IAC3F,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,OAAO,GAAuB,SAAS,CAAC;IAC5C,IAAI,eAA4C,CAAC;IACjD,IAAI,cAAc,GAAmC,SAAS,CAAC;IAE/D,IAAI;QACF,eAAe,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;QAChD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAC3B,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAAC;QAC7C,IAAI,CAAC,iBAAiB,EAAE;YACtB,OAAO,CAAC,IAAI,CACV,gHAAgH,CACjH,CAAC;YACF,OAAO;SACR;QAED,MAAM,KAAK,GAAG;YACZ,kBAAkB,E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porter';\nimport type { TaskContext } from '../../types/TaskContext.js';\nimport type { SyncOptions } from './types/SyncOptions.js';\nimport { setupReporting } from '../../setupReporting.js';\nimport { syncDownload, syncUpload } from '@ms-cloudpack/api-server/apis';\nimport { createPartialApiContext } from '../../common/createPartialApiContext.js';\nimport type { Context } from '@ms-cloudpack/api-server';\nimport { isCIBuild } from '../../utilities/isCIBuild.js';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\n\nexport async function sync({ upload, nonInteractiveLogin }: SyncOptions, context: TaskContext) {\n let hasErrors = false;\n let message: string | undefined = undefined;\n let telemetryClient: TelemetryClient | undefined;\n let disposeContext: Context['dispose'] | undefined = undefined;\n\n try {\n telemetryClient = await setupReporting(context);\n const { config } = context;\n const remoteCacheConfig = config.remoteCache;\n if (!remoteCacheConfig) {\n console.warn(\n 'Remote cache is not configured. Please add remoteCache to your cloudpack.config.json file to use this feature.',\n );\n return;\n }\n\n const input = {\n isInteractiveLogin: !(isCIBuild() || nonInteractiveLogin),\n };\n\n if (upload) {\n const ctx = await createPartialApiContext({\n ...context,\n telemetryClient,\n items: ['bus', 'taskRunner', 'watcher', 'packages', 'session'],\n });\n disposeContext = ctx.dispose;\n await syncUpload({ input, ctx });\n } else {\n const ctx = await createPartialApiContext({\n ...context,\n telemetryClient,\n items: ['packages', 'session'],\n });\n disposeContext = ctx.dispose;\n await syncDownload({ input, ctx });\n }\n\n hasErrors = context.reporter.hasErrors();\n } catch (error) {\n message = error instanceof Error ? error.message : '<Unknown error>';\n hasErrors = true;\n } finally {\n await disposeContext?.();\n context.reporter.complete(hasErrors ? red(message) : message);\n await telemetryClient?.shutdown();\n process.exit(hasErrors ? 1 : 0);\n }\n}\n"]}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import type { Context } from '@ms-cloudpack/api-server';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
3
|
+
import type { TelemetryClient } from '@ms-cloudpack/telemetry';
|
|
4
|
+
import type { CloudpackConfig } from '@ms-cloudpack/config';
|
|
5
|
+
export interface LazyApiContextOptions {
|
|
6
|
+
reporter: TaskReporter;
|
|
7
|
+
appPath: string;
|
|
8
|
+
config: CloudpackConfig;
|
|
9
|
+
telemetryClient: TelemetryClient;
|
|
10
|
+
}
|
|
11
|
+
export declare function createPartialApiContext<TKeys extends Exclude<keyof Context, 'dispose'>, TReturn extends Pick<Context, TKeys | 'dispose' | 'reporter' | 'telemetryClient'>>(options: LazyApiContextOptions & {
|
|
12
|
+
items: TKeys[];
|
|
13
|
+
}): Promise<TReturn>;
|
|
4
14
|
//# sourceMappingURL=createPartialApiContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPartialApiContext.d.ts","sourceRoot":"","sources":["../../src/common/createPartialApiContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAuB,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"createPartialApiContext.d.ts","sourceRoot":"","sources":["../../src/common/createPartialApiContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAuB,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAM5D,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,eAAe,CAAC;IACxB,eAAe,EAAE,eAAe,CAAC;CAClC;AAsFD,wBAAsB,uBAAuB,CAC3C,KAAK,SAAS,OAAO,CAAC,MAAM,OAAO,EAAE,SAAS,CAAC,EAC/C,OAAO,SAAS,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,SAAS,GAAG,UAAU,GAAG,iBAAiB,CAAC,EACjF,OAAO,EAAE,qBAAqB,GAAG;IAAE,KAAK,EAAE,KAAK,EAAE,CAAA;CAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAiBvE"}
|
|
@@ -10,18 +10,17 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
12
|
var _LazyApiContext_bus, _LazyApiContext_watcher, _LazyApiContext_packages, _LazyApiContext_taskRunner, _LazyApiContext_session;
|
|
13
|
-
import { rootSpan } from '../initTelemetry.js';
|
|
14
13
|
class LazyApiContext {
|
|
15
|
-
constructor(
|
|
16
|
-
this.
|
|
14
|
+
constructor(options) {
|
|
15
|
+
this.options = options;
|
|
17
16
|
_LazyApiContext_bus.set(this, void 0);
|
|
18
17
|
_LazyApiContext_watcher.set(this, void 0);
|
|
19
18
|
_LazyApiContext_packages.set(this, void 0);
|
|
20
19
|
_LazyApiContext_taskRunner.set(this, void 0);
|
|
21
20
|
_LazyApiContext_session.set(this, void 0);
|
|
22
21
|
}
|
|
23
|
-
get
|
|
24
|
-
return Promise.resolve(
|
|
22
|
+
get telemetryClient() {
|
|
23
|
+
return Promise.resolve(this.options.telemetryClient);
|
|
25
24
|
}
|
|
26
25
|
get bus() {
|
|
27
26
|
if (!__classPrivateFieldGet(this, _LazyApiContext_bus, "f")) {
|
|
@@ -44,13 +43,13 @@ class LazyApiContext {
|
|
|
44
43
|
return __classPrivateFieldGet(this, _LazyApiContext_watcher, "f");
|
|
45
44
|
}
|
|
46
45
|
get reporter() {
|
|
47
|
-
return Promise.resolve(this.
|
|
46
|
+
return Promise.resolve(this.options.reporter);
|
|
48
47
|
}
|
|
49
48
|
get packages() {
|
|
50
49
|
if (!__classPrivateFieldGet(this, _LazyApiContext_packages, "f")) {
|
|
51
50
|
const createPackageDefinitionsLazy = async () => {
|
|
52
51
|
const { createPackageDefinitions } = await import('@ms-cloudpack/config');
|
|
53
|
-
return createPackageDefinitions({ config: this.
|
|
52
|
+
return createPackageDefinitions({ config: this.options.config });
|
|
54
53
|
};
|
|
55
54
|
__classPrivateFieldSet(this, _LazyApiContext_packages, createPackageDefinitionsLazy(), "f");
|
|
56
55
|
}
|
|
@@ -70,7 +69,7 @@ class LazyApiContext {
|
|
|
70
69
|
if (!__classPrivateFieldGet(this, _LazyApiContext_session, "f")) {
|
|
71
70
|
const createSessionLazy = async () => {
|
|
72
71
|
const { createSession } = await import('./createSession.js');
|
|
73
|
-
return createSession(this.
|
|
72
|
+
return createSession(this.options, { reporter: await this.reporter, packages: await this.packages });
|
|
74
73
|
};
|
|
75
74
|
__classPrivateFieldSet(this, _LazyApiContext_session, createSessionLazy(), "f");
|
|
76
75
|
}
|
|
@@ -84,12 +83,12 @@ class LazyApiContext {
|
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
_LazyApiContext_bus = new WeakMap(), _LazyApiContext_watcher = new WeakMap(), _LazyApiContext_packages = new WeakMap(), _LazyApiContext_taskRunner = new WeakMap(), _LazyApiContext_session = new WeakMap();
|
|
87
|
-
export async function createPartialApiContext(
|
|
88
|
-
const { reporter } =
|
|
89
|
-
const lazyContext = new LazyApiContext(
|
|
86
|
+
export async function createPartialApiContext(options) {
|
|
87
|
+
const { reporter, telemetryClient, items } = options;
|
|
88
|
+
const lazyContext = new LazyApiContext(options);
|
|
90
89
|
const result = {
|
|
91
90
|
reporter,
|
|
92
|
-
|
|
91
|
+
telemetryClient,
|
|
93
92
|
dispose: () => {
|
|
94
93
|
return lazyContext.dispose();
|
|
95
94
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPartialApiContext.js","sourceRoot":"","sources":["../../src/common/createPartialApiContext.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"createPartialApiContext.js","sourceRoot":"","sources":["../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C,UAAU,EAAE,CAAC;SAC5B;IACH,CAAC;CACF;;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAG3C,OAAmD;IACnD,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IACrD,MAAM,WAAW,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;IAEhD,MAAM,MAAM,GAAG;QACb,QAAQ;QACR,eAAe;QACf,OAAO,EAAE,GAAG,EAAE;YACZ,OAAO,WAAW,CAAC,OAAO,EAAE,CAAC;QAC/B,CAAC;KACS,CAAC;IAEb,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC,CAAmB,CAAC;KAC5D;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { DataBus } from '@ms-cloudpack/data-bus';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { Context, Session, TaskRunner } from '@ms-cloudpack/api-server';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { Watcher } from '@ms-cloudpack/file-watcher';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\n\ntype PromisifyProperties<T> = {\n [K in keyof T]: T[K] extends (...args: unknown[]) => unknown ? T[K] : Promise<T[K]>;\n};\n\nexport interface LazyApiContextOptions {\n reporter: TaskReporter;\n appPath: string;\n config: CloudpackConfig;\n telemetryClient: TelemetryClient;\n}\n\nclass LazyApiContext implements PromisifyProperties<Context> {\n #bus: Promise<DataBus> | undefined;\n #watcher: Promise<Watcher> | undefined;\n #packages: Promise<PackageDefinitionsCache> | undefined;\n #taskRunner: Promise<TaskRunner> | undefined;\n #session: Promise<Session> | undefined;\n\n constructor(private readonly options: LazyApiContextOptions) {}\n\n public get telemetryClient(): Promise<TelemetryClient> {\n return Promise.resolve(this.options.telemetryClient);\n }\n\n public get bus(): Promise<DataBus> {\n if (!this.#bus) {\n const createDataBusLazy = async () => {\n const { createDataBus } = await import('@ms-cloudpack/data-bus');\n return createDataBus();\n };\n this.#bus = createDataBusLazy();\n }\n\n return this.#bus;\n }\n\n public get watcher(): Promise<Watcher> {\n if (!this.#watcher) {\n const createWatcherLazy = async () => {\n const { createWatcher } = await import('@ms-cloudpack/file-watcher');\n return createWatcher();\n };\n this.#watcher = createWatcherLazy();\n }\n\n return this.#watcher;\n }\n\n public get reporter(): Promise<TaskReporter> {\n return Promise.resolve(this.options.reporter);\n }\n\n public get packages(): Promise<PackageDefinitionsCache> {\n if (!this.#packages) {\n const createPackageDefinitionsLazy = async () => {\n const { createPackageDefinitions } = await import('@ms-cloudpack/config');\n return createPackageDefinitions({ config: this.options.config });\n };\n this.#packages = createPackageDefinitionsLazy();\n }\n\n return this.#packages;\n }\n\n public get taskRunner(): Promise<TaskRunner> {\n if (!this.#taskRunner) {\n const createTaskRunnerLazy = async () => {\n const { TaskRunner } = await import('@ms-cloudpack/api-server');\n return new TaskRunner();\n };\n this.#taskRunner = createTaskRunnerLazy();\n }\n return this.#taskRunner;\n }\n\n public get session(): Promise<Session> {\n if (!this.#session) {\n const createSessionLazy = async () => {\n const { createSession } = await import('./createSession.js');\n return createSession(this.options, { reporter: await this.reporter, packages: await this.packages });\n };\n this.#session = createSessionLazy();\n }\n\n return this.#session;\n }\n\n public async dispose() {\n if (this.#watcher) {\n const watcher = await this.#watcher;\n await watcher.unwatchAll();\n }\n }\n}\n\nexport async function createPartialApiContext<\n TKeys extends Exclude<keyof Context, 'dispose'>,\n TReturn extends Pick<Context, TKeys | 'dispose' | 'reporter' | 'telemetryClient'>,\n>(options: LazyApiContextOptions & { items: TKeys[] }): Promise<TReturn> {\n const { reporter, telemetryClient, items } = options;\n const lazyContext = new LazyApiContext(options);\n\n const result = {\n reporter,\n telemetryClient,\n dispose: () => {\n return lazyContext.dispose();\n },\n } as TReturn;\n\n for (const item of items) {\n result[item] = (await lazyContext[item]) as TReturn[TKeys];\n }\n\n return result;\n}\n"]}
|
package/lib/initTelemetry.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type TelemetryConfig } from '@ms-cloudpack/config';
|
|
2
|
-
import { type Span, type TelemetryClient } from '@ms-cloudpack/telemetry';
|
|
3
2
|
import type { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
4
3
|
export interface TelemetryInitOptions {
|
|
5
4
|
useDebugLogging: boolean;
|
|
@@ -7,18 +6,11 @@ export interface TelemetryInitOptions {
|
|
|
7
6
|
telemetryConfig: TelemetryConfig | undefined;
|
|
8
7
|
sharedSpanAttributes?: Record<string, string>;
|
|
9
8
|
}
|
|
10
|
-
export declare let rootSpan: Span | undefined;
|
|
11
9
|
/**
|
|
12
10
|
* Initialize the telemetry client, create the root span, register performance observers.
|
|
13
11
|
* Telemetry will not be sent if no instrumentation key is found.
|
|
14
12
|
* @param options - options to initialize telemetry
|
|
15
13
|
* @returns
|
|
16
14
|
*/
|
|
17
|
-
export declare function initTelemetry(options: TelemetryInitOptions, taskReporter: TaskReporter): Promise<TelemetryClient>;
|
|
18
|
-
/**
|
|
19
|
-
* Ends rootSpan and flushes all telemetry.
|
|
20
|
-
* No-op if telemetry is not initialized.
|
|
21
|
-
* @returns a promise that resolves when telemetry is flushed and shutdown.
|
|
22
|
-
*/
|
|
23
|
-
export declare function stopTelemetry(): Promise<void> | undefined;
|
|
15
|
+
export declare function initTelemetry(options: TelemetryInitOptions, taskReporter: TaskReporter): Promise<import("@ms-cloudpack/telemetry").TelemetryClient>;
|
|
24
16
|
//# sourceMappingURL=initTelemetry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initTelemetry.d.ts","sourceRoot":"","sources":["../src/initTelemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"initTelemetry.d.ts","sourceRoot":"","sources":["../src/initTelemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAI5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,eAAe,GAAG,SAAS,CAAC;IAC7C,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/C;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,YAAY,8DA4B5F"}
|
package/lib/initTelemetry.js
CHANGED
|
@@ -2,8 +2,6 @@ import {} from '@ms-cloudpack/config';
|
|
|
2
2
|
import { getVersion } from '@ms-cloudpack/package-utilities';
|
|
3
3
|
import { createTelemetryClient } from '@ms-cloudpack/telemetry';
|
|
4
4
|
import { registerPerformanceObservers } from './performance/registerPerformanceObservers.js';
|
|
5
|
-
let telemetryClient;
|
|
6
|
-
export let rootSpan;
|
|
7
5
|
/**
|
|
8
6
|
* Initialize the telemetry client, create the root span, register performance observers.
|
|
9
7
|
* Telemetry will not be sent if no instrumentation key is found.
|
|
@@ -16,33 +14,21 @@ export async function initTelemetry(options, taskReporter) {
|
|
|
16
14
|
if (!options.useDebugLogging) {
|
|
17
15
|
taskReporter.ignoreLogMessage('ApplicationInsights:');
|
|
18
16
|
}
|
|
19
|
-
telemetryClient = await createTelemetryClient({
|
|
17
|
+
const telemetryClient = await createTelemetryClient({
|
|
20
18
|
productVersion: getVersion(import.meta.url),
|
|
21
19
|
instrumentationKey,
|
|
22
20
|
logLevel,
|
|
23
21
|
serviceNamespace: 'cloudpack',
|
|
24
22
|
serviceName: 'cli',
|
|
23
|
+
rootSpanName: 'CLI',
|
|
25
24
|
});
|
|
26
25
|
if (options.sharedSpanAttributes) {
|
|
27
26
|
for (const [key, value] of Object.entries(options.sharedSpanAttributes)) {
|
|
28
27
|
telemetryClient.setSharedSpanAttribute(key, value);
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
if (rootSpan) {
|
|
34
|
-
// Register performance observers to track performance metrics as events of CLI span.
|
|
35
|
-
registerPerformanceObservers(rootSpan);
|
|
36
|
-
}
|
|
30
|
+
// Register performance observers to track performance metrics as events of CLI span.
|
|
31
|
+
registerPerformanceObservers(telemetryClient.rootSpan);
|
|
37
32
|
return telemetryClient;
|
|
38
33
|
}
|
|
39
|
-
/**
|
|
40
|
-
* Ends rootSpan and flushes all telemetry.
|
|
41
|
-
* No-op if telemetry is not initialized.
|
|
42
|
-
* @returns a promise that resolves when telemetry is flushed and shutdown.
|
|
43
|
-
*/
|
|
44
|
-
export function stopTelemetry() {
|
|
45
|
-
rootSpan?.end();
|
|
46
|
-
return telemetryClient?.shutdown();
|
|
47
|
-
}
|
|
48
34
|
//# sourceMappingURL=initTelemetry.js.map
|
package/lib/initTelemetry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initTelemetry.js","sourceRoot":"","sources":["../src/initTelemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,
|
|
1
|
+
{"version":3,"file":"initTelemetry.js","sourceRoot":"","sources":["../src/initTelemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAU7F;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAA6B,EAAE,YAA0B;IAC3F,MAAM,kBAAkB,GACtB,OAAO,CAAC,eAAe,EAAE,kBAAkB,IAAI,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC;IAErG,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IACvG,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE;QAC5B,YAAY,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;KACvD;IAED,MAAM,eAAe,GAAG,MAAM,qBAAqB,CAAC;QAClD,cAAc,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;QAC3C,kBAAkB;QAClB,QAAQ;QACR,gBAAgB,EAAE,WAAW;QAC7B,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,KAAK;KACpB,CAAC,CAAC;IAEH,IAAI,OAAO,CAAC,oBAAoB,EAAE;QAChC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE;YACvE,eAAe,CAAC,sBAAsB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SACpD;KACF;IAED,qFAAqF;IACrF,4BAA4B,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAEvD,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import { type TelemetryConfig } from '@ms-cloudpack/config';\nimport { getVersion } from '@ms-cloudpack/package-utilities';\nimport { createTelemetryClient } from '@ms-cloudpack/telemetry';\nimport { registerPerformanceObservers } from './performance/registerPerformanceObservers.js';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\n\nexport interface TelemetryInitOptions {\n useDebugLogging: boolean;\n useVerboseLogging: boolean;\n telemetryConfig: TelemetryConfig | undefined;\n sharedSpanAttributes?: Record<string, string>;\n}\n\n/**\n * Initialize the telemetry client, create the root span, register performance observers.\n * Telemetry will not be sent if no instrumentation key is found.\n * @param options - options to initialize telemetry\n * @returns\n */\nexport async function initTelemetry(options: TelemetryInitOptions, taskReporter: TaskReporter) {\n const instrumentationKey =\n options.telemetryConfig?.instrumentationKey || process.env.CLOUDPACK_TELEMETRY_INSTRUMENTATION_KEY;\n\n const logLevel = options.useVerboseLogging ? 'VERBOSE' : options.useDebugLogging ? 'DEBUG' : undefined;\n if (!options.useDebugLogging) {\n taskReporter.ignoreLogMessage('ApplicationInsights:');\n }\n\n const telemetryClient = await createTelemetryClient({\n productVersion: getVersion(import.meta.url),\n instrumentationKey,\n logLevel,\n serviceNamespace: 'cloudpack',\n serviceName: 'cli',\n rootSpanName: 'CLI',\n });\n\n if (options.sharedSpanAttributes) {\n for (const [key, value] of Object.entries(options.sharedSpanAttributes)) {\n telemetryClient.setSharedSpanAttribute(key, value);\n }\n }\n\n // Register performance observers to track performance metrics as events of CLI span.\n registerPerformanceObservers(telemetryClient.rootSpan);\n\n return telemetryClient;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/cli",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.3",
|
|
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",
|
|
@@ -11,19 +11,19 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@lage-run/target-graph": "^0.8.6",
|
|
14
|
-
"@ms-cloudpack/api-server": "^0.
|
|
14
|
+
"@ms-cloudpack/api-server": "^0.15.0",
|
|
15
15
|
"@ms-cloudpack/bundler": "^0.14.11",
|
|
16
16
|
"@ms-cloudpack/config": "^0.12.1",
|
|
17
17
|
"@ms-cloudpack/create-express-app": "^1.3.9",
|
|
18
18
|
"@ms-cloudpack/data-bus": "^0.4.0",
|
|
19
|
-
"@ms-cloudpack/file-watcher": "^0.0
|
|
19
|
+
"@ms-cloudpack/file-watcher": "^0.1.0",
|
|
20
20
|
"@ms-cloudpack/json-utilities": "^0.0.7",
|
|
21
|
-
"@ms-cloudpack/overlay": "^0.14.
|
|
21
|
+
"@ms-cloudpack/overlay": "^0.14.14",
|
|
22
22
|
"@ms-cloudpack/package-utilities": "^5.1.3",
|
|
23
23
|
"@ms-cloudpack/path-string-parsing": "^1.0.3",
|
|
24
24
|
"@ms-cloudpack/path-utilities": "^2.3.2",
|
|
25
25
|
"@ms-cloudpack/task-reporter": "^0.7.2",
|
|
26
|
-
"@ms-cloudpack/telemetry": "^0.3.
|
|
26
|
+
"@ms-cloudpack/telemetry": "^0.3.7",
|
|
27
27
|
"commander": "^11.0.0",
|
|
28
28
|
"cross-spawn": "^7.0.3",
|
|
29
29
|
"fs-extra": "^11.0.0",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { CreateHtmlOptions } from './CreateHtmlOptions.js';
|
|
2
|
-
import type { CreateHtmlResult } from './CreateHtmlResult.js';
|
|
3
|
-
/**
|
|
4
|
-
* A custom server render function that can be used to override the default HTML response.
|
|
5
|
-
*/
|
|
6
|
-
export type CreateHtmlFunction = (options: CreateHtmlOptions) => Promise<CreateHtmlResult> | CreateHtmlResult;
|
|
7
|
-
//# sourceMappingURL=CreateHtmlFunction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlFunction.d.ts","sourceRoot":"","sources":["../../src/types/CreateHtmlFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;GAEG;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlFunction.js","sourceRoot":"","sources":["../../src/types/CreateHtmlFunction.ts"],"names":[],"mappings":"","sourcesContent":["import type { CreateHtmlOptions } from './CreateHtmlOptions.js';\nimport type { CreateHtmlResult } from './CreateHtmlResult.js';\n\n/**\n * A custom server render function that can be used to override the default HTML response.\n */\n\nexport type CreateHtmlFunction = (options: CreateHtmlOptions) => Promise<CreateHtmlResult> | CreateHtmlResult;\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ImportMap } from '@ms-cloudpack/package-utilities';
|
|
2
|
-
import type { PackageJson } from '@ms-cloudpack/bundler-types';
|
|
3
|
-
import type { Route } from '@ms-cloudpack/config';
|
|
4
|
-
import type { Session } from '@ms-cloudpack/api-server';
|
|
5
|
-
import type { Request, Response } from '@ms-cloudpack/create-express-app';
|
|
6
|
-
/**
|
|
7
|
-
* The input options for a createHtml custom server render function.
|
|
8
|
-
*/
|
|
9
|
-
export type CreateHtmlOptions = {
|
|
10
|
-
session: Session;
|
|
11
|
-
route: Route;
|
|
12
|
-
baseUrl: string;
|
|
13
|
-
definition: PackageJson;
|
|
14
|
-
importMap: ImportMap;
|
|
15
|
-
overlayScript: string | undefined;
|
|
16
|
-
entryScript: string | undefined;
|
|
17
|
-
inlineScripts: string[];
|
|
18
|
-
req: Request;
|
|
19
|
-
res: Response;
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=CreateHtmlOptions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlOptions.d.ts","sourceRoot":"","sources":["../../src/types/CreateHtmlOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAE1E;;GAEG;AAEH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,WAAW,CAAC;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,QAAQ,CAAC;CACf,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlOptions.js","sourceRoot":"","sources":["../../src/types/CreateHtmlOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { ImportMap } from '@ms-cloudpack/package-utilities';\nimport type { PackageJson } from '@ms-cloudpack/bundler-types';\nimport type { Route } from '@ms-cloudpack/config';\nimport type { Session } from '@ms-cloudpack/api-server';\nimport type { Request, Response } from '@ms-cloudpack/create-express-app';\n\n/**\n * The input options for a createHtml custom server render function.\n */\n\nexport type CreateHtmlOptions = {\n session: Session;\n route: Route;\n baseUrl: string;\n definition: PackageJson;\n importMap: ImportMap;\n overlayScript: string | undefined;\n entryScript: string | undefined;\n inlineScripts: string[];\n req: Request;\n res: Response;\n};\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a custom HtmlResult object returned from running the renderScript for a Route
|
|
3
|
-
*/
|
|
4
|
-
export type CustomHtmlResult = {
|
|
5
|
-
type: 'static-html' | 'js' | 'json';
|
|
6
|
-
content: string;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* The expected result of the createHtml custom server render function.
|
|
10
|
-
*/
|
|
11
|
-
export type CreateHtmlResult = string | {
|
|
12
|
-
html: string;
|
|
13
|
-
statusCode: number;
|
|
14
|
-
} | CustomHtmlResult;
|
|
15
|
-
//# sourceMappingURL=CreateHtmlResult.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlResult.d.ts","sourceRoot":"","sources":["../../src/types/CreateHtmlResult.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,aAAa,GAAG,IAAI,GAAG,MAAM,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN;IACE,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,GACD,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlResult.js","sourceRoot":"","sources":["../../src/types/CreateHtmlResult.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Represents a custom HtmlResult object returned from running the renderScript for a Route\n */\nexport type CustomHtmlResult = {\n type: 'static-html' | 'js' | 'json';\n content: string;\n};\n\n/**\n * The expected result of the createHtml custom server render function.\n */\nexport type CreateHtmlResult =\n | string\n | {\n html: string;\n statusCode: number;\n }\n | CustomHtmlResult;\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { CreateHtmlFunction } from './CreateHtmlFunction.js';
|
|
2
|
-
/**
|
|
3
|
-
* The expected shape of the createHtml custom server render function script.
|
|
4
|
-
*/
|
|
5
|
-
export type CreateHtmlScript = {
|
|
6
|
-
default: CreateHtmlFunction;
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=CreateHtmlScript.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlScript.d.ts","sourceRoot":"","sources":["../../src/types/CreateHtmlScript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAAE,OAAO,EAAE,kBAAkB,CAAA;CAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlScript.js","sourceRoot":"","sources":["../../src/types/CreateHtmlScript.ts"],"names":[],"mappings":"","sourcesContent":["import type { CreateHtmlFunction } from './CreateHtmlFunction.js';\n\n/**\n * The expected shape of the createHtml custom server render function script.\n */\nexport type CreateHtmlScript = { default: CreateHtmlFunction };\n"]}
|
package/lib/types/Watcher.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Watcher.d.ts","sourceRoot":"","sources":["../../src/types/Watcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,IAAI,CAAC;CAC/C"}
|
package/lib/types/Watcher.js
DELETED
package/lib/types/Watcher.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Watcher.js","sourceRoot":"","sources":["../../src/types/Watcher.ts"],"names":[],"mappings":"","sourcesContent":["import type { BundleRequest } from '@ms-cloudpack/api-server';\n\nexport interface Watcher {\n watch: (bundleRequest: BundleRequest) => void;\n}\n"]}
|