@o3r/components 14.4.1 → 14.4.3

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.3",
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.3",
48
+ "@o3r/configuration": "~14.4.3",
49
+ "@o3r/core": "~14.4.3",
50
+ "@o3r/dynamic-content": "~14.4.3",
51
+ "@o3r/extractors": "~14.4.3",
52
+ "@o3r/localization": "~14.4.3",
53
+ "@o3r/logger": "~14.4.3",
54
+ "@o3r/rules-engine": "~14.4.3",
55
+ "@o3r/schematics": "~14.4.3",
56
+ "@o3r/transloco": "~14.4.3",
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.3",
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;AA0GpC;;GAEG;AAEH,eAAO,MAAM,WAAW,wBAAsC,CAAC"}
@@ -0,0 +1,95 @@
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-esbuild',
10
+ '@angular-devkit/build-angular:server',
11
+ '@angular/build:application',
12
+ '@angular/build:karma'
13
+ ]);
14
+ /**
15
+ * Builders from `@angular-builders/custom-webpack` that bundle JavaScript through a user-provided webpack config file.
16
+ * These do not support the `externalDependencies` option, so the equivalent fix must be applied in the webpack config
17
+ * referenced by their `customWebpackConfig.path` option.
18
+ */
19
+ const CUSTOM_WEBPACK_BUILDERS = new Set([
20
+ '@angular-builders/custom-webpack:browser',
21
+ '@angular-builders/custom-webpack:server',
22
+ '@angular-builders/custom-webpack:karma'
23
+ ]);
24
+ /**
25
+ * Add `@o3r/transloco` to externalDependencies in bundling targets of angular.json
26
+ * when it is not a direct dependency of the project.
27
+ * This is required because `@o3r/components` performs a dynamic `import('@o3r/transloco')` at runtime,
28
+ * and webpack/esbuild will fail at build time if the module is not installed and not marked as external.
29
+ * @param tree
30
+ * @param context
31
+ */
32
+ const addTranslocoExternalDependency = (tree, context) => {
33
+ const workspace = (0, schematics_2.getWorkspaceConfig)(tree);
34
+ if (!workspace) {
35
+ context.logger.warn('No angular.json found, skipping migration.');
36
+ return;
37
+ }
38
+ const packageJson = tree.exists('/package.json')
39
+ ? tree.readJson('/package.json')
40
+ : null;
41
+ const isTranslocoInstalled = !!packageJson?.dependencies?.[TRANSLOCO_PACKAGE]
42
+ || !!packageJson?.devDependencies?.[TRANSLOCO_PACKAGE];
43
+ if (isTranslocoInstalled) {
44
+ context.logger.info(`${TRANSLOCO_PACKAGE} is already installed, no externalDependencies update needed.`);
45
+ return;
46
+ }
47
+ let modified = false;
48
+ for (const [projectName, project] of Object.entries(workspace.projects || {})) {
49
+ if (project.projectType !== 'application') {
50
+ continue;
51
+ }
52
+ const architect = project.architect || {};
53
+ for (const [targetName, target] of Object.entries(architect)) {
54
+ if (CUSTOM_WEBPACK_BUILDERS.has(target.builder)) {
55
+ const webpackConfigPath = target.options?.customWebpackConfig?.path;
56
+ const webpackConfigLabel = webpackConfigPath ? `the webpack config "${webpackConfigPath}"` : 'your webpack config';
57
+ context.logger.warn(`${projectName}/${targetName} uses the custom-webpack builder "${target.builder}", which does not support the externalDependencies option.\n`
58
+ + `Please add the following to ${webpackConfigLabel} manually so the bundler skips the optional ${TRANSLOCO_PACKAGE} import:\n`
59
+ + ' const { IgnorePlugin } = require(\'webpack\');\n'
60
+ + ' config.plugins.push(new IgnorePlugin({\n'
61
+ + ` resourceRegExp: /^${TRANSLOCO_PACKAGE.replace('/', '\\/')}$/\n`
62
+ + ' }));\n'
63
+ + `For testing only, if adjusting the webpack config is not possible, you can as a last resort install ${TRANSLOCO_PACKAGE} as a dev dependency so it is bundled normally during tests.`);
64
+ continue;
65
+ }
66
+ if (!BUNDLING_BUILDERS.has(target.builder)) {
67
+ continue;
68
+ }
69
+ if (!target.options) {
70
+ target.options = {};
71
+ }
72
+ const existingExternals = (target.options).externalDependencies ?? [];
73
+ if (!existingExternals.includes(TRANSLOCO_PACKAGE)) {
74
+ (target.options).externalDependencies = [...existingExternals, TRANSLOCO_PACKAGE];
75
+ context.logger.info(`Added ${TRANSLOCO_PACKAGE} to externalDependencies in ${projectName}/${targetName}.`);
76
+ modified = true;
77
+ }
78
+ }
79
+ }
80
+ if (modified) {
81
+ (0, schematics_2.writeAngularJson)(tree, workspace);
82
+ }
83
+ };
84
+ // eslint-disable-next-line @typescript-eslint/naming-convention -- version in the function name
85
+ function updateV14_4Fn() {
86
+ return (tree, context) => (0, schematics_1.chain)([
87
+ addTranslocoExternalDependency
88
+ ])(tree, context);
89
+ }
90
+ /**
91
+ * Update of `@o3r/components` v14.4
92
+ */
93
+ // eslint-disable-next-line @typescript-eslint/naming-convention -- version in the function name
94
+ exports.updateV14_4 = (0, schematics_2.createOtterSchematic)(updateV14_4Fn);
95
+ //# 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,+CAA+C;IAC/C,sCAAsC;IACtC,4BAA4B;IAC5B,sBAAsB;CACvB,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,OAAO,EAAE,EAAE;IAC7D,MAAM,SAAS,GAAG,I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