@angular/core
Advanced tools
Comparing version 19.1.0-next.0 to 19.1.0-next.1
{ | ||
"name": "@angular/core", | ||
"version": "19.1.0-next.0", | ||
"version": "19.1.0-next.1", | ||
"description": "Angular - the core framework", | ||
@@ -5,0 +5,0 @@ "author": "angular", |
/** | ||
* @license Angular v19.1.0-next.0 | ||
* @license Angular v19.1.0-next.1 | ||
* (c) 2010-2024 Google LLC. https://angular.io/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
/** | ||
* @license Angular v19.1.0-next.0 | ||
* @license Angular v19.1.0-next.1 | ||
* (c) 2010-2024 Google LLC. https://angular.io/ | ||
@@ -222,2 +222,11 @@ * License: MIT | ||
debugName?: string; | ||
/** | ||
* Kind of node. Example: 'signal', 'computed', 'input', 'effect'. | ||
* | ||
* ReactiveNode has this as 'unknown' by default, but derived node types should override this to | ||
* make available the kind of signal that particular instance of a ReactiveNode represents. | ||
* | ||
* Used in Angular DevTools to identify the kind of signal. | ||
*/ | ||
kind: string; | ||
} | ||
@@ -224,0 +233,0 @@ |
/** | ||
* @license Angular v19.1.0-next.0 | ||
* @license Angular v19.1.0-next.1 | ||
* (c) 2010-2024 Google LLC. https://angular.io/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
'use strict'; | ||
/** | ||
* @license Angular v19.1.0-next.0 | ||
* @license Angular v19.1.0-next.1 | ||
* (c) 2010-2024 Google LLC. https://angular.io/ | ||
@@ -13,8 +13,8 @@ * License: MIT | ||
var p = require('path'); | ||
var project_tsconfig_paths = require('./project_tsconfig_paths-e9ccccbf.js'); | ||
var compiler_host = require('./compiler_host-087c5caa.js'); | ||
var project_tsconfig_paths = require('./project_tsconfig_paths-6c9cde78.js'); | ||
var compiler_host = require('./compiler_host-3e96c3f7.js'); | ||
var ts = require('typescript'); | ||
var imports = require('./imports-4ac08251.js'); | ||
var imports = require('./imports-44987700.js'); | ||
require('@angular-devkit/core'); | ||
require('./checker-3cbc9cc1.js'); | ||
require('./checker-a00b735e.js'); | ||
require('os'); | ||
@@ -21,0 +21,0 @@ require('fs'); |
'use strict'; | ||
/** | ||
* @license Angular v19.1.0-next.0 | ||
* @license Angular v19.1.0-next.1 | ||
* (c) 2010-2024 Google LLC. https://angular.io/ | ||
@@ -13,8 +13,8 @@ * License: MIT | ||
var p = require('path'); | ||
var compiler_host = require('./compiler_host-087c5caa.js'); | ||
var compiler_host = require('./compiler_host-3e96c3f7.js'); | ||
var ts = require('typescript'); | ||
var nodes = require('./nodes-0e7d45ca.js'); | ||
var imports = require('./imports-4ac08251.js'); | ||
var leading_space = require('./leading_space-d190b83b.js'); | ||
require('./checker-3cbc9cc1.js'); | ||
var nodes = require('./nodes-b12e919a.js'); | ||
var imports = require('./imports-44987700.js'); | ||
var leading_space = require('./leading_space-6e7a8ec6.js'); | ||
require('./checker-a00b735e.js'); | ||
require('os'); | ||
@@ -54,2 +54,11 @@ require('fs'); | ||
]); | ||
/** Kinds of nodes which aren't injectable when set as a type of a parameter. */ | ||
const UNINJECTABLE_TYPE_KINDS = new Set([ | ||
ts__default["default"].SyntaxKind.TrueKeyword, | ||
ts__default["default"].SyntaxKind.FalseKeyword, | ||
ts__default["default"].SyntaxKind.NumberKeyword, | ||
ts__default["default"].SyntaxKind.StringKeyword, | ||
ts__default["default"].SyntaxKind.NullKeyword, | ||
ts__default["default"].SyntaxKind.VoidKeyword, | ||
]); | ||
/** | ||
@@ -81,8 +90,19 @@ * Finds the necessary information for the `inject` migration in a file. | ||
} | ||
// Only visit the initializer of parameters, because we won't exclude | ||
// their decorators from the identifier counting result below. | ||
if (ts__default["default"].isParameter(node)) { | ||
const closestConstructor = nodes.closestNode(node, ts__default["default"].isConstructorDeclaration); | ||
// Visiting the same parameters that we're about to remove can throw off the reference | ||
// counting logic below. If we run into an initializer, we always visit its initializer | ||
// and optionally visit the modifiers/decorators if it's not due to be deleted. Note that | ||
// here we technically aren't dealing with the the full list of classes, but the parent class | ||
// will have been visited by the time we reach the parameters. | ||
if (node.initializer) { | ||
walk(node.initializer); | ||
} | ||
if (closestConstructor === null || | ||
// This is meant to avoid the case where this is a | ||
// parameter inside a function placed in a constructor. | ||
!closestConstructor.parameters.includes(node) || | ||
!classes.some((c) => c.constructor === closestConstructor)) { | ||
node.modifiers?.forEach(walk); | ||
} | ||
return; | ||
@@ -117,5 +137,17 @@ } | ||
member.parameters.length > 0); | ||
// Basic check to determine if all parameters are injectable. This isn't exhaustive, but it | ||
// should catch the majority of cases. An exhaustive check would require a full type checker | ||
// which we don't have in this migration. | ||
const allParamsInjectable = !!constructorNode?.parameters.every((param) => { | ||
if (!param.type || !UNINJECTABLE_TYPE_KINDS.has(param.type.kind)) { | ||
return true; | ||
} | ||
return nodes.getAngularDecorators(localTypeChecker, ts__default["default"].getDecorators(param) || []).some((dec) => dec.name === 'Inject' || dec.name === 'Attribute'); | ||
}); | ||
// Don't migrate abstract classes by default, because | ||
// their parameters aren't guaranteed to be injectable. | ||
if (supportsDI && constructorNode && (!isAbstract || options.migrateAbstractClasses)) { | ||
if (supportsDI && | ||
constructorNode && | ||
allParamsInjectable && | ||
(!isAbstract || options.migrateAbstractClasses)) { | ||
classes.push({ | ||
@@ -673,3 +705,3 @@ node, | ||
const nextStatement = getNextPreservedStatement(superCall, removedStatements); | ||
tracker.insertText(sourceFile, nextStatement ? nextStatement.getFullStart() : superCall.getEnd() + 1, `\n${afterSuper.join('\n')}\n`); | ||
tracker.insertText(sourceFile, nextStatement ? nextStatement.getFullStart() : constructor.getEnd() - 1, `\n${afterSuper.join('\n')}\n` + (nextStatement ? '' : memberIndentation)); | ||
} | ||
@@ -696,3 +728,8 @@ // Need to resolve this once all constructor signatures have been removed. | ||
if (removedMembers.size === node.members.length) { | ||
tracker.insertText(sourceFile, constructor.getEnd() + 1, `${prependToClass.join('\n')}\n`); | ||
tracker.insertText(sourceFile, | ||
// If all members were deleted, insert after the last one. | ||
// This allows us to preserve the indentation. | ||
node.members.length > 0 | ||
? node.members[node.members.length - 1].getEnd() + 1 | ||
: node.getEnd() - 1, `${prependToClass.join('\n')}\n`); | ||
} | ||
@@ -911,11 +948,6 @@ else { | ||
} | ||
else if ( | ||
// Pass the type for cases like `@Inject(FOO_TOKEN) foo: Foo`, because: | ||
// 1. It guarantees that the type stays the same as before. | ||
// 2. Avoids leaving unused imports behind. | ||
// We only do this for type references since the `@Inject` pattern above is fairly common and | ||
// apps don't necessarily type their injection tokens correctly, whereas doing it for literal | ||
// types will add a lot of noise to the generated code. | ||
type && | ||
else if (type && | ||
(ts__default["default"].isTypeReferenceNode(type) || | ||
ts__default["default"].isTypeLiteralNode(type) || | ||
ts__default["default"].isTupleTypeNode(type) || | ||
(ts__default["default"].isUnionTypeNode(type) && type.types.some(ts__default["default"].isTypeReferenceNode)))) { | ||
@@ -942,24 +974,13 @@ typeArguments = [type]; | ||
const lastParamStart = constructorText.indexOf(lastParamText); | ||
const whitespacePattern = /\s/; | ||
let trailingCharacters = 0; | ||
if (lastParamStart > -1) { | ||
let lastParamEnd = lastParamStart + lastParamText.length; | ||
let closeParenIndex = -1; | ||
for (let i = lastParamEnd; i < constructorText.length; i++) { | ||
const char = constructorText[i]; | ||
if (char === ')') { | ||
closeParenIndex = i; | ||
break; | ||
} | ||
else if (!whitespacePattern.test(char)) { | ||
// The end of the last parameter won't include | ||
// any trailing commas which we need to account for. | ||
lastParamEnd = i + 1; | ||
} | ||
// This shouldn't happen, but bail out just in case so we don't mangle the code. | ||
if (lastParamStart === -1) { | ||
return; | ||
} | ||
for (let i = lastParamStart + lastParamText.length; i < constructorText.length; i++) { | ||
const char = constructorText[i]; | ||
if (char === ')') { | ||
tracker.replaceText(node.getSourceFile(), node.parameters.pos, node.getStart() + i - node.parameters.pos, ''); | ||
break; | ||
} | ||
if (closeParenIndex > -1) { | ||
trailingCharacters = closeParenIndex - lastParamEnd; | ||
} | ||
} | ||
tracker.replaceText(node.getSourceFile(), node.parameters.pos, node.parameters.end - node.parameters.pos + trailingCharacters, ''); | ||
} | ||
@@ -966,0 +987,0 @@ /** |
'use strict'; | ||
/** | ||
* @license Angular v19.1.0-next.0 | ||
* @license Angular v19.1.0-next.1 | ||
* (c) 2010-2024 Google LLC. https://angular.io/ | ||
@@ -12,8 +12,8 @@ * License: MIT | ||
var schematics = require('@angular-devkit/schematics'); | ||
var project_tsconfig_paths = require('./project_tsconfig_paths-e9ccccbf.js'); | ||
var combine_units = require('./combine_units-ab03aca8.js'); | ||
var project_tsconfig_paths = require('./project_tsconfig_paths-6c9cde78.js'); | ||
var combine_units = require('./combine_units-4983dfd3.js'); | ||
require('os'); | ||
var ts = require('typescript'); | ||
var checker = require('./checker-3cbc9cc1.js'); | ||
var program = require('./program-ed10d149.js'); | ||
var checker = require('./checker-a00b735e.js'); | ||
var program = require('./program-37562cc3.js'); | ||
require('path'); | ||
@@ -20,0 +20,0 @@ require('@angular-devkit/core'); |
'use strict'; | ||
/** | ||
* @license Angular v19.1.0-next.0 | ||
* @license Angular v19.1.0-next.1 | ||
* (c) 2010-2024 Google LLC. https://angular.io/ | ||
@@ -13,8 +13,8 @@ * License: MIT | ||
var p = require('path'); | ||
var project_tsconfig_paths = require('./project_tsconfig_paths-e9ccccbf.js'); | ||
var compiler_host = require('./compiler_host-087c5caa.js'); | ||
var project_tsconfig_paths = require('./project_tsconfig_paths-6c9cde78.js'); | ||
var compiler_host = require('./compiler_host-3e96c3f7.js'); | ||
var ts = require('typescript'); | ||
var imports = require('./imports-4ac08251.js'); | ||
var imports = require('./imports-44987700.js'); | ||
require('@angular-devkit/core'); | ||
require('./checker-3cbc9cc1.js'); | ||
require('./checker-a00b735e.js'); | ||
require('os'); | ||
@@ -21,0 +21,0 @@ require('fs'); |
'use strict'; | ||
/** | ||
* @license Angular v19.1.0-next.0 | ||
* @license Angular v19.1.0-next.1 | ||
* (c) 2010-2024 Google LLC. https://angular.io/ | ||
@@ -13,8 +13,8 @@ * License: MIT | ||
var p = require('path'); | ||
var project_tsconfig_paths = require('./project_tsconfig_paths-e9ccccbf.js'); | ||
var compiler_host = require('./compiler_host-087c5caa.js'); | ||
var project_tsconfig_paths = require('./project_tsconfig_paths-6c9cde78.js'); | ||
var compiler_host = require('./compiler_host-3e96c3f7.js'); | ||
var ts = require('typescript'); | ||
var imports = require('./imports-4ac08251.js'); | ||
var imports = require('./imports-44987700.js'); | ||
require('@angular-devkit/core'); | ||
require('./checker-3cbc9cc1.js'); | ||
require('./checker-a00b735e.js'); | ||
require('os'); | ||
@@ -21,0 +21,0 @@ require('fs'); |
'use strict'; | ||
/** | ||
* @license Angular v19.1.0-next.0 | ||
* @license Angular v19.1.0-next.1 | ||
* (c) 2010-2024 Google LLC. https://angular.io/ | ||
@@ -14,6 +14,6 @@ * License: MIT | ||
var p = require('path'); | ||
var compiler_host = require('./compiler_host-087c5caa.js'); | ||
var project_tsconfig_paths = require('./project_tsconfig_paths-e9ccccbf.js'); | ||
var compiler_host = require('./compiler_host-3e96c3f7.js'); | ||
var project_tsconfig_paths = require('./project_tsconfig_paths-6c9cde78.js'); | ||
var ts = require('typescript'); | ||
var checker = require('./checker-3cbc9cc1.js'); | ||
var checker = require('./checker-a00b735e.js'); | ||
require('os'); | ||
@@ -20,0 +20,0 @@ require('@angular-devkit/core'); |
'use strict'; | ||
/** | ||
* @license Angular v19.1.0-next.0 | ||
* @license Angular v19.1.0-next.1 | ||
* (c) 2010-2024 Google LLC. https://angular.io/ | ||
@@ -12,10 +12,10 @@ * License: MIT | ||
var schematics = require('@angular-devkit/schematics'); | ||
var project_tsconfig_paths = require('./project_tsconfig_paths-e9ccccbf.js'); | ||
var combine_units = require('./combine_units-ab03aca8.js'); | ||
var project_tsconfig_paths = require('./project_tsconfig_paths-6c9cde78.js'); | ||
var combine_units = require('./combine_units-4983dfd3.js'); | ||
require('os'); | ||
var ts = require('typescript'); | ||
var checker = require('./checker-3cbc9cc1.js'); | ||
var program = require('./program-ed10d149.js'); | ||
var checker = require('./checker-a00b735e.js'); | ||
var program = require('./program-37562cc3.js'); | ||
require('path'); | ||
var migrate_ts_type_references = require('./migrate_ts_type_references-efb52bf2.js'); | ||
var migrate_ts_type_references = require('./migrate_ts_type_references-58326be5.js'); | ||
var assert = require('assert'); | ||
@@ -27,3 +27,3 @@ require('@angular-devkit/core'); | ||
require('url'); | ||
require('./leading_space-d190b83b.js'); | ||
require('./leading_space-6e7a8ec6.js'); | ||
@@ -30,0 +30,0 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } |
'use strict'; | ||
/** | ||
* @license Angular v19.1.0-next.0 | ||
* @license Angular v19.1.0-next.1 | ||
* (c) 2010-2024 Google LLC. https://angular.io/ | ||
@@ -15,9 +15,9 @@ * License: MIT | ||
var outputMigration = require('./output-migration.js'); | ||
require('./project_tsconfig_paths-e9ccccbf.js'); | ||
require('./project_tsconfig_paths-6c9cde78.js'); | ||
require('@angular-devkit/core'); | ||
require('./combine_units-ab03aca8.js'); | ||
require('./combine_units-4983dfd3.js'); | ||
require('node:path/posix'); | ||
require('os'); | ||
require('typescript'); | ||
require('./checker-3cbc9cc1.js'); | ||
require('./checker-a00b735e.js'); | ||
require('fs'); | ||
@@ -27,6 +27,6 @@ require('module'); | ||
require('url'); | ||
require('./program-ed10d149.js'); | ||
require('./migrate_ts_type_references-efb52bf2.js'); | ||
require('./program-37562cc3.js'); | ||
require('./migrate_ts_type_references-58326be5.js'); | ||
require('assert'); | ||
require('./leading_space-d190b83b.js'); | ||
require('./leading_space-6e7a8ec6.js'); | ||
@@ -33,0 +33,0 @@ function migrate(options) { |
/** | ||
* @license Angular v19.1.0-next.0 | ||
* @license Angular v19.1.0-next.1 | ||
* (c) 2010-2024 Google LLC. https://angular.io/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9897881
146242