@modern-js/builder 2.32.1 → 2.32.2-alpha.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @modern-js/builder
2
2
 
3
+ ## 2.32.2-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - f96d5655742: feat(builder): add tailwind config to webpack build dependencies
8
+
9
+ feat(builder): 添加 tailwind config 到 webpack build dependencies 中
10
+
11
+ - Updated dependencies [bc1f8daf0ff]
12
+ - @modern-js/builder-shared@2.32.2-alpha.0
13
+ - @modern-js/utils@2.32.2-alpha.0
14
+ - @modern-js/monorepo-utils@2.32.2-alpha.0
15
+
3
16
  ## 2.32.1
4
17
 
5
18
  ### Patch Changes
@@ -29,6 +29,45 @@ function getCacheDirectory({ cacheDirectory }, context) {
29
29
  }
30
30
  return (0, _path.join)(context.cachePath, context.bundlerType);
31
31
  }
32
+ async function getBuildDependencies(context) {
33
+ const { findExists } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
34
+ const rootPackageJson = (0, _path.join)(context.rootPath, "package.json");
35
+ const browserslistConfig = (0, _path.join)(context.rootPath, ".browserslistrc");
36
+ const buildDependencies = {
37
+ packageJson: [
38
+ rootPackageJson
39
+ ]
40
+ };
41
+ if (context.configPath) {
42
+ buildDependencies.config = [
43
+ context.configPath
44
+ ];
45
+ }
46
+ if (context.tsconfigPath) {
47
+ buildDependencies.tsconfig = [
48
+ context.tsconfigPath
49
+ ];
50
+ }
51
+ if (await (0, _buildershared.isFileExists)(browserslistConfig)) {
52
+ buildDependencies.browserslistrc = [
53
+ browserslistConfig
54
+ ];
55
+ }
56
+ const tailwindExts = [
57
+ "ts",
58
+ "js",
59
+ "cjs",
60
+ "mjs"
61
+ ];
62
+ const configs = tailwindExts.map((ext) => (0, _path.join)(context.rootPath, `tailwind.config.${ext}`));
63
+ const tailwindConfig = findExists(configs);
64
+ if (tailwindConfig) {
65
+ buildDependencies.tailwindcss = [
66
+ tailwindConfig
67
+ ];
68
+ }
69
+ return buildDependencies;
70
+ }
32
71
  const builderPluginCache = () => ({
33
72
  name: "builder-plugin-cache",
34
73
  setup(api) {
@@ -41,28 +80,7 @@ const builderPluginCache = () => ({
41
80
  const { context } = api;
42
81
  const cacheConfig = typeof buildCache === "boolean" ? {} : buildCache;
43
82
  const cacheDirectory = getCacheDirectory(cacheConfig, context);
44
- const rootPackageJson = (0, _path.join)(context.rootPath, "package.json");
45
- const browserslistConfig = (0, _path.join)(context.rootPath, ".browserslistrc");
46
- const buildDependencies = {
47
- packageJson: [
48
- rootPackageJson
49
- ]
50
- };
51
- if (context.configPath) {
52
- buildDependencies.config = [
53
- context.configPath
54
- ];
55
- }
56
- if (context.tsconfigPath) {
57
- buildDependencies.tsconfig = [
58
- context.tsconfigPath
59
- ];
60
- }
61
- if (await (0, _buildershared.isFileExists)(browserslistConfig)) {
62
- buildDependencies.browserslistrc = [
63
- browserslistConfig
64
- ];
65
- }
83
+ const buildDependencies = await getBuildDependencies(context);
66
84
  await validateCache(cacheDirectory, buildDependencies);
67
85
  chain.cache({
68
86
  // The default cache name of webpack is '${name}-${env}', and the `name` is `default` by default.
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "engines": {
19
19
  "node": ">=14.0.0"
20
20
  },
21
- "version": "2.32.1",
21
+ "version": "2.32.2-alpha.1",
22
22
  "jsnext:source": "./src/index.ts",
23
23
  "types": "./dist/index.d.ts",
24
24
  "main": "./dist/index.js",
@@ -32,16 +32,16 @@
32
32
  "dependencies": {
33
33
  "@svgr/webpack": "8.0.1",
34
34
  "@swc/helpers": "0.5.1",
35
- "@modern-js/builder-shared": "2.32.1",
36
- "@modern-js/utils": "2.32.1",
37
- "@modern-js/monorepo-utils": "2.32.1"
35
+ "@modern-js/builder-shared": "2.32.2-alpha.1",
36
+ "@modern-js/monorepo-utils": "2.32.2-alpha.1",
37
+ "@modern-js/utils": "2.32.2-alpha.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/babel__core": "^7.20.0",
41
41
  "@types/node": "^14",
42
42
  "typescript": "^5",
43
- "@modern-js/builder-webpack-provider": "2.32.1",
44
- "@modern-js/builder-rspack-provider": "2.32.1",
43
+ "@modern-js/builder-webpack-provider": "2.32.2-alpha.1",
44
+ "@modern-js/builder-rspack-provider": "2.32.2-alpha.1",
45
45
  "@scripts/build": "2.32.1",
46
46
  "@scripts/vitest-config": "2.32.1"
47
47
  },