Skip to content

Commit

Permalink
feat: add overall page (#37)
Browse files Browse the repository at this point in the history
feat: add overall page

feat: add overall page

feat: add overall page

feat: add overall page

feat: add overall page

feat: add overall page

feat: add overall page
  • Loading branch information
easy1090 authored Dec 5, 2023
1 parent 4a688b8 commit 96d0d68
Show file tree
Hide file tree
Showing 139 changed files with 13,657 additions and 407 deletions.
11 changes: 11 additions & 0 deletions .changeset/grumpy-bikes-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@rsdoctor/webpack-plugin': patch
'@rsdoctor/rspack-plugin': patch
'@rsdoctor/components': patch
'@rsdoctor/client': patch
'@rsdoctor/graph': patch
'@rsdoctor/core': patch
'@rsdoctor/sdk': patch
---

Rsdoctor report platform add overall page (close: #25)
2 changes: 1 addition & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
"@types/webpack": "5.28.0",
"fast-glob": "^3.3.1",
"playwright": "1.33.0",
"typescript": "^5.3.0"
"typescript": "^5.2.2"
}
}
35 changes: 35 additions & 0 deletions examples/webpack-minimal/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@example/doctor-webpack-minimal",
"version": "0.0.1",
"description": "",
"files": [
"dist",
"src",
"package.json"
],
"scripts": {
"compile": "node -r tsm ./node_modules/webpack/bin/webpack.js -c webpack.config.ts",
"build:analysis": "ENABLE_CLIENT_SERVER=true npm run compile"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@babel/highlight": "7.18.6",
"chalk": "4.1.2",
"htmlparser2": "7.2.0"
},
"devDependencies": {
"@types/node": "14.18.26",
"@rsdoctor/types": "workspace:*",
"@rsdoctor/webpack-plugin": "workspace:*",
"bundle-stats": "4.1.7",
"eslint": "8.22.0",
"ts-loader": "9.4.2",
"tslib": "2.4.1",
"tsm": "2.3.0",
"typescript": "^5.2.2",
"webpack": "5.89.0",
"webpack-cli": "5.0.0"
}
}
15 changes: 15 additions & 0 deletions examples/webpack-minimal/src/html.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Parser from 'htmlparser2';

export function getHtmlText(code: string) {
let context = '';

const parser = new Parser.Parser({
ontext(data) {
context += data;
},
});

parser.write(code);

return context;
}
10 changes: 10 additions & 0 deletions examples/webpack-minimal/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Instance } from 'chalk';
import { highlight } from './utils';
import { getHtmlText } from './html';
import { key6 } from './utils2';

const print = new Instance();

print(key6);
print(getHtmlText('<div>测试文本</div>'));
print(highlight?.('const abc = 123;'));
1 change: 1 addition & 0 deletions examples/webpack-minimal/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module '@babel/highlight';
7 changes: 7 additions & 0 deletions examples/webpack-minimal/src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import highlight from '@babel/highlight';

export { highlight };
export const key1 = '123';
export const key2 = '123';

console.log(key2);
14 changes: 14 additions & 0 deletions examples/webpack-minimal/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Linter } from '@rsdoctor/types';

export function toSeverity(input: Linter.SeverityInput, defaultLevel: Linter.Severity): Linter.Severity {
if (input === 'off') {
return Linter.Severity.Ignore;
}

if (input === 'on') {
return defaultLevel;
}

const key = `${input[0].toUpperCase()}${input.slice(1)}` as Linter.SeverityString;
return Linter.Severity[key] as Linter.Severity;
}
5 changes: 5 additions & 0 deletions examples/webpack-minimal/src/utils2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * as utils6 from './utils6';

export * from './utils';
export * from './utils4';
export * from './html';
3 changes: 3 additions & 0 deletions examples/webpack-minimal/src/utils3.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { key1 } from './utils';

export const key3 = key1 + 1;
1 change: 1 addition & 0 deletions examples/webpack-minimal/src/utils4.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './utils5';
1 change: 1 addition & 0 deletions examples/webpack-minimal/src/utils5.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './utils6';
1 change: 1 addition & 0 deletions examples/webpack-minimal/src/utils6.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const key6 = 'key6';
9 changes: 9 additions & 0 deletions examples/webpack-minimal/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "@rsdoctor/tsconfig/base",
"include": ["src", "webpack.config.ts"],
"compilerOptions": {
"outDir": "dist",
"baseUrl": ".",
"module": "ESNext"
}
}
45 changes: 45 additions & 0 deletions examples/webpack-minimal/webpack.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { resolve } from 'path';
import { Configuration } from 'webpack';
import { RsdoctorWebpackPlugin } from '@rsdoctor/webpack-plugin';

const data: Configuration = {
entry: './src/index.ts',
mode: 'none',
module: {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader',
},
],
},
resolve: {
mainFields: ['browser', 'module', 'main'],
extensions: ['.ts', '.js', '.json', '.wasm'],
},
output: {
path: resolve(__dirname, 'dist'),
filename: 'minimal.js',
},
optimization: {
concatenateModules: true,
usedExports: true,
mangleExports: true,
providedExports: true,
},
stats: {
assets: true,
warnings: true,
errors: true,
modules: true,
colors: true,
chunks: true,
builtAt: true,
hash: true,
ids: true,
},
devtool: 'source-map',
plugins: [new RsdoctorWebpackPlugin({ disableClientServer: !process.env.ENABLE_CLIENT_SERVER })],
};

export default data;
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@
"package.json": "pnpm run check-dependency-version"
},
"devDependencies": {
"@modern-js/app-tools": "^2.41.0",
"@modern-js/module-tools": "^2.41.0",
"@modern-js/monorepo-tools": "^2.41.0",
"@rsbuild/test-helper": "0.1.5",
"@rsdoctor/tsconfig": "workspace:*",
"@rsdoctor/test-helper": "workspace:*",
"@rsdoctor/tsconfig": "workspace:*",
"check-dependency-version-consistency": "^4.1.0",
"cross-env": "^7.0.3",
"husky": "^8.0.3",
Expand Down
1 change: 1 addition & 0 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @rsdoctor/components
21 changes: 21 additions & 0 deletions packages/client/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023-present Bytedance, Inc. and its affiliates.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 15 additions & 0 deletions packages/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Rsdoctor

Rsdoctor is a tool for diagnosing and analyzing the build process and build artifacts to help developers quickly identify and solve problems.

It also supports Webpack and Rspack builders, as well as various build frameworks, such as Rsbuild.

## Documentation

## Contributing

Please read the [Contributing Guide](https://github.com/web-infra-dev/rsdoctor/blob/main/CONTRIBUTING.md).

## License

Rsdoctor is [MIT licensed](https://github.com/web-infra-dev/rsdoctor/blob/main/LICENSE).
19 changes: 19 additions & 0 deletions packages/client/config/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Constants } from '@rsdoctor/types';

import path from 'path';

export const DistPath = path.resolve(__dirname, '../dist');

export const DistResourcePath = path.resolve(__dirname, '../dist/resource');

export const WebpackDoctorDirPath = path.resolve(__dirname, `../dist/${Constants.DoctorOutputFolder}`);

export const WebpackStatsFilePath = path.resolve(__dirname, '../dist/stats.json');

export const PortForWeb = 8681;

export const PortForCLI = 8123;

export const ClientEntry = path.resolve(__dirname, '../src/index.tsx');

export const RsdoctorWebpackPluginMain = path.resolve(__dirname, '../../webpack-plugin/dist');
Loading

0 comments on commit 96d0d68

Please sign in to comment.