@ms-cloudpack/cli 0.42.1 → 0.42.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 +1 -1
- package/lib/commands/bundle/bundle.d.ts.map +1 -1
- package/lib/commands/bundle/bundle.js +6 -4
- package/lib/commands/bundle/bundle.js.map +1 -1
- package/lib/commands/init/bundleAndGetImports.d.ts.map +1 -1
- package/lib/commands/init/bundleAndGetImports.js +2 -4
- package/lib/commands/init/bundleAndGetImports.js.map +1 -1
- package/lib/commands/init/init.js +3 -3
- package/lib/commands/init/init.js.map +1 -1
- package/lib/commands/start/start.d.ts +1 -1
- package/lib/commands/start/start.d.ts.map +1 -1
- package/lib/commands/start/start.js +7 -7
- package/lib/commands/start/start.js.map +1 -1
- package/lib/commands/start/startBundleServer.d.ts.map +1 -1
- package/lib/commands/start/startBundleServer.js +1 -2
- package/lib/commands/start/startBundleServer.js.map +1 -1
- package/lib/commands/sync/sync.d.ts +1 -1
- package/lib/commands/sync/sync.d.ts.map +1 -1
- package/lib/commands/sync/sync.js +27 -4
- package/lib/commands/sync/sync.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -10
- package/lib/index.js.map +1 -1
- package/lib/initTelemetry.d.ts +3 -15
- package/lib/initTelemetry.d.ts.map +1 -1
- package/lib/initTelemetry.js +6 -19
- package/lib/initTelemetry.js.map +1 -1
- package/lib/setupReporting.d.ts +3 -0
- package/lib/setupReporting.d.ts.map +1 -0
- package/lib/{commands/start/setupReporting.js → setupReporting.js} +13 -3
- package/lib/setupReporting.js.map +1 -0
- package/lib/tasks/bundleTaskWorker.js +1 -1
- package/lib/tasks/bundleTaskWorker.js.map +1 -1
- package/lib/types/Watcher.d.ts +1 -1
- package/lib/types/Watcher.d.ts.map +1 -1
- package/lib/types/Watcher.js.map +1 -1
- package/package.json +5 -10
- package/lib/commands/init/findImports.d.ts +0 -6
- package/lib/commands/init/findImports.d.ts.map +0 -1
- package/lib/commands/init/findImports.js +0 -73
- package/lib/commands/init/findImports.js.map +0 -1
- package/lib/commands/start/createBundleRequestForPackage.d.ts +0 -11
- package/lib/commands/start/createBundleRequestForPackage.d.ts.map +0 -1
- package/lib/commands/start/createBundleRequestForPackage.js +0 -21
- package/lib/commands/start/createBundleRequestForPackage.js.map +0 -1
- package/lib/commands/start/createBundleTask.d.ts +0 -10
- package/lib/commands/start/createBundleTask.d.ts.map +0 -1
- package/lib/commands/start/createBundleTask.js +0 -42
- package/lib/commands/start/createBundleTask.js.map +0 -1
- package/lib/commands/start/setupReporting.d.ts +0 -3
- package/lib/commands/start/setupReporting.d.ts.map +0 -1
- package/lib/commands/start/setupReporting.js.map +0 -1
- package/lib/commands/sync/Task.d.ts +0 -6
- package/lib/commands/sync/Task.d.ts.map +0 -1
- package/lib/commands/sync/Task.js +0 -2
- package/lib/commands/sync/Task.js.map +0 -1
- package/lib/commands/sync/createDownloadTask.d.ts +0 -5
- package/lib/commands/sync/createDownloadTask.d.ts.map +0 -1
- package/lib/commands/sync/createDownloadTask.js +0 -22
- package/lib/commands/sync/createDownloadTask.js.map +0 -1
- package/lib/commands/sync/createUploadTask.d.ts +0 -5
- package/lib/commands/sync/createUploadTask.d.ts.map +0 -1
- package/lib/commands/sync/createUploadTask.js +0 -18
- package/lib/commands/sync/createUploadTask.js.map +0 -1
- package/lib/commands/sync/getPackagesToSync.d.ts +0 -9
- package/lib/commands/sync/getPackagesToSync.d.ts.map +0 -1
- package/lib/commands/sync/getPackagesToSync.js +0 -24
- package/lib/commands/sync/getPackagesToSync.js.map +0 -1
- package/lib/commands/sync/syncInternal.d.ts +0 -10
- package/lib/commands/sync/syncInternal.d.ts.map +0 -1
- package/lib/commands/sync/syncInternal.js +0 -39
- package/lib/commands/sync/syncInternal.js.map +0 -1
- package/lib/common/getBundleDetails.d.ts +0 -14
- package/lib/common/getBundleDetails.d.ts.map +0 -1
- package/lib/common/getBundleDetails.js +0 -35
- package/lib/common/getBundleDetails.js.map +0 -1
- package/lib/tasks/bundleTask.d.ts +0 -9
- package/lib/tasks/bundleTask.d.ts.map +0 -1
- package/lib/tasks/bundleTask.js +0 -119
- package/lib/tasks/bundleTask.js.map +0 -1
- package/lib/tasks/formatBundleErrors.d.ts +0 -9
- package/lib/tasks/formatBundleErrors.d.ts.map +0 -1
- package/lib/tasks/formatBundleErrors.js +0 -19
- package/lib/tasks/formatBundleErrors.js.map +0 -1
- package/lib/tasks/getFileSizeSync.d.ts +0 -5
- package/lib/tasks/getFileSizeSync.d.ts.map +0 -1
- package/lib/tasks/getFileSizeSync.js +0 -16
- package/lib/tasks/getFileSizeSync.js.map +0 -1
- package/lib/tasks/hashPackage.d.ts +0 -6
- package/lib/tasks/hashPackage.d.ts.map +0 -1
- package/lib/tasks/hashPackage.js +0 -21
- package/lib/tasks/hashPackage.js.map +0 -1
- package/lib/types/BundleRequest.d.ts +0 -26
- package/lib/types/BundleRequest.d.ts.map +0 -1
- package/lib/types/BundleRequest.js +0 -2
- package/lib/types/BundleRequest.js.map +0 -1
- package/lib/types/BundleTaskOptions.d.ts +0 -4
- package/lib/types/BundleTaskOptions.d.ts.map +0 -1
- package/lib/types/BundleTaskOptions.js +0 -2
- package/lib/types/BundleTaskOptions.js.map +0 -1
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,EAAmC,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"initTelemetry.js","sourceRoot":"","sources":["../src/initTelemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,sB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qFAAqF;QACrF,4BAA4B,CAAC,QAAQ,CAAC,CAAC;KACxC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,QAAQ,EAAE,GAAG,EAAE,CAAC;IAChB,OAAO,eAAe,EAAE,QAAQ,EAAE,CAAC;AACrC,CAAC","sourcesContent":["import { type TelemetryConfig } from '@ms-cloudpack/config';\nimport { getVersion } from '@ms-cloudpack/package-utilities';\nimport { type Span, type TelemetryClient, 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\nlet telemetryClient: TelemetryClient | undefined;\nexport let rootSpan: Span | undefined;\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 telemetryClient = await createTelemetryClient({\n productVersion: getVersion(import.meta.url),\n instrumentationKey,\n logLevel,\n serviceNamespace: 'cloudpack',\n serviceName: '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 // This is the root span for the CLI. It will be used to track the duration of the CLI execution.\n rootSpan = telemetryClient.getTracer()?.startSpan('CLI');\n\n if (rootSpan) {\n // Register performance observers to track performance metrics as events of CLI span.\n registerPerformanceObservers(rootSpan);\n }\n\n return telemetryClient;\n}\n\n/**\n * Ends rootSpan and flushes all telemetry.\n * No-op if telemetry is not initialized.\n * @returns a promise that resolves when telemetry is flushed and shutdown.\n */\nexport function stopTelemetry() {\n rootSpan?.end();\n return telemetryClient?.shutdown();\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupReporting.d.ts","sourceRoot":"","sources":["../src/setupReporting.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAmB1D,wBAAsB,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,WAAW,8DA6B9E"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { getVersion } from '@ms-cloudpack/package-utilities';
|
|
2
|
-
import { initTelemetry } from '
|
|
2
|
+
import { initTelemetry } from './initTelemetry.js';
|
|
3
3
|
import { bold, defaultLoggingConfig, verboseLoggingConfig, debugLoggingConfig, } from '@ms-cloudpack/task-reporter';
|
|
4
|
+
import { readJson } from '@ms-cloudpack/json-utilities';
|
|
5
|
+
import path from 'path';
|
|
4
6
|
const { argv } = process;
|
|
5
7
|
const useDebugLogging = argv.includes('--debug') || argv.includes('-d');
|
|
6
8
|
const verb = argv[2];
|
|
7
9
|
const useVerboseLogging = argv.includes('--verbose') || argv.includes('-v') || verb === 'bundle';
|
|
8
10
|
const version = getVersion(import.meta.url);
|
|
9
|
-
export async function setupReporting({ reporter, config }) {
|
|
11
|
+
export async function setupReporting({ reporter, config, appPath }) {
|
|
10
12
|
reporter.setOptions({
|
|
11
13
|
productName: 'Cloudpack',
|
|
12
14
|
version,
|
|
@@ -16,10 +18,18 @@ export async function setupReporting({ reporter, config }) {
|
|
|
16
18
|
...(useVerboseLogging && verboseLoggingConfig),
|
|
17
19
|
...(useDebugLogging && debugLoggingConfig),
|
|
18
20
|
});
|
|
19
|
-
await
|
|
21
|
+
const definition = (await readJson(path.join(appPath, 'package.json')));
|
|
22
|
+
const telemetryClient = await initTelemetry({
|
|
20
23
|
useDebugLogging,
|
|
21
24
|
useVerboseLogging,
|
|
22
25
|
telemetryConfig: config.telemetry,
|
|
26
|
+
sharedSpanAttributes: {
|
|
27
|
+
verb,
|
|
28
|
+
arguments: argv.slice(3).join(' '),
|
|
29
|
+
environment: process.env.CI || process.env.TF_BUILD ? 'ci' : 'local',
|
|
30
|
+
appName: definition?.name || '<unknown>',
|
|
31
|
+
},
|
|
23
32
|
}, reporter);
|
|
33
|
+
return telemetryClient;
|
|
24
34
|
}
|
|
25
35
|
//# sourceMappingURL=setupReporting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupReporting.js","sourceRoot":"","sources":["../src/setupReporting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,IAAI,EACJ,oBAAoB,EACpB,oBAAoB,EAEpB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;AACzB,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxE,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACrB,MAAM,iBAAiB,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,QAAQ,CAAC;AACjG,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAe;IAC7E,QAAQ,CAAC,UAAU,CAAC;QAClB,WAAW,EAAE,WAAW;QACxB,OAAO;QACP,WAAW,EAAE,GAAG,EAAE,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG;QAC/D,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,GAAG,oBAAoB;QACvB,GAAG,CAAC,iBAAiB,IAAI,oBAAoB,CAAC;QAC9C,GAAG,CAAC,eAAe,IAAI,kBAAkB,CAAC;KACpB,CAAC,CAAC;IAE1B,MAAM,UAAU,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAgB,CAAC;IAEvF,MAAM,eAAe,GAAG,MAAM,aAAa,CACzC;QACE,eAAe;QACf,iBAAiB;QACjB,eAAe,EAAE,MAAM,CAAC,SAAS;QACjC,oBAAoB,EAAE;YACpB,IAAI;YACJ,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YAClC,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO;YACpE,OAAO,EAAE,UAAU,EAAE,IAAI,IAAI,WAAW;SACzC;KACF,EACD,QAAQ,CACT,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import { getVersion } from '@ms-cloudpack/package-utilities';\nimport type { TaskContext } from './types/TaskContext.js';\nimport { initTelemetry } from './initTelemetry.js';\nimport {\n bold,\n defaultLoggingConfig,\n verboseLoggingConfig,\n type TaskReporterOptions,\n debugLoggingConfig,\n} from '@ms-cloudpack/task-reporter';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport path from 'path';\nimport type { PackageJson } from '@ms-cloudpack/bundler-types';\n\nconst { argv } = process;\nconst useDebugLogging = argv.includes('--debug') || argv.includes('-d');\nconst verb = argv[2];\nconst useVerboseLogging = argv.includes('--verbose') || argv.includes('-v') || verb === 'bundle';\nconst version = getVersion(import.meta.url);\n\nexport async function setupReporting({ reporter, config, appPath }: TaskContext) {\n reporter.setOptions({\n productName: 'Cloudpack',\n version,\n description: () => `Running \"${bold(argv.slice(2).join(' '))}\"`,\n helpMessage: config.helpMessage,\n ...defaultLoggingConfig,\n ...(useVerboseLogging && verboseLoggingConfig),\n ...(useDebugLogging && debugLoggingConfig),\n } as TaskReporterOptions);\n\n const definition = (await readJson(path.join(appPath, 'package.json'))) as PackageJson;\n\n const telemetryClient = await initTelemetry(\n {\n useDebugLogging,\n useVerboseLogging,\n telemetryConfig: config.telemetry,\n sharedSpanAttributes: {\n verb,\n arguments: argv.slice(3).join(' '),\n environment: process.env.CI || process.env.TF_BUILD ? 'ci' : 'local',\n appName: definition?.name || '<unknown>',\n },\n },\n reporter,\n );\n\n return telemetryClient;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundleTaskWorker.js","sourceRoot":"","sources":["../../src/tasks/bundleTaskWorker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"bundleTaskWorker.js","sourceRoot":"","sources":["../../src/tasks/bundleTaskWorker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,GAAG,CAAC,IAAwB;IACxD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAExB,mEAAmE;IACnE,MAAM,UAAU,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC;AACrE,CAAC","sourcesContent":["import { bundleTask } from '@ms-cloudpack/api-server';\nimport type { Target } from '@lage-run/target-graph';\n\nexport default async function run(data: { target: Target }) {\n const { target } = data;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n await bundleTask({ bundleRequest: target.options?.bundleRequest });\n}\n"]}
|
package/lib/types/Watcher.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Watcher.d.ts","sourceRoot":"","sources":["../../src/types/Watcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Watcher.js","sourceRoot":"","sources":["../../src/types/Watcher.ts"],"names":[],"mappings":"","sourcesContent":["import type { BundleRequest } from '
|
|
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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/cli",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.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,28 +11,23 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@lage-run/target-graph": "^0.8.6",
|
|
14
|
-
"@ms-cloudpack/api-server": "^0.
|
|
15
|
-
"@ms-cloudpack/bundler": "^0.14.
|
|
14
|
+
"@ms-cloudpack/api-server": "^0.13.0",
|
|
15
|
+
"@ms-cloudpack/bundler": "^0.14.6",
|
|
16
16
|
"@ms-cloudpack/config": "^0.11.0",
|
|
17
17
|
"@ms-cloudpack/create-express-app": "^1.3.9",
|
|
18
18
|
"@ms-cloudpack/json-utilities": "^0.0.7",
|
|
19
|
-
"@ms-cloudpack/overlay": "^0.14.
|
|
19
|
+
"@ms-cloudpack/overlay": "^0.14.4",
|
|
20
20
|
"@ms-cloudpack/package-utilities": "^5.1.0",
|
|
21
21
|
"@ms-cloudpack/path-string-parsing": "^1.0.3",
|
|
22
22
|
"@ms-cloudpack/path-utilities": "^2.3.2",
|
|
23
|
-
"@ms-cloudpack/task-reporter": "^0.7.
|
|
23
|
+
"@ms-cloudpack/task-reporter": "^0.7.1",
|
|
24
24
|
"@ms-cloudpack/telemetry": "^0.3.6",
|
|
25
|
-
"@ms-cloudpack/remote-cache": "^0.0.1",
|
|
26
25
|
"commander": "^11.0.0",
|
|
27
26
|
"cross-spawn": "^7.0.3",
|
|
28
|
-
"es-module-lexer": "^1.0.3",
|
|
29
|
-
"fast-glob": "^3.2.12",
|
|
30
|
-
"filenamify": "^6.0.0",
|
|
31
27
|
"fs-extra": "^11.0.0",
|
|
32
28
|
"glob": "^8.0.0",
|
|
33
29
|
"glob-hasher": "^1.2.1",
|
|
34
30
|
"jsdom": "^22.0.0",
|
|
35
|
-
"object-hash": "^3.0.0",
|
|
36
31
|
"open": "^9.0.0",
|
|
37
32
|
"prompts": "^2.4.2",
|
|
38
33
|
"semver": "^7.3.7",
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns a dictionary where key is the package name and value is a set of required paths.
|
|
3
|
-
* Eg. `{ '@fluentui/react': new Set([ '.', './lib/Button' ]) }`
|
|
4
|
-
*/
|
|
5
|
-
export declare function findImports(filePaths: string[]): Promise<Record<string, Set<string>>>;
|
|
6
|
-
//# sourceMappingURL=findImports.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findImports.d.ts","sourceRoot":"","sources":["../../../src/commands/init/findImports.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAoE3F"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { parse } from 'es-module-lexer';
|
|
2
|
-
import fsPromises from 'fs/promises';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { parseImportString } from '@ms-cloudpack/path-string-parsing';
|
|
5
|
-
import { sourceExtensions } from '@ms-cloudpack/path-utilities';
|
|
6
|
-
import { builtinModules } from 'module';
|
|
7
|
-
/** Treat files with no extension as JS for purposes below */
|
|
8
|
-
const allSourceExtensions = [...sourceExtensions, ''];
|
|
9
|
-
/**
|
|
10
|
-
* Returns a dictionary where key is the package name and value is a set of required paths.
|
|
11
|
-
* Eg. `{ '@fluentui/react': new Set([ '.', './lib/Button' ]) }`
|
|
12
|
-
*/
|
|
13
|
-
export async function findImports(filePaths) {
|
|
14
|
-
const requiredExports = {};
|
|
15
|
-
const visitedPaths = new Set(filePaths);
|
|
16
|
-
const pathsToParse = [...filePaths];
|
|
17
|
-
while (pathsToParse.length) {
|
|
18
|
-
const filePath = pathsToParse.shift();
|
|
19
|
-
// Ignore any non-JS/TS files such as SVGs and sourcemaps
|
|
20
|
-
if (!filePath || !allSourceExtensions.includes(path.extname(filePath))) {
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
const source = await fsPromises.readFile(filePath, 'utf-8');
|
|
24
|
-
let rawImports;
|
|
25
|
-
try {
|
|
26
|
-
[rawImports] = parse(source);
|
|
27
|
-
}
|
|
28
|
-
catch (err) {
|
|
29
|
-
// This could happen if the source file isn't valid JS
|
|
30
|
-
// (unlikely after adding the check above to only attempt parsing JS/TS files)
|
|
31
|
-
console.warn(`Failed to parse ${filePath}:`, err);
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
const imports = Array.from(new Set(rawImports))
|
|
35
|
-
.map((i) => {
|
|
36
|
-
// The es-module-lexer returns entries where the "n" property equals the import source.
|
|
37
|
-
// This includes the package name and path. For example, in this case:
|
|
38
|
-
//
|
|
39
|
-
// import { Button } from '@fluentui/react/lib/Button';
|
|
40
|
-
//
|
|
41
|
-
// The "n" property would be "@fluentui/react/lib/Button".
|
|
42
|
-
// The "s" and "e" properties represent the start/end character positions of
|
|
43
|
-
// the import source. The "ss" and "se" properties represent the start/end
|
|
44
|
-
// character positions of the import specifier starting with "import". This
|
|
45
|
-
// may be useful for determining if the import is sync or async.
|
|
46
|
-
//
|
|
47
|
-
// Currently when the import source is a backtick string, the "n" property
|
|
48
|
-
// is undefined. This is a bug in es-module-lexer. We may need to handle this
|
|
49
|
-
// at the javascript layer and expand it into multiple potential imports.
|
|
50
|
-
if (!i.n) {
|
|
51
|
-
console.debug(`Found an import that didn't parse correctly:\nFilename:\n${filePath}\n\nImport:\n${source.slice(i.s, i.e)}`);
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
return parseImportString(i.n);
|
|
55
|
-
})
|
|
56
|
-
.filter(Boolean);
|
|
57
|
-
for (const { packageName, importPath } of imports) {
|
|
58
|
-
if (packageName?.startsWith('.')) {
|
|
59
|
-
const localPath = path.resolve(path.dirname(filePath), packageName, importPath || '');
|
|
60
|
-
if (!visitedPaths.has(localPath)) {
|
|
61
|
-
visitedPaths.add(localPath);
|
|
62
|
-
pathsToParse.push(localPath);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else if (packageName && !packageName.startsWith('node:') && !builtinModules.includes(packageName)) {
|
|
66
|
-
requiredExports[packageName] ??= new Set();
|
|
67
|
-
requiredExports[packageName].add(importPath || '.');
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return requiredExports;
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=findImports.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findImports.js","sourceRoot":"","sources":["../../../src/commands/init/findImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAA2B,MAAM,mCAAmC,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC,6DAA6D;AAC7D,MAAM,mBAAmB,GAAG,CAAC,GAAG,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAEtD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,SAAmB;IACnD,MAAM,eAAe,GAAgC,EAAE,CAAC;IACxD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;IACxC,MAAM,YAAY,GAAa,CAAC,GAAG,SAAS,CAAC,CAAC;IAE9C,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC;QACtC,yDAAyD;QACzD,IAAI,CAAC,QAAQ,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE;YACtE,SAAS;SACV;QAED,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC5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C,GAAG,CAAC,SAAS,CAAC,CAAC;oBAC5B,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;iBAC9B;aACF;iBAAM,IAAI,WAAW,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;gBACnG,eAAe,CAAC,WAAW,CAAC,KAAK,IAAI,GAAG,EAAE,CAAC;gBAC3C,eAAe,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC;aACrD;SACF;KACF;IAED,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import { parse } from 'es-module-lexer';\nimport fsPromises from 'fs/promises';\nimport path from 'path';\nimport { parseImportString, type ImportStringResult } from '@ms-cloudpack/path-string-parsing';\nimport { sourceExtensions } from '@ms-cloudpack/path-utilities';\nimport { builtinModules } from 'module';\n\n/** Treat files with no extension as JS for purposes below */\nconst allSourceExtensions = [...sourceExtensions, ''];\n\n/**\n * Returns a dictionary where key is the package name and value is a set of required paths.\n * Eg. `{ '@fluentui/react': new Set([ '.', './lib/Button' ]) }`\n */\nexport async function findImports(filePaths: string[]): Promise<Record<string, Set<string>>> {\n const requiredExports: Record<string, Set<string>> = {};\n const visitedPaths = new Set(filePaths);\n const pathsToParse: string[] = [...filePaths];\n\n while (pathsToParse.length) {\n const filePath = pathsToParse.shift();\n // Ignore any non-JS/TS files such as SVGs and sourcemaps\n if (!filePath || !allSourceExtensions.includes(path.extname(filePath))) {\n continue;\n }\n\n const source = await fsPromises.readFile(filePath, 'utf-8');\n let rawImports: ReturnType<typeof parse>[0];\n try {\n [rawImports] = parse(source);\n } catch (err) {\n // This could happen if the source file isn't valid JS\n // (unlikely after adding the check above to only attempt parsing JS/TS files)\n console.warn(`Failed to parse ${filePath}:`, err);\n continue;\n }\n const imports = Array.from(new Set(rawImports))\n .map((i) => {\n // The es-module-lexer returns entries where the \"n\" property equals the import source.\n // This includes the package name and path. For example, in this case:\n //\n // import { Button } from '@fluentui/react/lib/Button';\n //\n // The \"n\" property would be \"@fluentui/react/lib/Button\".\n // The \"s\" and \"e\" properties represent the start/end character positions of\n // the import source. The \"ss\" and \"se\" properties represent the start/end\n // character positions of the import specifier starting with \"import\". This\n // may be useful for determining if the import is sync or async.\n //\n // Currently when the import source is a backtick string, the \"n\" property\n // is undefined. This is a bug in es-module-lexer. We may need to handle this\n // at the javascript layer and expand it into multiple potential imports.\n if (!i.n) {\n console.debug(\n `Found an import that didn't parse correctly:\\nFilename:\\n${filePath}\\n\\nImport:\\n${source.slice(\n i.s,\n i.e,\n )}`,\n );\n return undefined;\n }\n\n return parseImportString(i.n);\n })\n .filter(Boolean) as ImportStringResult[];\n\n for (const { packageName, importPath } of imports) {\n if (packageName?.startsWith('.')) {\n const localPath = path.resolve(path.dirname(filePath), packageName, importPath || '');\n\n if (!visitedPaths.has(localPath)) {\n visitedPaths.add(localPath);\n pathsToParse.push(localPath);\n }\n } else if (packageName && !packageName.startsWith('node:') && !builtinModules.includes(packageName)) {\n requiredExports[packageName] ??= new Set();\n requiredExports[packageName].add(importPath || '.');\n }\n }\n }\n\n return requiredExports;\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { CloudpackConfig } from '@ms-cloudpack/config';
|
|
2
|
-
import type { ResolveMapEntry } from '@ms-cloudpack/package-utilities';
|
|
3
|
-
import type { BundleRequest } from '../../types/BundleRequest.js';
|
|
4
|
-
import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
|
|
5
|
-
export declare function createBundleRequestForPackage(options: {
|
|
6
|
-
packageEntry: ResolveMapEntry;
|
|
7
|
-
}, context: {
|
|
8
|
-
config: CloudpackConfig;
|
|
9
|
-
packages: PackageDefinitionsCache;
|
|
10
|
-
}): Promise<BundleRequest>;
|
|
11
|
-
//# sourceMappingURL=createBundleRequestForPackage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBundleRequestForPackage.d.ts","sourceRoot":"","sources":["../../../src/commands/start/createBundleRequestForPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,wBAAsB,6BAA6B,CACjD,OAAO,EAAE;IACP,YAAY,EAAE,eAAe,CAAC;CAC/B,EACD,OAAO,EAAE;IACP,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,uBAAuB,CAAC;CACnC,GACA,OAAO,CAAC,aAAa,CAAC,CAmBxB"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { getBundleDetails } from '../../common/getBundleDetails.js';
|
|
2
|
-
export async function createBundleRequestForPackage(options, context) {
|
|
3
|
-
const { packageEntry } = options;
|
|
4
|
-
const { config } = context;
|
|
5
|
-
const { features = {} } = config;
|
|
6
|
-
const { path, version, name } = packageEntry;
|
|
7
|
-
const { bundleId, isExternal, outputLocation } = await getBundleDetails({ packagePath: path }, context);
|
|
8
|
-
return {
|
|
9
|
-
id: bundleId,
|
|
10
|
-
packagePath: path,
|
|
11
|
-
packageName: name,
|
|
12
|
-
isExternal,
|
|
13
|
-
outputPath: outputLocation.path,
|
|
14
|
-
version,
|
|
15
|
-
disableSourceMaps: features.disableSourceMaps,
|
|
16
|
-
enableFindImports: features.enqueueDependencies,
|
|
17
|
-
enableCacheInternalPackages: features.cacheInternalPackages,
|
|
18
|
-
...context,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=createBundleRequestForPackage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBundleRequestForPackage.js","sourceRoot":"","sources":["../../../src/commands/start/createBundleRequestForPackage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAIpE,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAEC,EACD,OAGC;IAED,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IACjC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;IACjC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC;IAC7C,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,MAAM,gBAAgB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IAExG,OAAO;QACL,EAAE,EAAE,QAAQ;QACZ,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,IAAI;QACjB,UAAU;QACV,UAAU,EAAE,cAAc,CAAC,IAAI;QAC/B,OAAO;QACP,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB;QAC7C,iBAAiB,EAAE,QAAQ,CAAC,mBAAmB;QAC/C,2BAA2B,EAAE,QAAQ,CAAC,qBAAqB;QAC3D,GAAG,OAAO;KACX,CAAC;AACJ,CAAC","sourcesContent":["import type { CloudpackConfig } from '@ms-cloudpack/config';\nimport type { ResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport { getBundleDetails } from '../../common/getBundleDetails.js';\nimport type { BundleRequest } from '../../types/BundleRequest.js';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\n\nexport async function createBundleRequestForPackage(\n options: {\n packageEntry: ResolveMapEntry;\n },\n context: {\n config: CloudpackConfig;\n packages: PackageDefinitionsCache;\n },\n): Promise<BundleRequest> {\n const { packageEntry } = options;\n const { config } = context;\n const { features = {} } = config;\n const { path, version, name } = packageEntry;\n const { bundleId, isExternal, outputLocation } = await getBundleDetails({ packagePath: path }, context);\n\n return {\n id: bundleId,\n packagePath: path,\n packageName: name,\n isExternal,\n outputPath: outputLocation.path,\n version,\n disableSourceMaps: features.disableSourceMaps,\n enableFindImports: features.enqueueDependencies,\n enableCacheInternalPackages: features.cacheInternalPackages,\n ...context,\n };\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { BundleTaskOptions } from '../../types/BundleTaskOptions.js';
|
|
2
|
-
import type { BundleRequest } from '../../types/BundleRequest.js';
|
|
3
|
-
import type { Task } from '@ms-cloudpack/api-server';
|
|
4
|
-
import type { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
5
|
-
/**
|
|
6
|
-
* Creates a bundle task tracked in the task runner of the api server. This allows active tasks to be tracked
|
|
7
|
-
* remotely (e.g. in the browser) and allows the user to cancel tasks.
|
|
8
|
-
*/
|
|
9
|
-
export declare function createBundleTask(bundleRequest: BundleRequest, options?: BundleTaskOptions, reporter?: TaskReporter): Task<BundleRequest>;
|
|
10
|
-
//# sourceMappingURL=createBundleTask.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBundleTask.d.ts","sourceRoot":"","sources":["../../../src/commands/start/createBundleTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,IAAI,EAAiC,MAAM,0BAA0B,CAAC;AAIpF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,aAAa,EAC5B,OAAO,CAAC,EAAE,iBAAiB,EAC3B,QAAQ,CAAC,EAAE,YAAY,GACtB,IAAI,CAAC,aAAa,CAAC,CAoCrB"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import { bundleTask } from '../../tasks/bundleTask.js';
|
|
4
|
-
/**
|
|
5
|
-
* Creates a bundle task tracked in the task runner of the api server. This allows active tasks to be tracked
|
|
6
|
-
* remotely (e.g. in the browser) and allows the user to cancel tasks.
|
|
7
|
-
*/
|
|
8
|
-
export function createBundleTask(bundleRequest, options, reporter) {
|
|
9
|
-
const { id, packageName, version, outputPath, packagePath, isExternal } = bundleRequest;
|
|
10
|
-
return {
|
|
11
|
-
name: `Bundle ${packageName}@${version}`,
|
|
12
|
-
id,
|
|
13
|
-
dir: `${path.join(packagePath, 'src')}`,
|
|
14
|
-
watch: !isExternal,
|
|
15
|
-
async execute() {
|
|
16
|
-
await bundleTask({ bundleRequest, options, reporter });
|
|
17
|
-
return bundleRequest;
|
|
18
|
-
},
|
|
19
|
-
clear: () => {
|
|
20
|
-
bundleRequest.result?.dispose?.();
|
|
21
|
-
bundleRequest.result = undefined;
|
|
22
|
-
// eslint-disable-next-line no-restricted-syntax -- this function can't be async
|
|
23
|
-
fs.rmSync(outputPath, { recursive: true, force: true });
|
|
24
|
-
},
|
|
25
|
-
onDispose: () => {
|
|
26
|
-
bundleRequest.result?.dispose?.();
|
|
27
|
-
},
|
|
28
|
-
getErrors: () => bundleRequest.result?.errors,
|
|
29
|
-
getStartDescription: () => ({
|
|
30
|
-
id,
|
|
31
|
-
name: `Bundle ${packageName}@${version}`,
|
|
32
|
-
inputPath: packagePath || '',
|
|
33
|
-
outputPath,
|
|
34
|
-
}),
|
|
35
|
-
getEndDescription: (taskResult) => ({
|
|
36
|
-
id,
|
|
37
|
-
errors: taskResult?.result?.errors,
|
|
38
|
-
warnings: taskResult?.result?.warnings,
|
|
39
|
-
}),
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=createBundleTask.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBundleTask.js","sourceRoot":"","sources":["../../../src/commands/start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AU;SACX,CAAC;QACF,iBAAiB,EAAE,CAAC,UAAU,EAAE,EAAE,CAChC,CAAC;YACC,EAAE;YACF,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM;YAClC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ;SACvC,CAAuB;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["import type { BundleTaskOptions } from '../../types/BundleTaskOptions.js';\nimport type { BundleRequest } from '../../types/BundleRequest.js';\nimport type { Task, TaskEndDescription, TaskError } from '@ms-cloudpack/api-server';\nimport path from 'path';\nimport fs from 'fs';\nimport { bundleTask } from '../../tasks/bundleTask.js';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\n\n/**\n * Creates a bundle task tracked in the task runner of the api server. This allows active tasks to be tracked\n * remotely (e.g. in the browser) and allows the user to cancel tasks.\n */\nexport function createBundleTask(\n bundleRequest: BundleRequest,\n options?: BundleTaskOptions,\n reporter?: TaskReporter,\n): Task<BundleRequest> {\n const { id, packageName, version, outputPath, packagePath, isExternal } = bundleRequest;\n\n return {\n name: `Bundle ${packageName}@${version}`,\n id,\n dir: `${path.join(packagePath, 'src')}`,\n watch: !isExternal,\n async execute(): Promise<BundleRequest> {\n await bundleTask({ bundleRequest, options, reporter });\n\n return bundleRequest;\n },\n clear: () => {\n bundleRequest.result?.dispose?.();\n bundleRequest.result = undefined;\n // eslint-disable-next-line no-restricted-syntax -- this function can't be async\n fs.rmSync(outputPath, { recursive: true, force: true });\n },\n onDispose: () => {\n bundleRequest.result?.dispose?.();\n },\n getErrors: () => bundleRequest.result?.errors as unknown as TaskError[],\n getStartDescription: () => ({\n id,\n name: `Bundle ${packageName}@${version}`,\n inputPath: packagePath || '',\n outputPath,\n }),\n getEndDescription: (taskResult) =>\n ({\n id,\n errors: taskResult?.result?.errors,\n warnings: taskResult?.result?.warnings,\n }) as TaskEndDescription,\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setupReporting.d.ts","sourceRoot":"","sources":["../../../src/commands/start/setupReporting.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAgB9D,wBAAsB,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,QAAQ,CAAC,iBAmBlG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setupReporting.js","sourceRoot":"","sources":["../../../src/commands/start/setupReporting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACL,IAAI,EACJ,oBAAoB,EACpB,oBAAoB,EAEpB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AAErC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;AACzB,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxE,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACrB,MAAM,iBAAiB,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,QAAQ,CAAC;AACjG,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAA4C;IACjG,QAAQ,CAAC,UAAU,CAAC;QAClB,WAAW,EAAE,WAAW;QACxB,OAAO;QACP,WAAW,EAAE,GAAG,EAAE,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG;QAC/D,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,GAAG,oBAAoB;QACvB,GAAG,CAAC,iBAAiB,IAAI,oBAAoB,CAAC;QAC9C,GAAG,CAAC,eAAe,IAAI,kBAAkB,CAAC;KACpB,CAAC,CAAC;IAE1B,MAAM,aAAa,CACjB;QACE,eAAe;QACf,iBAAiB;QACjB,eAAe,EAAE,MAAM,CAAC,SAAS;KAClC,EACD,QAAQ,CACT,CAAC;AACJ,CAAC","sourcesContent":["import { getVersion } from '@ms-cloudpack/package-utilities';\nimport type { TaskContext } from '../../types/TaskContext.js';\nimport { initTelemetry } from '../../initTelemetry.js';\nimport {\n bold,\n defaultLoggingConfig,\n verboseLoggingConfig,\n type TaskReporterOptions,\n debugLoggingConfig,\n} from '@ms-cloudpack/task-reporter';\n\nconst { argv } = process;\nconst useDebugLogging = argv.includes('--debug') || argv.includes('-d');\nconst verb = argv[2];\nconst useVerboseLogging = argv.includes('--verbose') || argv.includes('-v') || verb === 'bundle';\nconst version = getVersion(import.meta.url);\n\nexport async function setupReporting({ reporter, config }: Pick<TaskContext, 'reporter' | 'config'>) {\n reporter.setOptions({\n productName: 'Cloudpack',\n version,\n description: () => `Running \"${bold(argv.slice(2).join(' '))}\"`,\n helpMessage: config.helpMessage,\n ...defaultLoggingConfig,\n ...(useVerboseLogging && verboseLoggingConfig),\n ...(useDebugLogging && debugLoggingConfig),\n } as TaskReporterOptions);\n\n await initTelemetry(\n {\n useDebugLogging,\n useVerboseLogging,\n telemetryConfig: config.telemetry,\n },\n reporter,\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/Task.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAC;CAChD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Task.js","sourceRoot":"","sources":["../../../src/commands/sync/Task.ts"],"names":[],"mappings":"","sourcesContent":["import type { TaskReporterTaskResult } from '@ms-cloudpack/task-reporter';\n\nexport interface Task {\n name: string;\n execute: () => Promise<TaskReporterTaskResult>;\n}\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { RemoteCacheClient } from '@ms-cloudpack/remote-cache';
|
|
2
|
-
import { type PackageToSync } from './getPackagesToSync.js';
|
|
3
|
-
import type { Task } from './Task.js';
|
|
4
|
-
export declare function createDownloadTask(client: RemoteCacheClient, { folderName, packageName, path, version }: PackageToSync): Task;
|
|
5
|
-
//# sourceMappingURL=createDownloadTask.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createDownloadTask.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/createDownloadTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAItC,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,iBAAiB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,aAAa,GACxD,IAAI,CAmBN"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {} from './getPackagesToSync.js';
|
|
2
|
-
import { existsSync } from 'fs';
|
|
3
|
-
import { bulletedList } from '@ms-cloudpack/task-reporter';
|
|
4
|
-
export function createDownloadTask(client, { folderName, packageName, path, version }) {
|
|
5
|
-
return {
|
|
6
|
-
name: `Downloading ${packageName}@${version}`,
|
|
7
|
-
execute: async () => {
|
|
8
|
-
if (existsSync(path)) {
|
|
9
|
-
return { status: 'skip', message: 'Package is already exist in the local cache.' };
|
|
10
|
-
}
|
|
11
|
-
const result = await client.downloadFolder(folderName, path);
|
|
12
|
-
if (!result) {
|
|
13
|
-
return { status: 'skip', message: `not found in the remote cache.` };
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
status: 'complete',
|
|
17
|
-
details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),
|
|
18
|
-
};
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=createDownloadTask.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createDownloadTask.js","sourceRoot":"","sources":["../../../src/commands/sync/createDownloadTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,UAAU,kBAAkB,CAChC,MAAyB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAiB;IAEzD,OAAO;QACL,IAAI,EAAE,eAAe,WAAW,IAAI,OAAO,EAAE;QAC7C,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;gBACpB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,8CAA8C,EAAE,CAAC;aACpF;YAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAC7D,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gCAAgC,EAAE,CAAC;aACtE;YAED,OAAO;gBACL,MAAM,EAAE,UAAU;gBAClB,OAAO,EAAE,YAAY,CAAC,CAAC,eAAe,UAAU,EAAE,EAAE,SAAS,IAAI,EAAE,EAAE,YAAY,OAAO,EAAE,CAAC,CAAC;aAC7F,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { RemoteCacheClient } from '@ms-cloudpack/remote-cache';\nimport { type PackageToSync } from './getPackagesToSync.js';\nimport type { Task } from './Task.js';\nimport { existsSync } from 'fs';\nimport { bulletedList } from '@ms-cloudpack/task-reporter';\n\nexport function createDownloadTask(\n client: RemoteCacheClient,\n { folderName, packageName, path, version }: PackageToSync,\n): Task {\n return {\n name: `Downloading ${packageName}@${version}`,\n execute: async () => {\n if (existsSync(path)) {\n return { status: 'skip', message: 'Package is already exist in the local cache.' };\n }\n\n const result = await client.downloadFolder(folderName, path);\n if (!result) {\n return { status: 'skip', message: `not found in the remote cache.` };\n }\n\n return {\n status: 'complete',\n details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),\n };\n },\n };\n}\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { RemoteCacheClient } from '@ms-cloudpack/remote-cache';
|
|
2
|
-
import type { PackageToSync } from './getPackagesToSync.js';
|
|
3
|
-
import type { Task } from './Task.js';
|
|
4
|
-
export declare function createUploadTask(client: RemoteCacheClient, { folderName, packageName, path, version }: PackageToSync): Task;
|
|
5
|
-
//# sourceMappingURL=createUploadTask.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createUploadTask.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/createUploadTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAItC,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,iBAAiB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,aAAa,GACxD,IAAI,CAeN"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'fs';
|
|
2
|
-
import { bulletedList } from '@ms-cloudpack/task-reporter';
|
|
3
|
-
export function createUploadTask(client, { folderName, packageName, path, version }) {
|
|
4
|
-
return {
|
|
5
|
-
name: `Uploading ${packageName}@${version}`,
|
|
6
|
-
execute: async () => {
|
|
7
|
-
if (!existsSync(path)) {
|
|
8
|
-
return { status: 'skip', message: `Not found in the local cache.` };
|
|
9
|
-
}
|
|
10
|
-
await client.uploadFolder(folderName, path);
|
|
11
|
-
return {
|
|
12
|
-
status: 'complete',
|
|
13
|
-
details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),
|
|
14
|
-
};
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=createUploadTask.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createUploadTask.js","sourceRoot":"","sources":["../../../src/commands/sync/createUploadTask.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,UAAU,gBAAgB,CAC9B,MAAyB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAiB;IAEzD,OAAO;QACL,IAAI,EAAE,aAAa,WAAW,IAAI,OAAO,EAAE;QAC3C,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;gBACrB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,+BAA+B,EAAE,CAAC;aACrE;YAED,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAC5C,OAAO;gBACL,MAAM,EAAE,UAAU;gBAClB,OAAO,EAAE,YAAY,CAAC,CAAC,eAAe,UAAU,EAAE,EAAE,SAAS,IAAI,EAAE,EAAE,YAAY,OAAO,EAAE,CAAC,CAAC;aAC7F,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { RemoteCacheClient } from '@ms-cloudpack/remote-cache';\nimport type { PackageToSync } from './getPackagesToSync.js';\nimport type { Task } from './Task.js';\nimport { existsSync } from 'fs';\nimport { bulletedList } from '@ms-cloudpack/task-reporter';\n\nexport function createUploadTask(\n client: RemoteCacheClient,\n { folderName, packageName, path, version }: PackageToSync,\n): Task {\n return {\n name: `Uploading ${packageName}@${version}`,\n execute: async () => {\n if (!existsSync(path)) {\n return { status: 'skip', message: `Not found in the local cache.` };\n }\n\n await client.uploadFolder(folderName, path);\n return {\n status: 'complete',\n details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),\n };\n },\n };\n}\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
2
|
-
export interface PackageToSync {
|
|
3
|
-
path: string;
|
|
4
|
-
folderName: string;
|
|
5
|
-
packageName: string;
|
|
6
|
-
version: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function getPackagesToSync(appPath: string, reporter: TaskReporter): Promise<PackageToSync[]>;
|
|
9
|
-
//# sourceMappingURL=getPackagesToSync.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPackagesToSync.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/getPackagesToSync.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAyBzG"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createPackageDefinitions, readConfig } from '@ms-cloudpack/config';
|
|
2
|
-
import { resolveDependenciesTask } from '../../tasks/resolveDependenciesTask.js';
|
|
3
|
-
import { findResolveMapEntry } from '@ms-cloudpack/package-utilities';
|
|
4
|
-
import { getBundleDetails } from '../../common/getBundleDetails.js';
|
|
5
|
-
export async function getPackagesToSync(appPath, reporter) {
|
|
6
|
-
const list = [];
|
|
7
|
-
const config = await readConfig(appPath);
|
|
8
|
-
const packages = createPackageDefinitions({ config });
|
|
9
|
-
const resolveMap = await resolveDependenciesTask({ appPath }, { packages, reporter });
|
|
10
|
-
const packageEntries = Object.keys(resolveMap)
|
|
11
|
-
.map((packageName) => findResolveMapEntry({
|
|
12
|
-
packageName,
|
|
13
|
-
resolveMap,
|
|
14
|
-
}))
|
|
15
|
-
.filter((item) => item);
|
|
16
|
-
for (const { path: packagePath, name, version } of packageEntries) {
|
|
17
|
-
const details = await getBundleDetails({ packagePath }, { packages });
|
|
18
|
-
if (details.isExternal) {
|
|
19
|
-
list.push({ ...details.outputLocation, packageName: name, version });
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return list;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=getPackagesToSync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPackagesToSync.js","sourceRoot":"","sources":["../../../src/commands/sync/getPackagesToSync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAwB,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAUpE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAe,EAAE,QAAsB;IAC7E,MAAM,IAAI,GAAoB,EAAE,CAAC;IAEjC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAEtD,MAAM,UAAU,GAAG,MAAM,uBAAuB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;IAEtF,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;SAC3C,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CACnB,mBAAmB,CAAC;QAClB,WAAW;QACX,UAAU;KACX,CAAC,CACH;SACA,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAsB,CAAC;IAE/C,KAAK,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,cAAc,EAAE;QACjE,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtE,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;SACtE;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { createPackageDefinitions, readConfig } from '@ms-cloudpack/config';\nimport { resolveDependenciesTask } from '../../tasks/resolveDependenciesTask.js';\nimport { findResolveMapEntry, type ResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport { getBundleDetails } from '../../common/getBundleDetails.js';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\n\nexport interface PackageToSync {\n path: string;\n folderName: string;\n packageName: string;\n version: string;\n}\n\nexport async function getPackagesToSync(appPath: string, reporter: TaskReporter): Promise<PackageToSync[]> {\n const list: PackageToSync[] = [];\n\n const config = await readConfig(appPath);\n const packages = createPackageDefinitions({ config });\n\n const resolveMap = await resolveDependenciesTask({ appPath }, { packages, reporter });\n\n const packageEntries = Object.keys(resolveMap)\n .map((packageName) =>\n findResolveMapEntry({\n packageName,\n resolveMap,\n }),\n )\n .filter((item) => item) as ResolveMapEntry[];\n\n for (const { path: packagePath, name, version } of packageEntries) {\n const details = await getBundleDetails({ packagePath }, { packages });\n if (details.isExternal) {\n list.push({ ...details.outputLocation, packageName: name, version });\n }\n }\n\n return list;\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { TaskContext } from '../../types/TaskContext.js';
|
|
2
|
-
import type { SyncOptions } from './types/SyncOptions.js';
|
|
3
|
-
/**
|
|
4
|
-
* Syncs the packages to the remote cache.
|
|
5
|
-
* @param syncOptions - The options for the sync command.
|
|
6
|
-
* @param context - The task context.
|
|
7
|
-
* @returns The number of packages synced.
|
|
8
|
-
*/
|
|
9
|
-
export declare function syncInternal({ upload: isUpload }: SyncOptions, context: TaskContext): Promise<void>;
|
|
10
|
-
//# sourceMappingURL=syncInternal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"syncInternal.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/syncInternal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAW9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCzG"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { getPackagesToSync } from './getPackagesToSync.js';
|
|
2
|
-
import { createUploadTask } from './createUploadTask.js';
|
|
3
|
-
import { createDownloadTask } from './createDownloadTask.js';
|
|
4
|
-
import { PerfMarkerSyncStart, PerfMeasurementSyncDownload, PerfMeasurementSyncUpload, } from '../../performance/markers.js';
|
|
5
|
-
import { readConfig } from '@ms-cloudpack/config';
|
|
6
|
-
import { RemoteCacheClient, getAuthenticatedConnectionString } from '@ms-cloudpack/remote-cache';
|
|
7
|
-
/**
|
|
8
|
-
* Syncs the packages to the remote cache.
|
|
9
|
-
* @param syncOptions - The options for the sync command.
|
|
10
|
-
* @param context - The task context.
|
|
11
|
-
* @returns The number of packages synced.
|
|
12
|
-
*/
|
|
13
|
-
export async function syncInternal({ upload: isUpload }, context) {
|
|
14
|
-
const { appPath, reporter } = context;
|
|
15
|
-
const config = await readConfig(appPath);
|
|
16
|
-
if (!config.remoteCache) {
|
|
17
|
-
console.warn('Remote cache is not configured. Please add remoteCache to your cloudpack.config.json file.');
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const { container, storageAccount } = config.remoteCache;
|
|
21
|
-
const connectionString = await getAuthenticatedConnectionString({
|
|
22
|
-
storageAccount,
|
|
23
|
-
container,
|
|
24
|
-
permissions: { read: !isUpload, write: isUpload },
|
|
25
|
-
});
|
|
26
|
-
const client = new RemoteCacheClient({
|
|
27
|
-
container,
|
|
28
|
-
connectionString,
|
|
29
|
-
});
|
|
30
|
-
const list = await getPackagesToSync(appPath, reporter);
|
|
31
|
-
performance.mark(PerfMarkerSyncStart);
|
|
32
|
-
const uploads = list.map((item) => {
|
|
33
|
-
const { name, execute } = isUpload ? createUploadTask(client, item) : createDownloadTask(client, item);
|
|
34
|
-
return reporter.runTask(name, execute);
|
|
35
|
-
});
|
|
36
|
-
await Promise.all(uploads);
|
|
37
|
-
performance.measure(isUpload ? PerfMeasurementSyncUpload : PerfMeasurementSyncDownload, PerfMarkerSyncStart);
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=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AAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAEtC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAChC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACvG,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAE3B,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,2BAA2B,EAAE,mBAAmB,CAAC,CAAC;AAC/G,CAAC","sourcesContent":["import type { TaskContext } from '../../types/TaskContext.js';\nimport { getPackagesToSync } from './getPackagesToSync.js';\nimport { createUploadTask } from './createUploadTask.js';\nimport { createDownloadTask } from './createDownloadTask.js';\nimport {\n PerfMarkerSyncStart,\n PerfMeasurementSyncDownload,\n PerfMeasurementSyncUpload,\n} from '../../performance/markers.js';\nimport { readConfig } from '@ms-cloudpack/config';\nimport { RemoteCacheClient, getAuthenticatedConnectionString } from '@ms-cloudpack/remote-cache';\nimport type { SyncOptions } from './types/SyncOptions.js';\n\n/**\n * Syncs the packages to the remote cache.\n * @param syncOptions - The options for the sync command.\n * @param context - The task context.\n * @returns The number of packages synced.\n */\nexport async function syncInternal({ upload: isUpload }: SyncOptions, context: TaskContext): Promise<void> {\n const { appPath, reporter } = context;\n\n const config = await readConfig(appPath);\n if (!config.remoteCache) {\n console.warn('Remote cache is not configured. Please add remoteCache to your cloudpack.config.json file.');\n return;\n }\n\n const { container, storageAccount } = config.remoteCache;\n const connectionString = await getAuthenticatedConnectionString({\n storageAccount,\n container,\n permissions: { read: !isUpload, write: isUpload },\n });\n\n const client = new RemoteCacheClient({\n container,\n connectionString,\n });\n\n const list = await getPackagesToSync(appPath, reporter);\n\n performance.mark(PerfMarkerSyncStart);\n\n const uploads = list.map((item) => {\n const { name, execute } = isUpload ? createUploadTask(client, item) : createDownloadTask(client, item);\n return reporter.runTask(name, execute);\n });\n\n await Promise.all(uploads);\n\n performance.measure(isUpload ? PerfMeasurementSyncUpload : PerfMeasurementSyncDownload, PerfMarkerSyncStart);\n}\n"]}
|