@unpackjs/core 1.7.1 → 1.7.2

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.
@@ -4795,19 +4795,19 @@
4795
4795
  }
4796
4796
  });
4797
4797
  },
4798
- 84: (module, __unused_webpack_exports, __nccwpck_require__) => {
4798
+ 465: (module, __unused_webpack_exports, __nccwpck_require__) => {
4799
4799
  "use strict";
4800
- const loader = __nccwpck_require__(739);
4800
+ const loader = __nccwpck_require__(442);
4801
4801
  module.exports = loader.default;
4802
4802
  },
4803
- 739: (__unused_webpack_module, exports, __nccwpck_require__) => {
4803
+ 442: (__unused_webpack_module, exports, __nccwpck_require__) => {
4804
4804
  "use strict";
4805
4805
  Object.defineProperty(exports, "__esModule", { value: true });
4806
4806
  exports["default"] = void 0;
4807
4807
  var _url = _interopRequireDefault(__nccwpck_require__(310));
4808
4808
  var _path = _interopRequireDefault(__nccwpck_require__(17));
4809
- var _options = _interopRequireDefault(__nccwpck_require__(732));
4810
- var _utils = __nccwpck_require__(813);
4809
+ var _options = _interopRequireDefault(__nccwpck_require__(798));
4810
+ var _utils = __nccwpck_require__(611);
4811
4811
  function _interopRequireDefault(e) {
4812
4812
  return e && e.__esModule ? e : { default: e };
4813
4813
  }
@@ -4917,7 +4917,7 @@
4917
4917
  }
4918
4918
  var _default = (exports["default"] = loader);
4919
4919
  },
4920
- 813: (__unused_webpack_module, exports, __nccwpck_require__) => {
4920
+ 611: (__unused_webpack_module, exports, __nccwpck_require__) => {
4921
4921
  "use strict";
4922
4922
  Object.defineProperty(exports, "__esModule", { value: true });
4923
4923
  exports.errorFactory = errorFactory;
@@ -5577,7 +5577,7 @@
5577
5577
  "use strict";
5578
5578
  module.exports = require("url");
5579
5579
  },
5580
- 732: (module) => {
5580
+ 798: (module) => {
5581
5581
  "use strict";
5582
5582
  module.exports = JSON.parse(
5583
5583
  '{"title":"Sass Loader options","type":"object","properties":{"implementation":{"description":"The implementation of the sass to be used.","link":"https://github.com/webpack-contrib/sass-loader#implementation","anyOf":[{"type":"string"},{"type":"object"}]},"api":{"description":"Switch between old and modern API for `sass` (`Dart Sass`) and `Sass Embedded` implementations.","link":"https://github.com/webpack-contrib/sass-loader#sassoptions","enum":["legacy","modern","modern-compiler"]},"sassOptions":{"description":"Options for `node-sass` or `sass` (`Dart Sass`) implementation.","link":"https://github.com/webpack-contrib/sass-loader#sassoptions","anyOf":[{"type":"object","additionalProperties":true},{"instanceof":"Function"}]},"additionalData":{"description":"Prepends/Appends `Sass`/`SCSS` code before the actual entry file.","link":"https://github.com/webpack-contrib/sass-loader#additionaldata","anyOf":[{"type":"string"},{"instanceof":"Function"}]},"sourceMap":{"description":"Enables/Disables generation of source maps.","link":"https://github.com/webpack-contrib/sass-loader#sourcemap","type":"boolean"},"webpackImporter":{"description":"Enables/Disables default `webpack` importer.","link":"https://github.com/webpack-contrib/sass-loader#webpackimporter","type":"boolean"},"warnRuleAsWarning":{"description":"Treats the \'@warn\' rule as a webpack warning.","link":"https://github.com/webpack-contrib/sass-loader#warnruleaswarning","type":"boolean"}},"additionalProperties":false}',
@@ -5607,6 +5607,6 @@
5607
5607
  }
5608
5608
  if (typeof __nccwpck_require__ !== "undefined")
5609
5609
  __nccwpck_require__.ab = __dirname + "/";
5610
- var __webpack_exports__ = __nccwpck_require__(84);
5610
+ var __webpack_exports__ = __nccwpck_require__(465);
5611
5611
  module.exports = __webpack_exports__;
5612
5612
  })();
@@ -49,7 +49,7 @@ var import_chunkSplit = require("./chunkSplit.cjs");
49
49
  var import_css = require("./css.cjs");
50
50
  var import_experimentCss = require("./experimentCss.cjs");
51
51
  var import_helper = require("./helper.cjs");
52
- const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
52
+ const { TsCheckerRspackPlugin } = require("ts-checker-rspack-plugin");
53
53
  const BundleAnalyzerPlugin = require("../../compiled/webpack-bundle-analyzer/index.js").BundleAnalyzerPlugin;
54
54
  const CopyWebpackPlugin = require("copy-webpack-plugin");
55
55
  async function getBundlerConfig(unpackConfig) {
@@ -126,7 +126,7 @@ async function getBundlerConfig(unpackConfig) {
126
126
  contextRegExp: /moment$/
127
127
  }),
128
128
  unpackConfig.build?.copy && new CopyPlugin({ patterns: unpackConfig.build.copy }),
129
- unpackConfig.build?.typeCheck && (0, import_utils.isDev)() && isTs && new ForkTsCheckerWebpackPlugin({
129
+ unpackConfig.build?.typeCheck && (0, import_utils.isDev)() && isTs && new TsCheckerRspackPlugin({
130
130
  typescript: {
131
131
  // set 'readonly' to avoid emitting tsbuildinfo, as the generated tsbuildinfo will break fork-ts-checker
132
132
  mode: "readonly",
@@ -182,7 +182,10 @@ async function getBundlerConfig(unpackConfig) {
182
182
  },
183
183
  cache: unpackConfig.build?.cache && unpackConfig.bundler === "webpack" ? {
184
184
  type: "filesystem"
185
- } : void 0
185
+ } : void 0,
186
+ watchOptions: {
187
+ ignored: /[\\/](?:\.git|node_modules)[\\/]/
188
+ }
186
189
  };
187
190
  if (unpackConfig.experiments?.css)
188
191
  import_logger.logger.warn("Experiments.css is not stable yet, please use with caution");
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler-config/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAqBzE,wBAAsB,gBAAgB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA8KhG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler-config/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAqBzE,wBAAsB,gBAAgB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAiLhG"}
@@ -12,7 +12,7 @@ import path2 from "node:path";
12
12
  import { rspack } from "@rspack/core";
13
13
  import HtmlWebpackPlugin from "html-webpack-plugin";
14
14
  import { isDev, isDevServer, isFunction, isPlainObject, isProd, mergeConfig } from "../utils.js";
15
- const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
15
+ const { TsCheckerRspackPlugin } = require("ts-checker-rspack-plugin");
16
16
  const BundleAnalyzerPlugin = require("../../compiled/webpack-bundle-analyzer/index.js").BundleAnalyzerPlugin;
17
17
  const CopyWebpackPlugin = require("copy-webpack-plugin");
18
18
  import esbuild from "esbuild";
@@ -103,7 +103,7 @@ async function getBundlerConfig(unpackConfig) {
103
103
  contextRegExp: /moment$/
104
104
  }),
105
105
  unpackConfig.build?.copy && new CopyPlugin({ patterns: unpackConfig.build.copy }),
106
- unpackConfig.build?.typeCheck && isDev() && isTs && new ForkTsCheckerWebpackPlugin({
106
+ unpackConfig.build?.typeCheck && isDev() && isTs && new TsCheckerRspackPlugin({
107
107
  typescript: {
108
108
  // set 'readonly' to avoid emitting tsbuildinfo, as the generated tsbuildinfo will break fork-ts-checker
109
109
  mode: "readonly",
@@ -159,7 +159,10 @@ async function getBundlerConfig(unpackConfig) {
159
159
  },
160
160
  cache: unpackConfig.build?.cache && unpackConfig.bundler === "webpack" ? {
161
161
  type: "filesystem"
162
- } : void 0
162
+ } : void 0,
163
+ watchOptions: {
164
+ ignored: /[\\/](?:\.git|node_modules)[\\/]/
165
+ }
163
166
  };
164
167
  if (unpackConfig.experiments?.css)
165
168
  logger.warn("Experiments.css is not stable yet, please use with caution");
@@ -76,7 +76,7 @@ function createUnpack() {
76
76
  build: async (unpackConfig) => {
77
77
  (0, import_utils.setNodeEnv)("production");
78
78
  console.log(
79
- import_colors.default.rainbow(`unpack v${"1.7.1"}`),
79
+ import_colors.default.rainbow(`unpack v${"1.7.2"}`),
80
80
  import_colors.default.green("building for production...")
81
81
  );
82
82
  const config = await resolveConfig(unpackConfig);
@@ -92,7 +92,7 @@ function createUnpack() {
92
92
  watch: async (unpackConfig) => {
93
93
  (0, import_utils.setNodeEnv)("development");
94
94
  console.log(
95
- import_colors.default.rainbow(`unpack v${"1.7.1"}`),
95
+ import_colors.default.rainbow(`unpack v${"1.7.2"}`),
96
96
  import_colors.default.green("building for development...")
97
97
  );
98
98
  const config = await resolveConfig(unpackConfig);
@@ -53,7 +53,7 @@ function createUnpack() {
53
53
  build: async (unpackConfig) => {
54
54
  setNodeEnv("production");
55
55
  console.log(
56
- colors.rainbow(`unpack v${"1.7.1"}`),
56
+ colors.rainbow(`unpack v${"1.7.2"}`),
57
57
  colors.green("building for production...")
58
58
  );
59
59
  const config = await resolveConfig(unpackConfig);
@@ -69,7 +69,7 @@ function createUnpack() {
69
69
  watch: async (unpackConfig) => {
70
70
  setNodeEnv("development");
71
71
  console.log(
72
- colors.rainbow(`unpack v${"1.7.1"}`),
72
+ colors.rainbow(`unpack v${"1.7.2"}`),
73
73
  colors.green("building for development...")
74
74
  );
75
75
  const config = await resolveConfig(unpackConfig);
@@ -188,10 +188,7 @@ const bundleDep = ({
188
188
  css: true
189
189
  },
190
190
  externals: {
191
- react: getExternalValue("react"),
192
- "react-dom": getExternalValue("react-dom"),
193
- "react-router": getExternalValue("react-router"),
194
- "react-router-dom": getExternalValue("react-router-dom")
191
+ react: getExternalValue("react")
195
192
  }
196
193
  });
197
194
  compiler.run((_, stats) => {
@@ -240,6 +237,8 @@ const getPkgEntry = (packageJson) => {
240
237
  if ((0, import_utils.isString)(defaultExport.default))
241
238
  return defaultExport.default;
242
239
  }
240
+ if ((0, import_utils.isString)(packageJson.exports.default))
241
+ return packageJson.exports.default;
243
242
  }
244
243
  if (packageJson.main)
245
244
  return packageJson.main;
@@ -251,8 +250,9 @@ const prebundleDeps = async ({
251
250
  const { root } = unpackConfig;
252
251
  const packageJson = JSON.parse(import_node_fs.default.readFileSync(import_node_path.default.resolve(root, "package.json"), "utf-8"));
253
252
  const existExternals = getExistExternals(unpackConfig.externals);
253
+ const excludeDeps = [...existExternals || [], ...userOptions.exclude || []];
254
254
  const shouldIncludeDeps = Object.keys(packageJson.dependencies).filter(
255
- (pkgName) => !existExternals.includes(pkgName) && !userOptions.exclude?.includes(pkgName)
255
+ (pkgName) => !excludeDeps.includes(pkgName)
256
256
  );
257
257
  const needBundleDeps = shouldIncludeDeps.map((pkgName) => {
258
258
  const packageJson2 = JSON.parse(
@@ -1 +1 @@
1
- {"version":3,"file":"prebundleDeps.d.ts","sourceRoot":"","sources":["../src/prebundleDeps.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AA+N3C,eAAO,MAAM,aAAa,sBAEvB;IACD,YAAY,EAAE,YAAY,CAAA;CAC3B,KAAG,OAAO,CAAC,YAAY,CA0GvB,CAAA"}
1
+ {"version":3,"file":"prebundleDeps.d.ts","sourceRoot":"","sources":["../src/prebundleDeps.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AA6N3C,eAAO,MAAM,aAAa,sBAEvB;IACD,YAAY,EAAE,YAAY,CAAA;CAC3B,KAAG,OAAO,CAAC,YAAY,CA2GvB,CAAA"}
@@ -174,10 +174,7 @@ const bundleDep = ({
174
174
  css: true
175
175
  },
176
176
  externals: {
177
- react: getExternalValue("react"),
178
- "react-dom": getExternalValue("react-dom"),
179
- "react-router": getExternalValue("react-router"),
180
- "react-router-dom": getExternalValue("react-router-dom")
177
+ react: getExternalValue("react")
181
178
  }
182
179
  });
183
180
  compiler.run((_, stats) => {
@@ -226,6 +223,8 @@ const getPkgEntry = (packageJson) => {
226
223
  if (isString(defaultExport.default))
227
224
  return defaultExport.default;
228
225
  }
226
+ if (isString(packageJson.exports.default))
227
+ return packageJson.exports.default;
229
228
  }
230
229
  if (packageJson.main)
231
230
  return packageJson.main;
@@ -237,8 +236,9 @@ const prebundleDeps = async ({
237
236
  const { root } = unpackConfig;
238
237
  const packageJson = JSON.parse(fs.readFileSync(path2.resolve(root, "package.json"), "utf-8"));
239
238
  const existExternals = getExistExternals(unpackConfig.externals);
239
+ const excludeDeps = [...existExternals || [], ...userOptions.exclude || []];
240
240
  const shouldIncludeDeps = Object.keys(packageJson.dependencies).filter(
241
- (pkgName) => !existExternals.includes(pkgName) && !userOptions.exclude?.includes(pkgName)
241
+ (pkgName) => !excludeDeps.includes(pkgName)
242
242
  );
243
243
  const needBundleDeps = shouldIncludeDeps.map((pkgName) => {
244
244
  const packageJson2 = JSON.parse(
@@ -30,7 +30,6 @@ __export(build_exports, {
30
30
  bundlerBuild: () => bundlerBuild
31
31
  });
32
32
  module.exports = __toCommonJS(build_exports);
33
- var import_node_path = __toESM(require("node:path"));
34
33
  var import_core = require("@rspack/core");
35
34
  var import_utils = require("../utils.cjs");
36
35
  var import_webpack = __toESM(require("webpack"));
@@ -61,12 +60,7 @@ async function bundlerBuild(unpackConfig) {
61
60
  }
62
61
  };
63
62
  if ((0, import_utils.isWatch)()) {
64
- compiler.watch(
65
- {
66
- ignored: [import_node_path.default.resolve(unpackConfig.root, "unpack.config.*")]
67
- },
68
- handler
69
- );
63
+ compiler.watch({}, handler);
70
64
  } else {
71
65
  compiler.run(handler);
72
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/run/build.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAKnD,wBAAsB,YAAY,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAmC5E"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/run/build.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAKnD,wBAAsB,YAAY,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA8B5E"}
package/dist/run/build.js CHANGED
@@ -7,7 +7,6 @@ var getFilename = () => fileURLToPath(import.meta.url);
7
7
  var getDirname = () => path.dirname(getFilename());
8
8
  var __dirname = /* @__PURE__ */ getDirname();
9
9
  var __filename = /* @__PURE__ */ getFilename();
10
- import path2 from "node:path";
11
10
  import { rspack } from "@rspack/core";
12
11
  import { isWatch } from "../utils.js";
13
12
  import webpack from "webpack";
@@ -38,12 +37,7 @@ async function bundlerBuild(unpackConfig) {
38
37
  }
39
38
  };
40
39
  if (isWatch()) {
41
- compiler.watch(
42
- {
43
- ignored: [path2.resolve(unpackConfig.root, "unpack.config.*")]
44
- },
45
- handler
46
- );
40
+ compiler.watch({}, handler);
47
41
  } else {
48
42
  compiler.run(handler);
49
43
  }
package/dist/run/dev.cjs CHANGED
@@ -62,7 +62,7 @@ async function bundlerDev(originalUnpackConfig) {
62
62
  };
63
63
  const server = new import_webpack_dev_server.default(devServerOptions, compiler);
64
64
  import_logger.logger.greet(
65
- ` ${import_colors.default.green(`${import_colors.default.bold("UNPACK")} v${"1.7.1"}`)} ${import_colors.default.dim(
65
+ ` ${import_colors.default.green(`${import_colors.default.bold("UNPACK")} v${"1.7.2"}`)} ${import_colors.default.dim(
66
66
  `ready in ${import_colors.default.reset(
67
67
  import_colors.default.bold(Math.ceil(performance.now() - global.__unpack_start_time))
68
68
  )}ms`
package/dist/run/dev.js CHANGED
@@ -39,7 +39,7 @@ async function bundlerDev(originalUnpackConfig) {
39
39
  };
40
40
  const server = new WebpackDevServer(devServerOptions, compiler);
41
41
  logger.greet(
42
- ` ${colors.green(`${colors.bold("UNPACK")} v${"1.7.1"}`)} ${colors.dim(
42
+ ` ${colors.green(`${colors.bold("UNPACK")} v${"1.7.2"}`)} ${colors.dim(
43
43
  `ready in ${colors.reset(
44
44
  colors.bold(Math.ceil(performance.now() - global.__unpack_start_time))
45
45
  )}ms`
@@ -12,7 +12,7 @@ import path from "path";
12
12
  import { fileURLToPath } from "url";
13
13
  var getFilename, getDirname, __dirname, __filename;
14
14
  var init_esm = __esm({
15
- "../../node_modules/.pnpm/@modern-js+module-tools@2.62.1_typescript@5.6.3/node_modules/@modern-js/module-tools/shims/esm.js"() {
15
+ "../../node_modules/.pnpm/@modern-js+module-tools@2.63.0_typescript@5.6.3/node_modules/@modern-js/module-tools/shims/esm.js"() {
16
16
  getFilename = () => fileURLToPath(import.meta.url);
17
17
  getDirname = () => path.dirname(getFilename());
18
18
  __dirname = /* @__PURE__ */ getDirname();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unpackjs/core",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
@@ -82,17 +82,16 @@
82
82
  "webpack-merge": "6.0.1"
83
83
  },
84
84
  "dependencies": {
85
- "@rspack/core": "1.1.3",
85
+ "@rspack/core": "1.1.4",
86
86
  "@types/less": "3.0.7",
87
87
  "copy-webpack-plugin": "12.0.2",
88
88
  "cors": "2.8.5",
89
89
  "esbuild": "0.24.0",
90
90
  "esbuild-loader": "4.2.2",
91
91
  "express": "4.21.1",
92
- "fork-ts-checker-webpack-plugin": "9.0.2",
93
92
  "html-webpack-plugin": "5.6.3",
94
93
  "json5": "2.2.3",
95
- "lightningcss": "1.28.1",
94
+ "lightningcss": "1.28.2",
96
95
  "loader-runner": "4.3.0",
97
96
  "mini-css-extract-plugin": "2.9.2",
98
97
  "neo-async": "2.6.2",
@@ -100,6 +99,7 @@
100
99
  "picocolors": "1.1.1",
101
100
  "postcss": "8.4.49",
102
101
  "tinyglobby": "0.2.10",
102
+ "ts-checker-rspack-plugin": "1.0.1",
103
103
  "typed-css-modules": "0.9.1",
104
104
  "webpack": "5.96.1",
105
105
  "webpack-dev-server": "5.1.0"