@o3r/components 14.4.1 → 14.4.2

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/migration.json CHANGED
@@ -5,6 +5,11 @@
5
5
  "version": "10.0.0-alpha.0",
6
6
  "description": "Updates of @o3r/components to v10.0.*",
7
7
  "factory": "./schematics/ng-update/v10-0/index#updateV10_0"
8
+ },
9
+ "migration-v14_4": {
10
+ "version": "14.4.0-alpha.0",
11
+ "description": "Updates of @o3r/components to v14.4.*",
12
+ "factory": "./schematics/ng-update/v14-4/index#updateV14_4"
8
13
  }
9
14
  }
10
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/components",
3
- "version": "14.4.1",
3
+ "version": "14.4.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -44,16 +44,16 @@
44
44
  "@ngrx/effects": "^21.0.0",
45
45
  "@ngrx/entity": "^21.0.0",
46
46
  "@ngrx/store": "^21.0.0",
47
- "@o3r/analytics": "~14.4.1",
48
- "@o3r/configuration": "~14.4.1",
49
- "@o3r/core": "~14.4.1",
50
- "@o3r/dynamic-content": "~14.4.1",
51
- "@o3r/extractors": "~14.4.1",
52
- "@o3r/localization": "~14.4.1",
53
- "@o3r/logger": "~14.4.1",
54
- "@o3r/rules-engine": "~14.4.1",
55
- "@o3r/schematics": "~14.4.1",
56
- "@o3r/transloco": "~14.4.1",
47
+ "@o3r/analytics": "~14.4.2",
48
+ "@o3r/configuration": "~14.4.2",
49
+ "@o3r/core": "~14.4.2",
50
+ "@o3r/dynamic-content": "~14.4.2",
51
+ "@o3r/extractors": "~14.4.2",
52
+ "@o3r/localization": "~14.4.2",
53
+ "@o3r/logger": "~14.4.2",
54
+ "@o3r/rules-engine": "~14.4.2",
55
+ "@o3r/schematics": "~14.4.2",
56
+ "@o3r/transloco": "~14.4.2",
57
57
  "@schematics/angular": "^21.0.0",
58
58
  "@yarnpkg/cli": "^4.0.0",
59
59
  "@yarnpkg/core": "^4.1.1",
@@ -137,7 +137,7 @@
137
137
  }
138
138
  },
139
139
  "dependencies": {
140
- "@o3r/schematics": "~14.4.1",
140
+ "@o3r/schematics": "~14.4.2",
141
141
  "tslib": "^2.6.2"
142
142
  },
