@omnific/react-scripts 0.1.5 → 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.
- package/dist/{build-CoW3Nti_.js → build-nKWu0sKB.js} +11 -10
- package/dist/{dev-D0bbZds7.js → dev-0IdkvY3b.js} +3 -3
- package/dist/index.js +8 -7
- package/dist/main.d.ts +1 -0
- package/dist/main.js +2 -1
- package/dist/{paths-DdPGCuT5.js → paths-C7Kz6S4s.js} +4 -3
- package/dist/scripts/build.js +1 -1
- package/dist/scripts/dev.js +1 -1
- package/package.json +11 -11
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as paths_default } from "./paths-
|
|
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
|
|
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 =
|
|
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(
|
|
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:
|
|
123
|
-
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 &&
|
|
146
|
-
console.log(" " + (isLarge ? styleText("yellow", sizeLabel) : sizeLabel) + " " + gzipLabel, " " + styleText("dim", asset.folder +
|
|
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-
|
|
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
|
|
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(
|
|
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-
|
|
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-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
|
|
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) =>
|
|
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
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
|
|
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
|
|
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 };
|
package/dist/scripts/build.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as startBuild } from "../build-
|
|
1
|
+
import { t as startBuild } from "../build-nKWu0sKB.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-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.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "React app scripts based on Rspack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -35,16 +35,10 @@
|
|
|
35
35
|
"dist",
|
|
36
36
|
"README.md"
|
|
37
37
|
],
|
|
38
|
-
"scripts": {
|
|
39
|
-
"build": "tsdown -c tsdown.config.mjs",
|
|
40
|
-
"release": "pnpm publish --access public",
|
|
41
|
-
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
42
|
-
},
|
|
43
38
|
"engines": {
|
|
44
39
|
"node": ">=22.12.0"
|
|
45
40
|
},
|
|
46
41
|
"dependencies": {
|
|
47
|
-
"@omnific/types": "workspace:*",
|
|
48
42
|
"@rspack/cli": "^2.0.3",
|
|
49
43
|
"@rspack/core": "^2.0.3",
|
|
50
44
|
"@rspack/dev-server": "^2.0.1",
|
|
@@ -61,10 +55,16 @@
|
|
|
61
55
|
"sass-embedded": "^1.93.2",
|
|
62
56
|
"sass-loader": "^16.0.8",
|
|
63
57
|
"ts-checker-rspack-plugin": "^1.3.0",
|
|
64
|
-
"webpack-merge": "^6.0.1"
|
|
58
|
+
"webpack-merge": "^6.0.1",
|
|
59
|
+
"@omnific/types": "0.0.7"
|
|
65
60
|
},
|
|
66
61
|
"devDependencies": {
|
|
67
|
-
"@
|
|
68
|
-
"@
|
|
62
|
+
"@types/prompts": "^2.4.9",
|
|
63
|
+
"@omnific/tsconfig": "0.0.3"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "tsdown -c tsdown.config.mjs",
|
|
67
|
+
"release": "pnpm publish --access public",
|
|
68
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
69
69
|
}
|
|
70
|
-
}
|
|
70
|
+
}
|