@angular-devkit/architect 0.1500.0-next.3 → 0.1500.0-next.5
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/node/BUILD.bazel +30 -0
- package/node/index.d.ts +2 -0
- package/node/index.js +15 -0
- package/node/jobs/job-registry.d.ts +20 -0
- package/node/jobs/job-registry.js +59 -0
- package/package.json +3 -3
- package/src/api.d.ts +3 -7
- package/src/architect.d.ts +4 -4
- package/src/architect.js +10 -11
- package/src/create-builder.js +4 -5
- package/src/index.d.ts +2 -0
- package/src/index.js +15 -1
- package/src/internal.d.ts +5 -4
- package/src/jobs/README.md +508 -0
- package/src/jobs/api.d.ts +332 -0
- package/src/jobs/api.js +73 -0
- package/src/jobs/architecture.md +260 -0
- package/src/jobs/create-job-handler.d.ts +46 -0
- package/src/jobs/create-job-handler.js +134 -0
- package/src/jobs/dispatcher.d.ts +31 -0
- package/src/jobs/dispatcher.js +50 -0
- package/src/jobs/exception.d.ts +15 -0
- package/src/jobs/exception.js +23 -0
- package/src/jobs/fallback-registry.d.ts +19 -0
- package/src/jobs/fallback-registry.js +27 -0
- package/src/jobs/index.d.ts +15 -0
- package/src/jobs/index.js +31 -0
- package/src/jobs/simple-registry.d.ts +44 -0
- package/src/jobs/simple-registry.js +77 -0
- package/src/jobs/simple-scheduler.d.ts +77 -0
- package/src/jobs/simple-scheduler.js +382 -0
- package/src/jobs/strategy.d.ts +28 -0
- package/src/jobs/strategy.js +99 -0
- package/src/jobs/types.d.ts +15 -0
- package/src/jobs/types.js +9 -0
- package/src/schedule-by-name.d.ts +4 -5
- package/src/schedule-by-name.js +3 -10
package/node/BUILD.bazel
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
# Use of this source code is governed by an MIT-style license that can be
|
|
4
4
|
# found in the LICENSE file at https://angular.io/license
|
|
5
5
|
|
|
6
|
+
load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test")
|
|
6
7
|
load("//tools:defaults.bzl", "ts_library")
|
|
8
|
+
load("//tools:toolchain_info.bzl", "TOOLCHAINS_NAMES", "TOOLCHAINS_VERSIONS")
|
|
7
9
|
|
|
8
10
|
licenses(["notice"])
|
|
9
11
|
|
|
@@ -21,7 +23,35 @@ ts_library(
|
|
|
21
23
|
"//packages/angular_devkit/architect",
|
|
22
24
|
"//packages/angular_devkit/core",
|
|
23
25
|
"//packages/angular_devkit/core/node",
|
|
26
|
+
"//tests/angular_devkit/architect/node/jobs:jobs_test_lib",
|
|
24
27
|
"@npm//@types/node",
|
|
25
28
|
"@npm//rxjs",
|
|
26
29
|
],
|
|
27
30
|
)
|
|
31
|
+
|
|
32
|
+
ts_library(
|
|
33
|
+
name = "node_test_lib",
|
|
34
|
+
testonly = True,
|
|
35
|
+
srcs = glob(
|
|
36
|
+
include = [
|
|
37
|
+
"**/*_spec.ts",
|
|
38
|
+
],
|
|
39
|
+
),
|
|
40
|
+
deps = [
|
|
41
|
+
":node",
|
|
42
|
+
"//packages/angular_devkit/architect",
|
|
43
|
+
],
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
[
|
|
47
|
+
jasmine_node_test(
|
|
48
|
+
name = "node_test_" + toolchain_name,
|
|
49
|
+
srcs = [":node_test_lib"],
|
|
50
|
+
tags = [toolchain_name],
|
|
51
|
+
toolchain = toolchain,
|
|
52
|
+
)
|
|
53
|
+
for toolchain_name, toolchain in zip(
|
|
54
|
+
TOOLCHAINS_NAMES,
|
|
55
|
+
TOOLCHAINS_VERSIONS,
|
|
56
|
+
)
|
|
57
|
+
]
|
package/node/index.d.ts
CHANGED
package/node/index.js
CHANGED
|
@@ -17,8 +17,23 @@ 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.jobs = void 0;
|
|
37
|
+
const jobs = __importStar(require("./jobs/job-registry"));
|
|
38
|
+
exports.jobs = jobs;
|
|
24
39
|
__exportStar(require("./node-modules-architect-host"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { jobs } from '@angular-devkit/architect';
|
|
9
|
+
import { JsonValue } from '@angular-devkit/core';
|
|
10
|
+
import { Observable } from 'rxjs';
|
|
11
|
+
export declare class NodeModuleJobRegistry<MinimumArgumentValueT extends JsonValue = JsonValue, MinimumInputValueT extends JsonValue = JsonValue, MinimumOutputValueT extends JsonValue = JsonValue> implements jobs.Registry<MinimumArgumentValueT, MinimumInputValueT, MinimumOutputValueT> {
|
|
12
|
+
protected _resolve(name: string): string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Get a job description for a named job.
|
|
15
|
+
*
|
|
16
|
+
* @param name The name of the job.
|
|
17
|
+
* @returns A description, or null if the job is not registered.
|
|
18
|
+
*/
|
|
19
|
+
get<A extends MinimumArgumentValueT, I extends MinimumInputValueT, O extends MinimumOutputValueT>(name: jobs.JobName): Observable<jobs.JobHandler<A, I, O> | null>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.NodeModuleJobRegistry = void 0;
|
|
11
|
+
const core_1 = require("@angular-devkit/core");
|
|
12
|
+
const rxjs_1 = require("rxjs");
|
|
13
|
+
class NodeModuleJobRegistry {
|
|
14
|
+
_resolve(name) {
|
|
15
|
+
try {
|
|
16
|
+
return require.resolve(name);
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
if (e.code === 'MODULE_NOT_FOUND') {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
throw e;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get a job description for a named job.
|
|
27
|
+
*
|
|
28
|
+
* @param name The name of the job.
|
|
29
|
+
* @returns A description, or null if the job is not registered.
|
|
30
|
+
*/
|
|
31
|
+
get(name) {
|
|
32
|
+
const [moduleName, exportName] = name.split(/#/, 2);
|
|
33
|
+
const resolvedPath = this._resolve(moduleName);
|
|
34
|
+
if (!resolvedPath) {
|
|
35
|
+
return (0, rxjs_1.of)(null);
|
|
36
|
+
}
|
|
37
|
+
const pkg = require(resolvedPath);
|
|
38
|
+
const handler = pkg[exportName || 'default'];
|
|
39
|
+
if (!handler) {
|
|
40
|
+
return (0, rxjs_1.of)(null);
|
|
41
|
+
}
|
|
42
|
+
function _getValue(...fields) {
|
|
43
|
+
return fields.find((x) => core_1.schema.isJsonSchema(x)) || true;
|
|
44
|
+
}
|
|
45
|
+
const argument = _getValue(pkg.argument, handler.argument);
|
|
46
|
+
const input = _getValue(pkg.input, handler.input);
|
|
47
|
+
const output = _getValue(pkg.output, handler.output);
|
|
48
|
+
const channels = _getValue(pkg.channels, handler.channels);
|
|
49
|
+
return (0, rxjs_1.of)(Object.assign(handler.bind(undefined), {
|
|
50
|
+
jobDescription: {
|
|
51
|
+
argument,
|
|
52
|
+
input,
|
|
53
|
+
output,
|
|
54
|
+
channels,
|
|
55
|
+
},
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.NodeModuleJobRegistry = NodeModuleJobRegistry;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/architect",
|
|
3
|
-
"version": "0.1500.0-next.
|
|
3
|
+
"version": "0.1500.0-next.5",
|
|
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": "15.0.0-next.
|
|
9
|
+
"@angular-devkit/core": "15.0.0-next.5",
|
|
10
10
|
"rxjs": "6.6.7"
|
|
11
11
|
},
|
|
12
12
|
"builders": "./builders/builders.json",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"url": "https://github.com/angular/angular-cli.git"
|
|
23
23
|
},
|
|
24
24
|
"engines": {
|
|
25
|
-
"node": "^14.
|
|
25
|
+
"node": "^14.20.0 || ^16.13.0 || >=18.10.0",
|
|
26
26
|
"npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
|
|
27
27
|
"yarn": ">= 1.13.0"
|
|
28
28
|
},
|
package/src/api.d.ts
CHANGED
|
@@ -5,14 +5,15 @@
|
|
|
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 {
|
|
8
|
+
import { json, logging } from '@angular-devkit/core';
|
|
9
9
|
import { Observable, SubscribableOrPromise } from 'rxjs';
|
|
10
10
|
import { Schema as RealBuilderInput, Target as RealTarget } from './input-schema';
|
|
11
|
+
import { Registry } from './jobs';
|
|
11
12
|
import { Schema as RealBuilderOutput } from './output-schema';
|
|
12
13
|
import { State as BuilderProgressState, Schema as RealBuilderProgress } from './progress-schema';
|
|
13
14
|
export declare type Target = json.JsonObject & RealTarget;
|
|
14
15
|
export { BuilderProgressState };
|
|
15
|
-
export declare type BuilderRegistry =
|
|
16
|
+
export declare type BuilderRegistry = Registry<json.JsonObject, BuilderInput, BuilderOutput>;
|
|
16
17
|
/**
|
|
17
18
|
* An API typed BuilderProgress. The interface generated from the schema is too permissive,
|
|
18
19
|
* so this API is the one we show in our API. Please note that not all fields are in there; this
|
|
@@ -204,11 +205,6 @@ export interface BuilderContext {
|
|
|
204
205
|
* @param status Update the status string. If omitted the status string is not modified.
|
|
205
206
|
*/
|
|
206
207
|
reportProgress(current: number, total?: number, status?: string): void;
|
|
207
|
-
/**
|
|
208
|
-
* API to report analytics. This might be undefined if the feature is unsupported. This might
|
|
209
|
-
* not be undefined, but the backend could also not report anything.
|
|
210
|
-
*/
|
|
211
|
-
readonly analytics: analytics.Analytics;
|
|
212
208
|
/**
|
|
213
209
|
* Add teardown logic to this Context, so that when it's being stopped it will execute teardown.
|
|
214
210
|
*/
|
package/src/architect.d.ts
CHANGED
|
@@ -5,21 +5,21 @@
|
|
|
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 {
|
|
8
|
+
import { json, logging } from '@angular-devkit/core';
|
|
9
9
|
import { Observable } from 'rxjs';
|
|
10
10
|
import { BuilderRun, Target } from './api';
|
|
11
11
|
import { ArchitectHost } from './internal';
|
|
12
|
+
import { JobName, Registry } from './jobs';
|
|
12
13
|
export interface ScheduleOptions {
|
|
13
14
|
logger?: logging.Logger;
|
|
14
|
-
analytics?: analytics.Analytics;
|
|
15
15
|
}
|
|
16
16
|
export declare class Architect {
|
|
17
17
|
private _host;
|
|
18
18
|
private readonly _scheduler;
|
|
19
19
|
private readonly _jobCache;
|
|
20
20
|
private readonly _infoCache;
|
|
21
|
-
constructor(_host: ArchitectHost, registry?: json.schema.SchemaRegistry, additionalJobRegistry?:
|
|
22
|
-
has(name:
|
|
21
|
+
constructor(_host: ArchitectHost, registry?: json.schema.SchemaRegistry, additionalJobRegistry?: Registry);
|
|
22
|
+
has(name: JobName): Observable<boolean>;
|
|
23
23
|
scheduleBuilder(name: string, options: json.JsonObject, scheduleOptions?: ScheduleOptions): Promise<BuilderRun>;
|
|
24
24
|
scheduleTarget(target: Target, overrides?: json.JsonObject, scheduleOptions?: ScheduleOptions): Promise<BuilderRun>;
|
|
25
25
|
}
|
package/src/architect.js
CHANGED
|
@@ -12,6 +12,7 @@ const core_1 = require("@angular-devkit/core");
|
|
|
12
12
|
const rxjs_1 = require("rxjs");
|
|
13
13
|
const operators_1 = require("rxjs/operators");
|
|
14
14
|
const api_1 = require("./api");
|
|
15
|
+
const jobs_1 = require("./jobs");
|
|
15
16
|
const schedule_by_name_1 = require("./schedule-by-name");
|
|
16
17
|
const inputSchema = require('./input-schema.json');
|
|
17
18
|
const outputSchema = require('./output-schema.json');
|
|
@@ -26,7 +27,7 @@ function _createJobHandlerFromBuilderInfo(info, target, host, registry, baseOpti
|
|
|
26
27
|
function handler(argument, context) {
|
|
27
28
|
// Add input validation to the inbound bus.
|
|
28
29
|
const inboundBusWithInputValidation = context.inboundBus.pipe((0, operators_1.concatMap)((message) => {
|
|
29
|
-
if (message.kind ===
|
|
30
|
+
if (message.kind === jobs_1.JobInboundMessageKind.Input) {
|
|
30
31
|
const v = message.value;
|
|
31
32
|
const options = {
|
|
32
33
|
...baseOptions,
|
|
@@ -56,7 +57,7 @@ function _createJobHandlerFromBuilderInfo(info, target, host, registry, baseOpti
|
|
|
56
57
|
throw new Error(`Cannot load builder for builderInfo ${JSON.stringify(info, null, 2)}`);
|
|
57
58
|
}
|
|
58
59
|
return builder.handler(argument, { ...context, inboundBus }).pipe((0, operators_1.map)((output) => {
|
|
59
|
-
if (output.kind ===
|
|
60
|
+
if (output.kind === jobs_1.JobOutboundMessageKind.Output) {
|
|
60
61
|
// Add target to it.
|
|
61
62
|
return {
|
|
62
63
|
...output,
|
|
@@ -168,7 +169,7 @@ class ArchitectTargetJobRegistry extends ArchitectBuilderJobRegistry {
|
|
|
168
169
|
}
|
|
169
170
|
}
|
|
170
171
|
function _getTargetOptionsFactory(host) {
|
|
171
|
-
return
|
|
172
|
+
return (0, jobs_1.createJobHandler)((target) => {
|
|
172
173
|
return host.getOptionsForTarget(target).then((options) => {
|
|
173
174
|
if (options === null) {
|
|
174
175
|
throw new Error(`Invalid target: ${JSON.stringify(target)}.`);
|
|
@@ -182,7 +183,7 @@ function _getTargetOptionsFactory(host) {
|
|
|
182
183
|
});
|
|
183
184
|
}
|
|
184
185
|
function _getProjectMetadataFactory(host) {
|
|
185
|
-
return
|
|
186
|
+
return (0, jobs_1.createJobHandler)((target) => {
|
|
186
187
|
return host.getProjectMetadata(target).then((options) => {
|
|
187
188
|
if (options === null) {
|
|
188
189
|
throw new Error(`Invalid target: ${JSON.stringify(target)}.`);
|
|
@@ -198,7 +199,7 @@ function _getProjectMetadataFactory(host) {
|
|
|
198
199
|
});
|
|
199
200
|
}
|
|
200
201
|
function _getBuilderNameForTargetFactory(host) {
|
|
201
|
-
return
|
|
202
|
+
return (0, jobs_1.createJobHandler)(async (target) => {
|
|
202
203
|
const builderName = await host.getBuilderNameForTarget(target);
|
|
203
204
|
if (!builderName) {
|
|
204
205
|
throw new Error(`No builder were found for target ${(0, api_1.targetStringFromTarget)(target)}.`);
|
|
@@ -211,7 +212,7 @@ function _getBuilderNameForTargetFactory(host) {
|
|
|
211
212
|
});
|
|
212
213
|
}
|
|
213
214
|
function _validateOptionsFactory(host, registry) {
|
|
214
|
-
return
|
|
215
|
+
return (0, jobs_1.createJobHandler)(async ([builderName, options]) => {
|
|
215
216
|
// Get option schema from the host.
|
|
216
217
|
const builderInfo = await host.resolveBuilder(builderName);
|
|
217
218
|
if (!builderInfo) {
|
|
@@ -240,19 +241,19 @@ class Architect {
|
|
|
240
241
|
this._host = _host;
|
|
241
242
|
this._jobCache = new Map();
|
|
242
243
|
this._infoCache = new Map();
|
|
243
|
-
const privateArchitectJobRegistry = new
|
|
244
|
+
const privateArchitectJobRegistry = new jobs_1.SimpleJobRegistry();
|
|
244
245
|
// Create private jobs.
|
|
245
246
|
privateArchitectJobRegistry.register(_getTargetOptionsFactory(_host));
|
|
246
247
|
privateArchitectJobRegistry.register(_getBuilderNameForTargetFactory(_host));
|
|
247
248
|
privateArchitectJobRegistry.register(_validateOptionsFactory(_host, registry));
|
|
248
249
|
privateArchitectJobRegistry.register(_getProjectMetadataFactory(_host));
|
|
249
|
-
const jobRegistry = new
|
|
250
|
+
const jobRegistry = new jobs_1.FallbackRegistry([
|
|
250
251
|
new ArchitectTargetJobRegistry(_host, registry, this._jobCache, this._infoCache),
|
|
251
252
|
new ArchitectBuilderJobRegistry(_host, registry, this._jobCache, this._infoCache),
|
|
252
253
|
privateArchitectJobRegistry,
|
|
253
254
|
...(additionalJobRegistry ? [additionalJobRegistry] : []),
|
|
254
255
|
]);
|
|
255
|
-
this._scheduler = new
|
|
256
|
+
this._scheduler = new jobs_1.SimpleScheduler(jobRegistry, registry);
|
|
256
257
|
}
|
|
257
258
|
has(name) {
|
|
258
259
|
return this._scheduler.has(name);
|
|
@@ -267,7 +268,6 @@ class Architect {
|
|
|
267
268
|
logger: scheduleOptions.logger || new core_1.logging.NullLogger(),
|
|
268
269
|
currentDirectory: this._host.getCurrentDirectory(),
|
|
269
270
|
workspaceRoot: this._host.getWorkspaceRoot(),
|
|
270
|
-
analytics: scheduleOptions.analytics,
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
273
|
scheduleTarget(target, overrides = {}, scheduleOptions = {}) {
|
|
@@ -276,7 +276,6 @@ class Architect {
|
|
|
276
276
|
logger: scheduleOptions.logger || new core_1.logging.NullLogger(),
|
|
277
277
|
currentDirectory: this._host.getCurrentDirectory(),
|
|
278
278
|
workspaceRoot: this._host.getWorkspaceRoot(),
|
|
279
|
-
analytics: scheduleOptions.analytics,
|
|
280
279
|
});
|
|
281
280
|
}
|
|
282
281
|
}
|
package/src/create-builder.js
CHANGED
|
@@ -13,16 +13,16 @@ const rxjs_1 = require("rxjs");
|
|
|
13
13
|
const operators_1 = require("rxjs/operators");
|
|
14
14
|
const api_1 = require("./api");
|
|
15
15
|
const internal_1 = require("./internal");
|
|
16
|
+
const jobs_1 = require("./jobs");
|
|
16
17
|
const schedule_by_name_1 = require("./schedule-by-name");
|
|
17
18
|
// eslint-disable-next-line max-lines-per-function
|
|
18
19
|
function createBuilder(fn) {
|
|
19
|
-
const cjh =
|
|
20
|
+
const cjh = jobs_1.createJobHandler;
|
|
20
21
|
// eslint-disable-next-line max-lines-per-function
|
|
21
22
|
const handler = cjh((options, context) => {
|
|
22
23
|
const scheduler = context.scheduler;
|
|
23
24
|
const progressChannel = context.createChannel('progress');
|
|
24
25
|
const logChannel = context.createChannel('log');
|
|
25
|
-
const analyticsChannel = context.createChannel('analytics');
|
|
26
26
|
let currentState = api_1.BuilderProgressState.Stopped;
|
|
27
27
|
const teardownLogics = [];
|
|
28
28
|
let tearingDown = false;
|
|
@@ -55,12 +55,12 @@ function createBuilder(fn) {
|
|
|
55
55
|
const subscriptions = [];
|
|
56
56
|
const inputSubscription = context.inboundBus.subscribe((i) => {
|
|
57
57
|
switch (i.kind) {
|
|
58
|
-
case
|
|
58
|
+
case jobs_1.JobInboundMessageKind.Stop:
|
|
59
59
|
// Run teardown logic then complete.
|
|
60
60
|
tearingDown = true;
|
|
61
61
|
Promise.all(teardownLogics.map((fn) => fn() || Promise.resolve())).then(() => observer.complete(), (err) => observer.error(err));
|
|
62
62
|
break;
|
|
63
|
-
case
|
|
63
|
+
case jobs_1.JobInboundMessageKind.Input:
|
|
64
64
|
if (!tearingDown) {
|
|
65
65
|
onInput(i.value);
|
|
66
66
|
}
|
|
@@ -151,7 +151,6 @@ function createBuilder(fn) {
|
|
|
151
151
|
progress({ state: currentState, current, total, status }, context);
|
|
152
152
|
}
|
|
153
153
|
},
|
|
154
|
-
analytics: new core_1.analytics.ForwardingAnalytics((report) => analyticsChannel.next(report)),
|
|
155
154
|
addTeardown(teardown) {
|
|
156
155
|
teardownLogics.push(teardown);
|
|
157
156
|
},
|
package/src/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
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 jobs from './jobs';
|
|
8
9
|
export * from './api';
|
|
9
10
|
export { Architect, ScheduleOptions } from './architect';
|
|
10
11
|
export { createBuilder } from './create-builder';
|
|
12
|
+
export { jobs };
|
package/src/index.js
CHANGED
|
@@ -17,11 +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 });
|
|
24
|
-
exports.createBuilder = exports.Architect = void 0;
|
|
36
|
+
exports.jobs = exports.createBuilder = exports.Architect = void 0;
|
|
37
|
+
const jobs = __importStar(require("./jobs"));
|
|
38
|
+
exports.jobs = jobs;
|
|
25
39
|
__exportStar(require("./api"), exports);
|
|
26
40
|
var architect_1 = require("./architect");
|
|
27
41
|
Object.defineProperty(exports, "Architect", { enumerable: true, get: function () { return architect_1.Architect; } });
|
package/src/internal.d.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
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 {
|
|
8
|
+
import { json } from '@angular-devkit/core';
|
|
9
9
|
import { BuilderInfo, BuilderInput, BuilderOutput, Target } from './api';
|
|
10
|
+
import { JobDescription, JobHandler } from './jobs';
|
|
10
11
|
/**
|
|
11
12
|
* BuilderSymbol used for knowing if a function was created using createBuilder(). This is a
|
|
12
13
|
* property set on the function that should be `true`.
|
|
@@ -25,21 +26,21 @@ export declare const BuilderVersionSymbol: unique symbol;
|
|
|
25
26
|
* A Specialization of the JobHandler type. This exposes BuilderDescription as the job description
|
|
26
27
|
* type.
|
|
27
28
|
*/
|
|
28
|
-
export declare type BuilderJobHandler<A extends json.JsonObject = json.JsonObject, I extends BuilderInput = BuilderInput, O extends BuilderOutput = BuilderOutput> =
|
|
29
|
+
export declare type BuilderJobHandler<A extends json.JsonObject = json.JsonObject, I extends BuilderInput = BuilderInput, O extends BuilderOutput = BuilderOutput> = JobHandler<A, I, O> & {
|
|
29
30
|
jobDescription: BuilderDescription;
|
|
30
31
|
};
|
|
31
32
|
/**
|
|
32
33
|
* A Builder description, which is used internally. Adds the builder info which is the
|
|
33
34
|
* metadata attached to a builder in Architect.
|
|
34
35
|
*/
|
|
35
|
-
export interface BuilderDescription extends
|
|
36
|
+
export interface BuilderDescription extends JobDescription {
|
|
36
37
|
info: BuilderInfo;
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
39
40
|
* A Builder instance. Use createBuilder() to create one of these.
|
|
40
41
|
*/
|
|
41
42
|
export interface Builder<OptionT extends json.JsonObject = json.JsonObject> {
|
|
42
|
-
handler:
|
|
43
|
+
handler: JobHandler<json.JsonObject, BuilderInput, BuilderOutput>;
|
|
43
44
|
[BuilderSymbol]: true;
|
|
44
45
|
[BuilderVersionSymbol]: string;
|
|
45
46
|
}
|