@alauda-fe/dynamic-plugin-sdk-rspack 0.0.1-alpha.1 → 0.0.1-alpha.10

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/index.js CHANGED
@@ -40,12 +40,15 @@ async function loadModule(path) {
40
40
  return module.default || module;
41
41
  }
42
42
  var with_alauda_console_default = async (options) => {
43
- const customWebpack = await loadModule("@alauda/custom-webpack");
43
+ const customWebpack = await loadModule("@alauda/custom-webpack/rspack");
44
44
  return (config) => {
45
45
  config.resolve ??= {};
46
46
  config.resolve.alias ??= {};
47
47
  config.plugins ??= [];
48
- return customWebpack(config, options);
48
+ return customWebpack(config, {
49
+ injectEntry: false,
50
+ ...options
51
+ });
49
52
  };
50
53
  };
51
54
 
@@ -53,8 +56,20 @@ var with_alauda_console_default = async (options) => {
53
56
  import { merge } from "rspack-merge";
54
57
  var with_base_config_default = () => (config) => {
55
58
  return merge(config, {
59
+ output: {
60
+ module: true
61
+ },
62
+ experiments: {
63
+ outputModule: true
64
+ },
56
65
  module: {
57
66
  rules: [
67
+ {
68
+ test: /\.[cm]?jsx?$/,
69
+ resolve: {
70
+ fullySpecified: false
71
+ }
72
+ },
58
73
  {
59
74
  test: /\.css$/i,
60
75
  resourceQuery: { not: [/ngGlobalStyle/, /ngResource/] },
@@ -80,14 +95,15 @@ var with_base_config_default = () => (config) => {
80
95
  ],
81
96
  resolve: {
82
97
  alias: {
83
- dayjs: "dayjs/esm"
98
+ dayjs: "dayjs/esm",
99
+ lodash: "lodash-es"
84
100
  }
85
101
  }
86
102
  });
87
103
  };
88
104
 
89
105
  // libs/dynamic-plugin-sdk-rspack/src/lib/with-host-mfe-config.ts
90
- import { withModuleFederation } from "@nx/module-federation/rspack";
106
+ import { withModuleFederation } from "@nx/module-federation/rspack.js";
91
107
  import { merge as merge2 } from "rspack-merge";
92
108
  var proxy = "http://localhost:8080/";
93
109
  function createRemoteProxy({ disableDevPluginProxy = false } = {}) {
@@ -129,11 +145,15 @@ function createRemoteProxy({ disableDevPluginProxy = false } = {}) {
129
145
  return remoteProxy;
130
146
  }
131
147
  var with_host_mfe_config_default = async (mfeConfig, overrideConfig, options = {}) => {
132
- const mfe = await withModuleFederation(mfeConfig, overrideConfig);
133
- const { disableDevPluginProxy = false } = options;
148
+ const mfe = await withModuleFederation(mfeConfig, {
149
+ ...overrideConfig,
150
+ dts: false
151
+ });
134
152
  return (config) => merge2(mfe(config, { context: config.context }), {
135
153
  devServer: {
136
- proxy: createRemoteProxy({ disableDevPluginProxy })
154
+ proxy: createRemoteProxy({
155
+ disableDevPluginProxy: options.disableDevPluginProxy
156
+ })
137
157
  }
138
158
  });
139
159
  };
@@ -163,18 +183,28 @@ var with_monaco_editor_default = () => (config) => {
163
183
  };
164
184
 
165
185
  // libs/dynamic-plugin-sdk-rspack/src/lib/with-remote-mfe-config.ts
166
- import { execSync } from "child_process";
167
- import { withModuleFederation as withModuleFederation2 } from "@nx/module-federation/rspack";
186
+ import { execSync } from "node:child_process";
187
+ import { withModuleFederation as withModuleFederation2 } from "@nx/module-federation/rspack.js";
168
188
  import { merge as merge4 } from "rspack-merge";
169
189
  var generateName = (name) => {
170
190
  const commitID = execSync("git rev-parse --short HEAD").toString().trim();
171
191
  return `${name}__${commitID}`;
172
192
  };
173
193
  var with_remote_mfe_config_default = async (mfeConfig, overrideConfig) => {
174
- const mfe = await withModuleFederation2(mfeConfig, overrideConfig);
194
+ const mfe = await withModuleFederation2(mfeConfig, {
195
+ ...overrideConfig,
196
+ dts: false,
197
+ // @ts-expect-error - The type definition of withModuleFederation is not accurate, it should allow filename to be string
198
+ filename: "remoteEntry.mjs",
199
+ library: {
200
+ type: "module"
201
+ }
202
+ });
175
203
  return (config) => {
176
204
  return merge4(mfe(config, { context: config.context }), {
177
- output: { uniqueName: generateName(mfeConfig.name) },
205
+ output: {
206
+ uniqueName: generateName(mfeConfig.name)
207
+ },
178
208
  devServer: {
179
209
  headers: {
180
210
  "Access-Control-Allow-Origin": "*"
package/lib/i18n-merge.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  import fs from 'node:fs';
4
4
  import path from 'node:path';
5
+ import { pathToFileURL } from 'node:url';
5
6
 
6
7
  /**
7
8
  * @param {string[]} argv
@@ -127,7 +128,10 @@ async function run() {
127
128
  throw new Error(`Config file not found: ${configPath}`);
128
129
  }
129
130
 
130
- const config = await import(configPath);
131
+ const config = await import(
132
+ pathToFileURL(configPath),
133
+ configPath.endsWith('.json') ? { with: { type: 'json' } } : undefined
134
+ ).then(mod => mod.default || mod);
131
135
  const inputs = config?.input;
132
136
  const output = config?.output;
133
137
 
package/package.json CHANGED
@@ -1,20 +1,25 @@
1
1
  {
2
2
  "name": "@alauda-fe/dynamic-plugin-sdk-rspack",
3
- "version": "0.0.1-alpha.1",
3
+ "version": "0.0.1-alpha.10",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
+ "types": "./src/index.d.ts",
6
7
  "sideEffects": false,
7
8
  "publishConfig": {
8
9
  "access": "public"
9
10
  },
10
11
  "peerDependencies": {
11
- "css-loader": ">=6.0.0",
12
- "monaco-editor-webpack-plugin": "^7.1.1",
13
- "style-loader": ">=3.0.0"
12
+ "@rspack/core": "^1.0.0 || ^2.0.0",
13
+ "@rspack/dev-server": "^1.0.0 || ^2.0.0"
14
14
  },
15
15
  "dependencies": {
16
- "@rspack/core": "1.6.8",
17
- "@rspack/dev-server": "1.2.1"
16
+ "@alauda/custom-webpack": "^5.3.2",
17
+ "@nx/module-federation": "^22.7.5",
18
+ "css-loader": ">=6.0.0",
19
+ "monaco-editor-webpack-plugin": "^7.1.1",
20
+ "rspack-merge": "^1.0.1",
21
+ "style-loader": ">=3.0.0",
22
+ "yaml-loader": ">=0.8.0"
18
23
  },
19
24
  "packageManager": "yarn@4.16.0",
20
25
  "resolutions": {