@angular-devkit/architect 0.1700.0-rc.3 → 0.1700.0-rc.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.
|
@@ -5,7 +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
|
+
/// <reference types="node" />
|
|
8
9
|
import { json, workspaces } from '@angular-devkit/core';
|
|
10
|
+
import { URL } from 'url';
|
|
9
11
|
import { BuilderInfo } from '../src';
|
|
10
12
|
import { Target } from '../src/input-schema';
|
|
11
13
|
import { ArchitectHost, Builder } from '../src/internal';
|
|
@@ -39,3 +41,16 @@ export declare class WorkspaceNodeModulesArchitectHost implements ArchitectHost<
|
|
|
39
41
|
getProjectMetadata(target: Target | string): Promise<json.JsonObject | null>;
|
|
40
42
|
loadBuilder(info: NodeModulesBuilderInfo): Promise<Builder>;
|
|
41
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* This uses a dynamic import to load a module which may be ESM.
|
|
46
|
+
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
|
|
47
|
+
* will currently, unconditionally downlevel dynamic import into a require call.
|
|
48
|
+
* require calls cannot load ESM code and will result in a runtime error. To workaround
|
|
49
|
+
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
|
|
50
|
+
* Once TypeScript provides support for keeping the dynamic import this workaround can
|
|
51
|
+
* be dropped.
|
|
52
|
+
*
|
|
53
|
+
* @param modulePath The path of the module to load.
|
|
54
|
+
* @returns A Promise that resolves to the dynamically imported module.
|
|
55
|
+
*/
|
|
56
|
+
export declare function loadEsmModule<T>(modulePath: string | URL): Promise<T>;
|
|
@@ -30,7 +30,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.WorkspaceNodeModulesArchitectHost = void 0;
|
|
33
|
+
exports.loadEsmModule = exports.WorkspaceNodeModulesArchitectHost = void 0;
|
|
34
34
|
const path = __importStar(require("path"));
|
|
35
35
|
const url_1 = require("url");
|
|
36
36
|
const v8_1 = require("v8");
|
|
@@ -182,6 +182,10 @@ class WorkspaceNodeModulesArchitectHost {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
exports.WorkspaceNodeModulesArchitectHost = WorkspaceNodeModulesArchitectHost;
|
|
185
|
+
/**
|
|
186
|
+
* Lazily compiled dynamic import loader function.
|
|
187
|
+
*/
|
|
188
|
+
let load;
|
|
185
189
|
/**
|
|
186
190
|
* This uses a dynamic import to load a module which may be ESM.
|
|
187
191
|
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
|
|
@@ -195,8 +199,10 @@ exports.WorkspaceNodeModulesArchitectHost = WorkspaceNodeModulesArchitectHost;
|
|
|
195
199
|
* @returns A Promise that resolves to the dynamically imported module.
|
|
196
200
|
*/
|
|
197
201
|
function loadEsmModule(modulePath) {
|
|
198
|
-
|
|
202
|
+
load ??= new Function('modulePath', `return import(modulePath);`);
|
|
203
|
+
return load(modulePath);
|
|
199
204
|
}
|
|
205
|
+
exports.loadEsmModule = loadEsmModule;
|
|
200
206
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
201
207
|
async function getBuilder(builderPath) {
|
|
202
208
|
switch (path.extname(builderPath)) {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/architect",
|
|
3
|
-
"version": "0.1700.0-rc.
|
|
3
|
+
"version": "0.1700.0-rc.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": "17.0.0-rc.
|
|
9
|
+
"@angular-devkit/core": "17.0.0-rc.5",
|
|
10
10
|
"rxjs": "7.8.1"
|
|
11
11
|
},
|
|
12
12
|
"builders": "./builders/builders.json",
|