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

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/] },
@@ -76,18 +91,20 @@ var with_base_config_default = () => (config) => {
76
91
  {
77
92
  module: /monaco-(editor|yaml)/
78
93
  },
94
+ /Can't resolve 'crypto'/,
79
95
  /Failed to parse source map from/
80
96
  ],
81
97
  resolve: {
82
98
  alias: {
83
- dayjs: "dayjs/esm"
99
+ dayjs: "dayjs/esm",
100
+ lodash: "lodash-es"
84
101
  }
85
102
  }
86
103
  });
87
104
  };
88
105
 
89
106
  // libs/dynamic-plugin-sdk-rspack/src/lib/with-host-mfe-config.ts
90
- import { withModuleFederation } from "@nx/module-federation/rspack";
107
+ import { withModuleFederation } from "@nx/module-federation/rspack.js";
91
108
  import { merge as merge2 } from "rspack-merge";
92
109
  var proxy = "http://localhost:8080/";
93
110
  function createRemoteProxy({ disableDevPluginProxy = false } = {}) {
@@ -129,11 +146,15 @@ function createRemoteProxy({ disableDevPluginProxy = false } = {}) {
129
146
  return remoteProxy;
130
147
  }
131
148
  var with_host_mfe_config_default = async (mfeConfig, overrideConfig, options = {}) => {
132
- const mfe = await withModuleFederation(mfeConfig, overrideConfig);
133
- const { disableDevPluginProxy = false } = options;
149
+ const mfe = await withModuleFederation(mfeConfig, {
150
+ ...overrideConfig,
151
+ dts: false
152
+ });
134
153
  return (config) => merge2(mfe(config, { context: config.context }), {
135
154
  devServer: {
136
- proxy: createRemoteProxy({ disableDevPluginProxy })
155
+ proxy: createRemoteProxy({
156
+ disableDevPluginProxy: options.disableDevPluginProxy
157
+ })
137
158
  }
138
159
  });
139
160
  };
@@ -163,18 +184,28 @@ var with_monaco_editor_default = () => (config) => {
163
184
  };
164
185
 
165
186
  // 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";
187
+ import { execSync } from "node:child_process";
188
+ import { withModuleFederation as withModuleFederation2 } from "@nx/module-federation/rspack.js";
168
189
  import { merge as merge4 } from "rspack-merge";
169
190
  var generateName = (name) => {
170
191
  const commitID = execSync("git rev-parse --short HEAD").toString().trim();
171
192
  return `${name}__${commitID}`;
172
193
  };
173
194
  var with_remote_mfe_config_default = async (mfeConfig, overrideConfig) => {
174
- const mfe = await withModuleFederation2(mfeConfig, overrideConfig);
195
+ const mfe = await withModuleFederation2(mfeConfig, {
196
+ ...overrideConfig,
197
+ dts: false,
198
+ // @ts-expect-error - The type definition of withModuleFederation is not accurate, it should allow filename to be string
199
+ filename: "remoteEntry.mjs",
200
+ library: {
201
+ type: "module"
202
+ }
203
+ });
175
204
  return (config) => {
176
205
  return merge4(mfe(config, { context: config.context }), {
177
- output: { uniqueName: generateName(mfeConfig.name) },
206
+ output: {
207
+ uniqueName: generateName(mfeConfig.name)
208
+ },
178
209
  devServer: {
179
210
  headers: {
180
211
  "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.11",
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": {