@schematics/angular 12.1.0-next.3 → 12.1.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 +20 -1
- package/application/other-files/app.component.html.template +7 -0
- package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template +1 -1
- package/component/index.js +27 -3
- package/component/schema.d.ts +5 -2
- package/component/schema.js +3 -1
- package/component/schema.json +2 -2
- package/directive/index.js +21 -2
- package/library/index.js +3 -3
- package/migrations/migration-collection.json +5 -0
- package/migrations/update-10/remove-es5-browser-support.js +21 -2
- package/migrations/update-12/replace-prod-flag.d.ts +9 -0
- package/migrations/update-12/replace-prod-flag.js +28 -0
- package/migrations/update-12/update-angular-config.js +17 -3
- package/migrations/update-12/update-lazy-module-paths.js +20 -1
- package/migrations/update-12/update-web-workers.js +20 -1
- package/migrations/update-9/update-server-main-file.js +20 -1
- package/module/index.js +20 -1
- package/package.json +4 -4
- package/pipe/index.js +20 -1
- package/service-worker/index.js +20 -1
- package/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts +516 -357
- package/third_party/github.com/Microsoft/TypeScript/lib/typescript.js +14199 -10055
- package/universal/index.js +20 -1
- package/utility/ast-utils.js +20 -1
- package/utility/latest-versions.js +4 -4
- package/utility/ng-ast-utils.js +20 -1
- package/utility/workspace.js +1 -1
- package/web-worker/index.js +27 -44
- package/web-worker/schema.d.ts +1 -0
- package/web-worker/schema.json +2 -1
package/universal/index.js
CHANGED
|
@@ -6,11 +6,30 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
const core_1 = require("@angular-devkit/core");
|
|
11
30
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
31
|
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
13
|
-
const ts = require("../third_party/github.com/Microsoft/TypeScript/lib/typescript");
|
|
32
|
+
const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
|
|
14
33
|
const ast_utils_1 = require("../utility/ast-utils");
|
|
15
34
|
const change_1 = require("../utility/change");
|
|
16
35
|
const dependencies_1 = require("../utility/dependencies");
|
package/utility/ast-utils.js
CHANGED
|
@@ -6,10 +6,29 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.addRouteDeclarationToModule = exports.getRouterModuleDeclaration = exports.getEnvironmentExportName = exports.isImported = exports.addBootstrapToModule = exports.addExportToModule = exports.addProviderToModule = exports.addImportToModule = exports.addDeclarationToModule = exports.addSymbolToNgModuleMetadata = exports.getMetadataField = exports.getDecoratorMetadata = exports.insertAfterLastOccurrence = exports.findNode = exports.getSourceNodes = exports.findNodes = exports.insertImport = void 0;
|
|
11
30
|
const core_1 = require("@angular-devkit/core");
|
|
12
|
-
const ts = require("../third_party/github.com/Microsoft/TypeScript/lib/typescript");
|
|
31
|
+
const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
|
|
13
32
|
const change_1 = require("./change");
|
|
14
33
|
/**
|
|
15
34
|
* Add Import `import { symbolName } from fileName` if the import doesn't exit
|
|
@@ -10,14 +10,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.latestVersions = void 0;
|
|
11
11
|
exports.latestVersions = {
|
|
12
12
|
// These versions should be kept up to date with latest Angular peer dependencies.
|
|
13
|
-
Angular: '~12.1.0
|
|
13
|
+
Angular: '~12.1.0',
|
|
14
14
|
RxJs: '~6.6.0',
|
|
15
15
|
ZoneJs: '~0.11.4',
|
|
16
|
-
TypeScript: '~4.2
|
|
17
|
-
TsLib: '^2.
|
|
16
|
+
TypeScript: '~4.3.2',
|
|
17
|
+
TsLib: '^2.2.0',
|
|
18
18
|
// Since @angular-devkit/build-angular and @schematics/angular are always
|
|
19
19
|
// published together from the same monorepo, and they are both
|
|
20
20
|
// non-experimental, they will always have the same version.
|
|
21
21
|
DevkitBuildAngular: '~' + require('../package.json')['version'],
|
|
22
|
-
ngPackagr: '^12.
|
|
22
|
+
ngPackagr: '^12.1.0-next.0',
|
|
23
23
|
};
|
package/utility/ng-ast-utils.js
CHANGED
|
@@ -6,12 +6,31 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.getAppModulePath = exports.findBootstrapModulePath = exports.findBootstrapModuleCall = void 0;
|
|
11
30
|
const core_1 = require("@angular-devkit/core");
|
|
12
31
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
32
|
const path_1 = require("path");
|
|
14
|
-
const ts = require("../third_party/github.com/Microsoft/TypeScript/lib/typescript");
|
|
33
|
+
const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
|
|
15
34
|
const ast_utils_1 = require("../utility/ast-utils");
|
|
16
35
|
function findBootstrapModuleCall(host, mainPath) {
|
|
17
36
|
const mainBuffer = host.read(mainPath);
|
package/utility/workspace.js
CHANGED
|
@@ -68,7 +68,7 @@ async function createDefaultPath(tree, projectName) {
|
|
|
68
68
|
const workspace = await getWorkspace(tree);
|
|
69
69
|
const project = workspace.projects.get(projectName);
|
|
70
70
|
if (!project) {
|
|
71
|
-
throw new Error(
|
|
71
|
+
throw new Error(`Project "${projectName}" does not exist.`);
|
|
72
72
|
}
|
|
73
73
|
return buildDefaultPath(project);
|
|
74
74
|
}
|
package/web-worker/index.js
CHANGED
|
@@ -9,34 +9,9 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
const core_1 = require("@angular-devkit/core");
|
|
11
11
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
|
-
const json_file_1 = require("../utility/json-file");
|
|
13
12
|
const parse_name_1 = require("../utility/parse-name");
|
|
14
13
|
const paths_1 = require("../utility/paths");
|
|
15
14
|
const workspace_1 = require("../utility/workspace");
|
|
16
|
-
function addConfig(options, root, tsConfigPath) {
|
|
17
|
-
return (host, context) => {
|
|
18
|
-
context.logger.debug('updating project configuration.');
|
|
19
|
-
// Add worker glob exclusion to tsconfig.app.json.
|
|
20
|
-
// Projects pre version 8 should to have tsconfig.app.json inside their application
|
|
21
|
-
const isInSrc = core_1.dirname(core_1.normalize(tsConfigPath)).endsWith('src');
|
|
22
|
-
const workerGlob = `${isInSrc ? '' : 'src/'}**/*.worker.ts`;
|
|
23
|
-
try {
|
|
24
|
-
const json = new json_file_1.JSONFile(host, tsConfigPath);
|
|
25
|
-
const exclude = json.get(['exclude']);
|
|
26
|
-
if (exclude && Array.isArray(exclude) && !exclude.includes(workerGlob)) {
|
|
27
|
-
json.modify(['exclude'], [...exclude, workerGlob]);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
catch { }
|
|
31
|
-
return schematics_1.mergeWith(schematics_1.apply(schematics_1.url('./files/worker-tsconfig'), [
|
|
32
|
-
schematics_1.applyTemplates({
|
|
33
|
-
...options,
|
|
34
|
-
relativePathToWorkspaceRoot: paths_1.relativePathToWorkspaceRoot(root),
|
|
35
|
-
}),
|
|
36
|
-
schematics_1.move(root),
|
|
37
|
-
]));
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
15
|
function addSnippet(options) {
|
|
41
16
|
return (host, context) => {
|
|
42
17
|
context.logger.debug('Updating appmodule');
|
|
@@ -82,9 +57,6 @@ function default_1(options) {
|
|
|
82
57
|
if (!options.project) {
|
|
83
58
|
throw new schematics_1.SchematicsException('Option "project" is required.');
|
|
84
59
|
}
|
|
85
|
-
if (!options.target) {
|
|
86
|
-
throw new schematics_1.SchematicsException('Option "target" is required.');
|
|
87
|
-
}
|
|
88
60
|
const project = workspace.projects.get(options.project);
|
|
89
61
|
if (!project) {
|
|
90
62
|
throw new schematics_1.SchematicsException(`Invalid project name (${options.project})`);
|
|
@@ -93,36 +65,47 @@ function default_1(options) {
|
|
|
93
65
|
if (projectType !== 'application') {
|
|
94
66
|
throw new schematics_1.SchematicsException(`Web Worker requires a project type of "application".`);
|
|
95
67
|
}
|
|
96
|
-
const projectTarget = project.targets.get(options.target);
|
|
97
|
-
if (!projectTarget) {
|
|
98
|
-
throw new Error(`Target is not defined for this project.`);
|
|
99
|
-
}
|
|
100
|
-
const projectTargetOptions = (projectTarget.options ||
|
|
101
|
-
{});
|
|
102
68
|
if (options.path === undefined) {
|
|
103
69
|
options.path = workspace_1.buildDefaultPath(project);
|
|
104
70
|
}
|
|
105
71
|
const parsedPath = parse_name_1.parseName(options.path, options.name);
|
|
106
72
|
options.name = parsedPath.name;
|
|
107
73
|
options.path = parsedPath.path;
|
|
108
|
-
const
|
|
109
|
-
const needWebWorkerConfig = !projectTargetOptions.webWorkerTsConfig;
|
|
110
|
-
if (needWebWorkerConfig) {
|
|
111
|
-
const workerConfigPath = core_1.join(core_1.normalize(root), 'tsconfig.worker.json');
|
|
112
|
-
projectTargetOptions.webWorkerTsConfig = workerConfigPath;
|
|
113
|
-
}
|
|
114
|
-
const templateSource = schematics_1.apply(schematics_1.url('./files/worker'), [
|
|
74
|
+
const templateSourceWorkerCode = schematics_1.apply(schematics_1.url('./files/worker'), [
|
|
115
75
|
schematics_1.applyTemplates({ ...options, ...core_1.strings }),
|
|
116
76
|
schematics_1.move(parsedPath.path),
|
|
117
77
|
]);
|
|
78
|
+
const root = project.root || '';
|
|
79
|
+
const templateSourceWorkerConfig = schematics_1.apply(schematics_1.url('./files/worker-tsconfig'), [
|
|
80
|
+
schematics_1.applyTemplates({
|
|
81
|
+
...options,
|
|
82
|
+
relativePathToWorkspaceRoot: paths_1.relativePathToWorkspaceRoot(root),
|
|
83
|
+
}),
|
|
84
|
+
schematics_1.move(root),
|
|
85
|
+
]);
|
|
118
86
|
return schematics_1.chain([
|
|
119
87
|
// Add project configuration.
|
|
120
|
-
|
|
121
|
-
|
|
88
|
+
workspace_1.updateWorkspace((workspace) => {
|
|
89
|
+
var _a, _b, _c, _d;
|
|
90
|
+
var _e, _f;
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
92
|
+
const project = workspace.projects.get(options.project);
|
|
93
|
+
const buildTarget = project.targets.get('build');
|
|
94
|
+
const testTarget = project.targets.get('test');
|
|
95
|
+
if (!buildTarget) {
|
|
96
|
+
throw new Error(`Build target is not defined for this project.`);
|
|
97
|
+
}
|
|
98
|
+
const workerConfigPath = core_1.join(core_1.normalize(root), 'tsconfig.worker.json');
|
|
99
|
+
(_b = (_e = ((_a = buildTarget.options) !== null && _a !== void 0 ? _a : (buildTarget.options = {}))).webWorkerTsConfig) !== null && _b !== void 0 ? _b : (_e.webWorkerTsConfig = workerConfigPath);
|
|
100
|
+
if (testTarget) {
|
|
101
|
+
(_d = (_f = ((_c = testTarget.options) !== null && _c !== void 0 ? _c : (testTarget.options = {}))).webWorkerTsConfig) !== null && _d !== void 0 ? _d : (_f.webWorkerTsConfig = workerConfigPath);
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
122
104
|
// Create the worker in a sibling module.
|
|
123
105
|
options.snippet ? addSnippet(options) : schematics_1.noop(),
|
|
124
106
|
// Add the worker.
|
|
125
|
-
schematics_1.mergeWith(
|
|
107
|
+
schematics_1.mergeWith(templateSourceWorkerCode),
|
|
108
|
+
schematics_1.mergeWith(templateSourceWorkerConfig),
|
|
126
109
|
]);
|
|
127
110
|
};
|
|
128
111
|
}
|
package/web-worker/schema.d.ts
CHANGED
package/web-worker/schema.json
CHANGED