@rsdoctor/components 1.5.7 → 1.5.9
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/components/Alert/change.mjs +5 -7
- package/dist/components/Alert/change.mjs.map +1 -1
- package/dist/components/Alert/ecma-version-check_module.css.map +1 -1
- package/dist/components/Alert/index.css.map +1 -1
- package/dist/components/Alert/package-relation.mjs.map +1 -1
- package/dist/components/Alert/package-relation_module.css +1 -1
- package/dist/components/Alert/package-relation_module.css.map +1 -1
- package/dist/components/Alerts/bundle-alert_module.css.map +1 -1
- package/dist/components/Alerts/collapse_module.css.map +1 -1
- package/dist/components/Alerts/list.mjs +1 -3
- package/dist/components/Alerts/list.mjs.map +1 -1
- package/dist/components/Alerts/list_module.css +2 -0
- package/dist/components/Alerts/list_module.css.map +1 -1
- package/dist/components/Alerts/overlay_module.css.map +1 -1
- package/dist/components/Card/index.mjs +1 -1
- package/dist/components/Card/index.mjs.map +1 -1
- package/dist/components/Card/size_module.css.map +1 -1
- package/dist/components/Charts/index.mjs +1 -1
- package/dist/components/Charts/index.mjs.map +1 -1
- package/dist/components/Charts/loader.css +3 -3
- package/dist/components/Charts/loader.css.map +1 -1
- package/dist/components/Charts/tooltips.css.map +1 -1
- package/dist/components/Charts/treemap_module.css.map +1 -1
- package/dist/components/Charts/utils.mjs +1 -1
- package/dist/components/Charts/utils.mjs.map +1 -1
- package/dist/components/Configuration/builder_module.css.map +1 -1
- package/dist/components/FileTree/index.css.map +1 -1
- package/dist/components/Keyword/style_module.css.map +1 -1
- package/dist/components/Layout/header.css.map +1 -1
- package/dist/components/Layout/menus.mjs +4 -4
- package/dist/components/Layout/menus.mjs.map +1 -1
- package/dist/components/Loader/Analysis/style_module.css.map +1 -1
- package/dist/components/Overall/DataSummary_module.css.map +1 -1
- package/dist/components/Overall/bundle_module.css.map +1 -1
- package/dist/components/Overall/card_module.css.map +1 -1
- package/dist/components/Overall/compile_module.css.map +1 -1
- package/dist/components/Overall/help-center_module.css.map +1 -1
- package/dist/components/Overall/list_module.css.map +1 -1
- package/dist/components/Overall/overview_module.css.map +1 -1
- package/dist/components/Overall/project_module.css.map +1 -1
- package/dist/components/Resolver/analysis.mjs.map +1 -1
- package/dist/components/Select/index.css.map +1 -1
- package/dist/components/TextDrawer/index.mjs +1 -1
- package/dist/components/base/CodeViewer/index_module.css.map +1 -1
- package/dist/components/base/CodeViewer/utils.mjs +1 -1
- package/dist/components/base/CodeViewer/utils.mjs.map +1 -1
- package/dist/components/base/DiffViewer/index_module.css.map +1 -1
- package/dist/constants.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/pages/BundleSize/components/card_module.css.map +1 -1
- package/dist/pages/BundleSize/components/cards.mjs.map +1 -1
- package/dist/pages/BundleSize/components/index.css.map +1 -1
- package/dist/pages/BundleSize/components/index_module.css.map +1 -1
- package/dist/pages/BundleSize/index.mjs +1 -1
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.css.map +1 -1
- package/dist/pages/ModuleAnalyze/index.css.map +1 -1
- package/dist/pages/ModuleResolve/index.mjs +1 -1
- package/dist/pages/Overall/index.mjs +1 -1
- package/dist/pages/Overall/index_module.css.map +1 -1
- package/dist/pages/Resources/BundleDiff/index.mjs +2 -2
- package/dist/pages/Resources/RuleIndex/index.mjs +1 -1
- package/dist/pages/TreeShaking/index.css.map +1 -1
- package/dist/pages/TreeShaking/index.mjs +1 -1
- package/dist/pages/Uploader/index.mjs +1 -1
- package/dist/pages/WebpackLoaders/Analysis/index.mjs +1 -1
- package/dist/pages/WebpackLoaders/Overall/index.mjs +1 -1
- package/dist/pages/WebpackPlugins/index.css.map +1 -1
- package/dist/pages/WebpackPlugins/index.mjs +1 -1
- package/dist/utils/data/index.mjs +1 -1
- package/dist/utils/data/index.mjs.map +1 -1
- package/dist/utils/request.mjs +25 -27
- package/dist/utils/request.mjs.map +1 -1
- package/dist/utils/request.test.d.ts +1 -0
- package/dist/utils/request.test.mjs +61 -0
- package/dist/utils/request.test.mjs.map +1 -0
- package/dist/utils/socket.mjs.map +1 -1
- package/dist/utils/storage.mjs +1 -1
- package/dist/utils/storage.mjs.map +1 -1
- package/package.json +4 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://./src/pages/ModuleAnalyze/components/fileTreeCom.scss"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["webpack://./../../node_modules/.pnpm/@rsbuild+core@2.0.0-rc.1_@emnapi+core@1.8.1_@emnapi+runtime@1.8.1_core-js@3.47.0/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[10].oneOf[2].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[10].oneOf[2].use[2]!/home/runner/work/rsdoctor/rsdoctor/node_modules/.pnpm/@rsbuild+plugin-sass@1.5.1_@rsbuild+core@2.0.0-rc.1_@emnapi+core@1.8.1_@emnapi+runtime@1.8.1_core-js@3.47.0_/node_modules/@rsbuild/plugin-sass/compiled/resolve-url-loader/index.js??ruleSet[1].rules[10].oneOf[2].use[3]!/home/runner/work/rsdoctor/rsdoctor/node_modules/.pnpm/@rsbuild+plugin-sass@1.5.1_@rsbuild+core@2.0.0-rc.1_@emnapi+core@1.8.1_@emnapi+runtime@1.8.1_core-js@3.47.0_/node_modules/@rsbuild/plugin-sass/compiled/sass-loader/index.js??ruleSet[1].rules[10].oneOf[2].use[4]!/home/runner/work/rsdoctor/rsdoctor/packages/components/src/pages/ModuleAnalyze/components/fileTreeCom.scss","webpack://./src/pages/ModuleAnalyze/components/fileTreeCom.scss"],"names":[],"mappings":"AAAA;ECCE,SAAS;AACX;;ADFwB;ECKtB,mBAAmB;EACnB,UAAU;EACV,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,gBAAgB;AAClB;;ADXgJ;ECc9I,sBAAsB;EACtB,mBAAmB;EACnB,eAAe;EACf,YAAY;EACZ,SAAS;EACT,cAAc;EACd,qBAAqB;EACrB,qBAAqB;EACrB,kBAAkB;AACpB;;ADvBkX;EC0BhX,wBAAwB;AAC1B;;AD3B2c;EC8Bzc,aAAa;AACf;;AD/Bkf;ECkChf,cAAc;AAChB;;ADnC+hB;ECsC7hB,cAAc;EACd,mBAAmB;AACrB;;ADxC0qB;EC2CxqB,qBAAqB;EACrB,kBAAkB;AACpB;;AD7C2vB;ECgDzvB,eAAe;EACf,qBAAqB;AACvB;;ADlDozB;ECqDlzB,eAAe;EACf,yBAAyB;EACzB,yBAAyB;EACzB,UAAU;AACZ;;ADzD+5B;EC4D75B,cAAc;AAChB;;AD7Dm+B;ECgEj+B,gBAAgB;AAClB;;ADjE0hC;ECoExhC,sBAAsB;EACtB,SAAS;EACT,qBAAqB;AACvB;;ADvEomC;EC0ElmC,WAAW;EACX,qBAAqB;AACvB;;AD5E+pC;EC+E7pC,yBAAyB;EACzB,oBAAoB;AACtB;;ADjF8uC;ECoF5uC,wBAAwB;AAC1B;;ADrFuyC;ECwFryC,2BAA2B;AAC7B;;ADzFg4C;EC4F93C,sBAAsB;EACtB,aAAa;AACf;;AD9Fu/C;ECiGr/C,eAAe;EACf,iBAAiB;EACjB,aAAa;AACf;;ADpGkpD;ECuGhpD,eAAe;AACjB;;ADxGw5D;EC2Gt5D,sBAAsB;AACxB;;AD5G+gE;EC+G7gE,oBAAoB;AACtB;;ADhH+nE;ECmH7nE,eAAe;EACf,cAAc;AAChB;;ADrH6vE;ECwH3vE,sBAAsB;EACtB,SAAS;EACT,qBAAqB;AACvB;;AD3Hi0E;EC8H/zE,WAAW;EACX,qBAAqB;AACvB","sourcesContent":[".file-tree-com{margin:0}.file-tree-com .file-tree-com-treenode{margin:0;padding:0;line-height:24px;white-space:nowrap;list-style:none;outline:0}.file-tree-com .file-tree-com-treenode .file-tree-com-node-content-wrapper{position:relative;display:inline-block;height:24px;margin:0;padding:0 4px;box-sizing:border-box;text-decoration:none;vertical-align:top;cursor:pointer}.file-tree-com .file-tree-com-treenode .file-tree-com-arrow-icon{transform:rotate(90deg)}.file-tree-com-child-tree{display:none}.file-tree-com-child-tree-open{display:block}.file-tree-com-treenode-disabled>span:not(.file-tree-com-switcher),.file-tree-com>a,.file-tree-com>a span{color:#767676;cursor:not-allowed}.file-tree-com-treenode-selected{background:rgba(5,145,255,.3);border-radius:4px}.file-tree-com-title{display:inline-block;cursor:pointer}.file-tree-com-titles-box:hover{background-color:#f0f3f5;border:1px solid #e5e6eb;cursor:pointer;width:80%}.file-tree-com-titles-box:hover .ant-typography:hover{color:#0079ff}.file-tree-com-node-title .file-icon{padding:4px 0 0 0}.file-tree-com-indent{display:inline-block;height:0;vertical-align:bottom}.file-tree-com-indent-unit{display:inline-block;width:14px}.file-tree-switcher-arrow{transform:rotate(0deg);transition:transform .3s ease}.file-tree-switcher-arrow-expand{transform:rotate(90deg)}.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child){border-left:1px solid #eee}.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles{display:flex;flex-direction:column}.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles .file-tree-com-node-title{display:flex;cursor:pointer;line-height:30px}.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles .file-tree-com-node-title img{cursor:pointer}.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles .file-tree-com-node-title img-tag{cursor:pointer}.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-node-title-selected{background-color:#ff0}.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-node-title-tag{margin-inline-end:0}.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-node-title-code-tag{cursor:pointer;padding:0 2px}.rc-tree-indent{display:inline-block;height:0;vertical-align:bottom}.rc-tree-indent-unit{display:inline-block;width:14px}",".file-tree-com {\n margin: 0;\n}\n\n.file-tree-com .file-tree-com-treenode {\n white-space: nowrap;\n outline: 0;\n margin: 0;\n padding: 0;\n line-height: 24px;\n list-style: none;\n}\n\n.file-tree-com .file-tree-com-treenode .file-tree-com-node-content-wrapper {\n box-sizing: border-box;\n vertical-align: top;\n cursor: pointer;\n height: 24px;\n margin: 0;\n padding: 0 4px;\n text-decoration: none;\n display: inline-block;\n position: relative;\n}\n\n.file-tree-com .file-tree-com-treenode .file-tree-com-arrow-icon {\n transform: rotate(90deg);\n}\n\n.file-tree-com-child-tree {\n display: none;\n}\n\n.file-tree-com-child-tree-open {\n display: block;\n}\n\n.file-tree-com-treenode-disabled > span:not(.file-tree-com-switcher), .file-tree-com > a, .file-tree-com > a span {\n color: #767676;\n cursor: not-allowed;\n}\n\n.file-tree-com-treenode-selected {\n background: #0591ff4d;\n border-radius: 4px;\n}\n\n.file-tree-com-title {\n cursor: pointer;\n display: inline-block;\n}\n\n.file-tree-com-titles-box:hover {\n cursor: pointer;\n background-color: #f0f3f5;\n border: 1px solid #e5e6eb;\n width: 80%;\n}\n\n.file-tree-com-titles-box:hover .ant-typography:hover {\n color: #0079ff;\n}\n\n.file-tree-com-node-title .file-icon {\n padding: 4px 0 0;\n}\n\n.file-tree-com-indent {\n vertical-align: bottom;\n height: 0;\n display: inline-block;\n}\n\n.file-tree-com-indent-unit {\n width: 14px;\n display: inline-block;\n}\n\n.file-tree-switcher-arrow {\n transition: transform .3s;\n transform: rotate(0);\n}\n\n.file-tree-switcher-arrow-expand {\n transform: rotate(90deg);\n}\n\n.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) {\n border-left: 1px solid #eee;\n}\n\n.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles {\n flex-direction: column;\n display: flex;\n}\n\n.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles .file-tree-com-node-title {\n cursor: pointer;\n line-height: 30px;\n display: flex;\n}\n\n.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles .file-tree-com-node-title img, .rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles .file-tree-com-node-title img-tag {\n cursor: pointer;\n}\n\n.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-node-title-selected {\n background-color: #ff0;\n}\n\n.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-node-title-tag {\n margin-inline-end: 0;\n}\n\n.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-node-title-code-tag {\n cursor: pointer;\n padding: 0 2px;\n}\n\n.rc-tree-indent {\n vertical-align: bottom;\n height: 0;\n display: inline-block;\n}\n\n.rc-tree-indent-unit {\n width: 14px;\n display: inline-block;\n}\n"],"sourceRoot":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://./src/pages/ModuleAnalyze/index.scss"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["webpack://./../../node_modules/.pnpm/@rsbuild+core@2.0.0-rc.1_@emnapi+core@1.8.1_@emnapi+runtime@1.8.1_core-js@3.47.0/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[10].oneOf[2].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[10].oneOf[2].use[2]!/home/runner/work/rsdoctor/rsdoctor/node_modules/.pnpm/@rsbuild+plugin-sass@1.5.1_@rsbuild+core@2.0.0-rc.1_@emnapi+core@1.8.1_@emnapi+runtime@1.8.1_core-js@3.47.0_/node_modules/@rsbuild/plugin-sass/compiled/resolve-url-loader/index.js??ruleSet[1].rules[10].oneOf[2].use[3]!/home/runner/work/rsdoctor/rsdoctor/node_modules/.pnpm/@rsbuild+plugin-sass@1.5.1_@rsbuild+core@2.0.0-rc.1_@emnapi+core@1.8.1_@emnapi+runtime@1.8.1_core-js@3.47.0_/node_modules/@rsbuild/plugin-sass/compiled/sass-loader/index.js??ruleSet[1].rules[10].oneOf[2].use[4]!/home/runner/work/rsdoctor/rsdoctor/packages/components/src/pages/ModuleAnalyze/index.scss","webpack://./src/pages/ModuleAnalyze/index.scss"],"names":[],"mappings":"AAAA;ECCE,aAAa;EACb,gBAAgB;AAClB;;ADHuD;ECMrD,eAAe;AACjB;;ADPsH;ECUpH,sBAAsB;EACtB,aAAa;AACf;;ADZ6K;ECe3K,iBAAiB;AACnB;;ADhBwN;ECmBtN,gBAAgB;EAChB,gBAAgB;EAChB,2BAA2B;EAC3B,kBAAkB;EAClB,gBAAgB;EAChB,mBAAmB;AACrB;;ADzB2W;EC4BzW,gBAAgB;EAChB,mBAAmB;EACnB,eAAe;EACf,gBAAgB;EAChB,qBAAqB;AACvB;;ADjC6e;ECoC3e,sBAAsB;EACtB,QAAQ;EACR,aAAa;AACf;;ADvC0jB;EC0CxjB,kCAAkC;EAClC,8BAA8B;EAC9B,mBAAmB;EACnB,cAAc;EACd,aAAa;AACf;;AD/CmtB;ECkDjtB,mBAAmB;AACrB;;ADnDmxB;ECsDjxB,gBAAgB;EAChB,4BAA4B;EAC5B,eAAe;EACf,gBAAgB;AAClB;;AD1Dw4B;EC6Dt4B,gBAAgB;EAChB,eAAe;AACjB","sourcesContent":[".module-analyze-file-tree{width:\"100%\";min-height:50em}.module-analyze-file-tree .module-analyze-empty{margin-top:20%}.module-analyze-box{display:flex;flex-direction:column}.file-tree-com-titles-box{line-height:30px}.module-analyze-bailout-card{margin-top:16px;border-radius:8px;border:1px solid rgba(5,5,5,.06);box-shadow:none;background:#fff;margin-bottom:24px}.module-analyze-bailout-card-title{display:inline-block;font-size:14px;margin-bottom:12px;color:rgba(28,31,35,.8);font-weight:600}.module-analyze-bailout-card-list{display:flex;flex-direction:column;gap:8px}.module-analyze-bailout-card-item{display:flex;align-items:center;justify-content:space-between;padding:6px 0;border-bottom:1px solid rgba(22,26,35,.08)}.module-analyze-bailout-card-item:last-child{border-bottom:none}.module-analyze-bailout-card-text{max-width:calc(100% - 70px);font-weight:400;font-size:12px;color:rgba(28,31,35,.8)}.module-analyze-bailout-card-meta{font-size:12px;color:rgba(28,31,35,.45)}",".module-analyze-file-tree {\n width: \"100%\";\n min-height: 50em;\n}\n\n.module-analyze-file-tree .module-analyze-empty {\n margin-top: 20%;\n}\n\n.module-analyze-box {\n flex-direction: column;\n display: flex;\n}\n\n.file-tree-com-titles-box {\n line-height: 30px;\n}\n\n.module-analyze-bailout-card {\n box-shadow: none;\n background: #fff;\n border: 1px solid #0505050f;\n border-radius: 8px;\n margin-top: 16px;\n margin-bottom: 24px;\n}\n\n.module-analyze-bailout-card-title {\n color: #1c1f23cc;\n margin-bottom: 12px;\n font-size: 14px;\n font-weight: 600;\n display: inline-block;\n}\n\n.module-analyze-bailout-card-list {\n flex-direction: column;\n gap: 8px;\n display: flex;\n}\n\n.module-analyze-bailout-card-item {\n border-bottom: 1px solid #161a2314;\n justify-content: space-between;\n align-items: center;\n padding: 6px 0;\n display: flex;\n}\n\n.module-analyze-bailout-card-item:last-child {\n border-bottom: none;\n}\n\n.module-analyze-bailout-card-text {\n color: #1c1f23cc;\n max-width: calc(100% - 70px);\n font-size: 12px;\n font-weight: 400;\n}\n\n.module-analyze-bailout-card-meta {\n color: #1c1f2373;\n font-size: 12px;\n}\n"],"sourceRoot":""}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./constants.mjs";
|
|
2
1
|
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import "react";
|
|
4
3
|
import { Card } from "antd";
|
|
5
4
|
import { ResolverAnalysis } from "../../components/Resolver/analysis.mjs";
|
|
6
5
|
import { WebpackConfigurationViewer } from "../../components/Configuration/index.mjs";
|
|
6
|
+
export * from "./constants.mjs";
|
|
7
7
|
const Page = ()=>/*#__PURE__*/ jsx("div", {
|
|
8
8
|
children: /*#__PURE__*/ jsx(Card, {
|
|
9
9
|
title: "Webpack Resolver Analysis",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./constants.mjs";
|
|
2
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import "react";
|
|
4
3
|
import { Flex } from "antd";
|
|
@@ -8,6 +7,7 @@ import { BundleOverall, CompileOverall, ProjectOverall } from "../../components/
|
|
|
8
7
|
import { ResponsiveLayout } from "./responsiveLayout.mjs";
|
|
9
8
|
import { useProjectInfo } from "../../components/Layout/project-info-context.mjs";
|
|
10
9
|
import index_module from "./index.module.mjs";
|
|
10
|
+
export * from "./constants.mjs";
|
|
11
11
|
const Component = ()=>{
|
|
12
12
|
const { project } = useProjectInfo();
|
|
13
13
|
if (!project) return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://./src/pages/Overall/index.module.scss"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["webpack://./../../node_modules/.pnpm/@rsbuild+core@2.0.0-rc.1_@emnapi+core@1.8.1_@emnapi+runtime@1.8.1_core-js@3.47.0/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[10].oneOf[2].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[10].oneOf[2].use[2]!/home/runner/work/rsdoctor/rsdoctor/node_modules/.pnpm/@rsbuild+plugin-sass@1.5.1_@rsbuild+core@2.0.0-rc.1_@emnapi+core@1.8.1_@emnapi+runtime@1.8.1_core-js@3.47.0_/node_modules/@rsbuild/plugin-sass/compiled/resolve-url-loader/index.js??ruleSet[1].rules[10].oneOf[2].use[3]!/home/runner/work/rsdoctor/rsdoctor/node_modules/.pnpm/@rsbuild+plugin-sass@1.5.1_@rsbuild+core@2.0.0-rc.1_@emnapi+core@1.8.1_@emnapi+runtime@1.8.1_core-js@3.47.0_/node_modules/@rsbuild/plugin-sass/compiled/sass-loader/index.js??ruleSet[1].rules[10].oneOf[2].use[4]!/home/runner/work/rsdoctor/rsdoctor/packages/components/src/pages/Overall/index.module.scss","webpack://./src/pages/Overall/index.module.scss"],"names":[],"mappings":"AAAA;ECCE,6NAA6N;AAC/N;;ADFoO;ECKlO,6BAA6B;AAC/B;;ADNmS;ECSjS,OAAO;AACT;;ADVwU;ECatU,aAAa;AACf;;ADdyY;ECiBvY,8BAA8B;EAC9B,aAAa;AACf;;ADnB6b;ECsB3b,mBAAmB;AACrB","sourcesContent":[":root{--font-family-code: Roboto, Roboto Mono, -apple-system, BlinkMacSystemFont, 'Segoe UI', Menlo, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'}:root :global .ant-layout-content{padding:16px 32px !important}:root :global .ant-tree-title{flex:1}:root :global .ant-tree-node-content-wrapper-normal{display:flex}.overall{display:flex;justify-content:space-between}.layout .row{margin-bottom:16px}",":root {\n --font-family-code: Roboto, Roboto Mono, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Menlo, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";\n}\n\n:root :global .ant-layout-content {\n padding: 16px 32px !important;\n}\n\n:root :global .ant-tree-title {\n flex: 1;\n}\n\n:root :global .ant-tree-node-content-wrapper-normal {\n display: flex;\n}\n\n.overall {\n justify-content: space-between;\n display: flex;\n}\n\n.layout .row {\n margin-bottom: 16px;\n}\n"],"sourceRoot":""}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from "./constants.mjs";
|
|
2
|
-
export * from "./DiffContainer/index.mjs";
|
|
3
1
|
import { jsx } from "react/jsx-runtime";
|
|
4
2
|
import "react";
|
|
5
3
|
import { DiffContainer } from "./DiffContainer/index.mjs";
|
|
4
|
+
export * from "./constants.mjs";
|
|
5
|
+
export * from "./DiffContainer/index.mjs";
|
|
6
6
|
const Page = ()=>/*#__PURE__*/ jsx(DiffContainer, {
|
|
7
7
|
manifests: []
|
|
8
8
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./constants.mjs";
|
|
2
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { useEffect, useState } from "react";
|
|
4
3
|
import { Rule } from "@rsdoctor/types";
|
|
@@ -7,6 +6,7 @@ import react_markdown from "react-markdown";
|
|
|
7
6
|
import { Title } from "../../../components/Title/index.mjs";
|
|
8
7
|
import { Size } from "../../../constants.mjs";
|
|
9
8
|
import { useUrlQuery } from "../../../utils/index.mjs";
|
|
9
|
+
export * from "./constants.mjs";
|
|
10
10
|
const Page = ()=>{
|
|
11
11
|
const query = useUrlQuery();
|
|
12
12
|
const defaultErrorCode = query[Rule.RsdoctorRuleClientConstant.UrlQueryForErrorCode] || '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://./src/pages/TreeShaking/index.scss"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["webpack://./../../node_modules/.pnpm/@rsbuild+core@2.0.0-rc.1_@emnapi+core@1.8.1_@emnapi+runtime@1.8.1_core-js@3.47.0/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[10].oneOf[2].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[10].oneOf[2].use[2]!/home/runner/work/rsdoctor/rsdoctor/node_modules/.pnpm/@rsbuild+plugin-sass@1.5.1_@rsbuild+core@2.0.0-rc.1_@emnapi+core@1.8.1_@emnapi+runtime@1.8.1_core-js@3.47.0_/node_modules/@rsbuild/plugin-sass/compiled/resolve-url-loader/index.js??ruleSet[1].rules[10].oneOf[2].use[3]!/home/runner/work/rsdoctor/rsdoctor/node_modules/.pnpm/@rsbuild+plugin-sass@1.5.1_@rsbuild+core@2.0.0-rc.1_@emnapi+core@1.8.1_@emnapi+runtime@1.8.1_core-js@3.47.0_/node_modules/@rsbuild/plugin-sass/compiled/sass-loader/index.js??ruleSet[1].rules[10].oneOf[2].use[4]!/home/runner/work/rsdoctor/rsdoctor/packages/components/src/pages/TreeShaking/index.scss","webpack://./src/pages/TreeShaking/index.scss"],"names":[],"mappings":"AAAA;ECCE,WAAW;EACX,YAAY;AACd;;ADH0C;ECMxC,sBAAsB;EACtB,aAAa;AACf;;ADR0G;ECWxG,mBAAmB;EACnB,0BAA0B;AAC5B;;ADb8M;ECgB5M,mBAAmB;EACnB,0BAA0B;AAC5B;;ADlB6T;ECqB3T,aAAa;AACf;;ADtBqX;ECyBnX,YAAY;EACZ,cAAc;AAChB;;AD3Bsb;EC8Bpb,YAAY;EACZ,aAAa;AACf;;ADhCuf;ECmCrf,UAAU;AACZ;;ADpCwjB;ECuCtjB,WAAW;EACX,yBAAyB;AAC3B;;ADzC8rB;EC4C5rB,UAAU;AACZ;;AD7CqwB;ECgDnwB,YAAY;AACd;;ADjD21B;ECoDz1B,mBAAmB;AACrB;;ADrDi9B;ECwD/8B,+BAA+B;AACjC;;ADzD4oC;EC4D1oC,4BAA4B;AAC9B;;AD7D60C;ECgE30C,0BAA0B;AAC5B;;ADjE2gD;ECoEzgD,sBAAsB;EACtB,uBAAuB;EACvB,aAAa;AACf;;ADvEunD;EC0ErnD,uBAAuB;EACvB,mBAAmB;EACnB,gBAAgB;AAClB;;AD7EuwD;ECgFrwD,sBAAsB;EACtB,WAAW;AACb;;ADlFm1D;ECqFj1D,kBAAkB;EAClB,iBAAiB;AACnB;;ADvFq8D;EC0Fn8D,aAAa;AACf","sourcesContent":[".tree-shaking-page{width:100%;height:100%}.tree-shaking-page .ant-card{display:flex;flex-direction:column}.tree-shaking-page .tree-shaking-statement-side-effect{text-decoration:underline;background:#711f1c}.tree-shaking-page .tree-shaking-statement-declaration-identifier{text-decoration:underline;background:#2c87ec}.tree-shaking-page .tree-shaking-files-box{height:700px}.tree-shaking-page .tree-shaking-files{overflow:auto;height:100%}.tree-shaking-page .tree-shaking-editor{flex-grow:1;height:700px}.tree-shaking-page .tree-shaking-editor .ant-card-body{padding:0}.tree-shaking-page .tree-shaking-files-box,.tree-shaking-page .tree-shaking-editor .ant-card-body{width:auto;height:calc(100% - 48px)}.tree-shaking-page .tree-shaking-export-table .ant-card-body{padding:0}.tree-shaking-page .tree-shaking-export-table .ant-card-body .ant-divider{margin:24px}.tree-shaking-page .tree-shaking-export-table .ant-table-wrapper .ant-table-tbody>tr:last-child>td{border-bottom:none}.tree-shaking-page .tree-shaking-export-table .ant-table-wrapper .ant-table-tbody>tr:last-child>td .ant-table-container table>thead>tr:first-child th{border-top:1px solid rgba(5,5,5,.06)}.tree-shaking-page .tree-shaking-export-table .ant-table-wrapper .ant-table-tbody>tr:last-child>td .ant-table-container table>thead>tr:first-child th th:first-child{border-start-start-radius:0}.tree-shaking-page .tree-shaking-export-table .ant-table-wrapper .ant-table-tbody>tr:last-child>td .ant-table-container table>thead>tr:first-child th th:last-child{border-start-end-radius:0}.tree-shaking-page .tree-shaking-side-effect-list{display:flex;flex-direction:column;align-items:flex-start}.tree-shaking-page .tree-shaking-side-effect-list .tree-shaking-side-effect-list-item{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.monaco-hover .markdown-hover.hover-row hr{margin:2px;background-color:gray}.monaco-hover .markdown-hover.hover-row div[data-code=tree-shaking-hover] ol{margin:4px 0 10px 0;padding-left:4px}.monaco-hover .markdown-hover.hover-row div[data-code=tree-shaking-hover] ol pre{margin:2px 0}",".tree-shaking-page {\n width: 100%;\n height: 100%;\n}\n\n.tree-shaking-page .ant-card {\n flex-direction: column;\n display: flex;\n}\n\n.tree-shaking-page .tree-shaking-statement-side-effect {\n background: #711f1c;\n text-decoration: underline;\n}\n\n.tree-shaking-page .tree-shaking-statement-declaration-identifier {\n background: #2c87ec;\n text-decoration: underline;\n}\n\n.tree-shaking-page .tree-shaking-files-box {\n height: 700px;\n}\n\n.tree-shaking-page .tree-shaking-files {\n height: 100%;\n overflow: auto;\n}\n\n.tree-shaking-page .tree-shaking-editor {\n flex-grow: 1;\n height: 700px;\n}\n\n.tree-shaking-page .tree-shaking-editor .ant-card-body {\n padding: 0;\n}\n\n.tree-shaking-page .tree-shaking-files-box, .tree-shaking-page .tree-shaking-editor .ant-card-body {\n width: auto;\n height: calc(100% - 48px);\n}\n\n.tree-shaking-page .tree-shaking-export-table .ant-card-body {\n padding: 0;\n}\n\n.tree-shaking-page .tree-shaking-export-table .ant-card-body .ant-divider {\n margin: 24px;\n}\n\n.tree-shaking-page .tree-shaking-export-table .ant-table-wrapper .ant-table-tbody > tr:last-child > td {\n border-bottom: none;\n}\n\n.tree-shaking-page .tree-shaking-export-table .ant-table-wrapper .ant-table-tbody > tr:last-child > td .ant-table-container table > thead > tr:first-child th {\n border-top: 1px solid #0505050f;\n}\n\n.tree-shaking-page .tree-shaking-export-table .ant-table-wrapper .ant-table-tbody > tr:last-child > td .ant-table-container table > thead > tr:first-child th th:first-child {\n border-start-start-radius: 0;\n}\n\n.tree-shaking-page .tree-shaking-export-table .ant-table-wrapper .ant-table-tbody > tr:last-child > td .ant-table-container table > thead > tr:first-child th th:last-child {\n border-start-end-radius: 0;\n}\n\n.tree-shaking-page .tree-shaking-side-effect-list {\n flex-direction: column;\n align-items: flex-start;\n display: flex;\n}\n\n.tree-shaking-page .tree-shaking-side-effect-list .tree-shaking-side-effect-list-item {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n}\n\n.monaco-hover .markdown-hover.hover-row hr {\n background-color: gray;\n margin: 2px;\n}\n\n.monaco-hover .markdown-hover.hover-row div[data-code=\"tree-shaking-hover\"] ol {\n margin: 4px 0 10px;\n padding-left: 4px;\n}\n\n.monaco-hover .markdown-hover.hover-row div[data-code=\"tree-shaking-hover\"] ol pre {\n margin: 2px 0;\n}\n"],"sourceRoot":""}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./constants.mjs";
|
|
2
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { useMemo, useState } from "react";
|
|
4
3
|
import { Card, Col, Radio, Row } from "antd";
|
|
@@ -16,6 +15,7 @@ import { CodeEditor } from "./editor.mjs";
|
|
|
16
15
|
import { Space } from "./space.mjs";
|
|
17
16
|
import { TreeShakingTable } from "./table.mjs";
|
|
18
17
|
import "./index.css";
|
|
18
|
+
export * from "./constants.mjs";
|
|
19
19
|
const Component = ({ data, cwd })=>{
|
|
20
20
|
const moduleGraph = useModuleGraphInstanceByModuleGraph(data);
|
|
21
21
|
if (0 === moduleGraph.size()) return /*#__PURE__*/ jsx(Space, {});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./constants.mjs";
|
|
2
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { InboxOutlined } from "@ant-design/icons";
|
|
4
3
|
import { Spin, Upload, message } from "antd";
|
|
@@ -6,6 +5,7 @@ import { useState } from "react";
|
|
|
6
5
|
import { readJSONByFileReader } from "../../utils/index.mjs";
|
|
7
6
|
import { isRspackStats } from "../../utils/stats.mjs";
|
|
8
7
|
import { handleRsdoctorManifest, handleRspackStats } from "./utils.mjs";
|
|
8
|
+
export * from "./constants.mjs";
|
|
9
9
|
const Component = ()=>{
|
|
10
10
|
const [loading, setLoading] = useState(false);
|
|
11
11
|
const handleFileUpload = async (file)=>{
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./constants.mjs";
|
|
2
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import "react";
|
|
4
3
|
import { LoaderAnalysis } from "../../../components/Loader/Analysis/index.mjs";
|
|
@@ -7,6 +6,7 @@ import { Card } from "../../../components/Card/index.mjs";
|
|
|
7
6
|
import { Popover, Space, Tag, Typography, theme } from "antd";
|
|
8
7
|
import { ExclamationCircleOutlined } from "@ant-design/icons";
|
|
9
8
|
import { t } from "i18next";
|
|
9
|
+
export * from "./constants.mjs";
|
|
10
10
|
const { useToken: useToken } = theme;
|
|
11
11
|
const Page = ()=>{
|
|
12
12
|
const { token } = useToken();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./constants.mjs";
|
|
2
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import "react";
|
|
4
3
|
import { WebpackConfigurationViewer } from "../../../components/Configuration/index.mjs";
|
|
@@ -7,6 +6,7 @@ import { LoaderChart } from "../../../components/Charts/index.mjs";
|
|
|
7
6
|
import { Popover, Space, Tag, Typography } from "antd/lib";
|
|
8
7
|
import { ExclamationCircleOutlined } from "@ant-design/icons";
|
|
9
8
|
import { useTranslation } from "react-i18next";
|
|
9
|
+
export * from "./constants.mjs";
|
|
10
10
|
const Page = ()=>{
|
|
11
11
|
const { t } = useTranslation();
|
|
12
12
|
return /*#__PURE__*/ jsx(Card, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://./src/pages/WebpackPlugins/index.scss"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["webpack://./../../node_modules/.pnpm/@rsbuild+core@2.0.0-rc.1_@emnapi+core@1.8.1_@emnapi+runtime@1.8.1_core-js@3.47.0/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[10].oneOf[2].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[10].oneOf[2].use[2]!/home/runner/work/rsdoctor/rsdoctor/node_modules/.pnpm/@rsbuild+plugin-sass@1.5.1_@rsbuild+core@2.0.0-rc.1_@emnapi+core@1.8.1_@emnapi+runtime@1.8.1_core-js@3.47.0_/node_modules/@rsbuild/plugin-sass/compiled/resolve-url-loader/index.js??ruleSet[1].rules[10].oneOf[2].use[3]!/home/runner/work/rsdoctor/rsdoctor/node_modules/.pnpm/@rsbuild+plugin-sass@1.5.1_@rsbuild+core@2.0.0-rc.1_@emnapi+core@1.8.1_@emnapi+runtime@1.8.1_core-js@3.47.0_/node_modules/@rsbuild/plugin-sass/compiled/sass-loader/index.js??ruleSet[1].rules[10].oneOf[2].use[4]!/home/runner/work/rsdoctor/rsdoctor/packages/components/src/pages/WebpackPlugins/index.scss","webpack://./src/pages/WebpackPlugins/index.scss"],"names":[],"mappings":"AAAA;ECCE,YAAY;AACd","sourcesContent":[".plugin-select .ant-select-selector{width:300px}",".plugin-select .ant-select-selector {\n width: 300px;\n}\n"],"sourceRoot":""}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./constants.mjs";
|
|
2
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { ApiOutlined, PartitionOutlined } from "@ant-design/icons";
|
|
4
3
|
import { SDK } from "@rsdoctor/types";
|
|
@@ -9,6 +8,7 @@ import { ServerAPIProvider } from "../../components/Manifest/index.mjs";
|
|
|
9
8
|
import { WebpackPluginsDataTable } from "../../components/Plugins/webpack.mjs";
|
|
10
9
|
import { Size } from "../../constants.mjs";
|
|
11
10
|
import "./index.css";
|
|
11
|
+
export * from "./constants.mjs";
|
|
12
12
|
const Page = ()=>{
|
|
13
13
|
const [selectedTapNames, setSelectedTapNames] = useState([]);
|
|
14
14
|
const [selectedHooks, setSelectedHooks] = useState([]);
|
|
@@ -18,7 +18,7 @@ async function createDataLoader(manifest) {
|
|
|
18
18
|
console.log("[LocalServerDataLoader]");
|
|
19
19
|
return new LocalServerDataLoader(manifest);
|
|
20
20
|
}
|
|
21
|
-
} catch
|
|
21
|
+
} catch {
|
|
22
22
|
console.log('[DataLoader] fallback to RemoteDataLoader');
|
|
23
23
|
}
|
|
24
24
|
return new RemoteDataLoader(manifest);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils/data/index.mjs","sources":["../../../src/utils/data/index.ts"],"sourcesContent":["import { Constants, Manifest } from '@rsdoctor/types';\nimport { useEffect, useState } from 'react';\nimport { LocalServerDataLoader } from './local';\nimport { RemoteDataLoader } from './remote';\nimport { BaseDataLoader } from './base';\nimport { getAPILoaderModeFromStorage } from '../storage';\nimport { APILoaderMode4Dev } from '../../constants';\nimport { BriefDataLoader } from './brief';\n\nconst loaderTask = new WeakMap<\n Manifest.RsdoctorManifestWithShardingFiles,\n Promise<BaseDataLoader>\n>();\n\nasync function createDataLoader(\n manifest: Manifest.RsdoctorManifestWithShardingFiles,\n) {\n try {\n if (process.env.NODE_ENV === 'development') {\n const mode = getAPILoaderModeFromStorage();\n console.log(`[development]-${mode}`);\n if (mode === APILoaderMode4Dev.Local)\n return new LocalServerDataLoader(manifest);\n if (mode === APILoaderMode4Dev.Remote)\n return new RemoteDataLoader(manifest);\n }\n\n // local server exists\n if (manifest.__LOCAL__SERVER__) {\n console.log(`[LocalServerDataLoader]`);\n return new LocalServerDataLoader(manifest);\n }\n } catch
|
|
1
|
+
{"version":3,"file":"utils/data/index.mjs","sources":["../../../src/utils/data/index.ts"],"sourcesContent":["import { Constants, Manifest } from '@rsdoctor/types';\nimport { useEffect, useState } from 'react';\nimport { LocalServerDataLoader } from './local';\nimport { RemoteDataLoader } from './remote';\nimport { BaseDataLoader } from './base';\nimport { getAPILoaderModeFromStorage } from '../storage';\nimport { APILoaderMode4Dev } from '../../constants';\nimport { BriefDataLoader } from './brief';\n\nconst loaderTask = new WeakMap<\n Manifest.RsdoctorManifestWithShardingFiles,\n Promise<BaseDataLoader>\n>();\n\nasync function createDataLoader(\n manifest: Manifest.RsdoctorManifestWithShardingFiles,\n) {\n try {\n if (process.env.NODE_ENV === 'development') {\n const mode = getAPILoaderModeFromStorage();\n console.log(`[development]-${mode}`);\n if (mode === APILoaderMode4Dev.Local)\n return new LocalServerDataLoader(manifest);\n if (mode === APILoaderMode4Dev.Remote)\n return new RemoteDataLoader(manifest);\n }\n\n // local server exists\n if (manifest.__LOCAL__SERVER__) {\n console.log(`[LocalServerDataLoader]`);\n return new LocalServerDataLoader(manifest);\n }\n } catch {\n console.log('[DataLoader] fallback to RemoteDataLoader');\n }\n\n return new RemoteDataLoader(manifest);\n}\n\nexport function useDataLoader(\n manifest: Manifest.RsdoctorManifestWithShardingFiles | void,\n) {\n const [loader, setLoader] = useState<BaseDataLoader | void>(undefined);\n\n useEffect(() => {\n if (window[Constants.WINDOW_RSDOCTOR_TAG]) {\n console.log('[brief mode]');\n const loader = new BriefDataLoader({ data: [] } as any);\n setLoader(loader);\n }\n }, []);\n\n useEffect(() => {\n if (!manifest) return;\n\n if (!loaderTask.has(manifest)) {\n const promise = createDataLoader(manifest);\n loaderTask.set(manifest, promise);\n }\n\n const task = loaderTask.get(manifest)!;\n task.then((loader) => {\n setLoader(loader);\n });\n }, [manifest]);\n\n return {\n loader,\n };\n}\n"],"names":["loaderTask","WeakMap","createDataLoader","manifest","process","mode","getAPILoaderModeFromStorage","console","APILoaderMode4Dev","LocalServerDataLoader","RemoteDataLoader","useDataLoader","loader","setLoader","useState","undefined","useEffect","window","Constants","BriefDataLoader","promise","task"],"mappings":";;;;;;;AASA,MAAMA,aAAa,IAAIC;AAKvB,eAAeC,iBACbC,QAAoD;IAEpD,IAAI;QACF,IAAIC,AAAyB,kBAAzBA,QAAQ,GAAG,CAAC,QAAQ,EAAoB;YAC1C,MAAMC,OAAOC;YACbC,QAAQ,GAAG,CAAC,CAAC,cAAc,EAAEF,MAAM;YACnC,IAAIA,SAASG,kBAAkB,KAAK,EAClC,OAAO,IAAIC,sBAAsBN;YACnC,IAAIE,SAASG,kBAAkB,MAAM,EACnC,OAAO,IAAIE,iBAAiBP;QAChC;QAGA,IAAIA,SAAS,iBAAiB,EAAE;YAC9BI,QAAQ,GAAG,CAAC;YACZ,OAAO,IAAIE,sBAAsBN;QACnC;IACF,EAAE,OAAM;QACNI,QAAQ,GAAG,CAAC;IACd;IAEA,OAAO,IAAIG,iBAAiBP;AAC9B;AAEO,SAASQ,cACdR,QAA2D;IAE3D,MAAM,CAACS,QAAQC,UAAU,GAAGC,SAAgCC;IAE5DC,UAAU;QACR,IAAIC,MAAM,CAACC,UAAU,mBAAmB,CAAC,EAAE;YACzCX,QAAQ,GAAG,CAAC;YACZ,MAAMK,SAAS,IAAIO,gBAAgB;gBAAE,MAAM,EAAE;YAAC;YAC9CN,UAAUD;QACZ;IACF,GAAG,EAAE;IAELI,UAAU;QACR,IAAI,CAACb,UAAU;QAEf,IAAI,CAACH,WAAW,GAAG,CAACG,WAAW;YAC7B,MAAMiB,UAAUlB,iBAAiBC;YACjCH,WAAW,GAAG,CAACG,UAAUiB;QAC3B;QAEA,MAAMC,OAAOrB,WAAW,GAAG,CAACG;QAC5BkB,KAAK,IAAI,CAAC,CAACT;YACTC,UAAUD;QACZ;IACF,GAAG;QAACT;KAAS;IAEb,OAAO;QACLS;IACF;AACF"}
|
package/dist/utils/request.mjs
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
1
|
import { Manifest, SDK } from "@rsdoctor/types";
|
|
3
|
-
import { Manifest as common_Manifest, Url } from "@rsdoctor/utils/common";
|
|
2
|
+
import { Fetch, Manifest as common_Manifest, Url } from "@rsdoctor/utils/common";
|
|
4
3
|
import { APILoaderMode4Dev } from "../constants.mjs";
|
|
5
4
|
import { getManifestUrlFromUrlQuery } from "./url.mjs";
|
|
6
5
|
import { getAPILoaderModeFromStorage } from "./storage.mjs";
|
|
7
6
|
function random() {
|
|
8
7
|
return `${Date.now()}${Math.floor(10000 * Math.random())}`;
|
|
9
8
|
}
|
|
9
|
+
function resolveRequestUrl(url) {
|
|
10
|
+
if ('development' === process.env.NODE_ENV && getAPILoaderModeFromStorage() === APILoaderMode4Dev.Local && url.startsWith('/')) {
|
|
11
|
+
const nextUrl = url === manifestUrlForDev ? SDK.ServerAPI.API.Manifest : url;
|
|
12
|
+
const currentUrl = new URL(location.href);
|
|
13
|
+
currentUrl.port = String(process.env.LOCAL_CLI_PORT);
|
|
14
|
+
return `${currentUrl.origin}${nextUrl}`;
|
|
15
|
+
}
|
|
16
|
+
return url;
|
|
17
|
+
}
|
|
18
|
+
async function requestText(url, timeout) {
|
|
19
|
+
const res = await Fetch.fetchWithTimeout(resolveRequestUrl(url), {
|
|
20
|
+
timeout
|
|
21
|
+
});
|
|
22
|
+
return res.text();
|
|
23
|
+
}
|
|
10
24
|
async function fetchShardingFile(url) {
|
|
11
|
-
if (Url.isUrl(url)) return
|
|
12
|
-
timeout: 999999,
|
|
13
|
-
responseType: 'text'
|
|
14
|
-
}).then((e)=>e.data);
|
|
25
|
+
if (Url.isUrl(url)) return requestText(url, 999999);
|
|
15
26
|
return url;
|
|
16
27
|
}
|
|
17
28
|
async function loadManifestByUrl(url) {
|
|
@@ -20,10 +31,7 @@ async function loadManifestByUrl(url) {
|
|
|
20
31
|
return res;
|
|
21
32
|
}
|
|
22
33
|
async function fetchJSONByUrl(url) {
|
|
23
|
-
|
|
24
|
-
timeout: 30000
|
|
25
|
-
});
|
|
26
|
-
let json = res.data;
|
|
34
|
+
let json = await requestText(url, 30000);
|
|
27
35
|
if ('string' == typeof json) {
|
|
28
36
|
const trimmed = json.trim();
|
|
29
37
|
json = /^<!doctype html\b/i.test(trimmed) || /^<html\b/i.test(trimmed) ? {} : JSON.parse(json);
|
|
@@ -66,28 +74,18 @@ async function fetchManifest(url = getManifestUrl()) {
|
|
|
66
74
|
const res = await pool.get(url);
|
|
67
75
|
return res;
|
|
68
76
|
}
|
|
69
|
-
if ('development' === process.env.NODE_ENV) {
|
|
70
|
-
if (getAPILoaderModeFromStorage() === APILoaderMode4Dev.Local) axios.interceptors.request.use((c)=>{
|
|
71
|
-
c.withCredentials = false;
|
|
72
|
-
if (c.url?.startsWith('/')) {
|
|
73
|
-
if (c.url === manifestUrlForDev) c.url = SDK.ServerAPI.API.Manifest;
|
|
74
|
-
const url = new URL(location.href);
|
|
75
|
-
url.port = String(process.env.LOCAL_CLI_PORT);
|
|
76
|
-
return {
|
|
77
|
-
...c,
|
|
78
|
-
url: `${url.origin}${c.url}`
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return c;
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
77
|
async function postServerAPI(...args) {
|
|
85
78
|
const [api, body] = args;
|
|
86
79
|
const timeout = 'development' === process.env.NODE_ENV ? 10000 : 60000;
|
|
87
|
-
const
|
|
80
|
+
const res = await Fetch.fetchWithTimeout(resolveRequestUrl(`${api}?_t=${random()}`), {
|
|
81
|
+
method: 'POST',
|
|
82
|
+
headers: {
|
|
83
|
+
'Content-Type': 'application/json'
|
|
84
|
+
},
|
|
85
|
+
body: void 0 === body ? void 0 : JSON.stringify(body),
|
|
88
86
|
timeout
|
|
89
87
|
});
|
|
90
|
-
return
|
|
88
|
+
return await res.json();
|
|
91
89
|
}
|
|
92
90
|
export { fetchJSONByUrl, fetchJSONByUrls, fetchManifest, fetchShardingFile, getManifestUrl, loadManifestByUrl, parseManifest, postServerAPI };
|
|
93
91
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils/request.mjs","sources":["../../src/utils/request.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"utils/request.mjs","sources":["../../src/utils/request.ts"],"sourcesContent":["import { Manifest, SDK } from '@rsdoctor/types';\nimport { Fetch, Manifest as ManifestMethod, Url } from '@rsdoctor/utils/common';\nimport { APILoaderMode4Dev } from '../constants';\nimport { getManifestUrlFromUrlQuery } from './url';\nimport { getAPILoaderModeFromStorage } from './storage';\n\nfunction random() {\n return `${Date.now()}${Math.floor(Math.random() * 10000)}`;\n}\n\nfunction resolveRequestUrl(url: string): string {\n if (\n process.env.NODE_ENV === 'development' &&\n getAPILoaderModeFromStorage() === APILoaderMode4Dev.Local &&\n url.startsWith('/')\n ) {\n const nextUrl =\n url === manifestUrlForDev ? SDK.ServerAPI.API.Manifest : url;\n const currentUrl = new URL(location.href);\n currentUrl.port = String(process.env.LOCAL_CLI_PORT!);\n return `${currentUrl.origin}${nextUrl}`;\n }\n\n return url;\n}\n\nasync function requestText(url: string, timeout: number) {\n const res = await Fetch.fetchWithTimeout(resolveRequestUrl(url), { timeout });\n return res.text();\n}\n\nexport async function fetchShardingFile(url: string): Promise<string> {\n if (Url.isUrl(url)) {\n return requestText(url, 999999);\n }\n // json string\n return url;\n}\n\nexport async function loadManifestByUrl(url: string) {\n const json = await fetchJSONByUrl(url);\n\n const res = await parseManifest(json);\n return res;\n}\n\nexport async function fetchJSONByUrl(url: string) {\n let json: unknown = await requestText(url, 30000);\n\n if (typeof json === 'string') {\n const trimmed = json.trim();\n // If we got an HTML document (usually error page / SPA fallback), skip JSON.parse\n if (/^<!doctype html\\b/i.test(trimmed) || /^<html\\b/i.test(trimmed)) {\n json = {} as Manifest.RsdoctorManifestWithShardingFiles;\n } else {\n json = JSON.parse(json);\n }\n }\n\n return json as Manifest.RsdoctorManifestWithShardingFiles;\n}\n\nexport function fetchJSONByUrls(urls: string[]) {\n return Promise.all(urls.map((url) => fetchJSONByUrl(url)));\n}\n\nexport async function parseManifest(\n json: Manifest.RsdoctorManifestWithShardingFiles,\n) {\n let transformedData: Manifest.RsdoctorManifestData;\n\n try {\n // try to load cloud data first\n if (json.cloudData) {\n try {\n transformedData = await ManifestMethod.fetchShardingFiles(\n json.cloudData,\n fetchShardingFile,\n );\n } catch (error) {\n console.log('cloudData load error: ', error);\n }\n } else {\n transformedData = await ManifestMethod.fetchShardingFiles(\n json.data,\n fetchShardingFile,\n );\n }\n } catch {\n transformedData = await ManifestMethod.fetchShardingFiles(\n json.data,\n fetchShardingFile,\n );\n }\n\n return {\n ...json,\n data: transformedData!,\n };\n}\n\nconst manifestUrlForDev = '/manifest.json';\n\nexport function getManifestUrl(): string {\n let file: string | void;\n\n if (\n (window as { [key: string]: any })[\n Manifest.RsdoctorManifestClientConstant.WindowPropertyForManifestUrl\n ]\n ) {\n // load from window property\n file = (window as { [key: string]: any })[\n Manifest.RsdoctorManifestClientConstant.WindowPropertyForManifestUrl\n ];\n } else {\n // load from url query\n file = getManifestUrlFromUrlQuery();\n }\n\n if (!file) {\n file = SDK.ServerAPI.API.Manifest;\n }\n\n return file;\n}\n\nconst pool = new Map<\n string,\n Promise<Manifest.RsdoctorManifestWithShardingFiles>\n>();\n\nexport async function fetchManifest(url = getManifestUrl()) {\n if (!pool.has(url)) {\n pool.set(\n url,\n fetchJSONByUrl(url).catch((err) => {\n pool.delete(url);\n throw err;\n }),\n );\n }\n\n const res = await pool.get(url)!;\n\n return res;\n}\n\nexport async function postServerAPI<\n T extends SDK.ServerAPI.API,\n B extends SDK.ServerAPI.InferRequestBodyType<T> =\n SDK.ServerAPI.InferRequestBodyType<T>,\n R extends SDK.ServerAPI.InferResponseType<T> =\n SDK.ServerAPI.InferResponseType<T>,\n>(...args: B extends void ? [api: T] : [api: T, body: B]): Promise<R> {\n const [api, body] = args;\n const timeout = process.env.NODE_ENV === 'development' ? 10000 : 60000;\n const res = await Fetch.fetchWithTimeout(\n resolveRequestUrl(`${api}?_t=${random()}`),\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: body === undefined ? undefined : JSON.stringify(body),\n timeout,\n },\n );\n return (await res.json()) as R;\n}\n"],"names":["random","Date","Math","resolveRequestUrl","url","process","getAPILoaderModeFromStorage","APILoaderMode4Dev","nextUrl","manifestUrlForDev","SDK","currentUrl","URL","location","String","requestText","timeout","res","Fetch","fetchShardingFile","Url","loadManifestByUrl","json","fetchJSONByUrl","parseManifest","trimmed","JSON","fetchJSONByUrls","urls","Promise","transformedData","ManifestMethod","error","console","getManifestUrl","file","window","Manifest","getManifestUrlFromUrlQuery","pool","Map","fetchManifest","err","postServerAPI","args","api","body","undefined"],"mappings":";;;;;AAMA,SAASA;IACP,OAAO,GAAGC,KAAK,GAAG,KAAKC,KAAK,KAAK,CAACA,AAAgB,QAAhBA,KAAK,MAAM,KAAa;AAC5D;AAEA,SAASC,kBAAkBC,GAAW;IACpC,IACEC,AAAyB,kBAAzBA,QAAQ,GAAG,CAAC,QAAQ,IACpBC,kCAAkCC,kBAAkB,KAAK,IACzDH,IAAI,UAAU,CAAC,MACf;QACA,MAAMI,UACJJ,QAAQK,oBAAoBC,IAAI,SAAS,CAAC,GAAG,CAAC,QAAQ,GAAGN;QAC3D,MAAMO,aAAa,IAAIC,IAAIC,SAAS,IAAI;QACxCF,WAAW,IAAI,GAAGG,OAAOT,QAAQ,GAAG,CAAC,cAAc;QACnD,OAAO,GAAGM,WAAW,MAAM,GAAGH,SAAS;IACzC;IAEA,OAAOJ;AACT;AAEA,eAAeW,YAAYX,GAAW,EAAEY,OAAe;IACrD,MAAMC,MAAM,MAAMC,MAAM,gBAAgB,CAACf,kBAAkBC,MAAM;QAAEY;IAAQ;IAC3E,OAAOC,IAAI,IAAI;AACjB;AAEO,eAAeE,kBAAkBf,GAAW;IACjD,IAAIgB,IAAI,KAAK,CAAChB,MACZ,OAAOW,YAAYX,KAAK;IAG1B,OAAOA;AACT;AAEO,eAAeiB,kBAAkBjB,GAAW;IACjD,MAAMkB,OAAO,MAAMC,eAAenB;IAElC,MAAMa,MAAM,MAAMO,cAAcF;IAChC,OAAOL;AACT;AAEO,eAAeM,eAAenB,GAAW;IAC9C,IAAIkB,OAAgB,MAAMP,YAAYX,KAAK;IAE3C,IAAI,AAAgB,YAAhB,OAAOkB,MAAmB;QAC5B,MAAMG,UAAUH,KAAK,IAAI;QAGvBA,OADE,qBAAqB,IAAI,CAACG,YAAY,YAAY,IAAI,CAACA,WAClD,CAAC,IAEDC,KAAK,KAAK,CAACJ;IAEtB;IAEA,OAAOA;AACT;AAEO,SAASK,gBAAgBC,IAAc;IAC5C,OAAOC,QAAQ,GAAG,CAACD,KAAK,GAAG,CAAC,CAACxB,MAAQmB,eAAenB;AACtD;AAEO,eAAeoB,cACpBF,IAAgD;IAEhD,IAAIQ;IAEJ,IAAI;QAEF,IAAIR,KAAK,SAAS,EAChB,IAAI;YACFQ,kBAAkB,MAAMC,gBAAAA,kBAAiC,CACvDT,KAAK,SAAS,EACdH;QAEJ,EAAE,OAAOa,OAAO;YACdC,QAAQ,GAAG,CAAC,0BAA0BD;QACxC;aAEAF,kBAAkB,MAAMC,gBAAAA,kBAAiC,CACvDT,KAAK,IAAI,EACTH;IAGN,EAAE,OAAM;QACNW,kBAAkB,MAAMC,gBAAAA,kBAAiC,CACvDT,KAAK,IAAI,EACTH;IAEJ;IAEA,OAAO;QACL,GAAGG,IAAI;QACP,MAAMQ;IACR;AACF;AAEA,MAAMrB,oBAAoB;AAEnB,SAASyB;IACd,IAAIC;IAQFA,OALCC,MAAiC,CAChCC,SAAS,8BAA8B,CAAC,4BAA4B,CACrE,GAGOD,MAAiC,CACvCC,SAAS,8BAA8B,CAAC,4BAA4B,CACrE,GAGMC;IAGT,IAAI,CAACH,MACHA,OAAOzB,IAAI,SAAS,CAAC,GAAG,CAAC,QAAQ;IAGnC,OAAOyB;AACT;AAEA,MAAMI,OAAO,IAAIC;AAKV,eAAeC,cAAcrC,MAAM8B,gBAAgB;IACxD,IAAI,CAACK,KAAK,GAAG,CAACnC,MACZmC,KAAK,GAAG,CACNnC,KACAmB,eAAenB,KAAK,KAAK,CAAC,CAACsC;QACzBH,KAAK,MAAM,CAACnC;QACZ,MAAMsC;IACR;IAIJ,MAAMzB,MAAM,MAAMsB,KAAK,GAAG,CAACnC;IAE3B,OAAOa;AACT;AAEO,eAAe0B,cAMpB,GAAGC,IAAmD;IACtD,MAAM,CAACC,KAAKC,KAAK,GAAGF;IACpB,MAAM5B,UAAUX,AAAyB,kBAAzBA,QAAQ,GAAG,CAAC,QAAQ,GAAqB,QAAQ;IACjE,MAAMY,MAAM,MAAMC,MAAM,gBAAgB,CACtCf,kBAAkB,GAAG0C,IAAI,IAAI,EAAE7C,UAAU,GACzC;QACE,QAAQ;QACR,SAAS;YAAE,gBAAgB;QAAmB;QAC9C,MAAM8C,AAASC,WAATD,OAAqBC,SAAYrB,KAAK,SAAS,CAACoB;QACtD9B;IACF;IAEF,OAAQ,MAAMC,IAAI,IAAI;AACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, rs } from "@rstest/core";
|
|
2
|
+
import { fetchJSONByUrl, postServerAPI } from "./request.mjs";
|
|
3
|
+
describe('request utils', ()=>{
|
|
4
|
+
const originalFetch = globalThis.fetch;
|
|
5
|
+
const originalNodeEnv = process.env.NODE_ENV;
|
|
6
|
+
afterEach(()=>{
|
|
7
|
+
globalThis.fetch = originalFetch;
|
|
8
|
+
process.env.NODE_ENV = originalNodeEnv;
|
|
9
|
+
});
|
|
10
|
+
it('fetchJSONByUrl() parses json text payload', async ()=>{
|
|
11
|
+
const fetchMock = rs.fn().mockResolvedValue({
|
|
12
|
+
ok: true,
|
|
13
|
+
text: async ()=>'{"name":"rsdoctor"}'
|
|
14
|
+
});
|
|
15
|
+
globalThis.fetch = fetchMock;
|
|
16
|
+
process.env.NODE_ENV = 'production';
|
|
17
|
+
const data = await fetchJSONByUrl('https://example.com/manifest.json');
|
|
18
|
+
expect(data).toStrictEqual({
|
|
19
|
+
name: 'rsdoctor'
|
|
20
|
+
});
|
|
21
|
+
expect(fetchMock).toBeCalledTimes(1);
|
|
22
|
+
});
|
|
23
|
+
it('fetchJSONByUrl() throws for non-2xx response', async ()=>{
|
|
24
|
+
const fetchMock = rs.fn().mockResolvedValue({
|
|
25
|
+
ok: false,
|
|
26
|
+
status: 500
|
|
27
|
+
});
|
|
28
|
+
globalThis.fetch = fetchMock;
|
|
29
|
+
process.env.NODE_ENV = 'production';
|
|
30
|
+
await expect(fetchJSONByUrl('https://example.com/manifest.json')).rejects.toThrow('Request failed with status 500');
|
|
31
|
+
});
|
|
32
|
+
it('postServerAPI() sends json body and parses response json', async ()=>{
|
|
33
|
+
const fetchMock = rs.fn().mockResolvedValue({
|
|
34
|
+
ok: true,
|
|
35
|
+
json: async ()=>({
|
|
36
|
+
ok: true
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
globalThis.fetch = fetchMock;
|
|
40
|
+
process.env.NODE_ENV = 'production';
|
|
41
|
+
const result = await postServerAPI('/api/demo', {
|
|
42
|
+
id: 1
|
|
43
|
+
});
|
|
44
|
+
const [url, init] = fetchMock.mock.calls[0];
|
|
45
|
+
expect(url).toContain('/api/demo?_t=');
|
|
46
|
+
expect(init).toMatchObject({
|
|
47
|
+
method: 'POST',
|
|
48
|
+
headers: {
|
|
49
|
+
'Content-Type': 'application/json'
|
|
50
|
+
},
|
|
51
|
+
body: JSON.stringify({
|
|
52
|
+
id: 1
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
expect(result).toStrictEqual({
|
|
56
|
+
ok: true
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=request.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils/request.test.mjs","sources":["../../src/utils/request.test.ts"],"sourcesContent":["import { afterEach, describe, expect, it, rs } from '@rstest/core';\nimport { fetchJSONByUrl, postServerAPI } from './request';\n\ndescribe('request utils', () => {\n const originalFetch = globalThis.fetch;\n const originalNodeEnv = process.env.NODE_ENV;\n\n afterEach(() => {\n globalThis.fetch = originalFetch;\n process.env.NODE_ENV = originalNodeEnv;\n });\n\n it('fetchJSONByUrl() parses json text payload', async () => {\n const fetchMock = rs.fn().mockResolvedValue({\n ok: true,\n text: async () => '{\"name\":\"rsdoctor\"}',\n });\n globalThis.fetch = fetchMock as typeof fetch;\n process.env.NODE_ENV = 'production';\n\n const data = await fetchJSONByUrl('https://example.com/manifest.json');\n\n expect(data).toStrictEqual({ name: 'rsdoctor' });\n expect(fetchMock).toBeCalledTimes(1);\n });\n\n it('fetchJSONByUrl() throws for non-2xx response', async () => {\n const fetchMock = rs.fn().mockResolvedValue({\n ok: false,\n status: 500,\n });\n globalThis.fetch = fetchMock as typeof fetch;\n process.env.NODE_ENV = 'production';\n\n await expect(\n fetchJSONByUrl('https://example.com/manifest.json'),\n ).rejects.toThrow('Request failed with status 500');\n });\n\n it('postServerAPI() sends json body and parses response json', async () => {\n const fetchMock = rs.fn().mockResolvedValue({\n ok: true,\n json: async () => ({ ok: true }),\n });\n globalThis.fetch = fetchMock as typeof fetch;\n process.env.NODE_ENV = 'production';\n\n const result = await (postServerAPI as any)('/api/demo', { id: 1 });\n const [url, init] = fetchMock.mock.calls[0];\n\n expect(url).toContain('/api/demo?_t=');\n expect(init).toMatchObject({\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ id: 1 }),\n });\n expect(result).toStrictEqual({ ok: true });\n });\n});\n"],"names":["describe","originalFetch","globalThis","originalNodeEnv","process","afterEach","it","fetchMock","rs","data","fetchJSONByUrl","expect","result","postServerAPI","url","init","JSON"],"mappings":";;AAGAA,SAAS,iBAAiB;IACxB,MAAMC,gBAAgBC,WAAW,KAAK;IACtC,MAAMC,kBAAkBC,QAAQ,GAAG,CAAC,QAAQ;IAE5CC,UAAU;QACRH,WAAW,KAAK,GAAGD;QACnBG,QAAQ,GAAG,CAAC,QAAQ,GAAGD;IACzB;IAEAG,GAAG,6CAA6C;QAC9C,MAAMC,YAAYC,GAAG,EAAE,GAAG,iBAAiB,CAAC;YAC1C,IAAI;YACJ,MAAM,UAAY;QACpB;QACAN,WAAW,KAAK,GAAGK;QACnBH,QAAQ,GAAG,CAAC,QAAQ,GAAG;QAEvB,MAAMK,OAAO,MAAMC,eAAe;QAElCC,OAAOF,MAAM,aAAa,CAAC;YAAE,MAAM;QAAW;QAC9CE,OAAOJ,WAAW,eAAe,CAAC;IACpC;IAEAD,GAAG,gDAAgD;QACjD,MAAMC,YAAYC,GAAG,EAAE,GAAG,iBAAiB,CAAC;YAC1C,IAAI;YACJ,QAAQ;QACV;QACAN,WAAW,KAAK,GAAGK;QACnBH,QAAQ,GAAG,CAAC,QAAQ,GAAG;QAEvB,MAAMO,OACJD,eAAe,sCACf,OAAO,CAAC,OAAO,CAAC;IACpB;IAEAJ,GAAG,4DAA4D;QAC7D,MAAMC,YAAYC,GAAG,EAAE,GAAG,iBAAiB,CAAC;YAC1C,IAAI;YACJ,MAAM,UAAa;oBAAE,IAAI;gBAAK;QAChC;QACAN,WAAW,KAAK,GAAGK;QACnBH,QAAQ,GAAG,CAAC,QAAQ,GAAG;QAEvB,MAAMQ,SAAS,MAAOC,cAAsB,aAAa;YAAE,IAAI;QAAE;QACjE,MAAM,CAACC,KAAKC,KAAK,GAAGR,UAAU,IAAI,CAAC,KAAK,CAAC,EAAE;QAE3CI,OAAOG,KAAK,SAAS,CAAC;QACtBH,OAAOI,MAAM,aAAa,CAAC;YACzB,QAAQ;YACR,SAAS;gBACP,gBAAgB;YAClB;YACA,MAAMC,KAAK,SAAS,CAAC;gBAAE,IAAI;YAAE;QAC/B;QACAL,OAAOC,QAAQ,aAAa,CAAC;YAAE,IAAI;QAAK;IAC1C;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils/socket.mjs","sources":["../../src/utils/socket.ts"],"sourcesContent":["/*
|
|
1
|
+
{"version":3,"file":"utils/socket.mjs","sources":["../../src/utils/socket.ts"],"sourcesContent":["/* rslint-disable no-restricted-globals */\nimport { io, Socket } from 'socket.io-client';\n\nconst map = new Map<string, Socket>();\nconst socketProtocol = location.protocol.includes('https') ? 'wss' : 'ws';\nconst defaultSocketUrl =\n process.env.NODE_ENV === 'development'\n ? `${socketProtocol}://${location.hostname}:${process.env.LOCAL_CLI_PORT}`\n : `${socketProtocol}://${location.host}`;\n\nconst ipv4Pattern =\n /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;\n\nfunction ensureSocket(socketUrl: string = defaultSocketUrl) {\n if (!map.has(socketUrl)) {\n const socket = io(socketUrl, {});\n socket.on('connect', () => {\n console.log(`Socket Connect ${socketUrl}`);\n });\n map.set(socketUrl, socket);\n }\n return map.get(socketUrl)!;\n}\n\nexport function getSocket(socketPort?: string): Socket {\n const socketUrl = formatURL({\n port: socketPort,\n hostname: location.hostname,\n protocol: location.protocol,\n });\n const socket = ensureSocket(socketPort ? socketUrl : defaultSocketUrl);\n return socket;\n}\n\nexport function formatURL({\n port,\n protocol,\n hostname,\n}: {\n port?: string;\n protocol: string;\n hostname: string;\n}) {\n if (typeof URL !== 'undefined') {\n const url = new URL('http://localhost');\n url.port = String(port);\n url.hostname = hostname;\n url.protocol = location.protocol.includes('https') ? 'wss' : 'ws';\n return ipv4Pattern.test(hostname) || hostname.includes('localhost')\n ? url.toString()\n : `${protocol}//${hostname}`;\n }\n\n // compatible with IE11\n const colon = protocol.indexOf(':') === -1 ? ':' : '';\n return `${protocol}${colon}//${hostname}:${port}`;\n}\n"],"names":["map","Map","socketProtocol","location","defaultSocketUrl","process","ipv4Pattern","ensureSocket","socketUrl","socket","io","console","getSocket","socketPort","formatURL","port","protocol","hostname","URL","url","String","colon"],"mappings":";AAGA,MAAMA,MAAM,IAAIC;AAChB,MAAMC,iBAAiBC,SAAS,QAAQ,CAAC,QAAQ,CAAC,WAAW,QAAQ;AACrE,MAAMC,mBACJC,AAAyB,kBAAzBA,QAAQ,GAAG,CAAC,QAAQ,GAChB,GAAGH,eAAe,GAAG,EAAEC,SAAS,QAAQ,CAAC,CAAC,EAAEE,QAAQ,GAAG,CAAC,cAAc,EAAE,GACxE,GAAGH,eAAe,GAAG,EAAEC,SAAS,IAAI,EAAE;AAE5C,MAAMG,cACJ;AAEF,SAASC,aAAaC,YAAoBJ,gBAAgB;IACxD,IAAI,CAACJ,IAAI,GAAG,CAACQ,YAAY;QACvB,MAAMC,SAASC,GAAGF,WAAW,CAAC;QAC9BC,OAAO,EAAE,CAAC,WAAW;YACnBE,QAAQ,GAAG,CAAC,CAAC,eAAe,EAAEH,WAAW;QAC3C;QACAR,IAAI,GAAG,CAACQ,WAAWC;IACrB;IACA,OAAOT,IAAI,GAAG,CAACQ;AACjB;AAEO,SAASI,UAAUC,UAAmB;IAC3C,MAAML,YAAYM,UAAU;QAC1B,MAAMD;QACN,UAAUV,SAAS,QAAQ;QAC3B,UAAUA,SAAS,QAAQ;IAC7B;IACA,MAAMM,SAASF,aAAaM,aAAaL,YAAYJ;IACrD,OAAOK;AACT;AAEO,SAASK,UAAU,EACxBC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EAKT;IACC,IAAI,AAAe,MAAf,OAAOC,KAAqB;QAC9B,MAAMC,MAAM,IAAID,IAAI;QACpBC,IAAI,IAAI,GAAGC,OAAOL;QAClBI,IAAI,QAAQ,GAAGF;QACfE,IAAI,QAAQ,GAAGhB,SAAS,QAAQ,CAAC,QAAQ,CAAC,WAAW,QAAQ;QAC7D,OAAOG,YAAY,IAAI,CAACW,aAAaA,SAAS,QAAQ,CAAC,eACnDE,IAAI,QAAQ,KACZ,GAAGH,SAAS,EAAE,EAAEC,UAAU;IAChC;IAGA,MAAMI,QAAQL,AAA0B,OAA1BA,SAAS,OAAO,CAAC,OAAc,MAAM;IACnD,OAAO,GAAGA,WAAWK,MAAM,EAAE,EAAEJ,SAAS,CAAC,EAAEF,MAAM;AACnD"}
|
package/dist/utils/storage.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils/storage.mjs","sources":["../../src/utils/storage.tsx"],"sourcesContent":["import type { Config } from '../config';\nimport { APILoaderMode4Dev, Language, Theme, ViewMode } from '../constants';\n\nenum Keys {\n Namespace = '__RSDOCTOR__STORAGE__',\n Theme = 'THEME',\n Locale = 'LOCALE',\n ViewMode = 'VIEWMODE',\n APILoaderMode4Dev = 'APILOADERMODE_DEV',\n FirstVisit = 'FIRST_VISIT'
|
|
1
|
+
{"version":3,"file":"utils/storage.mjs","sources":["../../src/utils/storage.tsx"],"sourcesContent":["import type { Config } from '../config';\nimport { APILoaderMode4Dev, Language, Theme, ViewMode } from '../constants';\n\nenum Keys {\n Namespace = '__RSDOCTOR__STORAGE__',\n Theme = 'THEME',\n Locale = 'LOCALE',\n ViewMode = 'VIEWMODE',\n APILoaderMode4Dev = 'APILOADERMODE_DEV',\n FirstVisit = 'FIRST_VISIT',\n}\n\nexport function getStorage(key: string): string | null {\n return window.localStorage.getItem(`${Keys.Namespace}${key}`);\n}\n\nexport function setStorage(key: string, value: string): boolean {\n try {\n window.localStorage.setItem(`${Keys.Namespace}${key}`, value);\n return true;\n } catch (error) {\n console.error(error);\n return false;\n }\n}\n\nexport function getThemeFromStorage(): Config['theme'] {\n return (getStorage(Keys.Theme) as Config['theme']) || Theme.Light;\n}\n\nexport function setThemeToStorage(theme: Config['theme']) {\n setStorage(Keys.Theme, theme);\n}\n\nexport function getLocaleFromStorage(): Config['locale'] {\n return (getStorage(Keys.Locale) as Config['locale']) || Language.En;\n}\n\nexport function setLocaleToStorage(locale: Config['locale']) {\n setStorage(Keys.Locale, locale);\n}\n\nexport function getViewModeFromStorage(): Config['viewMode'] {\n const fallback: Config['viewMode'] = {\n bundleAlerts: ViewMode.List,\n compileAlerts: ViewMode.List,\n };\n try {\n const str = getStorage(Keys.ViewMode);\n if (str) {\n return JSON.parse(str) || fallback;\n }\n return fallback;\n } catch {\n return fallback;\n }\n}\n\nexport function setViewModeToStorage(viewMode: Config['viewMode']) {\n setStorage(Keys.ViewMode, JSON.stringify(viewMode));\n}\n\nexport function hasViewModeFromStorage(): boolean {\n return !!getStorage(Keys.ViewMode);\n}\n\nexport function setAPILoaderModeToStorage(mode: APILoaderMode4Dev) {\n setStorage(Keys.APILoaderMode4Dev, mode);\n}\n\nexport function getAPILoaderModeFromStorage() {\n return getStorage(Keys.APILoaderMode4Dev) || APILoaderMode4Dev.Default;\n}\n\nexport function getFirstVisitFromStorage() {\n return getStorage(Keys.FirstVisit);\n}\n\nexport function setFirstVisitToStorage(value: '1') {\n setStorage(Keys.FirstVisit, value);\n}\n"],"names":["getStorage","key","window","setStorage","value","error","console","getThemeFromStorage","Theme","setThemeToStorage","theme","getLocaleFromStorage","Language","setLocaleToStorage","locale","getViewModeFromStorage","fallback","ViewMode","str","JSON","setViewModeToStorage","viewMode","hasViewModeFromStorage","setAPILoaderModeToStorage","mode","getAPILoaderModeFromStorage","APILoaderMode4Dev","getFirstVisitFromStorage","setFirstVisitToStorage"],"mappings":";AAYO,SAASA,WAAWC,GAAW;IACpC,OAAOC,OAAO,YAAY,CAAC,OAAO,CAAC,wBAAoBD,KAAK;AAC9D;AAEO,SAASE,WAAWF,GAAW,EAAEG,KAAa;IACnD,IAAI;QACFF,OAAO,YAAY,CAAC,OAAO,CAAC,wBAAoBD,KAAK,EAAEG;QACvD,OAAO;IACT,EAAE,OAAOC,OAAO;QACdC,QAAQ,KAAK,CAACD;QACd,OAAO;IACT;AACF;AAEO,SAASE;IACd,OAAQP,WAAW,YAAmCQ,MAAM,KAAK;AACnE;AAEO,SAASC,kBAAkBC,KAAsB;IACtDP,WAAW,SAAYO;AACzB;AAEO,SAASC;IACd,OAAQX,WAAW,aAAqCY,SAAS,EAAE;AACrE;AAEO,SAASC,mBAAmBC,MAAwB;IACzDX,WAAW,UAAaW;AAC1B;AAEO,SAASC;IACd,MAAMC,WAA+B;QACnC,cAAcC,SAAS,IAAI;QAC3B,eAAeA,SAAS,IAAI;IAC9B;IACA,IAAI;QACF,MAAMC,MAAMlB,WAAW;QACvB,IAAIkB,KACF,OAAOC,KAAK,KAAK,CAACD,QAAQF;QAE5B,OAAOA;IACT,EAAE,OAAM;QACN,OAAOA;IACT;AACF;AAEO,SAASI,qBAAqBC,QAA4B;IAC/DlB,WAAW,YAAegB,KAAK,SAAS,CAACE;AAC3C;AAEO,SAASC;IACd,OAAO,CAAC,CAACtB,WAAW;AACtB;AAEO,SAASuB,0BAA0BC,IAAuB;IAC/DrB,WAAW,qBAAwBqB;AACrC;AAEO,SAASC;IACd,OAAOzB,WAAW,wBAA2B0B,kBAAkB,OAAO;AACxE;AAEO,SAASC;IACd,OAAO3B,WAAW;AACpB;AAEO,SAAS4B,uBAAuBxB,KAAU;IAC/CD,WAAW,eAAiBC;AAC9B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/components",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": {
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"@monaco-editor/react": "4.7.0",
|
|
57
57
|
"ansi-to-react": "6.2.6",
|
|
58
58
|
"antd": "5.19.1",
|
|
59
|
-
"axios": "1.14.0",
|
|
60
59
|
"clsx": "^2.1.1",
|
|
61
60
|
"dayjs": "1.11.20",
|
|
62
61
|
"echarts": "^5.6.0",
|
|
@@ -74,9 +73,9 @@
|
|
|
74
73
|
"react-markdown": "^9.1.0",
|
|
75
74
|
"socket.io-client": "4.8.1",
|
|
76
75
|
"url-parse": "1.5.10",
|
|
77
|
-
"@rsdoctor/
|
|
78
|
-
"@rsdoctor/
|
|
79
|
-
"@rsdoctor/
|
|
76
|
+
"@rsdoctor/types": "1.5.9",
|
|
77
|
+
"@rsdoctor/graph": "1.5.9",
|
|
78
|
+
"@rsdoctor/utils": "1.5.9"
|
|
80
79
|
},
|
|
81
80
|
"peerDependencies": {
|
|
82
81
|
"react": ">=18.3.1",
|