@omnific/react-scripts 0.1.6 → 0.1.8
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/dist/{build-nKWu0sKB.js → build-B9hIgUAa.js} +12 -13
- package/dist/{dev-0IdkvY3b.js → dev-CBNN2HQS.js} +7 -8
- package/dist/index.js +5 -5
- package/dist/{paths-C7Kz6S4s.js → paths-CDd8vYJd.js} +2 -2
- package/dist/scripts/build.js +1 -1
- package/dist/scripts/dev.js +1 -1
- package/package.json +13 -13
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as paths_default } from "./paths-
|
|
1
|
+
import { t as paths_default } from "./paths-CDd8vYJd.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
|
|
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
|
|
23
|
+
async function readdir(path) {
|
|
24
24
|
let fileList = [];
|
|
25
|
-
const files = await fs.readdir(path
|
|
25
|
+
const files = await fs.readdir(path);
|
|
26
26
|
if (files.length === 0) return [];
|
|
27
27
|
for (const file of files) {
|
|
28
|
-
const filePath =
|
|
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
|
}
|
|
@@ -94,9 +94,8 @@ function getDifferenceLabel(currentSize, previousSize) {
|
|
|
94
94
|
const difference = currentSize - previousSize;
|
|
95
95
|
const fileSize = Number.isNaN(difference) ? "0" : prettyBytes(difference);
|
|
96
96
|
if (difference >= FIFTY_KILOBYTES) return styleText("red", "+" + fileSize);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
else return "";
|
|
97
|
+
if (difference < FIFTY_KILOBYTES && difference > 0) return styleText("yellow", "+" + fileSize);
|
|
98
|
+
return difference < 0 ? styleText("green", fileSize) : "";
|
|
100
99
|
}
|
|
101
100
|
function printFileSizesAfterBuild(stats, previousSizeMap) {
|
|
102
101
|
let suggestBundleSplitting = false;
|
|
@@ -112,7 +111,7 @@ function printFileSizesAfterBuild(stats, previousSizeMap) {
|
|
|
112
111
|
const sizeLabelLengthList = [];
|
|
113
112
|
for (const asset of statCompilation.assets) {
|
|
114
113
|
if (!canReadAsset(asset.name)) continue;
|
|
115
|
-
const fileContents = fs$1.readFileSync(
|
|
114
|
+
const fileContents = fs$1.readFileSync(pth.join(root, asset.name));
|
|
116
115
|
const previousSize = sizes[removeFileNameHash(root, asset.name)];
|
|
117
116
|
const difference = getDifferenceLabel(asset.size, previousSize);
|
|
118
117
|
const sizeLabel = prettyBytes(asset.size) + (difference ? " (" + difference + ")" : "");
|
|
@@ -120,8 +119,8 @@ function printFileSizesAfterBuild(stats, previousSizeMap) {
|
|
|
120
119
|
const sizeLabelLength = stripAnsi(sizeLabel).length;
|
|
121
120
|
const gzipLabelLength = stripAnsi(gzipLabel).length;
|
|
122
121
|
assets.push({
|
|
123
|
-
folder:
|
|
124
|
-
name:
|
|
122
|
+
folder: pth.join(pth.basename(paths_default.appBuild), pth.dirname(asset.name)),
|
|
123
|
+
name: pth.basename(asset.name),
|
|
125
124
|
size: asset.size,
|
|
126
125
|
sizeLabel,
|
|
127
126
|
gzipLabel,
|
|
@@ -143,8 +142,8 @@ function printFileSizesAfterBuild(stats, previousSizeMap) {
|
|
|
143
142
|
if (gzipLabelLength < longestGzipSizeLabelLength) gzipLabel += " ".repeat(longestGzipSizeLabelLength - gzipLabelLength);
|
|
144
143
|
const maxRecommendedSize = asset.name.indexOf("main.") === 0 ? WARN_AFTER_BUNDLE_GZIP_SIZE : WARN_AFTER_CHUNK_GZIP_SIZE;
|
|
145
144
|
const isLarge = maxRecommendedSize && asset.size > maxRecommendedSize;
|
|
146
|
-
if (isLarge &&
|
|
147
|
-
console.log(" " + (isLarge ? styleText("yellow", sizeLabel) : sizeLabel) + "
|
|
145
|
+
if (isLarge && pth.extname(asset.name) === ".js") suggestBundleSplitting = true;
|
|
146
|
+
console.log(" " + (isLarge ? styleText("yellow", sizeLabel) : sizeLabel) + " ".repeat(3) + gzipLabel, " " + styleText("dim", asset.folder + pth.sep) + styleText("cyan", asset.name));
|
|
148
147
|
}
|
|
149
148
|
}
|
|
150
149
|
if (suggestBundleSplitting) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as paths_default } from "./paths-
|
|
1
|
+
import { t as paths_default } from "./paths-CDd8vYJd.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
|
|
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";
|
|
@@ -56,7 +56,7 @@ function getInterfaceAddress(family, name) {
|
|
|
56
56
|
/**
|
|
57
57
|
* Get current machine IPv4
|
|
58
58
|
*
|
|
59
|
-
* interfaceName: interface name, default is 'eth' on
|
|
59
|
+
* interfaceName: interface name, default is 'eth' on Linux, 'en' on macOS.
|
|
60
60
|
*/
|
|
61
61
|
function ip(interfaceName) {
|
|
62
62
|
return getInterfaceAddress("IPv4", interfaceName)?.address;
|
|
@@ -92,7 +92,7 @@ function printInstructions(appName, urls) {
|
|
|
92
92
|
console.log("Note that the development build is not optimized.");
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
|
-
* 准备
|
|
95
|
+
* 准备URL 数据
|
|
96
96
|
*/
|
|
97
97
|
function prepareUrls(options) {
|
|
98
98
|
const { protocol, host, port, pathname = "/" } = options;
|
|
@@ -151,10 +151,9 @@ async function choosePort(options) {
|
|
|
151
151
|
message: styleText("yellow", message) + "\n\nWould you like to run the app on another port instead",
|
|
152
152
|
initial: true
|
|
153
153
|
})).shouldChangePort ? port : void 0;
|
|
154
|
-
} else {
|
|
155
|
-
console.log(styleText("red", message));
|
|
156
|
-
return;
|
|
157
154
|
}
|
|
155
|
+
console.log(styleText("red", message));
|
|
156
|
+
return;
|
|
158
157
|
} catch (error) {
|
|
159
158
|
throw new Error(styleText("red", `Could not find an open port at ${styleText("bold", options.host)}.`) + "\n" + ("Network error message: " + error.message || error) + "\n");
|
|
160
159
|
}
|
|
@@ -215,7 +214,7 @@ function escapeStringRegexp(string) {
|
|
|
215
214
|
//#endregion
|
|
216
215
|
//#region utils/ignored-files.ts
|
|
217
216
|
function ignoredFiles(appSource) {
|
|
218
|
-
return new RegExp(`^(?!${escapeStringRegexp(
|
|
217
|
+
return new RegExp(`^(?!${escapeStringRegexp(pth.normalize(appSource + "/").replaceAll(/\\+/g, "/"))}).+/node_modules/`, "g");
|
|
219
218
|
}
|
|
220
219
|
//#endregion
|
|
221
220
|
//#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-
|
|
3
|
-
import { a as isDevelopment, i as getEnv, n as DEVELOPMENT, o as isProduction, r as PRODUCTION, t as paths_default } from "./paths-
|
|
4
|
-
import { t as startDev } from "./dev-
|
|
2
|
+
import { t as startBuild } from "./build-B9hIgUAa.js";
|
|
3
|
+
import { a as isDevelopment, i as getEnv, n as DEVELOPMENT, o as isProduction, r as PRODUCTION, t as paths_default } from "./paths-CDd8vYJd.js";
|
|
4
|
+
import { t as startDev } from "./dev-CBNN2HQS.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
|
|
9
|
+
import pth 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) =>
|
|
114
|
+
devtoolModuleFilenameTemplate: isEnvironmentProduction ? (info) => pth.relative(paths_default.appSrc, info.absoluteResourcePath).replaceAll("\\", "/") : (info) => pth.resolve(info.absoluteResourcePath).replaceAll("\\", "/")
|
|
115
115
|
},
|
|
116
116
|
infrastructureLogging: { level: "none" },
|
|
117
117
|
optimization: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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
|
|
19
|
+
return pth.resolve(appDirectory, relativePath);
|
|
20
20
|
}
|
|
21
21
|
var paths_default = {
|
|
22
22
|
appSrc: resolveApp("src"),
|
package/dist/scripts/build.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as startBuild } from "../build-
|
|
1
|
+
import { t as startBuild } from "../build-B9hIgUAa.js";
|
|
2
2
|
export { startBuild };
|
package/dist/scripts/dev.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as startDev } from "../dev-
|
|
1
|
+
import { t as startDev } from "../dev-CBNN2HQS.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.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "React app scripts based on Rspack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -39,28 +39,28 @@
|
|
|
39
39
|
"node": ">=22.12.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@rspack/cli": "^2.0.
|
|
43
|
-
"@rspack/core": "^2.0.
|
|
44
|
-
"@rspack/dev-server": "^2.0.
|
|
45
|
-
"@rspack/plugin-react-refresh": "^2.0.
|
|
46
|
-
"@tailwindcss/postcss": "^4.3.
|
|
42
|
+
"@rspack/cli": "^2.0.8",
|
|
43
|
+
"@rspack/core": "^2.0.8",
|
|
44
|
+
"@rspack/dev-server": "^2.0.3",
|
|
45
|
+
"@rspack/plugin-react-refresh": "^2.0.2",
|
|
46
|
+
"@tailwindcss/postcss": "^4.3.1",
|
|
47
47
|
"get-port": "^7.2.0",
|
|
48
|
-
"less": "^4.6.
|
|
49
|
-
"less-loader": "^
|
|
50
|
-
"postcss": "^8.5.
|
|
48
|
+
"less": "^4.6.6",
|
|
49
|
+
"less-loader": "^13.0.0",
|
|
50
|
+
"postcss": "^8.5.15",
|
|
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
|
-
"sass-embedded": "^1.
|
|
56
|
-
"sass-loader": "^
|
|
57
|
-
"ts-checker-rspack-plugin": "^1.
|
|
55
|
+
"sass-embedded": "^1.100.0",
|
|
56
|
+
"sass-loader": "^17.0.0",
|
|
57
|
+
"ts-checker-rspack-plugin": "^1.4.0",
|
|
58
58
|
"webpack-merge": "^6.0.1",
|
|
59
59
|
"@omnific/types": "0.0.7"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/prompts": "^2.4.9",
|
|
63
|
-
"@omnific/tsconfig": "0.
|
|
63
|
+
"@omnific/tsconfig": "0.1.1"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"build": "tsdown -c tsdown.config.mjs",
|