diff options
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations')
11 files changed, 641 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/migration-collection.json b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/migration-collection.json new file mode 100644 index 00000000..7f783539 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/migration-collection.json @@ -0,0 +1,29 @@ +{ + "schematics": { + "schematic-options-13": { + "version": "13.0.0", + "factory": "./update-13/schematic-options", + "description": "Remove no longer valid Angular schematic options from `angular.json`." + }, + "update-angular-config-v13": { + "version": "13.0.0", + "factory": "./update-13/update-angular-config", + "description": "Remove deprecated options from 'angular.json' that are no longer present in v13." + }, + "update-libraries-v13": { + "version": "13.0.0", + "factory": "./update-13/update-libraries", + "description": "Update library projects to be published in partial mode and removed deprecated options from ng-packagr configuration." + }, + "drop-ie-polyfills": { + "version": "13.0.0", + "factory": "./update-13/drop-ie-polyfills", + "description": "Remove polyfills required only for Internet Explorer which is no longer supported." + }, + "update-gitignore": { + "version": "13.0.0", + "factory": "./update-13/update-gitignore", + "description": "Updating '.gitignore' to include '.angular/cache'." + } + } +} diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/drop-ie-polyfills.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/drop-ie-polyfills.d.ts new file mode 100644 index 00000000..50d7d6dc --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/drop-ie-polyfills.d.ts @@ -0,0 +1,51 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { Rule } from '@angular-devkit/schematics'; +/** + * Migrates all polyfills files of projects to remove two dependencies originally needed by Internet + * Explorer, but which are no longer needed now that support for IE has been dropped (`classlist.js` + * and `web-animations-js`). + * + * The polyfills file includes side-effectful imports of these dependencies with comments about + * their usage: + * + * ``` + * /** + * * IE11 requires the following for NgClass support on SVG elements + * *\/ + * import 'classlist.js'; + * + * /** + * * Web Animations `@angular/platform-browser/animations` + * * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + * *\/ + * import 'web-animations-js'; + * ``` + * + * This migration removes the `import` statements as well as any preceeding comments. It also + * removes these dependencies from `package.json` if present and schedules an `npm install` task to + * remove them from `node_modules/`. + * + * Also, the polyfills file has previously been generated with these imports commented out, to not + * include the dependencies by default, but still allow users to easily uncomment and enable them + * when required. So the migration also looks for: + * + * ``` + * // import 'classlist.js'; // Run `npm install --save classlist.js`. + * // OR + * // import 'web-animations-js'; // Run `npm install --save web-animations-js`. + * ``` + * + * And removes them as well. This keeps the polyfills files clean and up to date. Whitespace is + * handled by leaving all trailing whitespace alone, and deleting all the leading newlines until the + * previous non-empty line of code. This means any extra lines before a removed polyfill is dropped, + * while any extra lines after a polyfill are retained. This roughly correlates to how a real + * developer might write such a file. + */ +export default function (): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/drop-ie-polyfills.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/drop-ie-polyfills.js new file mode 100644 index 00000000..d9f0acd4 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/drop-ie-polyfills.js @@ -0,0 +1,290 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const schematics_1 = require("@angular-devkit/schematics"); +const tasks_1 = require("@angular-devkit/schematics/tasks"); +const assert_1 = __importDefault(require("assert")); +const ts = __importStar(require("../../third_party/github.com/Microsoft/TypeScript/lib/typescript")); +const dependencies_1 = require("../../utility/dependencies"); +const workspace_1 = require("../../utility/workspace"); +/** + * Migrates all polyfills files of projects to remove two dependencies originally needed by Internet + * Explorer, but which are no longer needed now that support for IE has been dropped (`classlist.js` + * and `web-animations-js`). + * + * The polyfills file includes side-effectful imports of these dependencies with comments about + * their usage: + * + * ``` + * /** + * * IE11 requires the following for NgClass support on SVG elements + * *\/ + * import 'classlist.js'; + * + * /** + * * Web Animations `@angular/platform-browser/animations` + * * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + * *\/ + * import 'web-animations-js'; + * ``` + * + * This migration removes the `import` statements as well as any preceeding comments. It also + * removes these dependencies from `package.json` if present and schedules an `npm install` task to + * remove them from `node_modules/`. + * + * Also, the polyfills file has previously been generated with these imports commented out, to not + * include the dependencies by default, but still allow users to easily uncomment and enable them + * when required. So the migration also looks for: + * + * ``` + * // import 'classlist.js'; // Run `npm install --save classlist.js`. + * // OR + * // import 'web-animations-js'; // Run `npm install --save web-animations-js`. + * ``` + * + * And removes them as well. This keeps the polyfills files clean and up to date. Whitespace is + * handled by leaving all trailing whitespace alone, and deleting all the leading newlines until the + * previous non-empty line of code. This means any extra lines before a removed polyfill is dropped, + * while any extra lines after a polyfill are retained. This roughly correlates to how a real + * developer might write such a file. + */ +function default_1() { + return async (tree, ctx) => { + const modulesToDrop = new Set(['classlist.js', 'web-animations-js']); + // Remove modules from `package.json` dependencies. + const moduleDeps = Array.from(modulesToDrop.values()) + .map((module) => (0, dependencies_1.getPackageJsonDependency)(tree, module)) + .filter((dep) => !!dep); + for (const { name } of moduleDeps) { + (0, dependencies_1.removePackageJsonDependency)(tree, name); + } + // Run `npm install` after removal. This isn't strictly necessary, as keeping the dependencies + // in `node_modules/` doesn't break anything. however non-polyfill usages of these dependencies + // will work while they are in `node_modules/` but then break on the next `npm install`. If any + // such usages exist, it is better for them to fail immediately after the migration instead of + // the next time the user happens to `npm install`. As an optimization, only run `npm install` + // if a dependency was actually removed. + if (moduleDeps.length > 0) { + ctx.addTask(new tasks_1.NodePackageInstallTask()); + } + // Find all the polyfill files in the workspace. + const wksp = await (0, workspace_1.getWorkspace)(tree); + const polyfills = Array.from((0, workspace_1.allWorkspaceTargets)(wksp)) + .filter(([_, target]) => { var _a; return !!((_a = target.options) === null || _a === void 0 ? void 0 : _a.polyfills); }) + .map(([_, target]) => { var _a; return (_a = target.options) === null || _a === void 0 ? void 0 : _a.polyfills; }); + const uniquePolyfills = Array.from(new Set(polyfills)); + // Drop the modules from each polyfill. + return (0, schematics_1.chain)(uniquePolyfills.map((polyfillPath) => dropModules(polyfillPath, modulesToDrop))); + }; +} +exports.default = default_1; +/** Processes the given polyfill path and removes any `import` statements for the given modules. */ +function dropModules(polyfillPath, modules) { + return (tree, ctx) => { + const sourceContent = tree.read(polyfillPath); + if (!sourceContent) { + ctx.logger.warn('Polyfill path from workspace configuration could not be read, does the file exist?', { polyfillPath }); + return; + } + const content = sourceContent.toString('utf8'); + const sourceFile = ts.createSourceFile(polyfillPath, content.replace(/^\uFEFF/, ''), ts.ScriptTarget.Latest, true /* setParentNodes */); + // Remove polyfills for the given module specifiers. + const recorder = tree.beginUpdate(polyfillPath); + removePolyfillImports(recorder, sourceFile, modules); + removePolyfillImportComments(recorder, sourceFile, modules); + tree.commitUpdate(recorder); + return tree; + }; +} +/** + * Searches the source file for any `import '${module}';` statements and removes them along with + * any preceeding comments. + * + * @param recorder The recorder to remove from. + * @param sourceFile The source file containing the `import` statements. + * @param modules The module specifiers to remove. + */ +function removePolyfillImports(recorder, sourceFile, modules) { + const imports = sourceFile.statements.filter((stmt) => ts.isImportDeclaration(stmt)); + for (const i of imports) { + // Should always be a string literal. + (0, assert_1.default)(ts.isStringLiteral(i.moduleSpecifier)); + // Ignore other modules. + if (!modules.has(i.moduleSpecifier.text)) { + continue; + } + // Remove the module import statement. + recorder.remove(i.getStart(), i.getWidth()); + // Remove leading comments. "Leading" comments seems to include comments within the node, so + // even though `getFullText()` returns an index before any leading comments to a node, it will + // still find and process them. + ts.forEachLeadingCommentRange(sourceFile.getFullText(), i.getFullStart(), (start, end, _, hasTrailingNewLine) => { + // Include both leading **and** trailing newlines because these are comments that *preceed* + // the `import` statement, so "trailing" newlines here are actually in-between the `import` + // and it's leading comments. + const commentRangeWithoutNewLines = { start, end }; + const commentRangeWithTrailingNewLines = hasTrailingNewLine + ? includeTrailingNewLine(sourceFile, commentRangeWithoutNewLines) + : commentRangeWithoutNewLines; + const commentRange = includeLeadingNewLines(sourceFile, commentRangeWithTrailingNewLines); + if (!isProtectedComment(sourceFile, commentRange)) { + recorder.remove(commentRange.start, commentRange.end - commentRange.start); + } + }); + } +} +/** + * Searches the source file for any `// import '${module}';` comments and removes them along with + * any preceeding comments. + * + * Recent `ng new` invocations generate polyfills commented out and not used by default. Ex: + * /** + * * IE11 requires the following for NgClass support on SVG elements + * *\/ + * // import 'classlist.js'; // Run `npm install --save classlist.js`. + * + * This function identifies any commented out import statements for the given module specifiers and + * removes them along with immediately preceeding comments. + * + * @param recorder The recorder to remove from. + * @param sourceFile The source file containing the commented `import` statements. + * @param modules The module specifiers to remove. + */ +function removePolyfillImportComments(recorder, sourceFile, modules) { + // Find all comment ranges in the source file. + const commentRanges = getCommentRanges(sourceFile); + // Find the indexes of comments which contain `import` statements for the given modules. + const moduleImportCommentIndexes = filterIndex(commentRanges, ({ start, end }) => { + const comment = getCommentText(sourceFile.getFullText().slice(start, end)); + return Array.from(modules.values()).some((module) => comment.startsWith(`import '${module}';`)); + }); + // Use the module import comment **and** it's preceding comment if present. + const commentIndexesToRemove = moduleImportCommentIndexes.flatMap((index) => { + if (index === 0) { + return [0]; + } + else { + return [index - 1, index]; + } + }); + // Get all the ranges for the comments to remove. + const commentRangesToRemove = commentIndexesToRemove + .map((index) => commentRanges[index]) + // Include leading newlines but **not** trailing newlines in order to leave appropriate space + // between any remaining polyfills. + .map((range) => includeLeadingNewLines(sourceFile, range)) + .filter((range) => !isProtectedComment(sourceFile, range)); + // Remove the comments. + for (const { start, end } of commentRangesToRemove) { + recorder.remove(start, end - start); + } +} +/** + * Returns whether a comment range is "protected", meaning it should **not** be deleted. + * + * There are two comments which are considered "protected": + * 1. The file overview doc comment previously generated by `ng new`. + * 2. The browser polyfills header (/***** BROWSER POLYFILLS *\/). + */ +function isProtectedComment(sourceFile, { start, end }) { + const comment = getCommentText(sourceFile.getFullText().slice(start, end)); + const isFileOverviewDocComment = comment.startsWith('This file includes polyfills needed by Angular and is loaded before the app.'); + const isBrowserPolyfillsHeader = comment.startsWith('BROWSER POLYFILLS'); + return isFileOverviewDocComment || isBrowserPolyfillsHeader; +} +/** Returns all the comments in the given source file. */ +function getCommentRanges(sourceFile) { + const commentRanges = []; + // Comments trailing the last node are also included in this. + ts.forEachChild(sourceFile, (node) => { + ts.forEachLeadingCommentRange(sourceFile.getFullText(), node.getFullStart(), (start, end) => { + commentRanges.push({ start, end }); + }); + }); + return commentRanges; +} +/** Returns a `SourceRange` with any leading newlines' characters included if present. */ +function includeLeadingNewLines(sourceFile, { start, end }) { + const text = sourceFile.getFullText(); + while (start > 0) { + if (start > 2 && text.slice(start - 2, start) === '\r\n') { + // Preceeded by `\r\n`, include that. + start -= 2; + } + else if (start > 1 && text[start - 1] === '\n') { + // Preceeded by `\n`, include that. + start--; + } + else { + // Not preceeded by any newline characters, don't include anything else. + break; + } + } + return { start, end }; +} +/** Returns a `SourceRange` with the trailing newline characters included if present. */ +function includeTrailingNewLine(sourceFile, { start, end }) { + const newline = sourceFile.getFullText().slice(end, end + 2); + if (newline === '\r\n') { + return { start, end: end + 2 }; + } + else if (newline.startsWith('\n')) { + return { start, end: end + 1 }; + } + else { + throw new Error('Expected comment to end in a newline character (either `\\n` or `\\r\\n`).'); + } +} +/** + * Extracts the text from a comment. Attempts to remove any extraneous syntax and trims the content. + */ +function getCommentText(commentInput) { + const comment = commentInput.trim(); + if (comment.startsWith('//')) { + return comment.slice('//'.length).trim(); + } + else if (comment.startsWith('/*')) { + const withoutPrefix = comment.replace(/\/\*+/, ''); + const withoutSuffix = withoutPrefix.replace(/\*+\//, ''); + const withoutNewlineAsterisks = withoutSuffix.replace(/^\s*\*\s*/, ''); + return withoutNewlineAsterisks.trim(); + } + else { + throw new Error(`Expected a comment, but got: "${comment}".`); + } +} +/** Like `Array.prototype.filter`, but returns the index of each item rather than its value. */ +function filterIndex(items, filter) { + return Array.from(items.entries()) + .filter(([_, item]) => filter(item)) + .map(([index]) => index); +} diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/schematic-options.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/schematic-options.d.ts new file mode 100644 index 00000000..0b3a970e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/schematic-options.d.ts @@ -0,0 +1,9 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { Rule } from '@angular-devkit/schematics'; +export default function (): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/schematic-options.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/schematic-options.js new file mode 100644 index 00000000..c6d30f0e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/schematic-options.js @@ -0,0 +1,51 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("@angular-devkit/core"); +const workspace_1 = require("../../utility/workspace"); +function default_1() { + return (0, workspace_1.updateWorkspace)((workspace) => { + // Update root level schematics options if present + const rootSchematics = workspace.extensions.schematics; + if (rootSchematics && core_1.json.isJsonObject(rootSchematics)) { + updateSchematicsField(rootSchematics); + } + // Update project level schematics options if present + for (const [, project] of workspace.projects) { + const projectSchematics = project.extensions.schematics; + if (projectSchematics && core_1.json.isJsonObject(projectSchematics)) { + updateSchematicsField(projectSchematics); + } + } + }); +} +exports.default = default_1; +function updateSchematicsField(schematics) { + for (const [schematicName, schematicOptions] of Object.entries(schematics)) { + if (!core_1.json.isJsonObject(schematicOptions)) { + continue; + } + if (schematicName.startsWith('@schematics/angular')) { + delete schematicOptions.lintFix; + } + switch (schematicName) { + case '@schematics/angular:service-worker': + delete schematicOptions.configuration; + break; + case '@schematics/angular:web-worker': + delete schematicOptions.target; + break; + case '@schematics/angular:application': + delete schematicOptions.legacyBrowsers; + break; + default: + break; + } + } +} diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-angular-config.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-angular-config.d.ts new file mode 100644 index 00000000..0b3a970e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-angular-config.d.ts @@ -0,0 +1,9 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { Rule } from '@angular-devkit/schematics'; +export default function (): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-angular-config.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-angular-config.js new file mode 100644 index 00000000..a124222b --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-angular-config.js @@ -0,0 +1,43 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +Object.defineProperty(exports, "__esModule", { value: true }); +const workspace_1 = require("../../utility/workspace"); +function default_1() { + return (0, workspace_1.updateWorkspace)((workspace) => { + for (const [, project] of workspace.projects) { + for (const [name, target] of project.targets) { + // Delete removed tslint builder + if (target.builder === '@angular-devkit/build-angular:tslint') { + project.targets.delete(name); + } + else if (target.builder === '@angular-devkit/build-angular:dev-server') { + for (const [, options] of (0, workspace_1.allTargetOptions)(target)) { + delete options.optimization; + delete options.aot; + delete options.progress; + delete options.deployUrl; + delete options.sourceMap; + delete options.vendorChunk; + delete options.commonChunk; + delete options.baseHref; + delete options.servePathDefaultWarning; + delete options.hmrWarning; + } + } + else if (target.builder.startsWith('@angular-devkit/build-angular')) { + // Only interested in Angular Devkit builders + for (const [, options] of (0, workspace_1.allTargetOptions)(target)) { + delete options.extractCss; + } + } + } + } + }); +} +exports.default = default_1; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-gitignore.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-gitignore.d.ts new file mode 100644 index 00000000..0b3a970e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-gitignore.d.ts @@ -0,0 +1,9 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { Rule } from '@angular-devkit/schematics'; +export default function (): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-gitignore.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-gitignore.js new file mode 100644 index 00000000..5a5ed3b5 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-gitignore.js @@ -0,0 +1,48 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +Object.defineProperty(exports, "__esModule", { value: true }); +function default_1() { + return (tree, context) => { + var _a; + const gitIgnoreEntry = '/.angular/cache'; + const gitIgnorePath = '.gitignore'; + const contents = (_a = tree.read(gitIgnorePath)) === null || _a === void 0 ? void 0 : _a.toString(); + if (!contents) { + context.logger.warn(`Could not find '${gitIgnorePath}'.`); + return; + } + if (contents.includes(gitIgnoreEntry)) { + // The migration has run already. + return; + } + // Try to insert the new entry in the misc section. + const recorder = tree.beginUpdate(gitIgnorePath); + let idx = contents.indexOf('# misc'); + if (idx < 0) { + idx = 0; + } + else { + switch (contents[idx + 6]) { + case '\n': + idx += 7; + break; + case '\r': + idx += 8; + break; + default: + // the word is something else. + idx = 0; + break; + } + } + recorder.insertLeft(idx, `${gitIgnoreEntry}\n`); + tree.commitUpdate(recorder); + }; +} +exports.default = default_1; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-libraries.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-libraries.d.ts new file mode 100644 index 00000000..0b3a970e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-libraries.d.ts @@ -0,0 +1,9 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { Rule } from '@angular-devkit/schematics'; +export default function (): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-libraries.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-libraries.js new file mode 100644 index 00000000..b548f519 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/migrations/update-13/update-libraries.js @@ -0,0 +1,93 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("@angular-devkit/core"); +const json_file_1 = require("../../utility/json-file"); +const workspace_1 = require("../../utility/workspace"); +function* visit(directory) { + for (const path of directory.subfiles) { + if (path === 'package.json') { + const entry = directory.file(path); + if ((entry === null || entry === void 0 ? void 0 : entry.content.toString().includes('ngPackage')) !== true) { + continue; + } + } + else if (path !== 'ng-package.json') { + continue; + } + yield (0, core_1.join)(directory.path, path); + } + for (const path of directory.subdirs) { + if (path === 'node_modules' || path.startsWith('.')) { + continue; + } + yield* visit(directory.dir(path)); + } +} +function default_1() { + const ENABLE_IVY_JSON_PATH = ['angularCompilerOptions', 'enableIvy']; + const COMPILATION_MODE_JSON_PATH = ['angularCompilerOptions', 'compilationMode']; + const NG_PACKAGR_DEPRECATED_OPTIONS_PATHS = [ + ['lib', 'umdModuleIds'], + ['lib', 'amdId'], + ['lib', 'umdId'], + ['ngPackage', 'lib', 'umdModuleIds'], + ['ngPackage', 'lib', 'amdId'], + ['ngPackage', 'lib', 'umdId'], + ]; + return async (tree, context) => { + const workspace = await (0, workspace_1.getWorkspace)(tree); + const librariesTsConfig = new Set(); + const ngPackagrConfig = new Set(); + for (const [, project] of workspace.projects) { + for (const [_, target] of project.targets) { + if (target.builder !== '@angular-devkit/build-angular:ng-packagr') { + continue; + } + for (const [, options] of (0, workspace_1.allTargetOptions)(target)) { + if (typeof options.tsConfig === 'string') { + librariesTsConfig.add(options.tsConfig); + } + if (typeof options.project === 'string') { + if (options.project.endsWith('.json')) { + ngPackagrConfig.add(options.project); + } + else { + context.logger + .warn(core_1.tags.stripIndent `Expected a JSON configuration file but found "${options.project}". + You may need to adjust the configuration file to remove invalid options. + For more information, see the breaking changes section within the release notes: https://github.com/ng-packagr/ng-packagr/releases/tag/v13.0.0/.`); + } + } + } + } + } + // Gather configurations which are not referecned in angular.json + // (This happens when users have secondary entry-points) + for (const p of visit(tree.root)) { + ngPackagrConfig.add(p); + } + // Update ng-packagr configuration + for (const config of ngPackagrConfig) { + const json = new json_file_1.JSONFile(tree, config); + for (const optionPath of NG_PACKAGR_DEPRECATED_OPTIONS_PATHS) { + json.remove(optionPath); + } + } + // Update tsconfig files + for (const tsConfig of librariesTsConfig) { + const json = new json_file_1.JSONFile(tree, tsConfig); + if (json.get(ENABLE_IVY_JSON_PATH) === false) { + json.remove(ENABLE_IVY_JSON_PATH); + json.modify(COMPILATION_MODE_JSON_PATH, 'partial'); + } + } + }; +} +exports.default = default_1; |