@centreon/js-config 24.7.0 → 24.7.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.
@@ -1,89 +0,0 @@
1
- const path = require('path');
2
-
3
- const rspack = require('@rspack/core');
4
-
5
- const {
6
- getModuleConfiguration,
7
- optimization,
8
- output,
9
- cache
10
- } = require('./globalConfig');
11
-
12
- const getBaseConfiguration = ({
13
- moduleName,
14
- moduleFederationConfig,
15
- enableCoverage
16
- }) => ({
17
- cache,
18
- module: getModuleConfiguration(enableCoverage),
19
- optimization,
20
- output: {
21
- ...output,
22
- clean: true,
23
- library: moduleName,
24
- uniqueName: moduleName
25
- },
26
- plugins: [
27
- moduleName &&
28
- new rspack.container.ModuleFederationPlugin({
29
- filename: 'remoteEntry.[chunkhash:8].js',
30
- library: { name: moduleName, type: 'umd' },
31
- name: moduleName,
32
- shared: [
33
- {
34
- '@centreon/ui-context': {
35
- requiredVersion: '1.x',
36
- singleton: true
37
- }
38
- },
39
- {
40
- jotai: {
41
- requiredVersion: '2.x',
42
- singleton: true
43
- }
44
- },
45
- {
46
- 'jotai-suspense': {
47
- singleton: true
48
- }
49
- },
50
- {
51
- react: {
52
- requiredVersion: '18.x',
53
- singleton: true
54
- }
55
- },
56
- {
57
- 'react-dom': {
58
- requiredVersion: '18.x',
59
- singleton: true
60
- }
61
- },
62
- {
63
- 'react-i18next': {
64
- requiredVersion: '14.x',
65
- singleton: true
66
- }
67
- },
68
- {
69
- 'react-router-dom': {
70
- requiredVersion: '6.x',
71
- singleton: true
72
- }
73
- }
74
- ],
75
- ...moduleFederationConfig
76
- })
77
- ].filter(Boolean),
78
- resolve: {
79
- alias: {
80
- '@centreon/ui/fonts': path.resolve(
81
- './node_modules/@centreon/ui/public/fonts'
82
- ),
83
- react: path.resolve('./node_modules/react')
84
- },
85
- extensions: ['.js', '.jsx', '.ts', '.tsx']
86
- }
87
- });
88
-
89
- module.exports = getBaseConfiguration;
@@ -1,12 +0,0 @@
1
- module.exports = {
2
- getDevConfiguration: () => ({
3
- cache: true,
4
- devtool: 'eval-cheap-module-source-map',
5
- optimization: {
6
- splitChunks: false
7
- },
8
- output: {
9
- filename: '[name].js'
10
- }
11
- })
12
- };
@@ -1,13 +0,0 @@
1
- const WriteRemoteEntryNameToModuleFederation = require('../plugins/WriteRemoteEntryNameToModuleFederation');
2
- const TransformPreloadScript = require('../plugins/TransformPreloadScript');
3
-
4
- module.exports = ({ outputPath, federatedComponentConfiguration }) => ({
5
- output: {
6
- library: '[chunkhash:8]',
7
- path: outputPath
8
- },
9
- plugins: [
10
- new WriteRemoteEntryNameToModuleFederation(federatedComponentConfiguration),
11
- new TransformPreloadScript(federatedComponentConfiguration)
12
- ]
13
- });
@@ -1,37 +0,0 @@
1
- const fs = require('fs');
2
-
3
- const swc = require('@swc/core');
4
-
5
- module.exports = class TransformPreloadScript {
6
- constructor(federatedComponentConfiguration) {
7
- this.federatedComponentConfiguration = federatedComponentConfiguration;
8
- }
9
-
10
- apply(compiler) {
11
- compiler.hooks.done.tap('TransformPreloadScript', () => {
12
- if (!fs.existsSync(compiler.options.output.path)) {
13
- fs.mkdirSync(compiler.options.output.path, { recursive: true });
14
- }
15
-
16
- if (this.federatedComponentConfiguration.preloadScript) {
17
- const { code } = swc.transformFileSync(
18
- `./${this.federatedComponentConfiguration.preloadScript}.ts`,
19
- {
20
- filename: `${this.federatedComponentConfiguration.preloadScript}.ts`,
21
- jsc: {
22
- parser: {
23
- syntax: 'typescript'
24
- }
25
- },
26
- minify: true
27
- }
28
- );
29
-
30
- fs.writeFileSync(
31
- `${compiler.options.output.path}/${this.federatedComponentConfiguration.preloadScript}.js`,
32
- code
33
- );
34
- }
35
- });
36
- }
37
- };
@@ -1,30 +0,0 @@
1
- const fs = require('fs');
2
-
3
- module.exports = class WriteRemoteEntryNameToModuleFederation {
4
- constructor(federatedComponentConfiguration) {
5
- this.federatedComponentConfiguration = federatedComponentConfiguration;
6
- }
7
-
8
- apply(compiler) {
9
- compiler.hooks.done.tap(
10
- 'WriteRemoteEntryNameToModuleFederation',
11
- (stats) => {
12
- const newFederatedComponentConfiguration = {
13
- ...this.federatedComponentConfiguration,
14
- remoteEntry: Object.keys(stats.compilation.assets).find((assetName) =>
15
- assetName.match(/(^remoteEntry)\S+.js$/)
16
- )
17
- };
18
-
19
- if (!fs.existsSync(compiler.options.output.path)) {
20
- fs.mkdirSync(compiler.options.output.path, { recursive: true });
21
- }
22
-
23
- fs.writeFileSync(
24
- `${compiler.options.output.path}/moduleFederation.json`,
25
- JSON.stringify(newFederatedComponentConfiguration, null, 2)
26
- );
27
- }
28
- );
29
- }
30
- };
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "@tsconfig/node20/tsconfig.json",
3
- "compilerOptions": {
4
- "sourceMap": true,
5
- "allowJs": true,
6
- "strictNullChecks": false,
7
- "declaration": false,
8
- "esModuleInterop": true,
9
- "strict": true,
10
- "types": ["@types/jest", "node"]
11
- }
12
- }
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "@tsconfig/node16/tsconfig.json",
3
- "compilerOptions": {
4
- "sourceMap": true,
5
- "allowJs": true,
6
- "strictNullChecks": false,
7
- "declaration": false,
8
- "esModuleInterop": true,
9
- "types": [
10
- "@types/jest",
11
- "node"
12
- ]
13
- }
14
- }
package/tsconfig.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "extends": "./tsconfig/index.json",
3
- "compilerOptions": {
4
- "baseUrl": "./",
5
- "outDir": "./dist",
6
- "declaration": true,
7
- "skipLibCheck": true,
8
- "pretty": true,
9
- "emitDeclarationOnly": true,
10
- "types": ["cypress", "cypress-wait-until"],
11
- "esModuleInterop": true,
12
- "paths": {
13
- "@badeball/cypress-cucumber-preprocessor/*": ["./node_modules/@badeball/cypress-cucumber-preprocessor/dist/subpath-entrypoints/*"]
14
- }
15
- },
16
- "exclude": [
17
- "./node_modules",
18
- "./dist",
19
- "../../node_modules"
20
- ],
21
- }