@ms-cloudpack/api-server 0.12.1 → 0.13.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 +2 -0
- package/lib/apis/ensurePackageBundled.d.ts +484 -0
- package/lib/apis/ensurePackageBundled.d.ts.map +1 -0
- package/lib/apis/ensurePackageBundled.js +106 -0
- package/lib/apis/ensurePackageBundled.js.map +1 -0
- package/lib/apis/getData.d.ts +2 -0
- package/lib/apis/getSessionId.d.ts +2 -0
- package/lib/apis/index.d.ts +2 -0
- package/lib/apis/index.d.ts.map +1 -1
- package/lib/apis/index.js +2 -0
- package/lib/apis/index.js.map +1 -1
- package/lib/apis/onDataChanged.d.ts +2 -0
- package/lib/apis/openCodeEditor.d.ts +2 -0
- package/lib/apis/openConfigEditor.d.ts +2 -0
- package/lib/apis/openFilePath.d.ts +2 -0
- package/lib/apis/reportMetric.d.ts +2 -0
- package/lib/apis/syncDownload.d.ts +57 -0
- package/lib/apis/syncDownload.d.ts.map +1 -0
- package/lib/apis/syncDownload.js +12 -0
- package/lib/apis/syncDownload.js.map +1 -0
- package/lib/apis/syncUpload.d.ts +57 -0
- package/lib/apis/syncUpload.d.ts.map +1 -0
- package/lib/apis/syncUpload.js +12 -0
- package/lib/apis/syncUpload.js.map +1 -0
- package/lib/apis/validatePackageOverride.d.ts +2 -0
- package/lib/common/prepareOutputPath.d.ts +5 -0
- package/lib/common/prepareOutputPath.d.ts.map +1 -0
- package/lib/common/prepareOutputPath.js +14 -0
- package/lib/common/prepareOutputPath.js.map +1 -0
- package/lib/index.d.ts +9 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -1
- package/lib/index.js.map +1 -1
- package/lib/trpc/common.d.ts +3 -0
- package/lib/trpc/common.d.ts.map +1 -1
- package/lib/trpc/createAppRouter.d.ts +107 -0
- package/lib/trpc/createAppRouter.d.ts.map +1 -1
- package/lib/trpc/createCloudpackServer.d.ts +3 -0
- package/lib/trpc/createCloudpackServer.d.ts.map +1 -1
- package/lib/trpc/createContextFactory.d.ts +2 -0
- package/lib/trpc/createContextFactory.d.ts.map +1 -1
- package/lib/trpc/createContextFactory.js +4 -0
- package/lib/trpc/createContextFactory.js.map +1 -1
- package/lib/trpc/createRouterFromApis.d.ts +1 -0
- package/lib/trpc/createRouterFromApis.d.ts.map +1 -1
- package/lib/types/BundleRequest.d.ts +16 -0
- package/lib/types/BundleRequest.d.ts.map +1 -1
- package/lib/types/BundleRequest.js.map +1 -1
- package/lib/types/BundleTaskOptions.d.ts +4 -0
- package/lib/types/BundleTaskOptions.d.ts.map +1 -0
- package/lib/types/BundleTaskOptions.js +2 -0
- package/lib/types/BundleTaskOptions.js.map +1 -0
- package/lib/types/TaskMessage.d.ts +2 -2
- package/lib/types/TaskResponse.d.ts +12 -12
- package/lib/types/TaskResult.d.ts +8 -8
- package/lib/utilities/bundleTask.d.ts +9 -0
- package/lib/utilities/bundleTask.d.ts.map +1 -0
- package/lib/utilities/bundleTask.js +119 -0
- package/lib/utilities/bundleTask.js.map +1 -0
- package/lib/utilities/createBundleRequestForPackage.d.ts +11 -0
- package/lib/utilities/createBundleRequestForPackage.d.ts.map +1 -0
- package/lib/utilities/createBundleRequestForPackage.js +21 -0
- package/lib/utilities/createBundleRequestForPackage.js.map +1 -0
- package/lib/utilities/createBundleTask.d.ts +10 -0
- package/lib/utilities/createBundleTask.d.ts.map +1 -0
- package/lib/utilities/createBundleTask.js +42 -0
- package/lib/utilities/createBundleTask.js.map +1 -0
- package/lib/utilities/ensureRemoteCacheEnabled.d.ts +11 -0
- package/lib/utilities/ensureRemoteCacheEnabled.d.ts.map +1 -0
- package/lib/utilities/ensureRemoteCacheEnabled.js +12 -0
- package/lib/utilities/ensureRemoteCacheEnabled.js.map +1 -0
- package/lib/utilities/findImports.d.ts +6 -0
- package/lib/utilities/findImports.d.ts.map +1 -0
- package/lib/utilities/findImports.js +75 -0
- package/lib/utilities/findImports.js.map +1 -0
- package/lib/utilities/formatBundleErrors.d.ts +9 -0
- package/lib/utilities/formatBundleErrors.d.ts.map +1 -0
- package/lib/utilities/formatBundleErrors.js +19 -0
- package/lib/utilities/formatBundleErrors.js.map +1 -0
- package/lib/utilities/getBundleDetails.d.ts +14 -0
- package/lib/utilities/getBundleDetails.d.ts.map +1 -0
- package/lib/utilities/getBundleDetails.js +35 -0
- package/lib/utilities/getBundleDetails.js.map +1 -0
- package/lib/utilities/getFileSizeSync.d.ts +5 -0
- package/lib/utilities/getFileSizeSync.d.ts.map +1 -0
- package/lib/utilities/getFileSizeSync.js +16 -0
- package/lib/utilities/getFileSizeSync.js.map +1 -0
- package/lib/utilities/hashPackage.d.ts +6 -0
- package/lib/utilities/hashPackage.d.ts.map +1 -0
- package/lib/utilities/hashPackage.js +21 -0
- package/lib/utilities/hashPackage.js.map +1 -0
- package/package.json +10 -3
|
@@ -23,6 +23,7 @@ export declare function createCloudpackServer(options: {
|
|
|
23
23
|
unwatchAll(): Promise<void>;
|
|
24
24
|
};
|
|
25
25
|
packages: PackageDefinitionsCache;
|
|
26
|
+
taskRunner: import("../utilities/TaskRunner.js").TaskRunner;
|
|
26
27
|
dispose(): Promise<void>;
|
|
27
28
|
};
|
|
28
29
|
close: () => Promise<void>;
|
|
@@ -59,5 +60,7 @@ export declare function createCloudpackServer(options: {
|
|
|
59
60
|
}) => Promise<{
|
|
60
61
|
fixable: boolean;
|
|
61
62
|
}>;
|
|
63
|
+
syncDownload: (options: unknown) => Promise<void>;
|
|
64
|
+
syncUpload: (options: unknown) => Promise<void>;
|
|
62
65
|
}>;
|
|
63
66
|
//# sourceMappingURL=createCloudpackServer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCloudpackServer.d.ts","sourceRoot":"","sources":["../../src/trpc/createCloudpackServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAKnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,wBAAsB,qBAAqB,CAAC,OAAO,EAAE;IACnD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;IAC3B,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,uBAAuB,CAAC;CACnC
|
|
1
|
+
{"version":3,"file":"createCloudpackServer.d.ts","sourceRoot":"","sources":["../../src/trpc/createCloudpackServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAKnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,wBAAsB,qBAAqB,CAAC,OAAO,EAAE;IACnD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;IAC3B,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,uBAAuB,CAAC;CACnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCA"}
|
|
@@ -2,6 +2,7 @@ import type { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
|
2
2
|
import type { Span } from '@ms-cloudpack/telemetry';
|
|
3
3
|
import type { Session } from '../types/Session.js';
|
|
4
4
|
import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
|
|
5
|
+
import { TaskRunner } from '../utilities/TaskRunner.js';
|
|
5
6
|
/**
|
|
6
7
|
* Creates the server context and returns a connection context factory.
|
|
7
8
|
* The context object is accessible to apis and serves as a way to share stateful
|
|
@@ -25,6 +26,7 @@ export declare function createContextFactory(options: {
|
|
|
25
26
|
unwatchAll(): Promise<void>;
|
|
26
27
|
};
|
|
27
28
|
packages: PackageDefinitionsCache;
|
|
29
|
+
taskRunner: TaskRunner;
|
|
28
30
|
dispose(): Promise<void>;
|
|
29
31
|
}>>;
|
|
30
32
|
export type CreateContext = Awaited<ReturnType<typeof createContextFactory>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createContextFactory.d.ts","sourceRoot":"","sources":["../../src/trpc/createContextFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAGnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"createContextFactory.d.ts","sourceRoot":"","sources":["../../src/trpc/createContextFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAGnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD;;;;GAIG;AAEH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,uBAAuB,CAAC;CACnC;;;;;;;;;;;;;;;IA6CA;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC;AAE7E,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createDataBus } from '@ms-cloudpack/data-bus';
|
|
2
2
|
import { createWatcher } from '@ms-cloudpack/file-watcher';
|
|
3
|
+
import { TaskRunner } from '../utilities/TaskRunner.js';
|
|
3
4
|
/**
|
|
4
5
|
* Creates the server context and returns a connection context factory.
|
|
5
6
|
* The context object is accessible to apis and serves as a way to share stateful
|
|
@@ -13,6 +14,7 @@ export async function createContextFactory(options) {
|
|
|
13
14
|
// const bus = createDataBus();
|
|
14
15
|
const bus = createDataBus();
|
|
15
16
|
const watcher = createWatcher();
|
|
17
|
+
const taskRunner = new TaskRunner();
|
|
16
18
|
// Return the factory function which creates a context object per connection. This allows
|
|
17
19
|
// us to choose what we expose to each client from server context, but also allows us to
|
|
18
20
|
// add additional context to each connection.
|
|
@@ -31,6 +33,8 @@ export async function createContextFactory(options) {
|
|
|
31
33
|
watcher,
|
|
32
34
|
// packages
|
|
33
35
|
packages,
|
|
36
|
+
// tasks
|
|
37
|
+
taskRunner,
|
|
34
38
|
// dispose things that the context creates.
|
|
35
39
|
async dispose() {
|
|
36
40
|
await watcher.unwatchAll();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createContextFactory.js","sourceRoot":"","sources":["../../src/trpc/createContextFactory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"createContextFactory.js","sourceRoot":"","sources":["../../src/trpc/createContextFactory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD;;;;GAIG;AACH,4DAA4D;AAC5D,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAK1C;IACC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC1D,yDAAyD;IACzD,kEAAkE;IAClE,+BAA+B;IAE/B,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAChC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IAEpC,yFAAyF;IACzF,wFAAwF;IACxF,6CAA6C;IAC7C,4DAA4D;IAC5D,KAAK,UAAU,aAAa;QAC1B,OAAO;YACL,kBAAkB;YAClB,OAAO;YAEP,WAAW;YACX,GAAG;YAEH,YAAY;YACZ,QAAQ;YAER,UAAU;YACV,QAAQ;YAER,eAAe;YACf,OAAO;YAEP,WAAW;YACX,QAAQ;YAER,QAAQ;YACR,UAAU;YAEV,2CAA2C;YAC3C,KAAK,CAAC,OAAO;gBACX,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;YAC7B,CAAC;SACF,CAAC;IACJ,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { Span } from '@ms-cloudpack/telemetry';\nimport type { Session } from '../types/Session.js';\nimport { createDataBus } from '@ms-cloudpack/data-bus';\nimport { createWatcher } from '@ms-cloudpack/file-watcher';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport { TaskRunner } from '../utilities/TaskRunner.js';\n\n/**\n * Creates the server context and returns a connection context factory.\n * The context object is accessible to apis and serves as a way to share stateful\n * objects across them.\n */\n// eslint-disable-next-line @typescript-eslint/require-await\nexport async function createContextFactory(options: {\n session: Session;\n reporter: TaskReporter;\n rootSpan?: Span;\n packages: PackageDefinitionsCache;\n}) {\n const { session, rootSpan, reporter, packages } = options;\n // const host = config?.devServer?.domain || 'localhost';\n // const port = await getPort({ port: [9890, 9891, 9892, 9893] });\n // const bus = createDataBus();\n\n const bus = createDataBus();\n const watcher = createWatcher();\n const taskRunner = new TaskRunner();\n\n // Return the factory function which creates a context object per connection. This allows\n // us to choose what we expose to each client from server context, but also allows us to\n // add additional context to each connection.\n // eslint-disable-next-line @typescript-eslint/require-await\n async function createContext() {\n return {\n // session manager\n session,\n\n // data bus\n bus,\n\n // telemetry\n rootSpan,\n\n // logging\n reporter,\n\n // file watcher\n watcher,\n\n // packages\n packages,\n\n // tasks\n taskRunner,\n\n // dispose things that the context creates.\n async dispose() {\n await watcher.unwatchAll();\n },\n };\n }\n\n return createContext;\n}\n\nexport type CreateContext = Awaited<ReturnType<typeof createContextFactory>>;\n\nexport type Context = Awaited<ReturnType<CreateContext>>;\n"]}
|
|
@@ -17,6 +17,7 @@ export declare function createRouterFromApis<TData extends {
|
|
|
17
17
|
unwatchAll(): Promise<void>;
|
|
18
18
|
};
|
|
19
19
|
packages: import("@ms-cloudpack/bundler-types").PackageDefinitionsCache;
|
|
20
|
+
taskRunner: import("../utilities/TaskRunner.js").TaskRunner;
|
|
20
21
|
dispose(): Promise<void>;
|
|
21
22
|
};
|
|
22
23
|
meta: object;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRouterFromApis.d.ts","sourceRoot":"","sources":["../../src/trpc/createRouterFromApis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,wBAAgB,oBAAoB,CAAC,KAAK,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,SAAS,EAAE,YAAY,CAAA;KAAE,CAAA;CAAE,EAAE,IAAI,EAAE,KAAK
|
|
1
|
+
{"version":3,"file":"createRouterFromApis.d.ts","sourceRoot":"","sources":["../../src/trpc/createRouterFromApis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,wBAAgB,oBAAoB,CAAC,KAAK,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,SAAS,EAAE,YAAY,CAAA;KAAE,CAAA;CAAE,EAAE,IAAI,EAAE,KAAK;;;;;;;;;;;;;;;;;;;;wDAU7G"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import type { BundleResult, PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
|
|
2
|
+
import type { CloudpackConfig } from '@ms-cloudpack/config';
|
|
3
|
+
/**
|
|
4
|
+
* Tracks a given bundle request and its result.
|
|
5
|
+
*/
|
|
1
6
|
export interface BundleRequest {
|
|
2
7
|
id: string;
|
|
3
8
|
packageName: string;
|
|
@@ -5,6 +10,17 @@ export interface BundleRequest {
|
|
|
5
10
|
packagePath: string;
|
|
6
11
|
outputPath: string;
|
|
7
12
|
isExternal: boolean;
|
|
13
|
+
bundlerType?: string;
|
|
14
|
+
result?: BundleResult & {
|
|
15
|
+
dependencies?: string[];
|
|
16
|
+
hash?: string;
|
|
17
|
+
};
|
|
18
|
+
resultFromCache?: boolean;
|
|
19
|
+
isRebuildRequired?: boolean;
|
|
8
20
|
disableSourceMaps?: boolean;
|
|
21
|
+
enableFindImports?: boolean;
|
|
22
|
+
enableCacheInternalPackages?: boolean;
|
|
23
|
+
packages: PackageDefinitionsCache;
|
|
24
|
+
config: CloudpackConfig;
|
|
9
25
|
}
|
|
10
26
|
//# sourceMappingURL=BundleRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BundleRequest.d.ts","sourceRoot":"","sources":["../../src/types/BundleRequest.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BundleRequest.d.ts","sourceRoot":"","sources":["../../src/types/BundleRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;GAEG;AAEH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,YAAY,GAAG;QAAE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,QAAQ,EAAE,uBAAuB,CAAC;IAClC,MAAM,EAAE,eAAe,CAAC;CACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BundleRequest.js","sourceRoot":"","sources":["../../src/types/BundleRequest.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"BundleRequest.js","sourceRoot":"","sources":["../../src/types/BundleRequest.ts"],"names":[],"mappings":"","sourcesContent":["import type { BundleResult, PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\n\n/**\n * Tracks a given bundle request and its result.\n */\n\nexport interface BundleRequest {\n id: string;\n packageName: string;\n version: string;\n packagePath: string;\n outputPath: string;\n isExternal: boolean;\n bundlerType?: string;\n result?: BundleResult & { dependencies?: string[]; hash?: string };\n resultFromCache?: boolean;\n isRebuildRequired?: boolean;\n disableSourceMaps?: boolean;\n enableFindImports?: boolean;\n enableCacheInternalPackages?: boolean;\n packages: PackageDefinitionsCache;\n config: CloudpackConfig;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BundleTaskOptions.d.ts","sourceRoot":"","sources":["../../src/types/BundleTaskOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BundleTaskOptions.js","sourceRoot":"","sources":["../../src/types/BundleTaskOptions.ts"],"names":[],"mappings":"","sourcesContent":["export interface BundleTaskOptions {\n force?: boolean;\n}\n"]}
|
|
@@ -118,7 +118,7 @@ export declare const ZodTaskMessage: z.ZodObject<{
|
|
|
118
118
|
}, "strip", z.ZodTypeAny, {
|
|
119
119
|
text: string;
|
|
120
120
|
pluginName?: string | undefined;
|
|
121
|
-
type?: "invalid-input" | "
|
|
121
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
122
122
|
location?: {
|
|
123
123
|
line: number;
|
|
124
124
|
column: number;
|
|
@@ -141,7 +141,7 @@ export declare const ZodTaskMessage: z.ZodObject<{
|
|
|
141
141
|
}, {
|
|
142
142
|
text: string;
|
|
143
143
|
pluginName?: string | undefined;
|
|
144
|
-
type?: "invalid-input" | "
|
|
144
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
145
145
|
location?: {
|
|
146
146
|
line: number;
|
|
147
147
|
column: number;
|
|
@@ -75,7 +75,7 @@ export declare const ZodTaskResponse: z.ZodObject<{
|
|
|
75
75
|
}, "strip", z.ZodTypeAny, {
|
|
76
76
|
text: string;
|
|
77
77
|
pluginName?: string | undefined;
|
|
78
|
-
type?: "invalid-input" | "
|
|
78
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
79
79
|
location?: {
|
|
80
80
|
line: number;
|
|
81
81
|
column: number;
|
|
@@ -98,7 +98,7 @@ export declare const ZodTaskResponse: z.ZodObject<{
|
|
|
98
98
|
}, {
|
|
99
99
|
text: string;
|
|
100
100
|
pluginName?: string | undefined;
|
|
101
|
-
type?: "invalid-input" | "
|
|
101
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
102
102
|
location?: {
|
|
103
103
|
line: number;
|
|
104
104
|
column: number;
|
|
@@ -193,7 +193,7 @@ export declare const ZodTaskResponse: z.ZodObject<{
|
|
|
193
193
|
}, "strip", z.ZodTypeAny, {
|
|
194
194
|
text: string;
|
|
195
195
|
pluginName?: string | undefined;
|
|
196
|
-
type?: "invalid-input" | "
|
|
196
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
197
197
|
location?: {
|
|
198
198
|
line: number;
|
|
199
199
|
column: number;
|
|
@@ -216,7 +216,7 @@ export declare const ZodTaskResponse: z.ZodObject<{
|
|
|
216
216
|
}, {
|
|
217
217
|
text: string;
|
|
218
218
|
pluginName?: string | undefined;
|
|
219
|
-
type?: "invalid-input" | "
|
|
219
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
220
220
|
location?: {
|
|
221
221
|
line: number;
|
|
222
222
|
column: number;
|
|
@@ -241,7 +241,7 @@ export declare const ZodTaskResponse: z.ZodObject<{
|
|
|
241
241
|
errors?: {
|
|
242
242
|
text: string;
|
|
243
243
|
pluginName?: string | undefined;
|
|
244
|
-
type?: "invalid-input" | "
|
|
244
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
245
245
|
location?: {
|
|
246
246
|
line: number;
|
|
247
247
|
column: number;
|
|
@@ -265,7 +265,7 @@ export declare const ZodTaskResponse: z.ZodObject<{
|
|
|
265
265
|
warnings?: {
|
|
266
266
|
text: string;
|
|
267
267
|
pluginName?: string | undefined;
|
|
268
|
-
type?: "invalid-input" | "
|
|
268
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
269
269
|
location?: {
|
|
270
270
|
line: number;
|
|
271
271
|
column: number;
|
|
@@ -290,7 +290,7 @@ export declare const ZodTaskResponse: z.ZodObject<{
|
|
|
290
290
|
errors?: {
|
|
291
291
|
text: string;
|
|
292
292
|
pluginName?: string | undefined;
|
|
293
|
-
type?: "invalid-input" | "
|
|
293
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
294
294
|
location?: {
|
|
295
295
|
line: number;
|
|
296
296
|
column: number;
|
|
@@ -314,7 +314,7 @@ export declare const ZodTaskResponse: z.ZodObject<{
|
|
|
314
314
|
warnings?: {
|
|
315
315
|
text: string;
|
|
316
316
|
pluginName?: string | undefined;
|
|
317
|
-
type?: "invalid-input" | "
|
|
317
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
318
318
|
location?: {
|
|
319
319
|
line: number;
|
|
320
320
|
column: number;
|
|
@@ -357,7 +357,7 @@ export declare const ZodTaskResponse: z.ZodObject<{
|
|
|
357
357
|
errors?: {
|
|
358
358
|
text: string;
|
|
359
359
|
pluginName?: string | undefined;
|
|
360
|
-
type?: "invalid-input" | "
|
|
360
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
361
361
|
location?: {
|
|
362
362
|
line: number;
|
|
363
363
|
column: number;
|
|
@@ -381,7 +381,7 @@ export declare const ZodTaskResponse: z.ZodObject<{
|
|
|
381
381
|
warnings?: {
|
|
382
382
|
text: string;
|
|
383
383
|
pluginName?: string | undefined;
|
|
384
|
-
type?: "invalid-input" | "
|
|
384
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
385
385
|
location?: {
|
|
386
386
|
line: number;
|
|
387
387
|
column: number;
|
|
@@ -414,7 +414,7 @@ export declare const ZodTaskResponse: z.ZodObject<{
|
|
|
414
414
|
errors?: {
|
|
415
415
|
text: string;
|
|
416
416
|
pluginName?: string | undefined;
|
|
417
|
-
type?: "invalid-input" | "
|
|
417
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
418
418
|
location?: {
|
|
419
419
|
line: number;
|
|
420
420
|
column: number;
|
|
@@ -438,7 +438,7 @@ export declare const ZodTaskResponse: z.ZodObject<{
|
|
|
438
438
|
warnings?: {
|
|
439
439
|
text: string;
|
|
440
440
|
pluginName?: string | undefined;
|
|
441
|
-
type?: "invalid-input" | "
|
|
441
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
442
442
|
location?: {
|
|
443
443
|
line: number;
|
|
444
444
|
column: number;
|
|
@@ -74,7 +74,7 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
74
74
|
}, "strip", z.ZodTypeAny, {
|
|
75
75
|
text: string;
|
|
76
76
|
pluginName?: string | undefined;
|
|
77
|
-
type?: "invalid-input" | "
|
|
77
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
78
78
|
location?: {
|
|
79
79
|
line: number;
|
|
80
80
|
column: number;
|
|
@@ -97,7 +97,7 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
97
97
|
}, {
|
|
98
98
|
text: string;
|
|
99
99
|
pluginName?: string | undefined;
|
|
100
|
-
type?: "invalid-input" | "
|
|
100
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
101
101
|
location?: {
|
|
102
102
|
line: number;
|
|
103
103
|
column: number;
|
|
@@ -192,7 +192,7 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
192
192
|
}, "strip", z.ZodTypeAny, {
|
|
193
193
|
text: string;
|
|
194
194
|
pluginName?: string | undefined;
|
|
195
|
-
type?: "invalid-input" | "
|
|
195
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
196
196
|
location?: {
|
|
197
197
|
line: number;
|
|
198
198
|
column: number;
|
|
@@ -215,7 +215,7 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
215
215
|
}, {
|
|
216
216
|
text: string;
|
|
217
217
|
pluginName?: string | undefined;
|
|
218
|
-
type?: "invalid-input" | "
|
|
218
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
219
219
|
location?: {
|
|
220
220
|
line: number;
|
|
221
221
|
column: number;
|
|
@@ -240,7 +240,7 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
240
240
|
errors?: {
|
|
241
241
|
text: string;
|
|
242
242
|
pluginName?: string | undefined;
|
|
243
|
-
type?: "invalid-input" | "
|
|
243
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
244
244
|
location?: {
|
|
245
245
|
line: number;
|
|
246
246
|
column: number;
|
|
@@ -264,7 +264,7 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
264
264
|
warnings?: {
|
|
265
265
|
text: string;
|
|
266
266
|
pluginName?: string | undefined;
|
|
267
|
-
type?: "invalid-input" | "
|
|
267
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
268
268
|
location?: {
|
|
269
269
|
line: number;
|
|
270
270
|
column: number;
|
|
@@ -289,7 +289,7 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
289
289
|
errors?: {
|
|
290
290
|
text: string;
|
|
291
291
|
pluginName?: string | undefined;
|
|
292
|
-
type?: "invalid-input" | "
|
|
292
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
293
293
|
location?: {
|
|
294
294
|
line: number;
|
|
295
295
|
column: number;
|
|
@@ -313,7 +313,7 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
313
313
|
warnings?: {
|
|
314
314
|
text: string;
|
|
315
315
|
pluginName?: string | undefined;
|
|
316
|
-
type?: "invalid-input" | "
|
|
316
|
+
type?: "invalid-input" | "input-relative" | "no-entries" | "entry-absolute" | undefined;
|
|
317
317
|
location?: {
|
|
318
318
|
line: number;
|
|
319
319
|
column: number;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
2
|
+
import type { BundleTaskOptions } from '../types/BundleTaskOptions.js';
|
|
3
|
+
import type { BundleRequest } from '../types/BundleRequest.js';
|
|
4
|
+
export declare function bundleTask({ bundleRequest, options, reporter, }: {
|
|
5
|
+
bundleRequest: BundleRequest;
|
|
6
|
+
options?: BundleTaskOptions;
|
|
7
|
+
reporter?: TaskReporter;
|
|
8
|
+
}): Promise<BundleRequest>;
|
|
9
|
+
//# sourceMappingURL=bundleTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundleTask.d.ts","sourceRoot":"","sources":["../../src/utilities/bundleTask.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,YAAY,EAElB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAO/D,wBAAsB,UAAU,CAAC,EAC/B,aAAa,EACb,OAAY,EACZ,QAAQ,GACT,EAAE;IACD,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB,0BAwDA"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { bundle as bundleInternal, getEntriesMapFromPackage, getExternalsFromPackage } from '@ms-cloudpack/bundler';
|
|
2
|
+
import { readJson, writeJson } from '@ms-cloudpack/json-utilities';
|
|
3
|
+
import { safeRelativePath } from '@ms-cloudpack/path-string-parsing';
|
|
4
|
+
import { bulletedList, formatPackageName, } from '@ms-cloudpack/task-reporter';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { findImports } from './findImports.js';
|
|
7
|
+
import { prepareOutputPath } from '../common/prepareOutputPath.js';
|
|
8
|
+
import { formatBundleErrors } from './formatBundleErrors.js';
|
|
9
|
+
import { getFileSizeSync } from './getFileSizeSync.js';
|
|
10
|
+
import { hashPackage } from './hashPackage.js';
|
|
11
|
+
import { getPackageSettings } from '@ms-cloudpack/config';
|
|
12
|
+
export async function bundleTask({ bundleRequest, options = {}, reporter, }) {
|
|
13
|
+
const { packageName, version } = bundleRequest;
|
|
14
|
+
const { force } = options || {};
|
|
15
|
+
const { rebuild } = bundleRequest?.result || {};
|
|
16
|
+
const taskName = `${rebuild ? `Re-bundle` : `Bundle`} ${formatPackageName({ name: packageName, version })}`;
|
|
17
|
+
const executeBundle = async () => {
|
|
18
|
+
if (rebuild) {
|
|
19
|
+
bundleRequest.result = await rebuild();
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
await bundle(bundleRequest, force);
|
|
23
|
+
}
|
|
24
|
+
const result = (bundleRequest.result ??= {});
|
|
25
|
+
result.outputFiles ??= [];
|
|
26
|
+
result.errors ??= [];
|
|
27
|
+
result.warnings ??= [];
|
|
28
|
+
if (!result.outputFiles.length) {
|
|
29
|
+
result.warnings.push({
|
|
30
|
+
text: `No output files were found for "${packageName}" in "${bundleRequest.outputPath}"`,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
status: result.errors.length ? 'fail' : 'complete',
|
|
35
|
+
...(result.errors?.length
|
|
36
|
+
? formatBundleErrors(result.errors)
|
|
37
|
+
: {
|
|
38
|
+
details: bulletedList([
|
|
39
|
+
`Package: ${bundleRequest.packageName}@${bundleRequest.version}`,
|
|
40
|
+
`Bundler: ${bundleRequest.result?.bundlerName || 'unknown'}`,
|
|
41
|
+
`Input path: ${bundleRequest.packagePath}`,
|
|
42
|
+
`Entries:`,
|
|
43
|
+
Object.values(bundleRequest.result?.entries || {}),
|
|
44
|
+
`Output path: ${bundleRequest.outputPath}`,
|
|
45
|
+
bundleRequest.result?.outputFiles?.map((file) => `${safeRelativePath(path.relative(bundleRequest.outputPath, file.outputPath))} (${getFileSizeSync(file.outputPath)})`),
|
|
46
|
+
]),
|
|
47
|
+
}),
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
if (reporter) {
|
|
51
|
+
await reporter.runTask(taskName, executeBundle);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
await executeBundle();
|
|
55
|
+
}
|
|
56
|
+
return bundleRequest;
|
|
57
|
+
}
|
|
58
|
+
async function bundle(bundleRequest, force) {
|
|
59
|
+
const { packages, config } = bundleRequest;
|
|
60
|
+
const context = { packages, config };
|
|
61
|
+
// If force is set, dispose the existing result.
|
|
62
|
+
if (force && bundleRequest?.result?.dispose) {
|
|
63
|
+
bundleRequest.result.dispose();
|
|
64
|
+
bundleRequest.result = undefined;
|
|
65
|
+
}
|
|
66
|
+
const { packagePath, outputPath, isExternal, disableSourceMaps, enableFindImports, enableCacheInternalPackages } = bundleRequest;
|
|
67
|
+
// Rehydrate the result if not incremental.
|
|
68
|
+
if ((isExternal || enableCacheInternalPackages) && !force) {
|
|
69
|
+
bundleRequest.result = await readJson(path.join(outputPath, 'result.json'));
|
|
70
|
+
}
|
|
71
|
+
const { userPackageSettings } = getPackageSettings({
|
|
72
|
+
name: bundleRequest.packageName,
|
|
73
|
+
version: bundleRequest.version,
|
|
74
|
+
config,
|
|
75
|
+
}) || {};
|
|
76
|
+
const { bundlerType, bundlerOptions } = userPackageSettings || {};
|
|
77
|
+
const bundleOptions = {
|
|
78
|
+
bundlerType: bundleRequest.bundlerType || bundlerType,
|
|
79
|
+
overrideOptions: bundlerOptions,
|
|
80
|
+
inputPath: packagePath,
|
|
81
|
+
outputPath,
|
|
82
|
+
incremental: !isExternal,
|
|
83
|
+
sourcemap: disableSourceMaps ? undefined : 'linked',
|
|
84
|
+
entries: await getEntriesMapFromPackage({ inputPath: packagePath }, context),
|
|
85
|
+
external: await getExternalsFromPackage({ inputPath: packagePath }, context),
|
|
86
|
+
};
|
|
87
|
+
const hash = !isExternal && enableCacheInternalPackages
|
|
88
|
+
? await hashPackage({ packagePath, isExternal, additionalProperties: bundleOptions })
|
|
89
|
+
: undefined;
|
|
90
|
+
if (bundleRequest.result?.errors?.length === 0 &&
|
|
91
|
+
// Dependencies are undefined if the older version of bundleTask was used to bundle the package.
|
|
92
|
+
// In this case, we need to bundle it again with the new version to have dependencies defined in the result.json.
|
|
93
|
+
(!enableFindImports || !!bundleRequest.result?.dependencies) &&
|
|
94
|
+
// Internal packages should be re-bundled if the package hash has changed.
|
|
95
|
+
(isExternal || (enableCacheInternalPackages && bundleRequest.result.hash === hash))) {
|
|
96
|
+
console.debug(`Using cached result for ${bundleRequest.packageName}@${bundleRequest.version}`);
|
|
97
|
+
bundleRequest.resultFromCache = true;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
bundleRequest.resultFromCache = false;
|
|
101
|
+
// Only use cached result if it's successful.
|
|
102
|
+
await prepareOutputPath(outputPath);
|
|
103
|
+
bundleRequest.result = await bundleInternal(bundleOptions);
|
|
104
|
+
bundleRequest.result.hash = hash;
|
|
105
|
+
if (enableFindImports) {
|
|
106
|
+
// Find imports that are in the output files and set dependencies.
|
|
107
|
+
const outputFilePaths = bundleRequest.result.outputFiles?.map((f) => f.outputPath);
|
|
108
|
+
const imports = outputFilePaths && (await findImports(outputFilePaths));
|
|
109
|
+
bundleRequest.result.dependencies = imports && Object.keys(imports);
|
|
110
|
+
}
|
|
111
|
+
// Write the result to disk.
|
|
112
|
+
if (isExternal || enableCacheInternalPackages) {
|
|
113
|
+
bundleRequest.result.rawInput = bundleRequest.result.rawOutput = undefined;
|
|
114
|
+
await writeJson(path.join(outputPath, 'result.json'), bundleRequest.result);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return bundleRequest;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=bundleTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundleTask.js","sourceRoot":"","sources":["../../src/utilities/bundleTask.ts"],"names":[],"mappings":"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","sourcesContent":["import { bundle as bundleInternal, getEntriesMapFromPackage, getExternalsFromPackage } from '@ms-cloudpack/bundler';\nimport { readJson, writeJson } from '@ms-cloudpack/json-utilities';\nimport { safeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport {\n bulletedList,\n formatPackageName,\n type TaskReporter,\n type TaskReporterTaskResult,\n} from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport { findImports } from './findImports.js';\nimport { prepareOutputPath } from '../common/prepareOutputPath.js';\nimport type { BundleTaskOptions } from '../types/BundleTaskOptions.js';\nimport type { BundleRequest } from '../types/BundleRequest.js';\nimport { formatBundleErrors } from './formatBundleErrors.js';\nimport { getFileSizeSync } from './getFileSizeSync.js';\nimport { hashPackage } from './hashPackage.js';\nimport type { BundleOptions } from '@ms-cloudpack/bundler-types';\nimport { getPackageSettings } from '@ms-cloudpack/config';\n\nexport async function bundleTask({\n bundleRequest,\n options = {},\n reporter,\n}: {\n bundleRequest: BundleRequest;\n options?: BundleTaskOptions;\n reporter?: TaskReporter;\n}) {\n const { packageName, version } = bundleRequest;\n const { force } = options || {};\n\n const { rebuild } = bundleRequest?.result || {};\n const taskName = `${rebuild ? `Re-bundle` : `Bundle`} ${formatPackageName({ name: packageName, version })}`;\n\n const executeBundle = async (): Promise<TaskReporterTaskResult> => {\n if (rebuild) {\n bundleRequest.result = await rebuild();\n } else {\n await bundle(bundleRequest, force);\n }\n\n const result = (bundleRequest.result ??= {});\n\n result.outputFiles ??= [];\n result.errors ??= [];\n result.warnings ??= [];\n\n if (!result.outputFiles.length) {\n result.warnings.push({\n text: `No output files were found for \"${packageName}\" in \"${bundleRequest.outputPath}\"`,\n });\n }\n\n return {\n status: result.errors.length ? 'fail' : 'complete',\n ...(result.errors?.length\n ? formatBundleErrors(result.errors)\n : {\n details: bulletedList([\n `Package: ${bundleRequest.packageName}@${bundleRequest.version}`,\n `Bundler: ${bundleRequest.result?.bundlerName || 'unknown'}`,\n `Input path: ${bundleRequest.packagePath}`,\n `Entries:`,\n Object.values(bundleRequest.result?.entries || {}),\n `Output path: ${bundleRequest.outputPath}`,\n bundleRequest.result?.outputFiles?.map(\n (file) =>\n `${safeRelativePath(path.relative(bundleRequest.outputPath, file.outputPath))} (${getFileSizeSync(\n file.outputPath,\n )})`,\n ),\n ]),\n }),\n };\n };\n\n if (reporter) {\n await reporter.runTask(taskName, executeBundle);\n } else {\n await executeBundle();\n }\n\n return bundleRequest;\n}\n\nasync function bundle(bundleRequest: BundleRequest, force?: boolean): Promise<BundleRequest> {\n const { packages, config } = bundleRequest;\n const context = { packages, config };\n\n // If force is set, dispose the existing result.\n if (force && bundleRequest?.result?.dispose) {\n bundleRequest.result.dispose();\n bundleRequest.result = undefined;\n }\n\n const { packagePath, outputPath, isExternal, disableSourceMaps, enableFindImports, enableCacheInternalPackages } =\n bundleRequest;\n\n // Rehydrate the result if not incremental.\n if ((isExternal || enableCacheInternalPackages) && !force) {\n bundleRequest.result = await readJson(path.join(outputPath, 'result.json'));\n }\n\n const { userPackageSettings } =\n getPackageSettings({\n name: bundleRequest.packageName,\n version: bundleRequest.version,\n config,\n }) || {};\n const { bundlerType, bundlerOptions } = userPackageSettings || {};\n\n const bundleOptions: BundleOptions = {\n bundlerType: bundleRequest.bundlerType || bundlerType,\n overrideOptions: bundlerOptions,\n inputPath: packagePath,\n outputPath,\n incremental: !isExternal,\n sourcemap: disableSourceMaps ? undefined : 'linked',\n entries: await getEntriesMapFromPackage({ inputPath: packagePath }, context),\n external: await getExternalsFromPackage({ inputPath: packagePath }, context),\n };\n\n const hash =\n !isExternal && enableCacheInternalPackages\n ? await hashPackage({ packagePath, isExternal, additionalProperties: bundleOptions })\n : undefined;\n\n if (\n bundleRequest.result?.errors?.length === 0 &&\n // Dependencies are undefined if the older version of bundleTask was used to bundle the package.\n // In this case, we need to bundle it again with the new version to have dependencies defined in the result.json.\n (!enableFindImports || !!bundleRequest.result?.dependencies) &&\n // Internal packages should be re-bundled if the package hash has changed.\n (isExternal || (enableCacheInternalPackages && bundleRequest.result.hash === hash))\n ) {\n console.debug(`Using cached result for ${bundleRequest.packageName}@${bundleRequest.version}`);\n bundleRequest.resultFromCache = true;\n } else {\n bundleRequest.resultFromCache = false;\n\n // Only use cached result if it's successful.\n await prepareOutputPath(outputPath);\n\n bundleRequest.result = await bundleInternal(bundleOptions);\n bundleRequest.result.hash = hash;\n\n if (enableFindImports) {\n // Find imports that are in the output files and set dependencies.\n const outputFilePaths = bundleRequest.result.outputFiles?.map((f) => f.outputPath);\n const imports = outputFilePaths && (await findImports(outputFilePaths));\n bundleRequest.result.dependencies = imports && Object.keys(imports);\n }\n\n // Write the result to disk.\n if (isExternal || enableCacheInternalPackages) {\n bundleRequest.result.rawInput = bundleRequest.result.rawOutput = undefined;\n await writeJson(path.join(outputPath, 'result.json'), bundleRequest.result);\n }\n }\n\n return bundleRequest;\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CloudpackConfig } from '@ms-cloudpack/config';
|
|
2
|
+
import type { ResolveMapEntry } from '@ms-cloudpack/package-utilities';
|
|
3
|
+
import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
|
|
4
|
+
import type { BundleRequest } from '../types/BundleRequest.js';
|
|
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
|
|
@@ -0,0 +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;AACvE,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;CAC/B,EACD,OAAO,EAAE;IACP,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,uBAAuB,CAAC;CACnC,GACA,OAAO,CAAC,aAAa,CAAC,CAmBxB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getBundleDetails } from '../utilities/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
|
|
@@ -0,0 +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,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 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 },\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"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BundleTaskOptions } from '../types/BundleTaskOptions.js';
|
|
2
|
+
import type { BundleRequest } from '../types/BundleRequest.js';
|
|
3
|
+
import type { Task } from '../types/Task.js';
|
|
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
|
|
@@ -0,0 +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;AAM7C,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"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import { bundleTask } from './/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
|