@omnific/react-scripts 0.1.1 → 0.1.3

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-BvJwGeTv.js";
1
+ import { t as paths_default } from "./paths-DdPGCuT5.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 path from "node:path";
6
+ import pth 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$1) {
23
+ async function readdir(path) {
24
24
  let fileList = [];
25
- const files = await fs.readdir(path$1);
25
+ const files = await fs.readdir(path);
26
26
  if (files.length === 0) return [];
27
27
  for (const file of files) {
28
- const filePath = path.join(path$1, file);
28
+ const filePath = pth.join(path, file);
29
29
  if ((await fs.stat(filePath)).isDirectory()) fileList = [...fileList, ...await readdir(filePath)];
30
30
  else fileList.push(filePath);
31
31
  }
@@ -111,7 +111,7 @@ function printFileSizesAfterBuild(stats, previousSizeMap) {
111
111
  const sizeLabelLengthList = [];
112
112
  for (const asset of statCompilation.assets) {
113
113
  if (!canReadAsset(asset.name)) continue;
114
- const fileContents = fs$1.readFileSync(path.join(root, asset.name));
114
+ const fileContents = fs$1.readFileSync(pth.join(root, asset.name));
115
115
  const previousSize = sizes[removeFileNameHash(root, asset.name)];
116
116
  const difference = getDifferenceLabel(asset.size, previousSize);
117
117
  const sizeLabel = prettyBytes(asset.size) + (difference ? " (" + difference + ")" : "");
@@ -119,8 +119,8 @@ function printFileSizesAfterBuild(stats, previousSizeMap) {
119
119
  const sizeLabelLength = stripAnsi(sizeLabel).length;
120
120
  const gzipLabelLength = stripAnsi(gzipLabel).length;
121
121
  assets.push({
122
- folder: path.join(path.basename(paths_default.appBuild), path.dirname(asset.name)),
123
- name: path.basename(asset.name),
122
+ folder: pth.join(pth.basename(paths_default.appBuild), pth.dirname(asset.name)),
123
+ name: pth.basename(asset.name),
124
124
  size: asset.size,
125
125
  sizeLabel,
126
126
  gzipLabel,
@@ -142,8 +142,8 @@ function printFileSizesAfterBuild(stats, previousSizeMap) {
142
142
  if (gzipLabelLength < longestGzipSizeLabelLength) gzipLabel += " ".repeat(longestGzipSizeLabelLength - gzipLabelLength);
143
143
  const maxRecommendedSize = asset.name.indexOf("main.") === 0 ? WARN_AFTER_BUNDLE_GZIP_SIZE : WARN_AFTER_CHUNK_GZIP_SIZE;
144
144
  const isLarge = maxRecommendedSize && asset.size > maxRecommendedSize;
145
- if (isLarge && path.extname(asset.name) === ".js") suggestBundleSplitting = true;
146
- console.log(" " + (isLarge ? styleText("yellow", sizeLabel) : sizeLabel) + " " + gzipLabel, " " + styleText("dim", asset.folder + path.sep) + styleText("cyan", asset.name));
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));
147
147
  }
148
148
  }
149
149
  if (suggestBundleSplitting) {
@@ -1,9 +1,9 @@
1
- import { t as paths_default } from "./paths-BvJwGeTv.js";
1
+ import { t as paths_default } from "./paths-DdPGCuT5.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 path from "node:path";
6
+ import pth from "node:path";
7
7
  import { RspackDevServer } from "@rspack/dev-server";
8
8
  import url from "node:url";
9
9
  import prompts from "prompts";
@@ -74,7 +74,9 @@ function isRoot() {
74
74
  /**
75
75
  * 清除控制台的信息
76
76
  */
77
- function clearConsole() {}
77
+ function clearConsole() {
78
+ process.stdout.write(process.platform === "win32" ? "\x1B[2J\x1B[0f" : "\x1B[2J\x1B[3J\x1B[H");
79
+ }
78
80
  //#endregion
79
81
  //#region utils/dev-server-utils.ts
80
82
  const isInteractive$1 = process.stdout.isTTY;
@@ -213,7 +215,7 @@ function escapeStringRegexp(string) {
213
215
  //#endregion
214
216
  //#region utils/ignored-files.ts
215
217
  function ignoredFiles(appSource) {
216
- return new RegExp(`^(?!${escapeStringRegexp(path.normalize(appSource + "/").replaceAll(/\\+/g, "/"))}).+/node_modules/`, "g");
218
+ return new RegExp(`^(?!${escapeStringRegexp(pth.normalize(appSource + "/").replaceAll(/\\+/g, "/"))}).+/node_modules/`, "g");
217
219
  }
218
220
  //#endregion
219
221
  //#region rspack-dev-server.ts
package/dist/index.js CHANGED
@@ -1,13 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import { t as startBuild } from "./build-DYTkS36_.js";
3
- import { a as isDevelopment, i as getEnv, n as DEVELOPMENT, o as isProduction, r as PRODUCTION, t as paths_default } from "./paths-BvJwGeTv.js";
4
- import { t as startDev } from "./dev-jQizUhIq.js";
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";
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 path from "node:path";
9
+ import pth from "node:path";
10
10
  import { existsSync } from "node:fs";
11
+ import { TsCheckerRspackPlugin } from "ts-checker-rspack-plugin";
11
12
  import { ReactRefreshRspackPlugin } from "@rspack/plugin-react-refresh";
12
13
  //#region utils/find-entry-file.ts
13
14
  const fileExtensions = [
@@ -110,7 +111,7 @@ function createRspackConfig() {
110
111
  chunkFilename: isEnvironmentProduction ? "static/js/[name].[contenthash:8].chunk.js" : "static/js/[name].chunk.js",
111
112
  assetModuleFilename: "static/media/[name].[hash][ext]",
112
113
  publicPath: paths_default.publicUrlOrPath,
113
- devtoolModuleFilenameTemplate: isEnvironmentProduction ? (info) => path.relative(paths_default.appSrc, info.absoluteResourcePath).replaceAll("\\", "/") : (info) => path.resolve(info.absoluteResourcePath).replaceAll("\\", "/")
114
+ devtoolModuleFilenameTemplate: isEnvironmentProduction ? (info) => pth.relative(paths_default.appSrc, info.absoluteResourcePath).replaceAll("\\", "/") : (info) => pth.resolve(info.absoluteResourcePath).replaceAll("\\", "/")
114
115
  },
115
116
  infrastructureLogging: { level: "none" },
116
117
  optimization: {
@@ -176,7 +177,6 @@ function createRspackConfig() {
176
177
  options: {
177
178
  jsc: {
178
179
  externalHelpers: hasSwcHelper,
179
- loose: true,
180
180
  parser: {
181
181
  syntax: "typescript",
182
182
  tsx: true
@@ -236,7 +236,26 @@ function createRspackConfig() {
236
236
  minify: isEnvironmentProduction
237
237
  }),
238
238
  isEnvironmentDevelopment && new rspack.CaseSensitivePlugin(),
239
- isEnvironmentDevelopment && new ReactRefreshRspackPlugin()
239
+ isEnvironmentDevelopment && new ReactRefreshRspackPlugin(),
240
+ isEnvironmentDevelopment && new TsCheckerRspackPlugin({
241
+ async: true,
242
+ formatter: "basic",
243
+ devServer: false,
244
+ typescript: {
245
+ mode: "write-tsbuildinfo",
246
+ diagnosticOptions: {
247
+ semantic: true,
248
+ syntactic: false,
249
+ declaration: false,
250
+ global: false
251
+ },
252
+ configOverwrite: { compilerOptions: {
253
+ incremental: true,
254
+ skipLibCheck: true,
255
+ noEmit: true
256
+ } }
257
+ }
258
+ })
240
259
  ],
241
260
  performance: false
242
261
  };
@@ -1,4 +1,4 @@
1
- import path from "node:path";
1
+ import pth 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 path.resolve(appDirectory, relativePath);
19
+ return pth.resolve(appDirectory, relativePath);
20
20
  }
21
21
  var paths_default = {
22
22
  appSrc: resolveApp("src"),
@@ -1,2 +1,2 @@
1
- import { t as startBuild } from "../build-DYTkS36_.js";
1
+ import { t as startBuild } from "../build-CoW3Nti_.js";
2
2
  export { startBuild };
@@ -1,2 +1,2 @@
1
- import { t as startDev } from "../dev-jQizUhIq.js";
1
+ import { t as startDev } from "../dev-D0bbZds7.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.1",
3
+ "version": "0.1.3",
4
4
  "description": "React app scripts based on Rspack",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,27 +39,27 @@
39
39
  "node": ">=22.12.0"
40
40
  },
41
41
  "dependencies": {
42
- "@rspack/cli": "^2.0.1",
43
- "@rspack/core": "^2.0.1",
42
+ "@rspack/cli": "^2.0.3",
43
+ "@rspack/core": "^2.0.3",
44
44
  "@rspack/dev-server": "^2.0.1",
45
45
  "@rspack/plugin-react-refresh": "^2.0.0",
46
- "@tailwindcss/postcss": "^4.2.4",
46
+ "@tailwindcss/postcss": "^4.3.0",
47
47
  "get-port": "^7.2.0",
48
48
  "less": "^4.6.4",
49
49
  "less-loader": "^12.3.2",
50
- "postcss": "^8.5.13",
50
+ "postcss": "^8.5.14",
51
51
  "postcss-loader": "^8.2.0",
52
52
  "pretty-bytes": "^7.1.0",
53
53
  "prompts": "^2.4.2",
54
54
  "react-refresh": "^0.18.0",
55
55
  "sass-embedded": "^1.93.2",
56
- "sass-loader": "^16.0.6",
56
+ "sass-loader": "^16.0.8",
57
+ "ts-checker-rspack-plugin": "^1.3.0",
57
58
  "webpack-merge": "^6.0.1",
58
- "@omnific/types": "0.0.5"
59
+ "@omnific/types": "0.0.6"
59
60
  },
60
61
  "devDependencies": {
61
- "@types/prompts": "^2.4.9",
62
- "tsdown": "^0.21.10"
62
+ "@types/prompts": "^2.4.9"
63
63
  },
64
64
  "scripts": {
65
65
  "build": "tsdown -c tsdown.config.mjs",