@ms-cloudpack/api-server 0.14.4 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apis/addPackageOverride.d.ts +5 -45
- package/lib/apis/addPackageOverride.d.ts.map +1 -1
- package/lib/apis/addPackageOverride.js +5 -5
- package/lib/apis/addPackageOverride.js.map +1 -1
- package/lib/apis/ensurePackageBundled.d.ts +5 -52
- package/lib/apis/ensurePackageBundled.d.ts.map +1 -1
- package/lib/apis/ensurePackageBundled.js +13 -7
- package/lib/apis/ensurePackageBundled.js.map +1 -1
- package/lib/apis/getData.d.ts +5 -41
- package/lib/apis/getData.d.ts.map +1 -1
- package/lib/apis/getData.js +4 -4
- package/lib/apis/getData.js.map +1 -1
- package/lib/apis/getSessionId.d.ts +5 -40
- package/lib/apis/getSessionId.d.ts.map +1 -1
- package/lib/apis/getSessionId.js +4 -4
- package/lib/apis/getSessionId.js.map +1 -1
- package/lib/apis/index.d.ts +1 -1
- package/lib/apis/index.d.ts.map +1 -1
- package/lib/apis/index.js.map +1 -1
- package/lib/apis/onDataChanged.d.ts +5 -41
- package/lib/apis/onDataChanged.d.ts.map +1 -1
- package/lib/apis/onDataChanged.js +4 -4
- package/lib/apis/onDataChanged.js.map +1 -1
- package/lib/apis/openCodeEditor.d.ts +4 -36
- package/lib/apis/openCodeEditor.d.ts.map +1 -1
- package/lib/apis/openCodeEditor.js +2 -2
- package/lib/apis/openCodeEditor.js.map +1 -1
- package/lib/apis/openConfigEditor.d.ts +4 -33
- package/lib/apis/openConfigEditor.d.ts.map +1 -1
- package/lib/apis/openConfigEditor.js +3 -1
- package/lib/apis/openConfigEditor.js.map +1 -1
- package/lib/apis/openFilePath.d.ts +4 -36
- package/lib/apis/openFilePath.d.ts.map +1 -1
- package/lib/apis/openFilePath.js +2 -2
- package/lib/apis/openFilePath.js.map +1 -1
- package/lib/apis/reportMetric.d.ts +4 -40
- package/lib/apis/reportMetric.d.ts.map +1 -1
- package/lib/apis/reportMetric.js +4 -3
- package/lib/apis/reportMetric.js.map +1 -1
- package/lib/apis/syncDownload.d.ts +4 -44
- package/lib/apis/syncDownload.d.ts.map +1 -1
- package/lib/apis/syncDownload.js +2 -2
- package/lib/apis/syncDownload.js.map +1 -1
- package/lib/apis/syncUpload.d.ts +4 -50
- package/lib/apis/syncUpload.d.ts.map +1 -1
- package/lib/apis/syncUpload.js +2 -2
- package/lib/apis/syncUpload.js.map +1 -1
- package/lib/apis/validatePackageOverride.d.ts +10 -42
- package/lib/apis/validatePackageOverride.d.ts.map +1 -1
- package/lib/apis/validatePackageOverride.js +3 -4
- package/lib/apis/validatePackageOverride.js.map +1 -1
- package/lib/apis.d.ts +2 -1
- package/lib/apis.d.ts.map +1 -1
- package/lib/apis.js +1 -0
- package/lib/apis.js.map +1 -1
- package/lib/common/createPartialApiContext.d.ts +14 -0
- package/lib/common/createPartialApiContext.d.ts.map +1 -0
- package/lib/common/createPartialApiContext.js +101 -0
- package/lib/common/createPartialApiContext.js.map +1 -0
- package/lib/common/createSession.d.ts +13 -0
- package/lib/common/createSession.d.ts.map +1 -0
- package/lib/common/createSession.js +62 -0
- package/lib/common/createSession.js.map +1 -0
- package/lib/data/busSources.d.ts +417 -89
- package/lib/data/busSources.d.ts.map +1 -1
- package/lib/index.d.ts +9 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/startApiServer.d.ts +2 -2
- package/lib/startApiServer.d.ts.map +1 -1
- package/lib/startApiServer.js +2 -2
- package/lib/startApiServer.js.map +1 -1
- package/lib/trpc/common.d.ts +5 -53
- package/lib/trpc/common.d.ts.map +1 -1
- package/lib/trpc/common.js +3 -9
- package/lib/trpc/common.js.map +1 -1
- package/lib/trpc/createAppRouter.d.ts +25 -400
- package/lib/trpc/createAppRouter.d.ts.map +1 -1
- package/lib/trpc/createCloudpackServer.d.ts +5 -20
- package/lib/trpc/createCloudpackServer.d.ts.map +1 -1
- package/lib/trpc/createCloudpackServer.js.map +1 -1
- package/lib/trpc/createContextFactory.d.ts +6 -22
- package/lib/trpc/createContextFactory.d.ts.map +1 -1
- package/lib/trpc/createContextFactory.js +4 -4
- package/lib/trpc/createContextFactory.js.map +1 -1
- package/lib/trpc/createRouterFromApis.d.ts +1 -16
- package/lib/trpc/createRouterFromApis.d.ts.map +1 -1
- package/lib/types/ApiParams.d.ts +12 -0
- package/lib/types/ApiParams.d.ts.map +1 -0
- package/lib/types/ApiParams.js +2 -0
- package/lib/types/ApiParams.js.map +1 -0
- package/lib/types/Context.d.ts +19 -0
- package/lib/types/Context.d.ts.map +1 -0
- package/lib/types/Context.js +2 -0
- package/lib/types/Context.js.map +1 -0
- package/lib/types/CreateHtmlFunction.d.ts.map +1 -1
- package/lib/types/CreateHtmlFunction.js.map +1 -1
- package/lib/types/CreateHtmlOptions.d.ts +7 -4
- package/lib/types/CreateHtmlOptions.d.ts.map +1 -1
- package/lib/types/CreateHtmlOptions.js.map +1 -1
- package/lib/types/CreateHtmlResult.d.ts +8 -1
- package/lib/types/CreateHtmlResult.d.ts.map +1 -1
- package/lib/types/CreateHtmlResult.js +0 -3
- package/lib/types/CreateHtmlResult.js.map +1 -1
- package/lib/types/CreateHtmlScript.d.ts.map +1 -1
- package/lib/types/CreateHtmlScript.js.map +1 -1
- package/lib/types/Task.d.ts +2 -2
- package/lib/types/Task.d.ts.map +1 -1
- package/lib/types/Task.js.map +1 -1
- package/lib/types/TaskDescription.d.ts +319 -63
- package/lib/types/TaskDescription.d.ts.map +1 -1
- package/lib/types/TaskEndDescription.d.ts +316 -60
- package/lib/types/TaskEndDescription.d.ts.map +1 -1
- package/lib/types/TaskEndDescription.js +3 -3
- package/lib/types/TaskEndDescription.js.map +1 -1
- package/lib/utilities/addOverride.d.ts +2 -6
- package/lib/utilities/addOverride.d.ts.map +1 -1
- package/lib/utilities/addOverride.js +1 -1
- package/lib/utilities/addOverride.js.map +1 -1
- package/lib/utilities/bundleTask.d.ts +3 -1
- package/lib/utilities/bundleTask.d.ts.map +1 -1
- package/lib/utilities/bundleTask.js +5 -4
- package/lib/utilities/bundleTask.js.map +1 -1
- package/lib/utilities/calculateHashOfInlinedDependencies.d.ts +9 -0
- package/lib/utilities/calculateHashOfInlinedDependencies.d.ts.map +1 -0
- package/lib/utilities/calculateHashOfInlinedDependencies.js +18 -0
- package/lib/utilities/calculateHashOfInlinedDependencies.js.map +1 -0
- package/lib/utilities/createBundleRequestForPackage.d.ts +2 -1
- package/lib/utilities/createBundleRequestForPackage.d.ts.map +1 -1
- package/lib/utilities/createBundleRequestForPackage.js +3 -2
- package/lib/utilities/createBundleRequestForPackage.js.map +1 -1
- package/lib/utilities/createBundleTask.d.ts +7 -1
- package/lib/utilities/createBundleTask.d.ts.map +1 -1
- package/lib/utilities/createBundleTask.js +4 -3
- package/lib/utilities/createBundleTask.js.map +1 -1
- package/lib/utilities/findPackageOverride.d.ts +1 -1
- package/lib/utilities/findPackageOverride.d.ts.map +1 -1
- package/lib/utilities/findPackageOverride.js.map +1 -1
- package/lib/utilities/getBundleDetails.d.ts +2 -0
- package/lib/utilities/getBundleDetails.d.ts.map +1 -1
- package/lib/utilities/getBundleDetails.js +3 -7
- package/lib/utilities/getBundleDetails.js.map +1 -1
- package/lib/utilities/getPackageHashEntries.d.ts +69 -0
- package/lib/utilities/getPackageHashEntries.d.ts.map +1 -0
- package/lib/utilities/getPackageHashEntries.js +29 -0
- package/lib/utilities/getPackageHashEntries.js.map +1 -0
- package/lib/utilities/getPackagePath.d.ts +16 -0
- package/lib/utilities/getPackagePath.d.ts.map +1 -0
- package/lib/utilities/getPackagePath.js +19 -0
- package/lib/utilities/getPackagePath.js.map +1 -0
- package/lib/utilities/getPackagesToSync.js +1 -1
- package/lib/utilities/getPackagesToSync.js.map +1 -1
- package/lib/utilities/getSourceHash.d.ts +9 -0
- package/lib/utilities/getSourceHash.d.ts.map +1 -0
- package/lib/utilities/getSourceHash.js +21 -0
- package/lib/utilities/getSourceHash.js.map +1 -0
- package/lib/utilities/hashPackage.d.ts +6 -4
- package/lib/utilities/hashPackage.d.ts.map +1 -1
- package/lib/utilities/hashPackage.js +21 -15
- package/lib/utilities/hashPackage.js.map +1 -1
- package/lib/utilities/resolveDependenciesTask.d.ts +16 -0
- package/lib/utilities/resolveDependenciesTask.d.ts.map +1 -0
- package/lib/utilities/resolveDependenciesTask.js +65 -0
- package/lib/utilities/resolveDependenciesTask.js.map +1 -0
- package/lib/utilities/validateOverride.d.ts +2 -6
- package/lib/utilities/validateOverride.d.ts.map +1 -1
- package/lib/utilities/validateOverride.js.map +1 -1
- package/package.json +10 -9
- package/lib/types/BundleResultExtended.d.ts +0 -23
- package/lib/types/BundleResultExtended.d.ts.map +0 -1
- package/lib/types/BundleResultExtended.js +0 -2
- package/lib/types/BundleResultExtended.js.map +0 -1
- package/lib/types/DevServer.d.ts +0 -33
- package/lib/types/DevServer.d.ts.map +0 -1
- package/lib/types/DevServer.js +0 -2
- package/lib/types/DevServer.js.map +0 -1
- package/lib/types/PackageOverride.d.ts +0 -8
- package/lib/types/PackageOverride.d.ts.map +0 -1
- package/lib/types/PackageOverride.js +0 -2
- package/lib/types/PackageOverride.js.map +0 -1
- package/lib/types/Route.d.ts +0 -23
- package/lib/types/Route.d.ts.map +0 -1
- package/lib/types/Route.js +0 -2
- package/lib/types/Route.js.map +0 -1
- package/lib/types/SessionStats.d.ts +0 -8
- package/lib/types/SessionStats.d.ts.map +0 -1
- package/lib/types/SessionStats.js +0 -2
- package/lib/types/SessionStats.js.map +0 -1
- package/lib/types/TaskError.d.ts +0 -25
- package/lib/types/TaskError.d.ts.map +0 -1
- package/lib/types/TaskError.js +0 -10
- package/lib/types/TaskError.js.map +0 -1
- package/lib/types/TelemetryConfig.d.ts +0 -7
- package/lib/types/TelemetryConfig.d.ts.map +0 -1
- package/lib/types/TelemetryConfig.js +0 -2
- package/lib/types/TelemetryConfig.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CloudpackConfig } from '@ms-cloudpack/config';
|
|
2
|
-
import type { ResolveMapEntry } from '@ms-cloudpack/package-utilities';
|
|
2
|
+
import type { ResolveMap, ResolveMapEntry } from '@ms-cloudpack/package-utilities';
|
|
3
3
|
import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
|
|
4
4
|
import type { BundleRequest } from '../types/BundleRequest.js';
|
|
5
5
|
export declare function createBundleRequestForPackage(options: {
|
|
@@ -11,5 +11,6 @@ export declare function createBundleRequestForPackage(options: {
|
|
|
11
11
|
}, context: {
|
|
12
12
|
config: CloudpackConfig;
|
|
13
13
|
packages: PackageDefinitionsCache;
|
|
14
|
+
resolveMap: ResolveMap;
|
|
14
15
|
}): Promise<BundleRequest>;
|
|
15
16
|
//# sourceMappingURL=createBundleRequestForPackage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBundleRequestForPackage.d.ts","sourceRoot":"","sources":["../../src/utilities/createBundleRequestForPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"createBundleRequestForPackage.d.ts","sourceRoot":"","sources":["../../src/utilities/createBundleRequestForPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,wBAAsB,6BAA6B,CACjD,OAAO,EAAE;IACP,YAAY,EAAE,eAAe,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,EACD,OAAO,EAAE;IACP,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,UAAU,EAAE,UAAU,CAAC;CACxB,GACA,OAAO,CAAC,aAAa,CAAC,CAqBxB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getBundleDetails } from '../utilities/getBundleDetails.js';
|
|
2
2
|
export async function createBundleRequestForPackage(options, context) {
|
|
3
3
|
const { packageEntry } = options;
|
|
4
|
-
const { config } = context;
|
|
4
|
+
const { config, packages } = context;
|
|
5
5
|
const { features = {} } = config;
|
|
6
6
|
const { path, version, name } = packageEntry;
|
|
7
7
|
const { bundleId, isExternal, outputLocation } = await getBundleDetails({ packagePath: path }, context);
|
|
@@ -16,7 +16,8 @@ export async function createBundleRequestForPackage(options, context) {
|
|
|
16
16
|
enableFindImports: options.enableFindImports ?? features.enqueueDependencies,
|
|
17
17
|
enableCacheInternalPackages: features.cacheInternalPackages,
|
|
18
18
|
bundlerType: options.bundlerType,
|
|
19
|
-
|
|
19
|
+
config,
|
|
20
|
+
packages,
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
23
|
//# sourceMappingURL=createBundleRequestForPackage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBundleRequestForPackage.js","sourceRoot":"","sources":["../../src/utilities/createBundleRequestForPackage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAMC,EACD,
|
|
1
|
+
{"version":3,"file":"createBundleRequestForPackage.js","sourceRoot":"","sources":["../../src/utilities/createBundleRequestForPackage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAMC,EACD,OAIC;IAED,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IACjC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IACrC,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,OAAO,CAAC,UAAU,IAAI,cAAc,CAAC,IAAI;QACrD,OAAO;QACP,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,IAAI,QAAQ,CAAC,iBAAiB;QAC1E,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,IAAI,QAAQ,CAAC,mBAAmB;QAC5E,2BAA2B,EAAE,QAAQ,CAAC,qBAAqB;QAC3D,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,MAAM;QACN,QAAQ;KACT,CAAC;AACJ,CAAC","sourcesContent":["import type { CloudpackConfig } from '@ms-cloudpack/config';\nimport type { ResolveMap, ResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport { getBundleDetails } from '../utilities/getBundleDetails.js';\nimport type { BundleRequest } from '../types/BundleRequest.js';\n\nexport async function createBundleRequestForPackage(\n options: {\n packageEntry: ResolveMapEntry;\n outputPath?: string;\n bundlerType?: string;\n disableSourceMaps?: boolean;\n enableFindImports?: boolean;\n },\n context: {\n config: CloudpackConfig;\n packages: PackageDefinitionsCache;\n resolveMap: ResolveMap;\n },\n): Promise<BundleRequest> {\n const { packageEntry } = options;\n const { config, packages } = 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: options.outputPath ?? outputLocation.path,\n version,\n disableSourceMaps: options.disableSourceMaps ?? features.disableSourceMaps,\n enableFindImports: options.enableFindImports ?? features.enqueueDependencies,\n enableCacheInternalPackages: features.cacheInternalPackages,\n bundlerType: options.bundlerType,\n config,\n packages,\n };\n}\n"]}
|
|
@@ -2,9 +2,15 @@ import type { BundleTaskOptions } from '../types/BundleTaskOptions.js';
|
|
|
2
2
|
import type { BundleRequest } from '../types/BundleRequest.js';
|
|
3
3
|
import type { Task } from '../types/Task.js';
|
|
4
4
|
import type { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
5
|
+
import type { ResolveMap } from '@ms-cloudpack/package-utilities';
|
|
5
6
|
/**
|
|
6
7
|
* Creates a bundle task tracked in the task runner of the api server. This allows active tasks to be tracked
|
|
7
8
|
* remotely (e.g. in the browser) and allows the user to cancel tasks.
|
|
8
9
|
*/
|
|
9
|
-
export declare function createBundleTask(
|
|
10
|
+
export declare function createBundleTask(params: {
|
|
11
|
+
bundleRequest: BundleRequest;
|
|
12
|
+
resolveMap: ResolveMap;
|
|
13
|
+
options?: BundleTaskOptions;
|
|
14
|
+
reporter?: TaskReporter;
|
|
15
|
+
}): Task<BundleRequest>;
|
|
10
16
|
//# sourceMappingURL=createBundleTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBundleTask.d.ts","sourceRoot":"","sources":["../../src/utilities/createBundleTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"createBundleTask.d.ts","sourceRoot":"","sources":["../../src/utilities/createBundleTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAK7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,aAAa,EAAE,aAAa,CAAC;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB,GAAG,IAAI,CAAC,aAAa,CAAC,CAqCtB"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import fs from 'fs';
|
|
3
|
-
import { bundleTask } from '
|
|
3
|
+
import { bundleTask } from './bundleTask.js';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a bundle task tracked in the task runner of the api server. This allows active tasks to be tracked
|
|
6
6
|
* remotely (e.g. in the browser) and allows the user to cancel tasks.
|
|
7
7
|
*/
|
|
8
|
-
export function createBundleTask(
|
|
8
|
+
export function createBundleTask(params) {
|
|
9
|
+
const { bundleRequest, resolveMap, options, reporter } = params;
|
|
9
10
|
const { id, packageName, version, outputPath, packagePath, isExternal } = bundleRequest;
|
|
10
11
|
return {
|
|
11
12
|
name: `Bundle ${packageName}@${version}`,
|
|
@@ -13,7 +14,7 @@ export function createBundleTask(bundleRequest, options, reporter) {
|
|
|
13
14
|
dir: `${path.join(packagePath, 'src')}`,
|
|
14
15
|
watch: !isExternal,
|
|
15
16
|
async execute() {
|
|
16
|
-
await bundleTask({ bundleRequest, options, reporter });
|
|
17
|
+
await bundleTask({ bundleRequest, options, reporter, resolveMap });
|
|
17
18
|
return bundleRequest;
|
|
18
19
|
},
|
|
19
20
|
clear: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBundleTask.js","sourceRoot":"","sources":["../../src/utilities/createBundleTask.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createBundleTask.js","sourceRoot":"","sources":["../../src/utilities/createBundleTask.ts"],"names":[],"mappings":"AAIA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAKhC;IACC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAChE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC;IAExF,OAAO;QACL,IAAI,EAAE,UAAU,WAAW,IAAI,OAAO,EAAE;QACxC,EAAE;QACF,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE;QACvC,KAAK,EAAE,CAAC,UAAU;QAClB,KAAK,CAAC,OAAO;YACX,MAAM,UAAU,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;YAEnE,OAAO,aAAa,CAAC;QACvB,CAAC;QACD,KAAK,EAAE,GAAG,EAAE;YACV,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC;YAClC,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC;YACjC,gFAAgF;YAChF,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1D,CAAC;QACD,SAAS,EAAE,GAAG,EAAE;YACd,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC;QACpC,CAAC;QACD,SAAS,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM;QAC7C,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC;YAC1B,EAAE;YACF,IAAI,EAAE,UAAU,WAAW,IAAI,OAAO,EAAE;YACxC,SAAS,EAAE,WAAW,IAAI,EAAE;YAC5B,UAAU;SACX,CAAC;QACF,iBAAiB,EAAE,CAAC,UAAU,EAAE,EAAE,CAChC,CAAC;YACC,EAAE;YACF,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM;YAClC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ;SACvC,CAAuB;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["import type { BundleTaskOptions } from '../types/BundleTaskOptions.js';\nimport type { BundleRequest } from '../types/BundleRequest.js';\nimport type { Task } from '../types/Task.js';\nimport type { TaskEndDescription } from '../types/TaskEndDescription.js';\nimport path from 'path';\nimport fs from 'fs';\nimport { bundleTask } from './bundleTask.js';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\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(params: {\n bundleRequest: BundleRequest;\n resolveMap: ResolveMap;\n options?: BundleTaskOptions;\n reporter?: TaskReporter;\n}): Task<BundleRequest> {\n const { bundleRequest, resolveMap, options, reporter } = params;\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, resolveMap });\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,\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findPackageOverride.d.ts","sourceRoot":"","sources":["../../src/utilities/findPackageOverride.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"findPackageOverride.d.ts","sourceRoot":"","sources":["../../src/utilities/findPackageOverride.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,eAAe,EAAE,EACnC,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,GACrB,eAAe,GAAG,SAAS,CAI7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findPackageOverride.js","sourceRoot":"","sources":["../../src/utilities/findPackageOverride.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"findPackageOverride.js","sourceRoot":"","sources":["../../src/utilities/findPackageOverride.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,gBAAmC,EACnC,WAAmB,EACnB,cAAsB;IAEtB,OAAO,gBAAgB,CAAC,IAAI,CAC1B,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,WAAW,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAC7G,CAAC;AACJ,CAAC","sourcesContent":["import type { PackageOverride } from '@ms-cloudpack/config';\nimport semver from 'semver';\n\n/**\n * Given a set of package overrides, finds the overrides for the given package name and version.\n */\nexport function findPackageOverride(\n packageOverrides: PackageOverride[],\n packageName: string,\n packageVersion: string,\n): PackageOverride | undefined {\n return packageOverrides.find(\n (override) => override.name === packageName && semver.satisfies(packageVersion, override.versionRequirement),\n );\n}\n"]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { type ResolveMap } from '@ms-cloudpack/package-utilities';
|
|
1
2
|
import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
|
|
2
3
|
export declare function getBundleDetails(options: {
|
|
3
4
|
packagePath: string;
|
|
4
5
|
}, context: {
|
|
5
6
|
packages: PackageDefinitionsCache;
|
|
7
|
+
resolveMap: ResolveMap;
|
|
6
8
|
}): Promise<{
|
|
7
9
|
bundleId: string;
|
|
8
10
|
isExternal: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBundleDetails.d.ts","sourceRoot":"","sources":["../../src/utilities/getBundleDetails.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getBundleDetails.d.ts","sourceRoot":"","sources":["../../src/utilities/getBundleDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAIrF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAG3E,wBAAsB,gBAAgB,CACpC,OAAO,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,EAChC,OAAO,EAAE;IAAE,QAAQ,EAAE,uBAAuB,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE;;;;;;;GA+BvE"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { isExternalPackage } from '@ms-cloudpack/package-utilities';
|
|
2
|
-
import hash from 'object-hash';
|
|
3
2
|
import filenamify from 'filenamify';
|
|
4
3
|
import path from 'path';
|
|
5
4
|
import { getCachePath } from './getCachePath.js';
|
|
5
|
+
import { hashPackage } from './hashPackage.js';
|
|
6
6
|
export async function getBundleDetails(options, context) {
|
|
7
7
|
const { packagePath } = options;
|
|
8
|
-
const { packages } = context;
|
|
8
|
+
const { packages, resolveMap } = context;
|
|
9
9
|
const definition = await packages.get(packagePath);
|
|
10
10
|
if (!definition) {
|
|
11
11
|
throw new Error(`Package definition (package.json) missing or invalid at "${packagePath}"`);
|
|
@@ -15,11 +15,7 @@ export async function getBundleDetails(options, context) {
|
|
|
15
15
|
throw new Error(`Package definition (package.json) missing name at "${packagePath}"`);
|
|
16
16
|
}
|
|
17
17
|
const isExternal = isExternalPackage(packagePath);
|
|
18
|
-
const bundleId =
|
|
19
|
-
name: packageName,
|
|
20
|
-
...definition,
|
|
21
|
-
version: (isExternal ? version : packagePath) || packagePath,
|
|
22
|
-
});
|
|
18
|
+
const bundleId = await hashPackage({ packagePath }, { packages, resolveMap });
|
|
23
19
|
// Derive where the output should be.
|
|
24
20
|
const folderName = `${filenamify(packageName)}-${version}-${bundleId}`;
|
|
25
21
|
const outputPath = path.join(getCachePath(), folderName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBundleDetails.js","sourceRoot":"","sources":["../../src/utilities/getBundleDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"getBundleDetails.js","sourceRoot":"","sources":["../../src/utilities/getBundleDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAmB,MAAM,iCAAiC,CAAC;AACrF,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAgC,EAChC,OAAsE;IAEtE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAChC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACzC,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,4DAA4D,WAAW,GAAG,CAAC,CAAC;KAC7F;IAED,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;IAElD,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,sDAAsD,WAAW,GAAG,CAAC,CAAC;KACvF;IAED,MAAM,UAAU,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;IAE9E,qCAAqC;IACrC,MAAM,UAAU,GAAG,GAAG,UAAU,CAAC,WAAW,CAAC,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;IACvE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,UAAU,CAAC,CAAC;IAEzD,OAAO;QACL,QAAQ;QACR,UAAU;QACV,cAAc,EAAE;YACd,IAAI,EAAE,UAAU;YAChB,UAAU;SACX;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { isExternalPackage, type ResolveMap } from '@ms-cloudpack/package-utilities';\nimport filenamify from 'filenamify';\nimport path from 'path';\nimport { getCachePath } from './getCachePath.js';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport { hashPackage } from './hashPackage.js';\n\nexport async function getBundleDetails(\n options: { packagePath: string },\n context: { packages: PackageDefinitionsCache; resolveMap: ResolveMap },\n) {\n const { packagePath } = options;\n const { packages, resolveMap } = context;\n const definition = await packages.get(packagePath);\n\n if (!definition) {\n throw new Error(`Package definition (package.json) missing or invalid at \"${packagePath}\"`);\n }\n\n const { name: packageName, version } = definition;\n\n if (!packageName) {\n throw new Error(`Package definition (package.json) missing name at \"${packagePath}\"`);\n }\n\n const isExternal = isExternalPackage(packagePath);\n const bundleId = await hashPackage({ packagePath }, { packages, resolveMap });\n\n // Derive where the output should be.\n const folderName = `${filenamify(packageName)}-${version}-${bundleId}`;\n const outputPath = path.join(getCachePath(), folderName);\n\n return {\n bundleId,\n isExternal,\n outputLocation: {\n path: outputPath,\n folderName,\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { PackageDefinitionsCache, PackageJsonDependencies } from '@ms-cloudpack/bundler-types';
|
|
2
|
+
import { type ResolveMap } from '@ms-cloudpack/package-utilities';
|
|
3
|
+
import { type PackageIdentifier } from './getPackagePath.js';
|
|
4
|
+
/**
|
|
5
|
+
* @returns the entries that are used to calculate the hash of a package
|
|
6
|
+
*/
|
|
7
|
+
export declare function getPackageHashEntries(packageIdentifier: PackageIdentifier, context: {
|
|
8
|
+
packages: PackageDefinitionsCache;
|
|
9
|
+
resolveMap: ResolveMap;
|
|
10
|
+
hashDependencies: (dependencies: PackageJsonDependencies) => Promise<Record<string, string>>;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
version: string;
|
|
13
|
+
filesHash: Record<string, string> | null | undefined;
|
|
14
|
+
inlinedDependenciesHash: Record<string, string> | undefined;
|
|
15
|
+
name?: string | undefined;
|
|
16
|
+
description?: string | undefined;
|
|
17
|
+
files?: string[] | undefined;
|
|
18
|
+
directories?: {
|
|
19
|
+
[directoryType: string]: string | undefined;
|
|
20
|
+
bin?: string | undefined;
|
|
21
|
+
lib?: string | undefined;
|
|
22
|
+
} | undefined;
|
|
23
|
+
type?: "module" | "commonjs" | undefined;
|
|
24
|
+
main?: string | undefined;
|
|
25
|
+
module?: string | undefined;
|
|
26
|
+
bin?: string | Partial<Record<string, string>> | undefined;
|
|
27
|
+
esnext?: string | {
|
|
28
|
+
[moduleName: string]: string | undefined;
|
|
29
|
+
main?: string | undefined;
|
|
30
|
+
browser?: string | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
browser?: string | Partial<Record<string, string | false>> | undefined;
|
|
33
|
+
sideEffects?: boolean | string[] | undefined;
|
|
34
|
+
types?: string | undefined;
|
|
35
|
+
typings?: string | undefined;
|
|
36
|
+
typesVersions?: Partial<Record<string, Partial<Record<string, string[]>>>> | undefined;
|
|
37
|
+
exports?: import("@ms-cloudpack/bundler-types").PackageJsonExports | undefined;
|
|
38
|
+
imports?: import("@ms-cloudpack/bundler-types").PackageJsonImports | undefined;
|
|
39
|
+
dependencies?: Partial<Record<string, string>> | undefined;
|
|
40
|
+
devDependencies?: Partial<Record<string, string>> | undefined;
|
|
41
|
+
peerDependencies?: Partial<Record<string, string>> | undefined;
|
|
42
|
+
peerDependenciesMeta?: Partial<Record<string, {
|
|
43
|
+
optional: true;
|
|
44
|
+
}>> | undefined;
|
|
45
|
+
optionalDependencies?: Partial<Record<string, string>> | undefined;
|
|
46
|
+
bundledDependencies?: Partial<Record<string, string>> | undefined;
|
|
47
|
+
bundleDependencies?: Partial<Record<string, string>> | undefined;
|
|
48
|
+
inlinedDependencies?: Partial<Record<string, string>> | undefined;
|
|
49
|
+
engines?: {
|
|
50
|
+
[x: string & Record<never, never>]: string | undefined;
|
|
51
|
+
node?: string | undefined;
|
|
52
|
+
npm?: string | undefined;
|
|
53
|
+
} | undefined;
|
|
54
|
+
os?: import("@ms-cloudpack/bundler-types").LiteralOrString<"aix" | "darwin" | "freebsd" | "linux" | "openbsd" | "sunos" | "win32" | "!aix" | "!darwin" | "!freebsd" | "!linux" | "!openbsd" | "!sunos" | "!win32">[] | undefined;
|
|
55
|
+
cpu?: import("@ms-cloudpack/bundler-types").LiteralOrString<"arm" | "arm64" | "ia32" | "mips" | "mipsel" | "ppc" | "ppc64" | "s390" | "s390x" | "x32" | "x64" | "!arm" | "!arm64" | "!ia32" | "!mips" | "!mipsel" | "!ppc" | "!ppc64" | "!s390" | "!s390x" | "!x32" | "!x64">[] | undefined;
|
|
56
|
+
private?: boolean | undefined;
|
|
57
|
+
publishConfig?: {
|
|
58
|
+
[additionalProperties: string]: unknown;
|
|
59
|
+
access?: "public" | "restricted" | undefined;
|
|
60
|
+
registry?: string | undefined;
|
|
61
|
+
tag?: string | undefined;
|
|
62
|
+
} | undefined;
|
|
63
|
+
packageManager?: string | undefined;
|
|
64
|
+
workspaces?: string[] | {
|
|
65
|
+
packages?: string[] | undefined;
|
|
66
|
+
nohoist?: string[] | undefined;
|
|
67
|
+
} | undefined;
|
|
68
|
+
}>;
|
|
69
|
+
//# sourceMappingURL=getPackageHashEntries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPackageHashEntries.d.ts","sourceRoot":"","sources":["../../src/utilities/getPackageHashEntries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACpG,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG7E;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,EAAE;IACP,QAAQ,EAAE,uBAAuB,CAAC;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,gBAAgB,EAAE,CAAC,YAAY,EAAE,uBAAuB,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { isExternalPackage } from '@ms-cloudpack/package-utilities';
|
|
2
|
+
import { getPackagePath } from './getPackagePath.js';
|
|
3
|
+
import { getSourceHash } from './getSourceHash.js';
|
|
4
|
+
/**
|
|
5
|
+
* @returns the entries that are used to calculate the hash of a package
|
|
6
|
+
*/
|
|
7
|
+
export async function getPackageHashEntries(packageIdentifier, context) {
|
|
8
|
+
const { packages, resolveMap, hashDependencies } = context;
|
|
9
|
+
const packagePath = getPackagePath(packageIdentifier, { resolveMap });
|
|
10
|
+
const definition = await packages.get(packagePath);
|
|
11
|
+
if (!definition) {
|
|
12
|
+
throw new Error(`Package definition (package.json) missing or invalid at "${packagePath}"`);
|
|
13
|
+
}
|
|
14
|
+
const { name, inlinedDependencies } = definition;
|
|
15
|
+
if (!name) {
|
|
16
|
+
throw new Error(`Package definition (package.json) missing name at "${packagePath}"`);
|
|
17
|
+
}
|
|
18
|
+
const isExternal = isExternalPackage(packagePath);
|
|
19
|
+
const filesHash = !isExternal ? await getSourceHash({ packagePath }) : undefined;
|
|
20
|
+
const inlinedDependenciesHash = inlinedDependencies && (await hashDependencies(inlinedDependencies));
|
|
21
|
+
const version = (isExternal ? definition.version : packagePath) || packagePath;
|
|
22
|
+
return {
|
|
23
|
+
...definition,
|
|
24
|
+
version,
|
|
25
|
+
filesHash,
|
|
26
|
+
inlinedDependenciesHash,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=getPackageHashEntries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPackageHashEntries.js","sourceRoot":"","sources":["../../src/utilities/getPackageHashEntries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAmB,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,cAAc,EAA0B,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,iBAAoC,EACpC,OAIC;IAED,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IAC3D,MAAM,WAAW,GAAG,cAAc,CAAC,iBAAiB,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IAEtE,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,4DAA4D,WAAW,GAAG,CAAC,CAAC;KAC7F;IAED,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,GAAG,UAAU,CAAC;IAEjD,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,sDAAsD,WAAW,GAAG,CAAC,CAAC;KACvF;IAED,MAAM,UAAU,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAElD,MAAM,SAAS,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAEjF,MAAM,uBAAuB,GAAG,mBAAmB,IAAI,CAAC,MAAM,gBAAgB,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAErG,MAAM,OAAO,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC;IAE/E,OAAO;QACL,GAAG,UAAU;QACb,OAAO;QACP,SAAS;QACT,uBAAuB;KACxB,CAAC;AACJ,CAAC","sourcesContent":["import type { PackageDefinitionsCache, PackageJsonDependencies } from '@ms-cloudpack/bundler-types';\nimport { isExternalPackage, type ResolveMap } from '@ms-cloudpack/package-utilities';\nimport { getPackagePath, type PackageIdentifier } from './getPackagePath.js';\nimport { getSourceHash } from './getSourceHash.js';\n\n/**\n * @returns the entries that are used to calculate the hash of a package\n */\nexport async function getPackageHashEntries(\n packageIdentifier: PackageIdentifier,\n context: {\n packages: PackageDefinitionsCache;\n resolveMap: ResolveMap;\n hashDependencies: (dependencies: PackageJsonDependencies) => Promise<Record<string, string>>;\n },\n) {\n const { packages, resolveMap, hashDependencies } = context;\n const packagePath = getPackagePath(packageIdentifier, { resolveMap });\n\n const definition = await packages.get(packagePath);\n\n if (!definition) {\n throw new Error(`Package definition (package.json) missing or invalid at \"${packagePath}\"`);\n }\n\n const { name, inlinedDependencies } = definition;\n\n if (!name) {\n throw new Error(`Package definition (package.json) missing name at \"${packagePath}\"`);\n }\n\n const isExternal = isExternalPackage(packagePath);\n\n const filesHash = !isExternal ? await getSourceHash({ packagePath }) : undefined;\n\n const inlinedDependenciesHash = inlinedDependencies && (await hashDependencies(inlinedDependencies));\n\n const version = (isExternal ? definition.version : packagePath) || packagePath;\n\n return {\n ...definition,\n version,\n filesHash,\n inlinedDependenciesHash,\n };\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ResolveMap } from '@ms-cloudpack/package-utilities';
|
|
2
|
+
export type PackageIdentifier = {
|
|
3
|
+
name: string;
|
|
4
|
+
version?: string;
|
|
5
|
+
} | {
|
|
6
|
+
packagePath: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Given the name and version of a package, or the path to a package, return the path to the package.
|
|
10
|
+
* @param packageIdentifier Either name and version or packagePath
|
|
11
|
+
* @returns The path to the package
|
|
12
|
+
*/
|
|
13
|
+
export declare function getPackagePath(packageIdentifier: PackageIdentifier, context: {
|
|
14
|
+
resolveMap: ResolveMap;
|
|
15
|
+
}): string;
|
|
16
|
+
//# sourceMappingURL=getPackagePath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPackagePath.d.ts","sourceRoot":"","sources":["../../src/utilities/getPackagePath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAEvF,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7F;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,OAAO,EAAE;IAAE,UAAU,EAAE,UAAU,CAAA;CAAE,UAavG"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { findResolveMapEntry } from '@ms-cloudpack/package-utilities';
|
|
2
|
+
/**
|
|
3
|
+
* Given the name and version of a package, or the path to a package, return the path to the package.
|
|
4
|
+
* @param packageIdentifier Either name and version or packagePath
|
|
5
|
+
* @returns The path to the package
|
|
6
|
+
*/
|
|
7
|
+
export function getPackagePath(packageIdentifier, context) {
|
|
8
|
+
if ('packagePath' in packageIdentifier) {
|
|
9
|
+
return packageIdentifier.packagePath;
|
|
10
|
+
}
|
|
11
|
+
const { resolveMap } = context;
|
|
12
|
+
const { name, version } = packageIdentifier;
|
|
13
|
+
const resolveMapEntry = findResolveMapEntry({ packageName: name, version, resolveMap });
|
|
14
|
+
if (!resolveMapEntry) {
|
|
15
|
+
throw new Error(`Missing dependency. Can not find ${name} in the resolve map`);
|
|
16
|
+
}
|
|
17
|
+
return resolveMapEntry.path;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=getPackagePath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPackagePath.js","sourceRoot":"","sources":["../../src/utilities/getPackagePath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAmB,MAAM,iCAAiC,CAAC;AAIvF;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,iBAAoC,EAAE,OAAmC;IACtG,IAAI,aAAa,IAAI,iBAAiB,EAAE;QACtC,OAAO,iBAAiB,CAAC,WAAW,CAAC;KACtC;IAED,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAC/B,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC;IAC5C,MAAM,eAAe,GAAG,mBAAmB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;IACxF,IAAI,CAAC,eAAe,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,qBAAqB,CAAC,CAAC;KAChF;IAED,OAAO,eAAe,CAAC,IAAI,CAAC;AAC9B,CAAC","sourcesContent":["import { findResolveMapEntry, type ResolveMap } from '@ms-cloudpack/package-utilities';\n\nexport type PackageIdentifier = { name: string; version?: string } | { packagePath: string };\n\n/**\n * Given the name and version of a package, or the path to a package, return the path to the package.\n * @param packageIdentifier Either name and version or packagePath\n * @returns The path to the package\n */\nexport function getPackagePath(packageIdentifier: PackageIdentifier, context: { resolveMap: ResolveMap }) {\n if ('packagePath' in packageIdentifier) {\n return packageIdentifier.packagePath;\n }\n\n const { resolveMap } = context;\n const { name, version } = packageIdentifier;\n const resolveMapEntry = findResolveMapEntry({ packageName: name, version, resolveMap });\n if (!resolveMapEntry) {\n throw new Error(`Missing dependency. Can not find ${name} in the resolve map`);\n }\n\n return resolveMapEntry.path;\n}\n"]}
|
|
@@ -10,7 +10,7 @@ export async function getPackagesToSync(options) {
|
|
|
10
10
|
}))
|
|
11
11
|
.filter((item) => item);
|
|
12
12
|
for (const { path: packagePath, name, version } of packageEntries) {
|
|
13
|
-
const details = await getBundleDetails({ packagePath }, { packages });
|
|
13
|
+
const details = await getBundleDetails({ packagePath }, { packages, resolveMap });
|
|
14
14
|
if (details.isExternal) {
|
|
15
15
|
list.push({ ...details.outputLocation, friendlyName: `${name}@${version}` });
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPackagesToSync.js","sourceRoot":"","sources":["../../src/utilities/getPackagesToSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAyC,MAAM,iCAAiC,CAAC;AAC7G,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAQzD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAGvC;IACC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACzC,MAAM,IAAI,GAAoB,EAAE,CAAC;IAEjC,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;
|
|
1
|
+
{"version":3,"file":"getPackagesToSync.js","sourceRoot":"","sources":["../../src/utilities/getPackagesToSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAyC,MAAM,iCAAiC,CAAC;AAC7G,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAQzD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAGvC;IACC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACzC,MAAM,IAAI,GAAoB,EAAE,CAAC;IAEjC,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,UAAU,EAAE,CAAC,CAAC;QAClF,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,YAAY,EAAE,GAAG,IAAI,IAAI,OAAO,EAAE,EAAE,CAAC,CAAC;SAC9E;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport { findResolveMapEntry, type ResolveMap, type ResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport { getBundleDetails } from './getBundleDetails.js';\n\nexport interface PackageToSync {\n path: string;\n folderName: string;\n friendlyName: string;\n}\n\nexport async function getPackagesToSync(options: {\n packages: PackageDefinitionsCache;\n resolveMap: ResolveMap;\n}): Promise<PackageToSync[]> {\n const { packages, resolveMap } = options;\n const list: PackageToSync[] = [];\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, resolveMap });\n if (details.isExternal) {\n list.push({ ...details.outputLocation, friendlyName: `${name}@${version}` });\n }\n }\n\n return list;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the hash of the source files in a package
|
|
3
|
+
* If there is a src folder, only hash the files in that folder and the .*json files
|
|
4
|
+
* Otherwise, hash all files except node_modules
|
|
5
|
+
*/
|
|
6
|
+
export declare function getSourceHash(options: {
|
|
7
|
+
packagePath: string;
|
|
8
|
+
}): Promise<Record<string, string> | null>;
|
|
9
|
+
//# sourceMappingURL=getSourceHash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSourceHash.d.ts","sourceRoot":"","sources":["../../src/utilities/getSourceHash.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,0CAanE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import glob from 'fast-glob';
|
|
2
|
+
import { existsSync } from 'fs';
|
|
3
|
+
import { hash } from 'glob-hasher';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
const excludeNodeModules = '!**/node_modules/**';
|
|
6
|
+
/**
|
|
7
|
+
* Get the hash of the source files in a package
|
|
8
|
+
* If there is a src folder, only hash the files in that folder and the .*json files
|
|
9
|
+
* Otherwise, hash all files except node_modules
|
|
10
|
+
*/
|
|
11
|
+
export async function getSourceHash(options) {
|
|
12
|
+
const { packagePath } = options;
|
|
13
|
+
const shouldUseSrc = existsSync(path.join(packagePath, 'src'));
|
|
14
|
+
const patterns = shouldUseSrc ? ['src/**', '*.json', excludeNodeModules] : ['**', excludeNodeModules];
|
|
15
|
+
const files = await glob(patterns, {
|
|
16
|
+
cwd: packagePath,
|
|
17
|
+
});
|
|
18
|
+
const globHash = hash(files, { cwd: packagePath });
|
|
19
|
+
return globHash;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=getSourceHash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSourceHash.js","sourceRoot":"","sources":["../../src/utilities/getSourceHash.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAgC;IAClE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAEhC,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/D,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;IAEtG,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE;QACjC,GAAG,EAAE,WAAW;KACjB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IAEnD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import glob from 'fast-glob';\nimport { existsSync } from 'fs';\nimport { hash } from 'glob-hasher';\nimport path from 'path';\n\nconst excludeNodeModules = '!**/node_modules/**';\n\n/**\n * Get the hash of the source files in a package\n * If there is a src folder, only hash the files in that folder and the .*json files\n * Otherwise, hash all files except node_modules\n */\nexport async function getSourceHash(options: { packagePath: string }) {\n const { packagePath } = options;\n\n const shouldUseSrc = existsSync(path.join(packagePath, 'src'));\n const patterns = shouldUseSrc ? ['src/**', '*.json', excludeNodeModules] : ['**', excludeNodeModules];\n\n const files = await glob(patterns, {\n cwd: packagePath,\n });\n\n const globHash = hash(files, { cwd: packagePath });\n\n return globHash;\n}\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
|
|
2
|
+
import { type ResolveMap } from '@ms-cloudpack/package-utilities';
|
|
3
|
+
import { type PackageIdentifier } from './getPackagePath.js';
|
|
4
|
+
export declare function hashPackage(packageIdentifier: PackageIdentifier, context: {
|
|
5
|
+
packages: PackageDefinitionsCache;
|
|
6
|
+
resolveMap: ResolveMap;
|
|
5
7
|
}): Promise<string>;
|
|
6
8
|
//# sourceMappingURL=hashPackage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashPackage.d.ts","sourceRoot":"","sources":["../../src/utilities/hashPackage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hashPackage.d.ts","sourceRoot":"","sources":["../../src/utilities/hashPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAA2B,MAAM,6BAA6B,CAAC;AACpG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAGlE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,wBAAsB,WAAW,CAC/B,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,EAAE;IAAE,QAAQ,EAAE,uBAAuB,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,GACrE,OAAO,CAAC,MAAM,CAAC,CAyBjB"}
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { existsSync } from 'fs';
|
|
3
|
-
import { hash } from 'glob-hasher';
|
|
1
|
+
import {} from '@ms-cloudpack/package-utilities';
|
|
4
2
|
import objectHash from 'object-hash';
|
|
5
|
-
import path from 'path';
|
|
6
3
|
import { performance } from 'perf_hooks';
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import {} from './getPackagePath.js';
|
|
5
|
+
import { getPackageHashEntries } from './getPackageHashEntries.js';
|
|
6
|
+
import { calculateHashOfInlinedDependencies } from './calculateHashOfInlinedDependencies.js';
|
|
7
|
+
export async function hashPackage(packageIdentifier, context) {
|
|
9
8
|
const start = performance.now();
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
9
|
+
const hashPackageWithContext = (options) => {
|
|
10
|
+
return hashPackage(options, context);
|
|
11
|
+
};
|
|
12
|
+
const hashDependencies = (dependencies) => {
|
|
13
|
+
return calculateHashOfInlinedDependencies({
|
|
14
|
+
inlinedDependencies: dependencies,
|
|
15
|
+
hashPackage: hashPackageWithContext,
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const hashEntries = await getPackageHashEntries(packageIdentifier, {
|
|
19
|
+
...context,
|
|
20
|
+
hashDependencies,
|
|
15
21
|
});
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
console.debug(`Hashed ${
|
|
19
|
-
return
|
|
22
|
+
const hashResult = objectHash(hashEntries);
|
|
23
|
+
const { name, version } = hashEntries;
|
|
24
|
+
console.debug(`Hashed ${name}@${version} in ${performance.now() - start}ms`);
|
|
25
|
+
return hashResult;
|
|
20
26
|
}
|
|
21
27
|
//# sourceMappingURL=hashPackage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashPackage.js","sourceRoot":"","sources":["../../src/utilities/hashPackage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hashPackage.js","sourceRoot":"","sources":["../../src/utilities/hashPackage.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,MAAM,iCAAiC,CAAC;AAClE,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAA0B,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAE7F,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,iBAAoC,EACpC,OAAsE;IAEtE,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAEhC,MAAM,sBAAsB,GAAG,CAAC,OAA0B,EAAE,EAAE;QAC5D,OAAO,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC;IAEF,MAAM,gBAAgB,GAAG,CAAC,YAAqC,EAAE,EAAE;QACjE,OAAO,kCAAkC,CAAC;YACxC,mBAAmB,EAAE,YAAY;YACjC,WAAW,EAAE,sBAAsB;SACpC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,MAAM,qBAAqB,CAAC,iBAAiB,EAAE;QACjE,GAAG,OAAO;QACV,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAE3C,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC;IACtC,OAAO,CAAC,KAAK,CAAC,UAAU,IAAI,IAAI,OAAO,OAAO,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC,CAAC;IAE7E,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import type { PackageDefinitionsCache, PackageJsonDependencies } from '@ms-cloudpack/bundler-types';\nimport { type ResolveMap } from '@ms-cloudpack/package-utilities';\nimport objectHash from 'object-hash';\nimport { performance } from 'perf_hooks';\nimport { type PackageIdentifier } from './getPackagePath.js';\nimport { getPackageHashEntries } from './getPackageHashEntries.js';\nimport { calculateHashOfInlinedDependencies } from './calculateHashOfInlinedDependencies.js';\n\nexport async function hashPackage(\n packageIdentifier: PackageIdentifier,\n context: { packages: PackageDefinitionsCache; resolveMap: ResolveMap },\n): Promise<string> {\n const start = performance.now();\n\n const hashPackageWithContext = (options: PackageIdentifier) => {\n return hashPackage(options, context);\n };\n\n const hashDependencies = (dependencies: PackageJsonDependencies) => {\n return calculateHashOfInlinedDependencies({\n inlinedDependencies: dependencies,\n hashPackage: hashPackageWithContext,\n });\n };\n\n const hashEntries = await getPackageHashEntries(packageIdentifier, {\n ...context,\n hashDependencies,\n });\n\n const hashResult = objectHash(hashEntries);\n\n const { name, version } = hashEntries;\n console.debug(`Hashed ${name}@${version} in ${performance.now() - start}ms`);\n\n return hashResult;\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
|
|
2
|
+
import type { LinkedPath, ResolveMap } from '@ms-cloudpack/package-utilities';
|
|
3
|
+
import { type TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
4
|
+
/**
|
|
5
|
+
* Resolves the locations of dependencies and returns the resolve map, logging results
|
|
6
|
+
* to the task reporter.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveDependenciesTask(options: {
|
|
9
|
+
appPath: string;
|
|
10
|
+
additionalPaths?: string[];
|
|
11
|
+
linkedPaths?: LinkedPath[];
|
|
12
|
+
}, context: {
|
|
13
|
+
reporter: TaskReporter;
|
|
14
|
+
packages: PackageDefinitionsCache;
|
|
15
|
+
}): Promise<ResolveMap>;
|
|
16
|
+
//# sourceMappingURL=resolveDependenciesTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveDependenciesTask.d.ts","sourceRoot":"","sources":["../../src/utilities/resolveDependenciesTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAmB,MAAM,iCAAiC,CAAC;AAE/F,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAElG;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE;IACP,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;CAC5B,EACD,OAAO,EAAE;IAAE,QAAQ,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,uBAAuB,CAAA;CAAE,uBAsCvE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createResolveMap } from '@ms-cloudpack/package-utilities';
|
|
2
|
+
import { bold, bulletedList, cyan, yellow } from '@ms-cloudpack/task-reporter';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the locations of dependencies and returns the resolve map, logging results
|
|
5
|
+
* to the task reporter.
|
|
6
|
+
*/
|
|
7
|
+
export async function resolveDependenciesTask(options, context) {
|
|
8
|
+
const { appPath, additionalPaths, linkedPaths } = options;
|
|
9
|
+
const { reporter, packages } = context;
|
|
10
|
+
let resolveMap;
|
|
11
|
+
// Grab the installed dependency locations.
|
|
12
|
+
await reporter.runTask('Resolving dependencies', async () => {
|
|
13
|
+
resolveMap = await createResolveMap({
|
|
14
|
+
appPath,
|
|
15
|
+
additionalPaths,
|
|
16
|
+
linkedPaths,
|
|
17
|
+
}, {
|
|
18
|
+
packages,
|
|
19
|
+
});
|
|
20
|
+
const { allPackages, duplicatedPackages } = getPackagesFromResolveMap(resolveMap);
|
|
21
|
+
const message = `Found ${cyan(allPackages.size)} total packages, ${duplicatedPackages.size ? `${yellow(duplicatedPackages.size)} with multiple versions.` : `no duplicates.`}`;
|
|
22
|
+
const extended = bulletedList(Array.from(duplicatedPackages.entries()).map(([name, versions]) => `${bold(name)}: ${Array.from(versions).join(', ')}`));
|
|
23
|
+
return {
|
|
24
|
+
message,
|
|
25
|
+
extended,
|
|
26
|
+
forceShow: true,
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- will be defined after the task runs
|
|
30
|
+
return resolveMap;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Given a resolveMap, returns a map of all packages and a map of packages with multiple versions.
|
|
34
|
+
* This is used to log the results of the resolve task.
|
|
35
|
+
*/
|
|
36
|
+
function getPackagesFromResolveMap(resolveMap) {
|
|
37
|
+
const allPackages = new Map();
|
|
38
|
+
const duplicatedPackages = new Map();
|
|
39
|
+
function addEntry(entry) {
|
|
40
|
+
if (allPackages.has(entry.name)) {
|
|
41
|
+
if (!duplicatedPackages.has(entry.name)) {
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
43
|
+
duplicatedPackages.set(entry.name, new Set([allPackages.get(entry.name).version]));
|
|
44
|
+
}
|
|
45
|
+
const dupeSet = duplicatedPackages.get(entry.name);
|
|
46
|
+
dupeSet?.add(entry.version);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
allPackages.set(entry.name, entry);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
for (const currentEntry of Object.values(resolveMap)) {
|
|
53
|
+
addEntry(currentEntry);
|
|
54
|
+
if (currentEntry.scopedVersions) {
|
|
55
|
+
for (const scopedEntry of Object.values(currentEntry.scopedVersions)) {
|
|
56
|
+
addEntry(scopedEntry);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
allPackages,
|
|
62
|
+
duplicatedPackages,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=resolveDependenciesTask.js.map
|