@omnific/react-scripts 0.1.4 → 0.1.6

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.
@@ -1,9 +1,9 @@
1
- import { t as paths_default } from "./paths-DdPGCuT5.js";
1
+ import { t as paths_default } from "./paths-C7Kz6S4s.js";
2
2
  import { styleText } from "node:util";
3
3
  import fs from "node:fs/promises";
4
4
  import { exit } from "node:process";
5
5
  import { rspack } from "@rspack/core";
6
- import pth from "node:path";
6
+ import path from "node:path";
7
7
  import fs$1 from "node:fs";
8
8
  import prettyBytes from "pretty-bytes";
9
9
  import zlib from "node:zlib";
@@ -20,12 +20,12 @@ async function emptyDirectory(directory) {
20
20
  * @param path
21
21
  * @returns
22
22
  */
23
- async function readdir(path) {
23
+ async function readdir(path$1) {
24
24
  let fileList = [];
25
- const files = await fs.readdir(path);
25
+ const files = await fs.readdir(path$1);
26
26
  if (files.length === 0) return [];
27
27
  for (const file of files) {
28
- const filePath = pth.join(path, file);
28
+ const filePath = path.join(path$1, file);
29
29
  if ((await fs.stat(filePath)).isDirectory()) fileList = [...fileList, ...await readdir(filePath)];
30
30
  else fileList.push(filePath);
31
31
  }
@@ -89,6 +89,7 @@ async function measureFileSizesBeforeBuild(buildFolder) {
89
89
  return result;
90
90
  }
91
91
  function getDifferenceLabel(currentSize, previousSize) {
92
+ if (!previousSize) return "";
92
93
  const FIFTY_KILOBYTES = 1024 * 50;
93
94
  const difference = currentSize - previousSize;
94
95
  const fileSize = Number.isNaN(difference) ? "0" : prettyBytes(difference);
@@ -111,7 +112,7 @@ function printFileSizesAfterBuild(stats, previousSizeMap) {
111
112
  const sizeLabelLengthList = [];
112
113
  for (const asset of statCompilation.assets) {
113
114
  if (!canReadAsset(asset.name)) continue;
114
- const fileContents = fs$1.readFileSync(pth.join(root, asset.name));
115
+ const fileContents = fs$1.readFileSync(path.join(root, asset.name));
115
116
  const previousSize = sizes[removeFileNameHash(root, asset.name)];
116
117
  const difference = getDifferenceLabel(asset.size, previousSize);
117
118
  const sizeLabel = prettyBytes(asset.size) + (difference ? " (" + difference + ")" : "");
@@ -119,8 +120,8 @@ function printFileSizesAfterBuild(stats, previousSizeMap) {
119
120
  const sizeLabelLength = stripAnsi(sizeLabel).length;
120
121
  const gzipLabelLength = stripAnsi(gzipLabel).length;
121
122
  assets.push({
122
- folder: pth.join(pth.basename(paths_default.appBuild), pth.dirname(asset.name)),
123
- name: pth.basename(asset.name),
123
+ folder: path.join(path.basename(paths_default.appBuild), path.dirname(asset.name)),
124
+ name: path.basename(asset.name),
124
125
  size: asset.size,
125
126
  sizeLabel,
126
127
  gzipLabel,
@@ -142,8 +143,8 @@ function printFileSizesAfterBuild(stats, previousSizeMap) {
142
143
  if (gzipLabelLength < longestGzipSizeLabelLength) gzipLabel += " ".repeat(longestGzipSizeLabelLength - gzipLabelLength);
143
144
  const maxRecommendedSize = asset.name.indexOf("main.") === 0 ? WARN_AFTER_BUNDLE_GZIP_SIZE : WARN_AFTER_CHUNK_GZIP_SIZE;
144
145
  const isLarge = maxRecommendedSize && asset.size > maxRecommendedSize;
145
- if (isLarge && pth.extname(asset.name) === ".js") suggestBundleSplitting = true;
146
- console.log(" " + (isLarge ? styleText("yellow", sizeLabel) : sizeLabel) + " " + gzipLabel, " " + styleText("dim", asset.folder + pth.sep) + styleText("cyan", asset.name));
146
+ if (isLarge && path.extname(asset.name) === ".js") suggestBundleSplitting = true;
147
+ console.log(" " + (isLarge ? styleText("yellow", sizeLabel) : sizeLabel) + " " + gzipLabel, " " + styleText("dim", asset.folder + path.sep) + styleText("cyan", asset.name));
147
148
  }
148
149
  }
149
150
  if (suggestBundleSplitting) {
@@ -1,9 +1,9 @@
1
- import { t as paths_default } from "./paths-DdPGCuT5.js";
1
+ import { t as paths_default } from "./paths-C7Kz6S4s.js";
2
2
  import { createRequire } from "node:module";
3
3
  import { styleText } from "node:util";
4
4
  import { exit } from "node:process";
5
5
  import { rspack } from "@rspack/core";
6
- import pth from "node:path";
6
+ import path from "node:path";
7
7
  import { RspackDevServer } from "@rspack/dev-server";
8
8
  import url from "node:url";
9
9
  import prompts from "prompts";
@@ -215,7 +215,7 @@ function escapeStringRegexp(string) {
215
215
  //#endregion
216
216
  //#region utils/ignored-files.ts
217
217
  function ignoredFiles(appSource) {
218
- return new RegExp(`^(?!${escapeStringRegexp(pth.normalize(appSource + "/").replaceAll(/\\+/g, "/"))}).+/node_modules/`, "g");
218
+ return new RegExp(`^(?!${escapeStringRegexp(path.normalize(appSource + "/").replaceAll(/\\+/g, "/"))}).+/node_modules/`, "g");
219
219
  }
220
220
  //#endregion
221
221
  //#region rspack-dev-server.ts
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { t as startBuild } from "./build-CoW3Nti_.js";
3
- import { a as isDevelopment, i as getEnv, n as DEVELOPMENT, o as isProduction, r as PRODUCTION, t as paths_default } from "./paths-DdPGCuT5.js";
4
- import { t as startDev } from "./dev-D0bbZds7.js";
2
+ import { t as startBuild } from "./build-nKWu0sKB.js";
3
+ import { a as isDevelopment, i as getEnv, n as DEVELOPMENT, o as isProduction, r as PRODUCTION, t as paths_default } from "./paths-C7Kz6S4s.js";
4
+ import { t as startDev } from "./dev-0IdkvY3b.js";
5
5
  import { createRequire } from "node:module";
6
6
  import { parseArgs, styleText } from "node:util";
7
7
  import { merge } from "webpack-merge";
8
8
  import { rspack } from "@rspack/core";
9
- import pth from "node:path";
9
+ import path from "node:path";
10
10
  import { existsSync } from "node:fs";
11
11
  import { TsCheckerRspackPlugin } from "ts-checker-rspack-plugin";
12
12
  import { ReactRefreshRspackPlugin } from "@rspack/plugin-react-refresh";
@@ -111,7 +111,7 @@ function createRspackConfig() {
111
111
  chunkFilename: isEnvironmentProduction ? "static/js/[name].[contenthash:8].chunk.js" : "static/js/[name].chunk.js",
112
112
  assetModuleFilename: "static/media/[name].[hash][ext]",
113
113
  publicPath: paths_default.publicUrlOrPath,
114
- devtoolModuleFilenameTemplate: isEnvironmentProduction ? (info) => pth.relative(paths_default.appSrc, info.absoluteResourcePath).replaceAll("\\", "/") : (info) => pth.resolve(info.absoluteResourcePath).replaceAll("\\", "/")
114
+ devtoolModuleFilenameTemplate: isEnvironmentProduction ? (info) => path.relative(paths_default.appSrc, info.absoluteResourcePath).replaceAll("\\", "/") : (info) => path.resolve(info.absoluteResourcePath).replaceAll("\\", "/")
115
115
  },
116
116
  infrastructureLogging: { level: "none" },
117
117
  optimization: {
@@ -252,7 +252,8 @@ function createRspackConfig() {
252
252
  configOverwrite: { compilerOptions: {
253
253
  incremental: true,
254
254
  skipLibCheck: true,
255
- noEmit: true
255
+ noEmit: true,
256
+ tsBuildInfoFile: paths_default.tsBuildInfoFile
256
257
  } }
257
258
  }
258
259
  })
@@ -324,7 +325,7 @@ const args = parseArgs({
324
325
  const service = new Service();
325
326
  const command = args.positionals[0];
326
327
  try {
327
- await service.run(command);
328
+ command && await service.run(command);
328
329
  } catch (error) {
329
330
  consoleError(error);
330
331
  }
package/dist/main.d.ts CHANGED
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  appPackageJson: string;
14
14
  appPublic: string;
15
15
  config: string;
16
+ tsBuildInfoFile: string;
16
17
  };
17
18
  //#endregion
18
19
  //#region utils/env.d.ts
package/dist/main.js CHANGED
@@ -29,7 +29,8 @@ var paths_default = {
29
29
  appNodeModules: resolveApp("node_modules"),
30
30
  appPackageJson: resolveApp("package.json"),
31
31
  appPublic: resolveApp("public"),
32
- config: resolveApp("react-scripts.config")
32
+ config: resolveApp("react-scripts.config"),
33
+ tsBuildInfoFile: resolveApp("node_modules/.cache/tsconfig.tsbuildinfo")
33
34
  };
34
35
  //#endregion
35
36
  //#region main.ts
@@ -1,4 +1,4 @@
1
- import pth from "node:path";
1
+ import path from "node:path";
2
2
  import fs from "node:fs";
3
3
  //#region utils/env.ts
4
4
  const DEVELOPMENT = "development";
@@ -16,7 +16,7 @@ function isProduction() {
16
16
  //#region paths.ts
17
17
  const appDirectory = fs.realpathSync(process.cwd());
18
18
  function resolveApp(relativePath) {
19
- return pth.resolve(appDirectory, relativePath);
19
+ return path.resolve(appDirectory, relativePath);
20
20
  }
21
21
  var paths_default = {
22
22
  appSrc: resolveApp("src"),
@@ -29,7 +29,8 @@ var paths_default = {
29
29
  appNodeModules: resolveApp("node_modules"),
30
30
  appPackageJson: resolveApp("package.json"),
31
31
  appPublic: resolveApp("public"),
32
- config: resolveApp("react-scripts.config")
32
+ config: resolveApp("react-scripts.config"),
33
+ tsBuildInfoFile: resolveApp("node_modules/.cache/tsconfig.tsbuildinfo")
33
34
  };
34
35
  //#endregion
35
36
  export { isDevelopment as a, getEnv as i, DEVELOPMENT as n, isProduction as o, PRODUCTION as r, paths_default as t };
@@ -1,2 +1,2 @@
1
- import { t as startBuild } from "../build-CoW3Nti_.js";
1
+ import { t as startBuild } from "../build-nKWu0sKB.js";
2
2
  export { startBuild };
@@ -1,2 +1,2 @@
1
- import { t as startDev } from "../dev-D0bbZds7.js";
1
+ import { t as startDev } from "../dev-0IdkvY3b.js";
2
2
  export { startDev };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnific/react-scripts",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "React app scripts based on Rspack",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -60,7 +60,7 @@
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/prompts": "^2.4.9",
63
- "@omnific/tsconfig": "0.0.2"
63
+ "@omnific/tsconfig": "0.0.3"
64
64
  },
65
65
  "scripts": {
66
66
  "build": "tsdown -c tsdown.config.mjs",