@angular-devkit/architect 0.2000.0-rc.2 → 0.2000.0-rc.4
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.
|
@@ -258,19 +258,22 @@ function loadEsmModule(modulePath) {
|
|
|
258
258
|
}
|
|
259
259
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
260
260
|
async function getBuilder(builderPath) {
|
|
261
|
+
let builder;
|
|
261
262
|
switch (path.extname(builderPath)) {
|
|
262
263
|
case '.mjs':
|
|
263
264
|
// Load the ESM configuration file using the TypeScript dynamic import workaround.
|
|
264
265
|
// Once TypeScript provides support for keeping the dynamic import this workaround can be
|
|
265
266
|
// changed to a direct dynamic import.
|
|
266
|
-
|
|
267
|
+
builder = (await loadEsmModule((0, node_url_1.pathToFileURL)(builderPath))).default;
|
|
268
|
+
break;
|
|
267
269
|
case '.cjs':
|
|
268
|
-
|
|
270
|
+
builder = localRequire(builderPath);
|
|
271
|
+
break;
|
|
269
272
|
default:
|
|
270
273
|
// The file could be either CommonJS or ESM.
|
|
271
274
|
// CommonJS is tried first then ESM if loading fails.
|
|
272
275
|
try {
|
|
273
|
-
|
|
276
|
+
builder = localRequire(builderPath);
|
|
274
277
|
}
|
|
275
278
|
catch (e) {
|
|
276
279
|
if (e.code === 'ERR_REQUIRE_ESM' ||
|
|
@@ -278,9 +281,11 @@ async function getBuilder(builderPath) {
|
|
|
278
281
|
// Load the ESM configuration file using the TypeScript dynamic import workaround.
|
|
279
282
|
// Once TypeScript provides support for keeping the dynamic import this workaround can be
|
|
280
283
|
// changed to a direct dynamic import.
|
|
281
|
-
|
|
284
|
+
builder = await loadEsmModule((0, node_url_1.pathToFileURL)(builderPath));
|
|
282
285
|
}
|
|
283
286
|
throw e;
|
|
284
287
|
}
|
|
288
|
+
break;
|
|
285
289
|
}
|
|
290
|
+
return 'default' in builder ? builder.default : builder;
|
|
286
291
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/architect",
|
|
3
|
-
"version": "0.2000.0-rc.
|
|
3
|
+
"version": "0.2000.0-rc.4",
|
|
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": "20.0.0-rc.
|
|
9
|
+
"@angular-devkit/core": "20.0.0-rc.4",
|
|
10
10
|
"rxjs": "7.8.2"
|
|
11
11
|
},
|
|
12
12
|
"builders": "./builders/builders.json",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"packageManager": "pnpm@9.15.9",
|
|
25
25
|
"engines": {
|
|
26
|
-
"node": "^20.
|
|
26
|
+
"node": "^20.19.0 || ^22.12.0 || >=24.0.0",
|
|
27
27
|
"npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
|
|
28
28
|
"yarn": ">= 1.13.0"
|
|
29
29
|
},
|
package/src/architect.js
CHANGED
|
@@ -14,14 +14,12 @@ const api_1 = require("./api");
|
|
|
14
14
|
const jobs_1 = require("./jobs");
|
|
15
15
|
const options_1 = require("./options");
|
|
16
16
|
const schedule_by_name_1 = require("./schedule-by-name");
|
|
17
|
-
const inputSchema = require('./input-schema.json');
|
|
18
|
-
const outputSchema = require('./output-schema.json');
|
|
19
17
|
function _createJobHandlerFromBuilderInfo(info, target, host, registry, baseOptions) {
|
|
20
18
|
const jobDescription = {
|
|
21
19
|
name: target ? `{${(0, api_1.targetStringFromTarget)(target)}}` : info.builderName,
|
|
22
|
-
argument:
|
|
23
|
-
input:
|
|
24
|
-
output:
|
|
20
|
+
argument: true,
|
|
21
|
+
input: true,
|
|
22
|
+
output: true,
|
|
25
23
|
info,
|
|
26
24
|
};
|
|
27
25
|
function handler(argument, context) {
|
|
@@ -179,8 +177,6 @@ function _getTargetOptionsFactory(host) {
|
|
|
179
177
|
});
|
|
180
178
|
}, {
|
|
181
179
|
name: '..getTargetOptions',
|
|
182
|
-
output: { type: 'object' },
|
|
183
|
-
argument: inputSchema.properties.target,
|
|
184
180
|
});
|
|
185
181
|
}
|
|
186
182
|
function _getProjectMetadataFactory(host) {
|
|
@@ -193,10 +189,6 @@ function _getProjectMetadataFactory(host) {
|
|
|
193
189
|
});
|
|
194
190
|
}, {
|
|
195
191
|
name: '..getProjectMetadata',
|
|
196
|
-
output: { type: 'object' },
|
|
197
|
-
argument: {
|
|
198
|
-
oneOf: [{ type: 'string' }, inputSchema.properties.target],
|
|
199
|
-
},
|
|
200
192
|
});
|
|
201
193
|
}
|
|
202
194
|
function _getBuilderNameForTargetFactory(host) {
|
|
@@ -208,8 +200,6 @@ function _getBuilderNameForTargetFactory(host) {
|
|
|
208
200
|
return builderName;
|
|
209
201
|
}, {
|
|
210
202
|
name: '..getBuilderNameForTarget',
|
|
211
|
-
output: { type: 'string' },
|
|
212
|
-
argument: inputSchema.properties.target,
|
|
213
203
|
});
|
|
214
204
|
}
|
|
215
205
|
function _validateOptionsFactory(host, registry) {
|
|
@@ -227,11 +217,6 @@ function _validateOptionsFactory(host, registry) {
|
|
|
227
217
|
return data;
|
|
228
218
|
}, {
|
|
229
219
|
name: '..validateOptions',
|
|
230
|
-
output: { type: 'object' },
|
|
231
|
-
argument: {
|
|
232
|
-
type: 'array',
|
|
233
|
-
items: [{ type: 'string' }, { type: 'object' }],
|
|
234
|
-
},
|
|
235
220
|
});
|
|
236
221
|
}
|
|
237
222
|
class Architect {
|
|
@@ -104,11 +104,18 @@ class SimpleScheduler {
|
|
|
104
104
|
output: handler.jobDescription.output || true,
|
|
105
105
|
channels: handler.jobDescription.channels || {},
|
|
106
106
|
};
|
|
107
|
+
const noopValidator = noopSchemaValidator();
|
|
107
108
|
const handlerWithExtra = Object.assign(handler.bind(undefined), {
|
|
108
109
|
jobDescription: description,
|
|
109
|
-
argumentV:
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
argumentV: description.argument === true
|
|
111
|
+
? noopValidator
|
|
112
|
+
: this._schemaRegistry.compile(description.argument),
|
|
113
|
+
inputV: description.input === true
|
|
114
|
+
? noopValidator
|
|
115
|
+
: this._schemaRegistry.compile(description.input),
|
|
116
|
+
outputV: description.output === true
|
|
117
|
+
? noopValidator
|
|
118
|
+
: this._schemaRegistry.compile(description.output),
|
|
112
119
|
});
|
|
113
120
|
this._internalJobDescriptionMap.set(name, handlerWithExtra);
|
|
114
121
|
return (0, rxjs_1.of)(handlerWithExtra);
|
|
@@ -379,3 +386,9 @@ class SimpleScheduler {
|
|
|
379
386
|
}
|
|
380
387
|
}
|
|
381
388
|
exports.SimpleScheduler = SimpleScheduler;
|
|
389
|
+
async function noopSchemaValidator() {
|
|
390
|
+
return async (data) => ({
|
|
391
|
+
data,
|
|
392
|
+
success: true,
|
|
393
|
+
});
|
|
394
|
+
}
|