143
143
  "engines": {
@@ -0,0 +1,6 @@
1
+ import { type Rule } from '@angular-devkit/schematics';
2
+ /**
3
+ * Update of `@o3r/components` v14.4
4
+ */
5
+ export declare const updateV14_4: (options: any) => Rule;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-update/v14-4/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,IAAI,EACV,MAAM,4BAA4B,CAAC;AA4GpC;;GAEG;AAEH,eAAO,MAAM,WAAW,wBAAsC,CAAC"}
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateV14_4 = void 0;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const schematics_2 = require("@o3r/schematics");
6
+ const TRANSLOCO_PACKAGE = '@o3r/transloco';
7
+ /** Angular builders that perform JavaScript bundling and support the externalDependencies option */
8
+ const BUNDLING_BUILDERS = new Set([
9
+ '@angular-devkit/build-angular:browser',
10
+ '@angular-devkit/build-angular:browser-esbuild',
11
+ '@angular/build:application',
12
+ '@angular-devkit/build-angular:server',
13
+ '@angular-devkit/build-angular:app-shell',
14
+ '@angular-devkit/build-angular:prerender',
15
+ '@angular-devkit/build-angular:karma'
16
+ ]);
17
+ /**
18
+ * Builders from `@angular-builders/custom-webpack` that bundle JavaScript through a user-provided webpack config file.
19
+ * These do not support the `externalDependencies` option, so the equivalent fix must be applied in the webpack config
20
+ * referenced by their `customWebpackConfig.path` option.
21
+ */
22
+ const CUSTOM_WEBPACK_BUILDERS = new Set([
23
+ '@angular-builders/custom-webpack:browser',
24
+ '@angular-builders/custom-webpack:server',
25
+ '@angular-builders/custom-webpack:karma'
26
+ ]);
27
+ /**
28
+ * Add `@o3r/transloco` to externalDependencies in bundling targets of angular.json
29
+ * when it is not a direct dependency of the project.
30
+ * This is required because `@o3r/components` performs a dynamic `import('@o3r/transloco')` at runtime,
31
+ * and webpack/esbuild will fail at build time if the module is not installed and not marked as external.
32
+ * @param tree
33
+ * @param context
34
+ */
35
+ const addTranslocoExternalDependency = (tree, context) => {
36
+ const workspace = (0, schematics_2.getWorkspaceConfig)(tree);
37
+ if (!workspace) {
38
+ context.logger.warn('No angular.json found, skipping migration.');
39
+ return;
40
+ }
41
+ const packageJson = tree.exists('/package.json')
42
+ ? tree.readJson('/package.json')
43
+ : null;
44
+ const isTranslocoInstalled = !!packageJson?.dependencies?.[TRANSLOCO_PACKAGE]
45
+ || !!packageJson?.devDependencies?.[TRANSLOCO_PACKAGE];
46
+ if (isTranslocoInstalled) {
47
+ context.logger.info(`${TRANSLOCO_PACKAGE} is already installed, no externalDependencies update needed.`);
48
+ return;
49
+ }
50
+ let modified = false;
51
+ for (const [projectName, project] of Object.entries(workspace.projects || {})) {
52
+ if (project.projectType !== 'application') {
53
+ continue;
54
+ }
55
+ const architect = project.architect || {};
56
+ for (const [targetName, target] of Object.entries(architect)) {
57
+ if (CUSTOM_WEBPACK_BUILDERS.has(target.builder)) {
58
+ const webpackConfigPath = target.options?.customWebpackConfig?.path;
59
+ const webpackConfigLabel = webpackConfigPath ? `the webpack config "${webpackConfigPath}"` : 'your webpack config';
60
+ context.logger.warn(`${projectName}/${targetName} uses the custom-webpack builder "${target.builder}", which does not support the externalDependencies option.\n`
61
+ + `Please add the following to ${webpackConfigLabel} manually so the bundler skips the optional ${TRANSLOCO_PACKAGE} import:\n`
62
+ + ' const { IgnorePlugin } = require(\'webpack\');\n'
63
+ + ' config.plugins.push(new IgnorePlugin({\n'
64
+ + ` resourceRegExp: /^${TRANSLOCO_PACKAGE.replace('/', '\\/')}$/\n`
65
+ + ' }));');
66
+ continue;
67
+ }
68
+ if (!BUNDLING_BUILDERS.has(target.builder)) {
69
+ continue;
70
+ }
71
+ if (!target.options) {
72
+ target.options = {};
73
+ }
74
+ const existingExternals = (target.options).externalDependencies ?? [];
75
+ if (!existingExternals.includes(TRANSLOCO_PACKAGE)) {
76
+ (target.options).externalDependencies = [...existingExternals, TRANSLOCO_PACKAGE];
77
+ context.logger.info(`Added ${TRANSLOCO_PACKAGE} to externalDependencies in ${projectName}/${targetName}.`);
78
+ modified = true;
79
+ }
80
+ }
81
+ }
82
+ if (modified) {
83
+ (0, schematics_2.writeAngularJson)(tree, workspace);
84
+ }
85
+ };
86
+ // eslint-disable-next-line @typescript-eslint/naming-convention -- version in the function name
87
+ function updateV14_4Fn() {
88
+ return (tree, context) => (0, schematics_1.chain)([
89
+ addTranslocoExternalDependency
90
+ ])(tree, context);
91
+ }
92
+ /**
93
+ * Update of `@o3r/components` v14.4
94
+ */
95
+ // eslint-disable-next-line @typescript-eslint/naming-convention -- version in the function name
96
+ exports.updateV14_4 = (0, schematics_2.createOtterSchematic)(updateV14_4Fn);
97
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../schematics/ng-update/v14-4/index.ts"],"names":[],"mappings":";;;AAAA,2DAGoC;AACpC,gDAIyB;AAKzB,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAE3C,oGAAoG;AACpG,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,uCAAuC;IACvC,+CAA+C;IAC/C,4BAA4B;IAC5B,sCAAsC;IACtC,yCAAyC;IACzC,yCAAyC;IACzC,qCAAqC;CACtC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC;IACtC,0CAA0C;IAC1C,yCAAyC;IACzC,wCAAwC;CACzC,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,8BAA8B,GAAS,CAAC,IAAI,EAAE,O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