@angular-devkit/architect 0.1701.2 → 0.1702.0-next.1

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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@angular-devkit/architect",
3
- "version": "0.1701.2",
3
+ "version": "0.1702.0-next.1",
4
4
  "description": "Angular Build Facade",
5
5
  "experimental": true,
6
6
  "main": "src/index.js",
7
7
  "typings": "src/index.d.ts",
8
8
  "dependencies": {
9
- "@angular-devkit/core": "17.1.2",
9
+ "@angular-devkit/core": "17.2.0-next.1",
10
10
  "rxjs": "7.8.1"
11
11
  },
12
12
  "builders": "./builders/builders.json",
package/src/api.d.ts CHANGED
@@ -249,9 +249,10 @@ export type BuilderInfo = json.JsonObject & {
249
249
  */
250
250
  export declare function targetStringFromTarget({ project, target, configuration }: Target): string;
251
251
  /**
252
- * Return a Target tuple from a string.
252
+ * Return a Target tuple from a specifier string.
253
+ * Supports abbreviated target specifiers (examples: `::`, `::development`, or `:build:production`).
253
254
  */
254
- export declare function targetFromTargetString(str: string): Target;
255
+ export declare function targetFromTargetString(specifier: string, abbreviatedProjectName?: string, abbreviatedTargetName?: string): Target;
255
256
  /**
256
257
  * Schedule a target, and forget about its run. This will return an observable of outputs, that
257
258
  * as a teardown will stop the target from running. This means that the Run object this returns
package/src/api.js CHANGED
@@ -51,16 +51,17 @@ function targetStringFromTarget({ project, target, configuration }) {
51
51
  }
52
52
  exports.targetStringFromTarget = targetStringFromTarget;
53
53
  /**
54
- * Return a Target tuple from a string.
54
+ * Return a Target tuple from a specifier string.
55
+ * Supports abbreviated target specifiers (examples: `::`, `::development`, or `:build:production`).
55
56
  */
56
- function targetFromTargetString(str) {
57
- const tuple = str.split(/:/, 3);
57
+ function targetFromTargetString(specifier, abbreviatedProjectName, abbreviatedTargetName) {
58
+ const tuple = specifier.split(':', 3);
58
59
  if (tuple.length < 2) {
59
- throw new Error('Invalid target string: ' + JSON.stringify(str));
60
+ throw new Error('Invalid target string: ' + JSON.stringify(specifier));
60
61
  }
61
62
  return {
62
- project: tuple[0],
63
- target: tuple[1],
63
+ project: tuple[0] || abbreviatedProjectName || '',
64
+ target: tuple[1] || abbreviatedTargetName || '',
64
65
  ...(tuple[2] !== undefined && { configuration: tuple[2] }),
65
66
  };
66
67
  }
@@ -5,6 +5,7 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
+ import * as strategy from './strategy';
8
9
  export * from './api';
9
10
  export * from './create-job-handler';
10
11
  export * from './exception';
@@ -12,4 +13,4 @@ export * from './dispatcher';
12
13
  export * from './fallback-registry';
13
14
  export * from './simple-registry';
14
15
  export * from './simple-scheduler';
15
- export * from './strategy';
16
+ export { strategy };
package/src/jobs/index.js CHANGED
@@ -17,10 +17,25 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
17
17
  if (k2 === undefined) k2 = k;
18
18
  o[k2] = m[k];
19
19
  }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
20
32
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
33
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
34
  };
23
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.strategy = void 0;
37
+ const strategy = __importStar(require("./strategy"));
38
+ exports.strategy = strategy;
24
39
  __exportStar(require("./api"), exports);
25
40
  __exportStar(require("./create-job-handler"), exports);
26
41
  __exportStar(require("./exception"), exports);
@@ -28,4 +43,3 @@ __exportStar(require("./dispatcher"), exports);
28
43
  __exportStar(require("./fallback-registry"), exports);
29
44
  __exportStar(require("./simple-registry"), exports);
30
45
  __exportStar(require("./simple-scheduler"), exports);
31
- __exportStar(require("./strategy"), exports);
@@ -7,22 +7,20 @@
7
7
  */
8
8
  import { JsonValue } from '@angular-devkit/core';
9
9
  import { JobDescription, JobHandler } from './api';
