@modern-js/builder 2.35.0 → 2.35.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.
@@ -16,14 +16,13 @@ const builderPluginArco = () => ({
16
16
  const ARCO_NAME = "@arco-design/web-react";
17
17
  const ARCO_ICON = `${ARCO_NAME}/icon`;
18
18
  api.modifyBuilderConfig((builderConfig) => {
19
- var _transformImport, _transformImport1;
20
19
  var _builderConfig;
21
20
  const { transformImport = [] } = builderConfig.source || {};
22
21
  if (transformImport === false || !(0, _utils.isPackageInstalled)(ARCO_NAME, api.context.rootPath)) {
23
22
  return;
24
23
  }
25
24
  const isUseSSR = (0, _antd.useSSR)(api.context.target);
26
- if (!((_transformImport = transformImport) === null || _transformImport === void 0 ? void 0 : _transformImport.some((item) => item.libraryName === ARCO_NAME))) {
25
+ if (!(transformImport === null || transformImport === void 0 ? void 0 : transformImport.some((item) => item.libraryName === ARCO_NAME))) {
27
26
  transformImport.push({
28
27
  libraryName: ARCO_NAME,
29
28
  libraryDirectory: isUseSSR ? "lib" : "es",
@@ -31,7 +30,7 @@ const builderPluginArco = () => ({
31
30
  style: true
32
31
  });
33
32
  }
34
- if (!((_transformImport1 = transformImport) === null || _transformImport1 === void 0 ? void 0 : _transformImport1.some((item) => item.libraryName === ARCO_ICON))) {
33
+ if (!(transformImport === null || transformImport === void 0 ? void 0 : transformImport.some((item) => item.libraryName === ARCO_ICON))) {
35
34
  transformImport.push({
36
35
  libraryName: ARCO_ICON,
37
36
  libraryDirectory: isUseSSR ? "react-icon-cjs" : "react-icon",
@@ -62,8 +62,12 @@ async function printFileSizes(stats, distPath) {
62
62
  folder: _path.default.join(_path.default.basename(distPath), _path.default.dirname(asset.name)),
63
63
  name: _path.default.basename(asset.name),
64
64
  gzippedSize,
65
- sizeLabel: filesize(size),
66
- gzipSizeLabel: getAssetColor(gzippedSize)(filesize(gzippedSize))
65
+ sizeLabel: filesize(size, {
66
+ round: 1
67
+ }),
68
+ gzipSizeLabel: getAssetColor(gzippedSize)(filesize(gzippedSize, {
69
+ round: 1
70
+ }))
67
71
  };
68
72
  };
69
73
  const multiStats = "stats" in stats ? stats.stats : [
@@ -89,7 +93,7 @@ async function printFileSizes(stats, distPath) {
89
93
  assets.sort((a, b) => b.size - a.size);
90
94
  const longestLabelLength = Math.max(...assets.map((a) => stripAnsi(a.sizeLabel).length));
91
95
  const longestFileLength = Math.max(...assets.map((a) => stripAnsi(a.folder + _path.default.sep + a.name).length));
92
- _buildershared.logger.info(`File sizes after production build:
96
+ _buildershared.logger.info(`Production file sizes:
93
97
  `);
94
98
  printHeader(longestFileLength, longestLabelLength);
95
99
  let totalSize = 0;
@@ -23,12 +23,11 @@ const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
23
23
  const _buildershared = require("@modern-js/builder-shared");
24
24
  const _lodash = /* @__PURE__ */ _interop_require_default._(require("@modern-js/utils/lodash"));
25
25
  async function getTemplateParameters(entryName, config, assetPrefix) {
26
- var _templateParametersByEntries;
27
26
  const { applyOptionsChain } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
28
27
  const { mountId, templateParameters, templateParametersByEntries } = config.html;
29
28
  const meta = await (0, _buildershared.getMetaTags)(entryName, config);
30
29
  const title = (0, _buildershared.getTitle)(entryName, config);
31
- const templateParams = ((_templateParametersByEntries = templateParametersByEntries) === null || _templateParametersByEntries === void 0 ? void 0 : _templateParametersByEntries[entryName]) || templateParameters;
30
+ const templateParams = (templateParametersByEntries === null || templateParametersByEntries === void 0 ? void 0 : templateParametersByEntries[entryName]) || templateParameters;
32
31
  const baseParameters = {
33
32
  meta,
34
33
  title,
@@ -26,10 +26,9 @@ const builderPluginNodeAddons = () => ({
26
26
  throw new Error(`Failed to compile Node.js addons, couldn't find the package.json of ${chalk.yellow(resource)}.`);
27
27
  }
28
28
  const getFilename = (resource2, pkgName2) => {
29
- var _match;
30
29
  const reg = new RegExp(`node_modules/${pkgName2}/(.+)`);
31
30
  const match = resource2.match(reg);
32
- const filename = (_match = match) === null || _match === void 0 ? void 0 : _match[1];
31
+ const filename = match === null || match === void 0 ? void 0 : match[1];
33
32
  if (!filename) {
34
33
  return "[name].[ext]";
35
34
  }
@@ -15,7 +15,6 @@ const builderPluginTsChecker = () => {
15
15
  name: "builder-plugin-ts-checker",
16
16
  setup(api) {
17
17
  api.modifyBundlerChain(async (chain, { target }) => {
18
- var _experiments;
19
18
  const config = api.getNormalizedConfig();
20
19
  if (config.output.disableTsChecker || !api.context.tsconfigPath) {
21
20
  return;
@@ -38,7 +37,7 @@ const builderPluginTsChecker = () => {
38
37
  }
39
38
  const { experiments } = api.getNormalizedConfig();
40
39
  var _experiments_sourceBuild;
41
- const enableSourceBuild = (_experiments_sourceBuild = (_experiments = experiments) === null || _experiments === void 0 ? void 0 : _experiments.sourceBuild) !== null && _experiments_sourceBuild !== void 0 ? _experiments_sourceBuild : false;
40
+ const enableSourceBuild = (_experiments_sourceBuild = experiments === null || experiments === void 0 ? void 0 : experiments.sourceBuild) !== null && _experiments_sourceBuild !== void 0 ? _experiments_sourceBuild : false;
42
41
  const tsCheckerOptions = applyOptionsChain({
43
42
  typescript: {
44
43
  // avoid OOM issue
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "engines": {
19
19
  "node": ">=14.0.0"
20
20
  },
21
- "version": "2.35.0",
21
+ "version": "2.35.1",
22
22
  "jsnext:source": "./src/index.ts",
23
23
  "types": "./dist/index.d.ts",
24
24
  "main": "./dist/index.js",
@@ -45,19 +45,19 @@
45
45
  "dependencies": {
46
46
  "@svgr/webpack": "8.0.1",
47
47
  "@swc/helpers": "0.5.1",
48
- "@modern-js/builder-shared": "2.35.0",
49
- "@modern-js/monorepo-utils": "2.35.0",
50
- "@modern-js/node-bundle-require": "2.35.0",
51
- "@modern-js/utils": "2.35.0"
48
+ "@modern-js/builder-shared": "2.35.1",
49
+ "@modern-js/monorepo-utils": "2.35.1",
50
+ "@modern-js/utils": "2.35.1",
51
+ "@modern-js/node-bundle-require": "2.35.1"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/babel__core": "^7.20.0",
55
55
  "@types/node": "^14",
56
56
  "typescript": "^5",
57
- "@modern-js/builder-webpack-provider": "2.35.0",
58
- "@modern-js/builder-rspack-provider": "2.35.0",
59
- "@scripts/build": "2.35.0",
60
- "@scripts/vitest-config": "2.35.0"
57
+ "@modern-js/builder-webpack-provider": "2.35.1",
58
+ "@modern-js/builder-rspack-provider": "2.35.1",
59
+ "@scripts/vitest-config": "2.35.1",
60
+ "@scripts/build": "2.35.1"
61
61
  },
62
62
  "publishConfig": {
63
63
  "registry": "https://registry.npmjs.org/",