From b10f6e730e6c0925188cd9ab5eefc3dcf39ae2dc Mon Sep 17 00:00:00 2001 From: Jessica Janiuk Date: Fri, 22 Nov 2024 19:43:28 +0000 Subject: [PATCH] 834c7c3 fix(core): make component id generation more stable between client and server builds (#58813) --- BUILD_INFO | 4 ++-- fesm2022/init.mjs | 2 +- fesm2022/localize.mjs | 2 +- init/index.d.ts | 2 +- package.json | 6 +++--- schematics/ng-add/ng_add_bundle.js | 2 +- schematics/ng-add/ng_add_bundle.js.map | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/BUILD_INFO b/BUILD_INFO index 8c633c0dc..0a01c006d 100644 --- a/BUILD_INFO +++ b/BUILD_INFO @@ -1,2 +1,2 @@ -Fri Nov 22 16:20:23 UTC 2024 -e294ca8e09429e4ebc5967d1d1f044aac07f7cc3 +Fri Nov 22 19:43:28 UTC 2024 +834c7c3ccc5f74b4e97e4ab08be87f83f09c1867 diff --git a/fesm2022/init.mjs b/fesm2022/init.mjs index ae06b1832..3ba9f7e5d 100755 --- a/fesm2022/init.mjs +++ b/fesm2022/init.mjs @@ -1,5 +1,5 @@ /** - * @license Angular v19.1.0-next.0+sha-e294ca8 + * @license Angular v19.1.0-next.0+sha-834c7c3 * (c) 2010-2024 Google LLC. https://angular.io/ * License: MIT */ diff --git a/fesm2022/localize.mjs b/fesm2022/localize.mjs index 462780c1c..40c5962b9 100755 --- a/fesm2022/localize.mjs +++ b/fesm2022/localize.mjs @@ -1,5 +1,5 @@ /** - * @license Angular v19.1.0-next.0+sha-e294ca8 + * @license Angular v19.1.0-next.0+sha-834c7c3 * (c) 2010-2024 Google LLC. https://angular.io/ * License: MIT */ diff --git a/init/index.d.ts b/init/index.d.ts index d4f638fbd..3b7dcb9e3 100755 --- a/init/index.d.ts +++ b/init/index.d.ts @@ -1,5 +1,5 @@ /** - * @license Angular v19.1.0-next.0+sha-e294ca8 + * @license Angular v19.1.0-next.0+sha-834c7c3 * (c) 2010-2024 Google LLC. https://angular.io/ * License: MIT */ diff --git a/package.json b/package.json index b73453797..775139d29 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@angular/localize", - "version": "19.1.0-next.0+sha-e294ca8", + "version": "19.1.0-next.0+sha-834c7c3", "description": "Angular - library for localizing messages", "bin": { "localize-translate": "./tools/bundles/src/translate/cli.js", @@ -67,8 +67,8 @@ "yargs": "^17.2.1" }, "peerDependencies": { - "@angular/compiler": "19.1.0-next.0+sha-e294ca8", - "@angular/compiler-cli": "19.1.0-next.0+sha-e294ca8" + "@angular/compiler": "19.1.0-next.0+sha-834c7c3", + "@angular/compiler-cli": "19.1.0-next.0+sha-834c7c3" }, "module": "./fesm2022/localize.mjs", "typings": "./index.d.ts", diff --git a/schematics/ng-add/ng_add_bundle.js b/schematics/ng-add/ng_add_bundle.js index 1cf38583d..1e2e69f7e 100755 --- a/schematics/ng-add/ng_add_bundle.js +++ b/schematics/ng-add/ng_add_bundle.js @@ -147,7 +147,7 @@ function moveToDependencies(host) { return; } (0, import_dependencies.removePackageJsonDependency)(host, "@angular/localize"); - return (0, import_utility.addDependency)("@angular/localize", `~19.1.0-next.0+sha-e294ca8`); + return (0, import_utility.addDependency)("@angular/localize", `~19.1.0-next.0+sha-834c7c3`); } function ng_add_default(options) { const projectName = options.project; diff --git a/schematics/ng-add/ng_add_bundle.js.map b/schematics/ng-add/ng_add_bundle.js.map index 84a754029..e35284ea7 100755 --- a/schematics/ng-add/ng_add_bundle.js.map +++ b/schematics/ng-add/ng_add_bundle.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../../../../../../../packages/localize/schematics/ng-add/index.ts"], - "sourcesContent": ["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n *\n * @fileoverview Schematics for `ng add @angular/localize` schematic.\n */\n\nimport {chain, noop, Rule, SchematicsException, Tree} from '@angular-devkit/schematics';\nimport {\n AngularBuilder,\n addDependency,\n readWorkspace,\n updateWorkspace,\n} from '@schematics/angular/utility';\nimport {removePackageJsonDependency} from '@schematics/angular/utility/dependencies';\nimport {JSONFile, JSONPath} from '@schematics/angular/utility/json-file';\n\nimport {Schema} from './schema';\n\nconst localizeType = `@angular/localize`;\nconst localizePolyfill = '@angular/localize/init';\nconst localizeTripleSlashType = `/// `;\n\nfunction addPolyfillToConfig(projectName: string): Rule {\n return updateWorkspace((workspace) => {\n const project = workspace.projects.get(projectName);\n if (!project) {\n throw new SchematicsException(`Invalid project name '${projectName}'.`);\n }\n\n const isLocalizePolyfill = (path: string) => path.startsWith('@angular/localize');\n\n for (const target of project.targets.values()) {\n switch (target.builder) {\n case AngularBuilder.Karma:\n case AngularBuilder.Server:\n case AngularBuilder.Browser:\n case AngularBuilder.BrowserEsbuild:\n case AngularBuilder.Application:\n case AngularBuilder.BuildApplication:\n target.options ??= {};\n const value = target.options['polyfills'];\n if (typeof value === 'string') {\n if (!isLocalizePolyfill(value)) {\n target.options['polyfills'] = [value, localizePolyfill];\n }\n } else if (Array.isArray(value)) {\n if (!(value as string[]).some(isLocalizePolyfill)) {\n value.push(localizePolyfill);\n }\n } else {\n target.options['polyfills'] = [localizePolyfill];\n }\n\n break;\n }\n }\n });\n}\n\nfunction addTypeScriptConfigTypes(projectName: string): Rule {\n return async (host: Tree) => {\n const workspace = await readWorkspace(host);\n const project = workspace.projects.get(projectName);\n if (!project) {\n throw new SchematicsException(`Invalid project name '${projectName}'.`);\n }\n\n // We add the root workspace tsconfig for better IDE support.\n const tsConfigFiles = new Set();\n for (const target of project.targets.values()) {\n switch (target.builder) {\n case AngularBuilder.Karma:\n case AngularBuilder.Server:\n case AngularBuilder.BrowserEsbuild:\n case AngularBuilder.Browser:\n case AngularBuilder.Application:\n case AngularBuilder.BuildApplication:\n const value = target.options?.['tsConfig'];\n if (typeof value === 'string') {\n tsConfigFiles.add(value);\n }\n\n break;\n }\n\n if (\n target.builder === AngularBuilder.Browser ||\n target.builder === AngularBuilder.BrowserEsbuild\n ) {\n const value = target.options?.['main'];\n if (typeof value === 'string') {\n addTripleSlashType(host, value);\n }\n } else if (target.builder === AngularBuilder.Application) {\n const value = target.options?.['browser'];\n if (typeof value === 'string') {\n addTripleSlashType(host, value);\n }\n }\n }\n\n const typesJsonPath: JSONPath = ['compilerOptions', 'types'];\n for (const path of tsConfigFiles) {\n if (!host.exists(path)) {\n continue;\n }\n\n const json = new JSONFile(host, path);\n const types = json.get(typesJsonPath) ?? [];\n if (!Array.isArray(types)) {\n throw new SchematicsException(\n `TypeScript configuration file '${path}' has an invalid 'types' property. It must be an array.`,\n );\n }\n\n const hasLocalizeType = types.some(\n (t) => t === localizeType || t === '@angular/localize/init',\n );\n if (hasLocalizeType) {\n // Skip has already localize type.\n continue;\n }\n\n json.modify(typesJsonPath, [...types, localizeType]);\n }\n };\n}\n\nfunction addTripleSlashType(host: Tree, path: string): void {\n const content = host.readText(path);\n if (!content.includes(localizeTripleSlashType)) {\n host.overwrite(path, localizeTripleSlashType + '\\n\\n' + content);\n }\n}\n\nfunction moveToDependencies(host: Tree): Rule | void {\n if (!host.exists('package.json')) {\n return;\n }\n\n // Remove the previous dependency and add in a new one under the desired type.\n removePackageJsonDependency(host, '@angular/localize');\n\n return addDependency('@angular/localize', `~19.1.0-next.0+sha-e294ca8`);\n}\n\nexport default function (options: Schema): Rule {\n const projectName = options.project;\n\n if (!projectName) {\n throw new SchematicsException('Option \"project\" is required.');\n }\n\n return chain([\n addTypeScriptConfigTypes(projectName),\n addPolyfillToConfig(projectName),\n // If `$localize` will be used at runtime then must install `@angular/localize`\n // into `dependencies`, rather than the default of `devDependencies`.\n options.useAtRuntime ? moveToDependencies : noop(),\n ]);\n}\n"], + "sourcesContent": ["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n *\n * @fileoverview Schematics for `ng add @angular/localize` schematic.\n */\n\nimport {chain, noop, Rule, SchematicsException, Tree} from '@angular-devkit/schematics';\nimport {\n AngularBuilder,\n addDependency,\n readWorkspace,\n updateWorkspace,\n} from '@schematics/angular/utility';\nimport {removePackageJsonDependency} from '@schematics/angular/utility/dependencies';\nimport {JSONFile, JSONPath} from '@schematics/angular/utility/json-file';\n\nimport {Schema} from './schema';\n\nconst localizeType = `@angular/localize`;\nconst localizePolyfill = '@angular/localize/init';\nconst localizeTripleSlashType = `/// `;\n\nfunction addPolyfillToConfig(projectName: string): Rule {\n return updateWorkspace((workspace) => {\n const project = workspace.projects.get(projectName);\n if (!project) {\n throw new SchematicsException(`Invalid project name '${projectName}'.`);\n }\n\n const isLocalizePolyfill = (path: string) => path.startsWith('@angular/localize');\n\n for (const target of project.targets.values()) {\n switch (target.builder) {\n case AngularBuilder.Karma:\n case AngularBuilder.Server:\n case AngularBuilder.Browser:\n case AngularBuilder.BrowserEsbuild:\n case AngularBuilder.Application:\n case AngularBuilder.BuildApplication:\n target.options ??= {};\n const value = target.options['polyfills'];\n if (typeof value === 'string') {\n if (!isLocalizePolyfill(value)) {\n target.options['polyfills'] = [value, localizePolyfill];\n }\n } else if (Array.isArray(value)) {\n if (!(value as string[]).some(isLocalizePolyfill)) {\n value.push(localizePolyfill);\n }\n } else {\n target.options['polyfills'] = [localizePolyfill];\n }\n\n break;\n }\n }\n });\n}\n\nfunction addTypeScriptConfigTypes(projectName: string): Rule {\n return async (host: Tree) => {\n const workspace = await readWorkspace(host);\n const project = workspace.projects.get(projectName);\n if (!project) {\n throw new SchematicsException(`Invalid project name '${projectName}'.`);\n }\n\n // We add the root workspace tsconfig for better IDE support.\n const tsConfigFiles = new Set();\n for (const target of project.targets.values()) {\n switch (target.builder) {\n case AngularBuilder.Karma:\n case AngularBuilder.Server:\n case AngularBuilder.BrowserEsbuild:\n case AngularBuilder.Browser:\n case AngularBuilder.Application:\n case AngularBuilder.BuildApplication:\n const value = target.options?.['tsConfig'];\n if (typeof value === 'string') {\n tsConfigFiles.add(value);\n }\n\n break;\n }\n\n if (\n target.builder === AngularBuilder.Browser ||\n target.builder === AngularBuilder.BrowserEsbuild\n ) {\n const value = target.options?.['main'];\n if (typeof value === 'string') {\n addTripleSlashType(host, value);\n }\n } else if (target.builder === AngularBuilder.Application) {\n const value = target.options?.['browser'];\n if (typeof value === 'string') {\n addTripleSlashType(host, value);\n }\n }\n }\n\n const typesJsonPath: JSONPath = ['compilerOptions', 'types'];\n for (const path of tsConfigFiles) {\n if (!host.exists(path)) {\n continue;\n }\n\n const json = new JSONFile(host, path);\n const types = json.get(typesJsonPath) ?? [];\n if (!Array.isArray(types)) {\n throw new SchematicsException(\n `TypeScript configuration file '${path}' has an invalid 'types' property. It must be an array.`,\n );\n }\n\n const hasLocalizeType = types.some(\n (t) => t === localizeType || t === '@angular/localize/init',\n );\n if (hasLocalizeType) {\n // Skip has already localize type.\n continue;\n }\n\n json.modify(typesJsonPath, [...types, localizeType]);\n }\n };\n}\n\nfunction addTripleSlashType(host: Tree, path: string): void {\n const content = host.readText(path);\n if (!content.includes(localizeTripleSlashType)) {\n host.overwrite(path, localizeTripleSlashType + '\\n\\n' + content);\n }\n}\n\nfunction moveToDependencies(host: Tree): Rule | void {\n if (!host.exists('package.json')) {\n return;\n }\n\n // Remove the previous dependency and add in a new one under the desired type.\n removePackageJsonDependency(host, '@angular/localize');\n\n return addDependency('@angular/localize', `~19.1.0-next.0+sha-834c7c3`);\n}\n\nexport default function (options: Schema): Rule {\n const projectName = options.project;\n\n if (!projectName) {\n throw new SchematicsException('Option \"project\" is required.');\n }\n\n return chain([\n addTypeScriptConfigTypes(projectName),\n addPolyfillToConfig(projectName),\n // If `$localize` will be used at runtime then must install `@angular/localize`\n // into `dependencies`, rather than the default of `devDependencies`.\n options.useAtRuntime ? moveToDependencies : noop(),\n ]);\n}\n"], "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAUA,wBAA2D;AAC3D,qBAKO;AACP,0BAA0C;AAC1C,uBAAiC;AAIjC,I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