@rsbuild/plugin-source-build 0.0.19 → 0.0.21

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/dist/index.js CHANGED
@@ -35,8 +35,8 @@ __export(src_exports, {
35
35
  pluginSourceBuild: () => pluginSourceBuild
36
36
  });
37
37
  module.exports = __toCommonJS(src_exports);
38
+ var import_fs = __toESM(require("fs"));
38
39
  var import_path = __toESM(require("path"));
39
- var import_fs_extra = require("@rsbuild/shared/fs-extra");
40
40
  var import_shared = require("@rsbuild/shared");
41
41
  var import_monorepo_utils = require("@rsbuild/monorepo-utils");
42
42
  var pluginName = "plugin-source-build";
@@ -75,28 +75,26 @@ function pluginSourceBuild(options) {
75
75
  config.source.include = [...(_b = config.source.include) != null ? _b : [], ...includes];
76
76
  });
77
77
  if (api.context.bundlerType === "webpack") {
78
- api.modifyWebpackChain(
79
- (chain, { CHAIN_ID }) => {
80
- const {
81
- tools: { tsLoader }
82
- } = api.getNormalizedConfig();
83
- const useTsLoader = Boolean(tsLoader);
84
- chain.module.rule(useTsLoader ? CHAIN_ID.RULE.TS : CHAIN_ID.RULE.JS).resolve.mainFields.merge([sourceField, "..."]);
85
- chain.module.rule(useTsLoader ? CHAIN_ID.RULE.TS : CHAIN_ID.RULE.JS).resolve.merge({
86
- conditionNames: ["...", sourceField]
78
+ api.modifyWebpackChain((chain, { CHAIN_ID }) => {
79
+ const {
80
+ tools: { tsLoader }
81
+ } = api.getNormalizedConfig();
82
+ const useTsLoader = Boolean(tsLoader);
83
+ chain.module.rule(useTsLoader ? CHAIN_ID.RULE.TS : CHAIN_ID.RULE.JS).resolve.mainFields.merge([sourceField, "..."]);
84
+ chain.module.rule(useTsLoader ? CHAIN_ID.RULE.TS : CHAIN_ID.RULE.JS).resolve.merge({
85
+ conditionNames: ["...", sourceField]
86
+ });
87
+ const { TS_CONFIG_PATHS } = CHAIN_ID.RESOLVE_PLUGIN;
88
+ if (chain.resolve.plugins.has(TS_CONFIG_PATHS)) {
89
+ chain.resolve.plugin(TS_CONFIG_PATHS).tap((options2) => {
90
+ const references = projects.map((project) => import_path.default.join(project.dir, import_shared.TS_CONFIG_FILE)).filter((filePath) => import_fs.default.existsSync(filePath));
91
+ return options2.map((option) => ({
92
+ ...option,
93
+ references
94
+ }));
87
95
  });
88
- const { TS_CONFIG_PATHS } = CHAIN_ID.RESOLVE_PLUGIN;
89
- if (chain.resolve.plugins.has(TS_CONFIG_PATHS)) {
90
- chain.resolve.plugin(TS_CONFIG_PATHS).tap((options2) => {
91
- const references = projects.map((project) => import_path.default.join(project.dir, import_shared.TS_CONFIG_FILE)).filter((filePath) => import_fs_extra.fs.existsSync(filePath));
92
- return options2.map((option) => ({
93
- ...option,
94
- references
95
- }));
96
- });
97
- }
98
96
  }
99
- );
97
+ });
100
98
  }
101
99
  }
102
100
  };
package/dist/index.mjs CHANGED
@@ -7,8 +7,8 @@ import { createRequire } from "module";
7
7
  global.require = createRequire(import.meta.url);
8
8
 
9
9
  // src/index.ts
10
+ import fs from "fs";
10
11
  import path2 from "path";
11
- import { fs } from "@rsbuild/shared/fs-extra";
12
12
  import { TS_CONFIG_FILE } from "@rsbuild/shared";
13
13
  import {
14
14
  filterByField,
@@ -49,28 +49,26 @@ function pluginSourceBuild(options) {
49
49
  config.source.include = [...config.source.include ?? [], ...includes];
50
50
  });
51
51
  if (api.context.bundlerType === "webpack") {
52
- api.modifyWebpackChain(
53
- (chain, { CHAIN_ID }) => {
54
- const {
55
- tools: { tsLoader }
56
- } = api.getNormalizedConfig();
57
- const useTsLoader = Boolean(tsLoader);
58
- chain.module.rule(useTsLoader ? CHAIN_ID.RULE.TS : CHAIN_ID.RULE.JS).resolve.mainFields.merge([sourceField, "..."]);
59
- chain.module.rule(useTsLoader ? CHAIN_ID.RULE.TS : CHAIN_ID.RULE.JS).resolve.merge({
60
- conditionNames: ["...", sourceField]
52
+ api.modifyWebpackChain((chain, { CHAIN_ID }) => {
53
+ const {
54
+ tools: { tsLoader }
55
+ } = api.getNormalizedConfig();
56
+ const useTsLoader = Boolean(tsLoader);
57
+ chain.module.rule(useTsLoader ? CHAIN_ID.RULE.TS : CHAIN_ID.RULE.JS).resolve.mainFields.merge([sourceField, "..."]);
58
+ chain.module.rule(useTsLoader ? CHAIN_ID.RULE.TS : CHAIN_ID.RULE.JS).resolve.merge({
59
+ conditionNames: ["...", sourceField]
60
+ });
61
+ const { TS_CONFIG_PATHS } = CHAIN_ID.RESOLVE_PLUGIN;
62
+ if (chain.resolve.plugins.has(TS_CONFIG_PATHS)) {
63
+ chain.resolve.plugin(TS_CONFIG_PATHS).tap((options2) => {
64
+ const references = projects.map((project) => path2.join(project.dir, TS_CONFIG_FILE)).filter((filePath) => fs.existsSync(filePath));
65
+ return options2.map((option) => ({
66
+ ...option,
67
+ references
68
+ }));
61
69
  });
62
- const { TS_CONFIG_PATHS } = CHAIN_ID.RESOLVE_PLUGIN;
63
- if (chain.resolve.plugins.has(TS_CONFIG_PATHS)) {
64
- chain.resolve.plugin(TS_CONFIG_PATHS).tap((options2) => {
65
- const references = projects.map((project) => path2.join(project.dir, TS_CONFIG_FILE)).filter((filePath) => fs.existsSync(filePath));
66
- return options2.map((option) => ({
67
- ...option,
68
- references
69
- }));
70
- });
71
- }
72
70
  }
73
- );
71
+ });
74
72
  }
75
73
  }
76
74
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-source-build",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "description": "Source build plugin of Rsbuild",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "repository": {
@@ -22,18 +22,18 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@rsbuild/monorepo-utils": "0.0.19",
26
- "@rsbuild/shared": "0.0.19"
25
+ "@rsbuild/monorepo-utils": "0.0.21",
26
+ "@rsbuild/shared": "0.0.21"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@babel/core": "^7.23.2",
30
30
  "typescript": "^5.2.2",
31
- "@rsbuild/core": "0.0.19",
32
- "@rsbuild/test-helper": "0.0.19",
33
- "@rsbuild/webpack": "0.0.19"
31
+ "@rsbuild/core": "0.0.21",
32
+ "@rsbuild/test-helper": "0.0.21",
33
+ "@rsbuild/webpack": "0.0.21"
34
34
  },
35
35
  "peerDependencies": {
36
- "@rsbuild/core": "^0.0.19"
36
+ "@rsbuild/core": "^0.0.21"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public",