Skip to content

Commit 1288984

Browse files
committed
refactor: add package.json exports to architect and schematics
Adds package.json exports fields to @angular-devkit/architect and @angular-devkit/schematics to explicitly define their public entry points and encapsulation in preparation for ESM conversion. @angular-devkit/architect exports the root, node, testing, builders.json, and package.json. @angular-devkit/schematics exports the root, tasks, testing, tools, collection-schema.json, and package.json. Also adds the corresponding public API golden definitions for @angular-devkit/architect.
1 parent 5ec6dac commit 1288984

5 files changed

Lines changed: 189 additions & 0 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
## API Report File for "@angular-devkit/architect_node"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
import { BaseException } from '@angular-devkit/core';
8+
import { json } from '@angular-devkit/core';
9+
import { JsonObject } from '@angular-devkit/core';
10+
import { JsonValue } from '@angular-devkit/core';
11+
import { logging } from '@angular-devkit/core';
12+
import { Observable } from 'rxjs';
13+
import { Observer } from 'rxjs';
14+
import { schema } from '@angular-devkit/core';
15+
import { workspaces } from '@angular-devkit/core';
16+
17+
declare namespace jobs {
18+
export {
19+
NodeModuleJobRegistry
20+
}
21+
}
22+
export { jobs }
23+
24+
// @public (undocumented)
25+
class NodeModuleJobRegistry<MinimumArgumentValueT extends JsonValue = JsonValue, MinimumInputValueT extends JsonValue = JsonValue, MinimumOutputValueT extends JsonValue = JsonValue> implements jobs_2.Registry<MinimumArgumentValueT, MinimumInputValueT, MinimumOutputValueT> {
26+
get<A extends MinimumArgumentValueT, I extends MinimumInputValueT, O extends MinimumOutputValueT>(name: jobs_2.JobName): Observable<jobs_2.JobHandler<A, I, O> | null>;
27+
// (undocumented)
28+
protected _resolve(name: string): string | null;
29+
}
30+
31+
// @public (undocumented)
32+
export type NodeModulesBuilderInfo = BuilderInfo & {
33+
import: string;
34+
};
35+
36+
// @public (undocumented)
37+
export interface WorkspaceHost {
38+
// (undocumented)
39+
getBuilderName(project: string, target: string): Promise<string>;
40+
// (undocumented)
41+
getDefaultConfigurationName(project: string, target: string): Promise<string | undefined>;
42+
// (undocumented)
43+
getMetadata(project: string): Promise<json.JsonObject>;
44+
// (undocumented)
45+
getOptions(project: string, target: string, configuration?: string): Promise<json.JsonObject>;
46+
// (undocumented)
47+
hasTarget(project: string, target: string): Promise<boolean>;
48+
}
49+
50+
// @public (undocumented)
51+
export class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModulesBuilderInfo> {
52+
constructor(workspaceHost: WorkspaceHost, _root: string);
53+
constructor(workspace: workspaces.WorkspaceDefinition, _root: string);
54+
// (undocumented)
55+
getBuilderNameForTarget(target: Target_2): Promise<string>;
56+
// (undocumented)
57+
getCurrentDirectory(): Promise<string>;
58+
// (undocumented)
59+
getOptionsForTarget(target: Target_2): Promise<json.JsonObject | null>;
60+
// (undocumented)
61+
getProjectMetadata(target: Target_2 | string): Promise<json.JsonObject | null>;
62+
// (undocumented)
63+
getWorkspaceRoot(): Promise<string>;
64+
// (undocumented)
65+
loadBuilder(info: NodeModulesBuilderInfo): Promise<Builder>;
66+
resolveBuilder(builderStr: string, basePath?: string, seenBuilders?: Set<string>): Promise<NodeModulesBuilderInfo>;
67+
// (undocumented)
68+
protected _root: string;
69+
}
70+
71+
// (No @packageDocumentation comment for this package)
72+
73+
```
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
## API Report File for "@angular-devkit/architect_testing"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
import { json } from '@angular-devkit/core';
8+
import { JsonObject } from '@angular-devkit/core';
9+
import { JsonValue } from '@angular-devkit/core';
10+
import { NodeJsSyncHost } from '@angular-devkit/core/node';
11+
import { Observable } from 'rxjs';
12+
import { Observer } from 'rxjs';
13+
import { Path } from '@angular-devkit/core';
14+
import { PathFragment } from '@angular-devkit/core';
15+
import { schema } from '@angular-devkit/core';
16+
import { Stats } from 'node:fs';
17+
import { virtualFs } from '@angular-devkit/core';
18+
19+
// @public (undocumented)
20+
export class TestingArchitectHost implements ArchitectHost {
21+
constructor(workspaceRoot?: string, currentDirectory?: string, _backendHost?: ArchitectHost | null);
22+
// (undocumented)
23+
addBuilder(builderName: string, builder: Builder, description?: string, optionSchema?: json.schema.JsonSchema): void;
24+
// (undocumented)
25+
addBuilderFromPackage(packageName: string): Promise<void>;
26+
// (undocumented)
27+
addTarget(target: Target, builderName: string, options?: json.JsonObject): void;
28+
// (undocumented)
29+
currentDirectory: string;
30+
// (undocumented)
31+
getBuilderNameForTarget(target: Target): Promise<string | null>;
32+
// (undocumented)
33+
getCurrentDirectory(): Promise<string>;
34+
// (undocumented)
35+
getOptionsForTarget(target: Target): Promise<json.JsonObject | null>;
36+
// (undocumented)
37+
getProjectMetadata(target: Target | string): Promise<json.JsonObject | null>;
38+
// (undocumented)
39+
getWorkspaceRoot(): Promise<string>;
40+
// (undocumented)
41+
loadBuilder(info: BuilderInfo): Promise<Builder | null>;
42+
resolveBuilder(builderName: string): Promise<BuilderInfo | null>;
43+
// (undocumented)
44+
workspaceRoot: string;
45+
}
46+
47+
// @public @deprecated (undocumented)
48+
export class TestProjectHost extends NodeJsSyncHost {
49+
constructor(_templateRoot: Path);
50+
// (undocumented)
51+
appendToFile(path: string, str: string): void;
52+
// (undocumented)
53+
copyFile(from: string, to: string): void;
54+
// (undocumented)
55+
fileMatchExists(dir: string, regex: RegExp): PathFragment | undefined;
56+
// (undocumented)
57+
initialize(): Observable<void>;
58+
// (undocumented)
59+
replaceInFile(path: string, match: RegExp | string, replacement: string): void;
60+
// (undocumented)
61+
restore(): Observable<void>;
62+
// (undocumented)
63+
root(): Path;
64+
// (undocumented)
65+
scopedSync(): virtualFs.SyncDelegateHost<Stats>;
66+
// (undocumented)
67+
protected _templateRoot: Path;
68+
// (undocumented)
69+
writeMultipleFiles(files: {
70+
[path: string]: string | ArrayBufferLike | Buffer;
71+
}): void;
72+
}
73+
74+
// (No @packageDocumentation comment for this package)
75+
76+
```