10
- export declare namespace strategy {
11
- type JobStrategy<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue> = (handler: JobHandler<A, I, O>, options?: Partial<Readonly<JobDescription>>) => JobHandler<A, I, O>;
12
- /**
13
- * Creates a JobStrategy that serializes every call. This strategy can be mixed between jobs.
14
- */
15
- function serialize<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue>(): JobStrategy<A, I, O>;
16
- /**
17
- * Creates a JobStrategy that will always reuse a running job, and restart it if the job ended.
18
- * @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it
19
- * is.
20
- */
21
- function reuse<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue>(replayMessages?: boolean): JobStrategy<A, I, O>;
22
- /**
23
- * Creates a JobStrategy that will reuse a running job if the argument matches.
24
- * @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it
25
- * is.
26
- */
27
- function memoize<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue>(replayMessages?: boolean): JobStrategy<A, I, O>;
28
- }
10
+ export type JobStrategy<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue> = (handler: JobHandler<A, I, O>, options?: Partial<Readonly<JobDescription>>) => JobHandler<A, I, O>;
11
+ /**
12
+ * Creates a JobStrategy that serializes every call. This strategy can be mixed between jobs.
13
+ */
14
+ export declare function serialize<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue>(): JobStrategy<A, I, O>;
15
+ /**
16
+ * Creates a JobStrategy that will always reuse a running job, and restart it if the job ended.
17
+ * @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it
18
+ * is.
19
+ */
20
+ export declare function reuse<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue>(replayMessages?: boolean): JobStrategy<A, I, O>;
21
+ /**
22
+ * Creates a JobStrategy that will reuse a running job if the argument matches.
23
+ * @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it
24
+ * is.
25
+ */
26
+ export declare function memoize<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue>(replayMessages?: boolean): JobStrategy<A, I, O>;
@@ -7,92 +7,88 @@
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.strategy = void 0;
10
+ exports.memoize = exports.reuse = exports.serialize = void 0;
11
11
  const core_1 = require("@angular-devkit/core");
12
12
  const rxjs_1 = require("rxjs");
13
13
  const api_1 = require("./api");
