react-native-bundle-discovery-ui 2.7.0-rc.0 → 2.7.0
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/CHANGELOG.md +7 -0
- package/dist/bin.js +221 -152
- package/dist/client/_virtual/_rolldown/runtime.js +26 -12
- package/dist/client/pages/_common.js +238 -209
- package/dist/client/pages/default.js +146 -129
- package/dist/client/pages/module.js +223 -172
- package/dist/client/pages/package.js +171 -151
- package/dist/client/prepare.js +56 -45
- package/dist/client/queryHelpers.js +302 -260
- package/dist/client/setup.js +2 -2
- package/dist/client/views/_theme.js +9 -7
- package/dist/client/views/foamtree.js +94 -79
- package/dist/client/views/highcharts.js +23 -13
- package/dist/client/views/prettify.js +17 -7
- package/dist/discoveryrc.js +18 -13
- package/dist/rolldown-runtime-VH7oDXx4.js +30 -16
- package/dist/rsdoctor.js +86 -59
- package/dist/src-BSLX-He2.js +25 -19
- package/package.json +4 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# react-native-bundle-discovery-ui
|
|
2
|
+
|
|
3
|
+
## 2.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#16](https://github.com/retyui/react-native-bundle-discovery/pull/16) [`ac2af30`](https://github.com/retyui/react-native-bundle-discovery/commit/ac2af3063e3c4031ee026b58d4039e56f7152383) Thanks [@retyui](https://github.com/retyui)! - Rewrite in TypeScript and ship compiled JavaScript from `dist/` (with type definitions for `react-native-bundle-discovery` and the Rozenite plugin). Package entry points are unchanged; deep imports of internal files (e.g. `react-native-bundle-discovery/webpack.js`, `react-native-bundle-discovery-ui/.discoveryrc.js`) moved under `dist/`.
|
package/dist/bin.js
CHANGED
|
@@ -14,120 +14,186 @@ chalk = require_rolldown_runtime.__toESM(chalk);
|
|
|
14
14
|
let _discoveryjs_cli_lib_shared_utils_js = require("@discoveryjs/cli/lib/shared/utils.js");
|
|
15
15
|
//#region src/build.ts
|
|
16
16
|
function buildHtmlPage(filePath, output, clean, singleFile, verbose) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
17
|
+
if (verbose)
|
|
18
|
+
console.info(
|
|
19
|
+
`Building HTML page from file: ${chalk.default.green(filePath)} options: ${JSON.stringify(
|
|
20
|
+
{
|
|
21
|
+
output,
|
|
22
|
+
clean,
|
|
23
|
+
singleFile,
|
|
24
|
+
},
|
|
25
|
+
null,
|
|
26
|
+
2,
|
|
27
|
+
)}`,
|
|
28
|
+
);
|
|
29
|
+
if (!filePath) {
|
|
30
|
+
console.error(
|
|
31
|
+
`Usage: '${chalk.default.green("npx react-native-bundle-discovery build <path-to-file>")}', Please provide a path to a JSON file.`,
|
|
32
|
+
);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
const jsonFilePath = node_path.default.resolve(process.cwd(), filePath);
|
|
36
|
+
if (verbose)
|
|
37
|
+
console.info(
|
|
38
|
+
`Loading JSON file from: ${chalk.default.green(jsonFilePath)}, base directory: ${chalk.default.green(process.cwd())}`,
|
|
39
|
+
);
|
|
40
|
+
let fullJsonPath;
|
|
41
|
+
try {
|
|
42
|
+
fullJsonPath = require.resolve(jsonFilePath);
|
|
43
|
+
} catch (err) {
|
|
44
|
+
console.error(
|
|
45
|
+
`❌Error loading file: ${chalk.default.red(jsonFilePath)}\n\n`,
|
|
46
|
+
);
|
|
47
|
+
console.error(err.message);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
const configFile = node_path.default.resolve(__dirname, "./.tmp.js");
|
|
51
|
+
if (verbose)
|
|
52
|
+
console.info(
|
|
53
|
+
`Creating temporary config file at: ${chalk.default.green(configFile)}, for discovery.js`,
|
|
54
|
+
);
|
|
55
|
+
const transformRcdoctor = node_path.default.join(__dirname, "rsdoctor.js");
|
|
56
|
+
node_fs.default.writeFileSync(
|
|
57
|
+
configFile,
|
|
58
|
+
`const {transformRSDoctorData} = require("${transformRcdoctor}");
|
|
59
|
+
module.exports = ${JSON.stringify(
|
|
60
|
+
{
|
|
61
|
+
...require_discoveryrc,
|
|
62
|
+
data: "<tmp>",
|
|
63
|
+
},
|
|
64
|
+
null,
|
|
65
|
+
1,
|
|
66
|
+
).replace(
|
|
67
|
+
`"<tmp>"`,
|
|
68
|
+
require_src.isRsdoctorReportPath(fullJsonPath)
|
|
69
|
+
? `() => transformRSDoctorData(require("${fullJsonPath}"))`
|
|
70
|
+
: `() => require("${fullJsonPath}")`,
|
|
71
|
+
)};`,
|
|
72
|
+
);
|
|
73
|
+
if (verbose)
|
|
74
|
+
console.info(`Building HTML page with options:`, {
|
|
75
|
+
output,
|
|
76
|
+
clean,
|
|
77
|
+
singleFile,
|
|
78
|
+
});
|
|
79
|
+
const _config = {
|
|
80
|
+
name: "Bundle Discovery",
|
|
81
|
+
mode: "single",
|
|
82
|
+
colorScheme: "auto",
|
|
83
|
+
download: true,
|
|
84
|
+
upload: false,
|
|
85
|
+
embed: false,
|
|
86
|
+
encodings: false,
|
|
87
|
+
};
|
|
88
|
+
const _options = {
|
|
89
|
+
singleFile,
|
|
90
|
+
clean,
|
|
91
|
+
output,
|
|
92
|
+
cache: true,
|
|
93
|
+
cachedir: node_path.default.resolve(__dirname, "./.discoveryjs-cache"),
|
|
94
|
+
checkCacheTtl: false,
|
|
95
|
+
minify: true,
|
|
96
|
+
dataCompression: true,
|
|
97
|
+
sourcemap: false,
|
|
98
|
+
embed: "by-config",
|
|
99
|
+
experimentalJsonxl: false,
|
|
100
|
+
scriptFormat: "esm",
|
|
101
|
+
scriptExternal: [],
|
|
102
|
+
data: true,
|
|
103
|
+
excludeModelOnDataFail: false,
|
|
104
|
+
prettyData: false,
|
|
105
|
+
modelDownload: false,
|
|
106
|
+
modelDataUpload: true,
|
|
107
|
+
modelResetCache: false,
|
|
108
|
+
serveOnlyAssets: true,
|
|
109
|
+
dev: true,
|
|
110
|
+
config: configFile,
|
|
111
|
+
configFile,
|
|
112
|
+
};
|
|
113
|
+
return (0, _discoveryjs_cli.build)(_options, _config, configFile).then(() => {
|
|
114
|
+
console.log(`========================================`);
|
|
115
|
+
console.log(
|
|
116
|
+
`✅ HTML page built successfully at: ${chalk.default.green(node_path.default.resolve(output, "index.html").replace(`${process.cwd()}/`, ""))}`,
|
|
117
|
+
);
|
|
118
|
+
console.log(`========================================`);
|
|
119
|
+
});
|
|
88
120
|
}
|
|
89
121
|
//#endregion
|
|
90
122
|
//#region src/server.ts
|
|
91
123
|
function serve(filePath, port, verbose) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
const PORT = process.env.PORT || port;
|
|
125
|
+
if (verbose)
|
|
126
|
+
console.info(
|
|
127
|
+
`start server with file: ${filePath} on port: ${port} ${process.env.PORT ? `(${chalk.default.yellow("PORT")} env)` : ""}`,
|
|
128
|
+
);
|
|
129
|
+
if (!filePath) {
|
|
130
|
+
console.error(
|
|
131
|
+
`Usage: '${chalk.default.green("npx react-native-bundle-discovery server <path-to-file>")}', Please provide a path to a JSON file.`,
|
|
132
|
+
);
|
|
133
|
+
process.exit(1);
|
|
134
|
+
}
|
|
135
|
+
const jsonFilePath = node_path.default.resolve(process.cwd(), filePath);
|
|
136
|
+
if (verbose)
|
|
137
|
+
console.info(
|
|
138
|
+
`Loading JSON file from: ${chalk.default.green(jsonFilePath)}, base directory: ${chalk.default.green(process.cwd())}`,
|
|
139
|
+
);
|
|
140
|
+
let fullJsonPath;
|
|
141
|
+
try {
|
|
142
|
+
fullJsonPath = require.resolve(jsonFilePath);
|
|
143
|
+
} catch (err) {
|
|
144
|
+
console.error(
|
|
145
|
+
`❌Error loading file: ${chalk.default.red(jsonFilePath)}\n\n`,
|
|
146
|
+
);
|
|
147
|
+
console.error(err.message);
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
const configFile = node_path.default.resolve(__dirname, "./.tmp.js");
|
|
151
|
+
if (verbose)
|
|
152
|
+
console.info(
|
|
153
|
+
`Creating temporary config file at: ${chalk.default.green(configFile)}, for discovery.js`,
|
|
154
|
+
);
|
|
155
|
+
const transformRcdoctor = node_path.default.join(__dirname, "rsdoctor.js");
|
|
156
|
+
node_fs.default.writeFileSync(
|
|
157
|
+
configFile,
|
|
158
|
+
`const {transformRSDoctorData} = require("${transformRcdoctor}");
|
|
159
|
+
module.exports = ${JSON.stringify(
|
|
160
|
+
{
|
|
161
|
+
...require_discoveryrc,
|
|
162
|
+
data: "<tmp>",
|
|
163
|
+
},
|
|
164
|
+
null,
|
|
165
|
+
1,
|
|
166
|
+
).replace(
|
|
167
|
+
`"<tmp>"`,
|
|
168
|
+
require_src.isRsdoctorReportPath(fullJsonPath)
|
|
169
|
+
? `() => transformRSDoctorData(require("${fullJsonPath}"))`
|
|
170
|
+
: `() => require("${fullJsonPath}")`,
|
|
171
|
+
)};`,
|
|
172
|
+
);
|
|
173
|
+
if (verbose)
|
|
174
|
+
console.info(
|
|
175
|
+
`Running server with config: ${chalk.default.green(configFile)}`,
|
|
176
|
+
);
|
|
177
|
+
return (0, _discoveryjs_cli_lib_shared_utils_js.silent)(() =>
|
|
178
|
+
(0, _discoveryjs_cli.createServer)({
|
|
179
|
+
cache: false,
|
|
180
|
+
minify: true,
|
|
181
|
+
dev: false,
|
|
182
|
+
config: configFile,
|
|
183
|
+
configFile,
|
|
184
|
+
}).then((server) =>
|
|
185
|
+
server.listen(PORT, () => {
|
|
186
|
+
console.log(
|
|
187
|
+
`[react-native-bundle-discovery]: 🚀 Server listen on ${chalk.default.green.underline(chalk.default.green(`http://localhost:${PORT}`))}`,
|
|
188
|
+
);
|
|
189
|
+
}),
|
|
190
|
+
),
|
|
191
|
+
);
|
|
126
192
|
}
|
|
127
193
|
//#endregion
|
|
128
194
|
//#region src/bin.ts
|
|
129
195
|
function printHelp() {
|
|
130
|
-
|
|
196
|
+
console.log(`react-native-bundle-discovery-ui
|
|
131
197
|
|
|
132
198
|
Usage:
|
|
133
199
|
react-native-bundle-discovery-ui <file> [port] [--verbose] # <- server can be omitted
|
|
@@ -149,54 +215,57 @@ Options:
|
|
|
149
215
|
`);
|
|
150
216
|
}
|
|
151
217
|
function fail(message) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
218
|
+
console.error(message);
|
|
219
|
+
console.error("Use --help to see usage.");
|
|
220
|
+
process.exit(1);
|
|
155
221
|
}
|
|
156
222
|
function main() {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
223
|
+
const argv = (0, minimist.default)(process.argv.slice(2), {
|
|
224
|
+
alias: {
|
|
225
|
+
v: "verbose",
|
|
226
|
+
h: "help",
|
|
227
|
+
o: "output",
|
|
228
|
+
c: "clean",
|
|
229
|
+
s: "single-file",
|
|
230
|
+
p: "port",
|
|
231
|
+
},
|
|
232
|
+
boolean: ["verbose", "help", "clean", "single-file"],
|
|
233
|
+
string: ["output"],
|
|
234
|
+
default: {
|
|
235
|
+
clean: true,
|
|
236
|
+
"single-file": true,
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
const command = argv._[0];
|
|
240
|
+
const isServerCommand = command === "server";
|
|
241
|
+
const isBuildCommand = command === "build";
|
|
242
|
+
const isImplicitServerCommand =
|
|
243
|
+
Boolean(command) && !isServerCommand && !isBuildCommand;
|
|
244
|
+
if (argv.help || !command) {
|
|
245
|
+
printHelp();
|
|
246
|
+
process.exit(0);
|
|
247
|
+
}
|
|
248
|
+
if (isServerCommand || isImplicitServerCommand) {
|
|
249
|
+
const file = isImplicitServerCommand ? argv._[0] : argv._[1];
|
|
250
|
+
if (!file) fail("Missing required argument: <file>");
|
|
251
|
+
const rawPort =
|
|
252
|
+
argv.port ?? (isImplicitServerCommand ? argv._[1] : argv._[2]) ?? 8079;
|
|
253
|
+
const port = Number(rawPort);
|
|
254
|
+
if (!Number.isFinite(port)) fail(`Invalid port: ${rawPort}`);
|
|
255
|
+
return serve(file, port, Boolean(argv.verbose));
|
|
256
|
+
}
|
|
257
|
+
if (isBuildCommand) {
|
|
258
|
+
const file = argv._[1];
|
|
259
|
+
if (!file) fail("Missing required argument: <file>");
|
|
260
|
+
return buildHtmlPage(
|
|
261
|
+
file,
|
|
262
|
+
argv.output,
|
|
263
|
+
argv.clean,
|
|
264
|
+
argv["single-file"],
|
|
265
|
+
Boolean(argv.verbose),
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
fail(`Unknown command: ${command}`);
|
|
200
269
|
}
|
|
201
270
|
main();
|
|
202
271
|
//#endregion
|
|
@@ -6,18 +6,32 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
if ((from && typeof from === "object") || typeof from === "function")
|
|
10
|
+
for (
|
|
11
|
+
var keys = __getOwnPropNames(from), i = 0, n = keys.length, key;
|
|
12
|
+
i < n;
|
|
13
|
+
i++
|
|
14
|
+
) {
|
|
15
|
+
key = keys[i];
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, {
|
|
18
|
+
get: ((k) => from[k]).bind(null, key),
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
17
23
|
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (
|
|
25
|
+
(target = mod != null ? __create(__getProtoOf(mod)) : {}),
|
|
26
|
+
__copyProps(
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default")
|
|
28
|
+
? __defProp(target, "default", {
|
|
29
|
+
value: mod,
|
|
30
|
+
enumerable: true,
|
|
31
|
+
})
|
|
32
|
+
: target,
|
|
33
|
+
mod,
|
|
34
|
+
)
|
|
35
|
+
);
|
|
22
36
|
//#endregion
|
|
23
37
|
exports.__toESM = __toESM;
|