packages/angular_devkit/architect/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,8 @@ api_golden_test_npm_package(
125125
],
126126
golden_dir = "goldens/public-api/angular_devkit/architect",
127127
npm_package = "packages/angular_devkit/architect/npm_package",
128+
types = {
129+
"//:node_modules/@types/node": "node",
130+
},
128131
)
129132
# @external_end

packages/angular_devkit/architect/package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@
88
},
99
"main": "src/index.js",
1010
"typings": "src/index.d.ts",
11+
"exports": {
12+
".": {
13+
"types": "./src/index.d.ts",
14+
"default": "./src/index.js"
15+
},
16+
"./node": {
17+
"types": "./node/index.d.ts",
18+
"default": "./node/index.js"
19+
},
20+
"./testing": {
21+
"types": "./testing/index.d.ts",
22+
"default": "./testing/index.js"
23+
},
24+
"./builders.json": "./builders/builders.json",
25+
"./builders/builders.json": "./builders/builders.json",
26+
"./package.json": "./package.json"
27+
},
1128
"dependencies": {
1229
"@angular-devkit/core": "workspace:0.0.0-PLACEHOLDER",
1330
"rxjs": "7.8.2"

packages/angular_devkit/schematics/package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@
44
"description": "Angular Schematics - Library",
55
"main": "src/index.js",
66
"typings": "src/index.d.ts",
7+
"exports": {
8+
".": {
9+
"types": "./src/index.d.ts",
10+
"default": "./src/index.js"
11+
},
12+
"./tasks": {
13+
"types": "./tasks/index.d.ts",
14+
"default": "./tasks/index.js"
15+
},
16+
"./testing": {
17+
"types": "./testing/index.d.ts",
18+
"default": "./testing/index.js"
19+
},
20+
"./tools": {
21+
"types": "./tools/index.d.ts",
22+
"default": "./tools/index.js"
23+
},
24+
"./collection-schema.json": "./collection-schema.json",
25+
"./package.json": "./package.json"
26+
},
727
"keywords": [
828
"blueprints",
929
"scaffolding",

0 commit comments

Comments
 (0)