14
- // eslint-disable-next-line @typescript-eslint/no-namespace
15
- var strategy;
16
- (function (strategy) {
17
- /**
18
- * Creates a JobStrategy that serializes every call. This strategy can be mixed between jobs.
19
- */
20
- function serialize() {
21
- let latest = (0, rxjs_1.of)();
22
- return (handler, options) => {
23
- const newHandler = (argument, context) => {
24
- const previous = latest;
25
- latest = (0, rxjs_1.concat)(previous.pipe((0, rxjs_1.ignoreElements)()), new rxjs_1.Observable((o) => handler(argument, context).subscribe(o))).pipe((0, rxjs_1.shareReplay)(0));
26
- return latest;
27
- };
28
- return Object.assign(newHandler, {
29
- jobDescription: Object.assign({}, handler.jobDescription, options),
30
- });
14
+ /**
15
+ * Creates a JobStrategy that serializes every call. This strategy can be mixed between jobs.
16
+ */
17
+ function serialize() {
18
+ let latest = (0, rxjs_1.of)();
19
+ return (handler, options) => {
20
+ const newHandler = (argument, context) => {
21
+ const previous = latest;
22
+ latest = (0, rxjs_1.concat)(previous.pipe((0, rxjs_1.ignoreElements)()), new rxjs_1.Observable((o) => handler(argument, context).subscribe(o))).pipe((0, rxjs_1.shareReplay)(0));
23
+ return latest;
31
24
  };
32
- }
33
- strategy.serialize = serialize;
34
- /**
35
- * Creates a JobStrategy that will always reuse a running job, and restart it if the job ended.
36
- * @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it
37
- * is.
38
- */
39
- function reuse(replayMessages = false) {
40
- let inboundBus = new rxjs_1.Subject();
41
- let run = null;
42
- let state = null;
43
- return (handler, options) => {
44
- const newHandler = (argument, context) => {
45
- // Forward inputs.
46
- const subscription = context.inboundBus.subscribe(inboundBus);
47
- if (run) {
48
- return (0, rxjs_1.concat)(
49
- // Update state.
50
- (0, rxjs_1.of)(state), run).pipe((0, rxjs_1.finalize)(() => subscription.unsubscribe()));
25
+ return Object.assign(newHandler, {
26
+ jobDescription: Object.assign({}, handler.jobDescription, options),
27
+ });
28
+ };
29
+ }
30
+ exports.serialize = serialize;
31
+ /**
32
+ * Creates a JobStrategy that will always reuse a running job, and restart it if the job ended.
33
+ * @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it
34
+ * is.
35
+ */
36
+ function reuse(replayMessages = false) {
37
+ let inboundBus = new rxjs_1.Subject();
38
+ let run = null;
39
+ let state = null;
40
+ return (handler, options) => {
41
+ const newHandler = (argument, context) => {
42
+ // Forward inputs.
43
+ const subscription = context.inboundBus.subscribe(inboundBus);
44
+ if (run) {
45
+ return (0, rxjs_1.concat)(
46
+ // Update state.
47
+ (0, rxjs_1.of)(state), run).pipe((0, rxjs_1.finalize)(() => subscription.unsubscribe()));
48
+ }
49
+ run = handler(argument, { ...context, inboundBus: inboundBus.asObservable() }).pipe((0, rxjs_1.tap)((message) => {
50
+ if (message.kind == api_1.JobOutboundMessageKind.Start ||
51
+ message.kind == api_1.JobOutboundMessageKind.OnReady ||
52
+ message.kind == api_1.JobOutboundMessageKind.End) {
53
+ state = message;
51
54
  }
52
- run = handler(argument, { ...context, inboundBus: inboundBus.asObservable() }).pipe((0, rxjs_1.tap)((message) => {
53
- if (message.kind == api_1.JobOutboundMessageKind.Start ||
54
- message.kind == api_1.JobOutboundMessageKind.OnReady ||
55
- message.kind == api_1.JobOutboundMessageKind.End) {
56
- state = message;
57
- }
58
- }, undefined, () => {
59
- subscription.unsubscribe();
60
- inboundBus = new rxjs_1.Subject();
61
- run = null;
62
- }), replayMessages ? (0, rxjs_1.shareReplay)() : (0, rxjs_1.share)());
63
- return run;
64
- };
65
- return Object.assign(newHandler, handler, options || {});
55
+ }, undefined, () => {
56
+ subscription.unsubscribe();
57
+ inboundBus = new rxjs_1.Subject();
58
+ run = null;
59
+ }), replayMessages ? (0, rxjs_1.shareReplay)() : (0, rxjs_1.share)());
60
+ return run;
66
61
  };
67
- }
68
- strategy.reuse = reuse;
69
- /**
70
- * Creates a JobStrategy that will reuse a running job if the argument matches.
71
- * @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it
72
- * is.
73
- */
74
- function memoize(replayMessages = false) {
75
- const runs = new Map();
76
- return (handler, options) => {
77
- const newHandler = (argument, context) => {
78
- const argumentJson = JSON.stringify((0, core_1.isJsonObject)(argument)
79
- ? Object.keys(argument)
80
- .sort()
81
- .reduce((result, key) => {
82
- result[key] = argument[key];
83
- return result;
84
- }, {})
85
- : argument);
86
- const maybeJob = runs.get(argumentJson);
87
- if (maybeJob) {
88
- return maybeJob;
89
- }
90
- const run = handler(argument, context).pipe(replayMessages ? (0, rxjs_1.shareReplay)() : (0, rxjs_1.share)());
91
- runs.set(argumentJson, run);
92
- return run;
93
- };
94
- return Object.assign(newHandler, handler, options || {});
62
+ return Object.assign(newHandler, handler, options || {});
63
+ };
64
+ }
65
+ exports.reuse = reuse;
66
+ /**
67
+ * Creates a JobStrategy that will reuse a running job if the argument matches.
68
+ * @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it
69
+ * is.
70
+ */
71
+ function memoize(replayMessages = false) {
72
+ const runs = new Map();
73
+ return (handler, options) => {
74
+ const newHandler = (argument, context) => {
75
+ const argumentJson = JSON.stringify((0, core_1.isJsonObject)(argument)
76
+ ? Object.keys(argument)
77
+ .sort()
78
+ .reduce((result, key) => {
79
+ result[key] = argument[key];
80
+ return result;
81
+ }, {})
82
+ : argument);
83
+ const maybeJob = runs.get(argumentJson);
84
+ if (maybeJob) {
85
+ return maybeJob;
86
+ }
87
+ const run = handler(argument, context).pipe(replayMessages ? (0, rxjs_1.shareReplay)() : (0, rxjs_1.share)());
88
+ runs.set(argumentJson, run);
89
+ return run;
95
90
  };
96
- }
97
- strategy.memoize = memoize;
98
- })(strategy || (exports.strategy = strategy = {}));
91
+ return Object.assign(newHandler, handler, options || {});
92
+ };
93
+ }
94
+ exports.memoize = memoize;