@angular/localize 20.1.0 → 20.2.0-next.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/fesm2022/init.mjs
CHANGED
package/fesm2022/localize.mjs
CHANGED
package/fesm2022/localize2.mjs
CHANGED
package/index.d.ts
CHANGED
package/init/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/localize",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.2.0-next.0",
|
|
4
4
|
"description": "Angular - library for localizing messages",
|
|
5
5
|
"bin": {
|
|
6
6
|
"localize-translate": "./tools/bundles/src/translate/cli.js",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"yargs": "^18.0.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@angular/compiler": "20.
|
|
71
|
-
"@angular/compiler-cli": "20.
|
|
70
|
+
"@angular/compiler": "20.2.0-next.0",
|
|
71
|
+
"@angular/compiler-cli": "20.2.0-next.0"
|
|
72
72
|
},
|
|
73
73
|
"module": "./fesm2022/localize.mjs",
|
|
74
74
|
"typings": "./index.d.ts",
|
|
@@ -126,7 +126,7 @@ function moveToDependencies(host) {
|
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
(0, import_dependencies.removePackageJsonDependency)(host, "@angular/localize");
|
|
129
|
-
return (0, import_utility.addDependency)("@angular/localize", `~20.
|
|
129
|
+
return (0, import_utility.addDependency)("@angular/localize", `~20.2.0-next.0`);
|
|
130
130
|
}
|
|
131
131
|
function ng_add_default(options) {
|
|
132
132
|
const projectName = options.project;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.ts"],
|
|
4
|
-
"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 = `/// <reference types=\"@angular/localize\" />`;\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.BuildKarma:\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<string>();\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 (\n target.builder === AngularBuilder.Application ||\n target.builder === AngularBuilder.BuildApplication\n ) {\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', `~20.
|
|
4
|
+
"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 = `/// <reference types=\"@angular/localize\" />`;\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.BuildKarma:\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<string>();\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 (\n target.builder === AngularBuilder.Application ||\n target.builder === AngularBuilder.BuildApplication\n ) {\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', `~20.2.0-next.0`);\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"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;AAUA,wBAA2D;AAC3D,qBAKO;AACP,0BAA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