@schematics/angular 14.0.0-next.7 → 14.0.0-rc.0
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/app-shell/index.js +4 -8
- package/application/files/src/test.ts.template +1 -1
- package/application/index.js +3 -3
- package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.spec.ts.template +1 -1
- package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template +5 -2
- package/component/index.js +9 -14
- package/component/schema.d.ts +4 -0
- package/component/schema.json +6 -0
- package/directive/files/__name@dasherize@if-flat__/__name@dasherize__.directive.ts.template +2 -1
- package/directive/index.js +9 -18
- package/directive/schema.d.ts +4 -0
- package/directive/schema.json +6 -0
- package/e2e/index.js +5 -5
- package/library/files/src/test.ts.template +1 -1
- package/library/index.js +3 -4
- package/migrations/migration-collection.json +5 -0
- package/migrations/update-14/update-libraries-secondary-entrypoints.d.ts +10 -0
- package/migrations/update-14/update-libraries-secondary-entrypoints.js +51 -0
- package/module/index.js +8 -16
- package/package.json +10 -3
- package/pipe/files/__name@dasherize@if-flat__/__name@dasherize__.pipe.ts.template +2 -1
- package/pipe/index.js +8 -17
- package/pipe/schema.d.ts +4 -0
- package/pipe/schema.json +6 -0
- package/service-worker/index.js +4 -8
- package/third_party/github.com/Microsoft/TypeScript/BUILD.bazel +4 -4
- package/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts +385 -290
- package/third_party/github.com/Microsoft/TypeScript/lib/typescript.js +11509 -9414
- package/universal/index.js +3 -7
- package/utility/ast-utils.js +26 -26
- package/utility/dependency.d.ts +45 -0
- package/utility/dependency.js +97 -0
- package/utility/find-module.d.ts +1 -0
- package/utility/find-module.js +5 -10
- package/utility/generate-from-files.js +2 -3
- package/utility/index.d.ts +10 -0
- package/utility/index.js +21 -0
- package/utility/json-file.js +1 -7
- package/utility/latest-versions/package.json +4 -3
- package/utility/latest-versions.js +1 -1
- package/utility/ng-ast-utils.js +2 -10
- package/utility/parse-name.js +0 -1
- package/utility/validation.js +1 -3
- package/utility/workspace-models.d.ts +6 -0
- package/utility/workspace-models.js +6 -0
- package/utility/workspace.d.ts +36 -3
- package/utility/workspace.js +70 -34
- package/web-worker/index.js +2 -2
- package/workspace/index.js +1 -2
package/utility/workspace.js
CHANGED
|
@@ -7,53 +7,89 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.allTargetOptions = exports.allWorkspaceTargets = exports.createDefaultPath = exports.buildDefaultPath = exports.getWorkspace = exports.updateWorkspace = void 0;
|
|
10
|
+
exports.allTargetOptions = exports.allWorkspaceTargets = exports.createDefaultPath = exports.buildDefaultPath = exports.writeWorkspace = exports.getWorkspace = exports.updateWorkspace = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
13
|
const workspace_models_1 = require("./workspace-models");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;
|
|
29
|
-
},
|
|
30
|
-
async isFile(path) {
|
|
31
|
-
return tree.exists(path);
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function updateWorkspace(updaterOrWorkspace) {
|
|
36
|
-
return async (tree) => {
|
|
37
|
-
const host = createHost(tree);
|
|
38
|
-
if (typeof updaterOrWorkspace === 'function') {
|
|
39
|
-
const { workspace } = await core_1.workspaces.readWorkspace('/', host);
|
|
40
|
-
const result = await updaterOrWorkspace(workspace);
|
|
41
|
-
await core_1.workspaces.writeWorkspace(workspace, host);
|
|
42
|
-
return result || schematics_1.noop;
|
|
14
|
+
const DEFAULT_WORKSPACE_PATH = '/angular.json';
|
|
15
|
+
/**
|
|
16
|
+
* A {@link workspaces.WorkspaceHost} backed by a Schematics {@link Tree} instance.
|
|
17
|
+
*/
|
|
18
|
+
class TreeWorkspaceHost {
|
|
19
|
+
constructor(tree) {
|
|
20
|
+
this.tree = tree;
|
|
21
|
+
}
|
|
22
|
+
async readFile(path) {
|
|
23
|
+
return this.tree.readText(path);
|
|
24
|
+
}
|
|
25
|
+
async writeFile(path, data) {
|
|
26
|
+
if (this.tree.exists(path)) {
|
|
27
|
+
this.tree.overwrite(path, data);
|
|
43
28
|
}
|
|
44
29
|
else {
|
|
45
|
-
|
|
46
|
-
return schematics_1.noop;
|
|
30
|
+
this.tree.create(path, data);
|
|
47
31
|
}
|
|
32
|
+
}
|
|
33
|
+
async isDirectory(path) {
|
|
34
|
+
// approximate a directory check
|
|
35
|
+
return !this.tree.exists(path) && this.tree.getDir(path).subfiles.length > 0;
|
|
36
|
+
}
|
|
37
|
+
async isFile(path) {
|
|
38
|
+
return this.tree.exists(path);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Updates the workspace file (`angular.json`) found within the root of the schematic's tree.
|
|
43
|
+
* The workspace object model can be directly modified within the provided updater function
|
|
44
|
+
* with changes being written to the workspace file after the updater function returns.
|
|
45
|
+
* The spacing and overall layout of the file (including comments) will be maintained where
|
|
46
|
+
* possible when updating the file.
|
|
47
|
+
*
|
|
48
|
+
* @param updater An update function that can be used to modify the object model for the
|
|
49
|
+
* workspace. A {@link WorkspaceDefinition} is provided as the first argument to the function.
|
|
50
|
+
*/
|
|
51
|
+
function updateWorkspace(updater) {
|
|
52
|
+
return async (tree) => {
|
|
53
|
+
const host = new TreeWorkspaceHost(tree);
|
|
54
|
+
const { workspace } = await core_1.workspaces.readWorkspace(DEFAULT_WORKSPACE_PATH, host);
|
|
55
|
+
const result = await updater(workspace);
|
|
56
|
+
await core_1.workspaces.writeWorkspace(workspace, host);
|
|
57
|
+
return result || schematics_1.noop;
|
|
48
58
|
};
|
|
49
59
|
}
|
|
50
60
|
exports.updateWorkspace = updateWorkspace;
|
|
51
|
-
|
|
52
|
-
|
|
61
|
+
// TODO: This should be renamed `readWorkspace` once deep imports are restricted (already exported from `utility` with that name)
|
|
62
|
+
/**
|
|
63
|
+
* Reads a workspace file (`angular.json`) from the provided {@link Tree} instance.
|
|
64
|
+
*
|
|
65
|
+
* @param tree A schematics {@link Tree} instance used to access the workspace file.
|
|
66
|
+
* @param path The path where a workspace file should be found. If a file is specified, the file
|
|
67
|
+
* path will be used. If a directory is specified, the file `angular.json` will be used from
|
|
68
|
+
* within the specified directory. Defaults to `/angular.json`.
|
|
69
|
+
* @returns A {@link WorkspaceDefinition} representing the workspace found at the specified path.
|
|
70
|
+
*/
|
|
71
|
+
async function getWorkspace(tree, path = DEFAULT_WORKSPACE_PATH) {
|
|
72
|
+
const host = new TreeWorkspaceHost(tree);
|
|
53
73
|
const { workspace } = await core_1.workspaces.readWorkspace(path, host);
|
|
54
74
|
return workspace;
|
|
55
75
|
}
|
|
56
76
|
exports.getWorkspace = getWorkspace;
|
|
77
|
+
/**
|
|
78
|
+
* Writes a workspace file (`angular.json`) to the provided {@link Tree} instance.
|
|
79
|
+
* The spacing and overall layout of an exisitng file (including comments) will be maintained where
|
|
80
|
+
* possible when writing the file.
|
|
81
|
+
*
|
|
82
|
+
* @param tree A schematics {@link Tree} instance used to access the workspace file.
|
|
83
|
+
* @param workspace The {@link WorkspaceDefinition} to write.
|
|
84
|
+
* @param path The path where a workspace file should be written. If a file is specified, the file
|
|
85
|
+
* path will be used. If not provided, the definition's underlying file path stored during reading
|
|
86
|
+
* will be used.
|
|
87
|
+
*/
|
|
88
|
+
async function writeWorkspace(tree, workspace, path) {
|
|
89
|
+
const host = new TreeWorkspaceHost(tree);
|
|
90
|
+
return core_1.workspaces.writeWorkspace(workspace, host, path);
|
|
91
|
+
}
|
|
92
|
+
exports.writeWorkspace = writeWorkspace;
|
|
57
93
|
/**
|
|
58
94
|
* Build a default project path for generating.
|
|
59
95
|
* @param project The project which will have its default path generated.
|
package/web-worker/index.js
CHANGED
|
@@ -46,7 +46,7 @@ function addSnippet(options) {
|
|
|
46
46
|
}
|
|
47
47
|
`;
|
|
48
48
|
// Append the worker creation snippet.
|
|
49
|
-
const originalContent = host.
|
|
49
|
+
const originalContent = host.readText(siblingModulePath);
|
|
50
50
|
host.overwrite(siblingModulePath, originalContent + '\n' + workerCreationSnippet);
|
|
51
51
|
return host;
|
|
52
52
|
};
|
|
@@ -72,7 +72,7 @@ function default_1(options) {
|
|
|
72
72
|
options.name = parsedPath.name;
|
|
73
73
|
options.path = parsedPath.path;
|
|
74
74
|
const templateSourceWorkerCode = (0, schematics_1.apply)((0, schematics_1.url)('./files/worker'), [
|
|
75
|
-
(0, schematics_1.applyTemplates)({ ...options, ...
|
|
75
|
+
(0, schematics_1.applyTemplates)({ ...options, ...schematics_1.strings }),
|
|
76
76
|
(0, schematics_1.move)(parsedPath.path),
|
|
77
77
|
]);
|
|
78
78
|
const root = project.root || '';
|
package/workspace/index.js
CHANGED
|
@@ -7,14 +7,13 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
const core_1 = require("@angular-devkit/core");
|
|
11
10
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
11
|
const latest_versions_1 = require("../utility/latest-versions");
|
|
13
12
|
function default_1(options) {
|
|
14
13
|
return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
15
14
|
options.minimal ? (0, schematics_1.filter)((path) => !path.endsWith('editorconfig.template')) : (0, schematics_1.noop)(),
|
|
16
15
|
(0, schematics_1.applyTemplates)({
|
|
17
|
-
utils:
|
|
16
|
+
utils: schematics_1.strings,
|
|
18
17
|
...options,
|
|
19
18
|
'dot': '.',
|
|
20
19
|
latestVersions: latest_versions_1.latestVersions,
|