@lark-apaas/fullstack-rspack-preset 1.0.50 → 1.0.52

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/lib/preset.js CHANGED
@@ -377,6 +377,12 @@ function createRecommendRspackConfig(options) {
377
377
  changeOrigin: true,
378
378
  onError: sendBackendUnavailable502,
379
379
  },
380
+ {
381
+ context: [`${clientBasePath}/openapi`],
382
+ target: `http://localhost:${serverPort}`,
383
+ changeOrigin: true,
384
+ onError: sendBackendUnavailable502,
385
+ },
380
386
  {
381
387
  context: [`${clientBasePath}/__innerapi__`],
382
388
  target: `http://localhost:${serverPort}`,
@@ -429,6 +435,7 @@ function createRecommendRspackConfig(options) {
429
435
  (0, devtool_kits_1.createDevLogsMiddleware)({ logDir: process.env.LOG_DIR || './logs' }),
430
436
  (0, devtool_kits_1.createOpenapiMiddleware)({
431
437
  openapiFilePath: path_1.default.resolve(rootDir, './client/src/api/gen/openapi.json'),
438
+ openapiSpecFilePath: path_1.default.resolve(rootDir, './docs/openapi.json'),
432
439
  serverDir: path_1.default.resolve(rootDir, './server'),
433
440
  enableEnhancement: true,
434
441
  }),
@@ -32,11 +32,7 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
- const core_1 = __importDefault(require("@rspack/core"));
40
36
  const fs = __importStar(require("fs"));
41
37
  const path = __importStar(require("path"));
42
38
  class SourceMapUploadPlugin {
@@ -51,7 +47,7 @@ class SourceMapUploadPlugin {
51
47
  console.log('SourceMapUploadPlugin: Starting sourcemap consolidation process...');
52
48
  const outputPath = compiler.options.output.path;
53
49
  if (!outputPath) {
54
- compilation.warnings.push(new core_1.default.WebpackError('SourceMapUploadPlugin: compiler.options.output.path is not defined. Skipping sourcemap consolidation.'));
50
+ console.warn('SourceMapUploadPlugin: compiler.options.output.path is not defined. Skipping sourcemap consolidation.');
55
51
  return;
56
52
  }
57
53
  const assets = compilation.getAssets();
@@ -63,12 +59,7 @@ class SourceMapUploadPlugin {
63
59
  const outputBaseDir = path.basename(outputPath); // e.g., 'client'
64
60
  const sourcemapTargetDir = path.join(this.options.outputDir, outputBaseDir); // e.g., 'dist/sourcemaps/client'
65
61
  for (const sourceMap of sourceMaps) {
66
- let assetName = sourceMap.name;
67
- // Align with Vite's output structure by adding 'assets' and removing 'chunks'
68
- if (assetName.startsWith('chunks/')) {
69
- assetName = assetName.substring('chunks/'.length);
70
- }
71
- assetName = path.join('assets', assetName);
62
+ const assetName = path.join('assets', path.basename(sourceMap.name));
72
63
  const destinationPath = path.join(sourcemapTargetDir, assetName);
73
64
  const originalPath = path.join(outputPath, sourceMap.name);
74
65
  try {
@@ -88,19 +79,12 @@ class SourceMapUploadPlugin {
88
79
  console.log(`SourceMapUploadPlugin: Deleted original sourcemap ${originalPath}`);
89
80
  }
90
81
  catch (deleteError) {
91
- const deleteErrorMessage = `SourceMapUploadPlugin: Failed to delete original sourcemap ${originalPath}.`;
92
- compilation.warnings.push(new core_1.default.WebpackError(`${deleteErrorMessage} Error: ${String(deleteError)}`));
82
+ console.warn(`SourceMapUploadPlugin: Failed to delete original sourcemap ${originalPath}.`, deleteError);
93
83
  }
94
84
  }
95
85
  catch (error) {
96
86
  const errorMessage = `SourceMapUploadPlugin: Failed to consolidate ${assetName}.`;
97
87
  console.error(errorMessage, error);
98
- if (error instanceof Error) {
99
- compilation.errors.push(new Error(`${errorMessage} Error: ${error.message}`));
100
- }
101
- else {
102
- compilation.errors.push(new Error(`${errorMessage} Error: ${String(error)}`));
103
- }
104
88
  }
105
89
  }
106
90
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-rspack-preset",
3
- "version": "1.0.50",
3
+ "version": "1.0.52",
4
4
  "files": [
5
5
  "lib",
6
6
  "patches",
@@ -31,7 +31,7 @@
31
31
  "@babel/parser": "^7.28.0",
32
32
  "@babel/traverse": "^7.28.0",
33
33
  "@babel/types": "^7.28.2",
34
- "@lark-apaas/devtool-kits": "^1.2.20",
34
+ "@lark-apaas/devtool-kits": "^1.2.21",
35
35
  "@lark-apaas/miaoda-inspector-babel-plugin": "^1.0.2",
36
36
  "@lark-apaas/styled-jsx": "^1.0.1",
37
37
  "@rspack/plugin-react-refresh": "^1.5.1",