@rsdoctor/sdk 1.5.3 → 1.5.5
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/compiled/dayjs/index.js +2 -2
- package/compiled/dayjs/package.json +1 -1
- package/dist/0~open.js +346 -0
- package/dist/index.cjs +1865 -1857
- package/dist/index.js +120 -172
- package/dist/rslib-runtime.js +30 -0
- package/package.json +9 -9
- package/dist/0~604.js +0 -354
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*!
|
|
1
|
+
/*! LICENSE: index.cjs.LICENSE.txt */
|
|
2
2
|
const __rslib_import_meta_url__ = "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
4
|
"../../node_modules/.pnpm/body-parser@2.2.2/node_modules/body-parser/index.js" (module, exports1, __webpack_require__) {
|
|
@@ -190,7 +190,7 @@ var __webpack_modules__ = {
|
|
|
190
190
|
},
|
|
191
191
|
"../../node_modules/.pnpm/body-parser@2.2.2/node_modules/body-parser/lib/types/urlencoded.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
192
192
|
"use strict";
|
|
193
|
-
var createError = __webpack_require__("../../node_modules/.pnpm/http-errors@2.0.1/node_modules/http-errors/index.js"), debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js")('body-parser:urlencoded'), read = __webpack_require__("../../node_modules/.pnpm/body-parser@2.2.2/node_modules/body-parser/lib/read.js"), qs = __webpack_require__("../../node_modules/.pnpm/qs@6.
|
|
193
|
+
var createError = __webpack_require__("../../node_modules/.pnpm/http-errors@2.0.1/node_modules/http-errors/index.js"), debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js")('body-parser:urlencoded'), read = __webpack_require__("../../node_modules/.pnpm/body-parser@2.2.2/node_modules/body-parser/lib/read.js"), qs = __webpack_require__("../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/index.js"), { normalizeOptions } = __webpack_require__("../../node_modules/.pnpm/body-parser@2.2.2/node_modules/body-parser/lib/utils.js");
|
|
194
194
|
module.exports = function(options) {
|
|
195
195
|
let normalizedOptions = normalizeOptions(options, 'application/x-www-form-urlencoded');
|
|
196
196
|
if ('utf-8' !== normalizedOptions.defaultCharset && 'iso-8859-1' !== normalizedOptions.defaultCharset) throw TypeError('option defaultCharset must be either utf-8 or iso-8859-1');
|
|
@@ -3141,9 +3141,9 @@ var __webpack_modules__ = {
|
|
|
3141
3141
|
if (exts && exts.length) {
|
|
3142
3142
|
extensions[type] = exts;
|
|
3143
3143
|
for(var i = 0; i < exts.length; i++){
|
|
3144
|
-
var
|
|
3145
|
-
types[extension1] = (
|
|
3146
|
-
let legacyType = function(
|
|
3144
|
+
var type0, type1, extension1 = exts[i];
|
|
3145
|
+
types[extension1] = (type0 = types[extension1], type1 = type, (type0 ? mimeScore(type0, db[type0].source) : 0) > (type1 ? mimeScore(type1, db[type1].source) : 0) ? type0 : type1);
|
|
3146
|
+
let legacyType = function(type0, type1) {
|
|
3147
3147
|
var SOURCE_RANK = [
|
|
3148
3148
|
'nginx',
|
|
3149
3149
|
'apache',
|
|
@@ -3151,7 +3151,7 @@ var __webpack_modules__ = {
|
|
|
3151
3151
|
'iana'
|
|
3152
3152
|
], score0 = type0 ? SOURCE_RANK.indexOf(db[type0].source) : 0, score1 = type1 ? SOURCE_RANK.indexOf(db[type1].source) : 0;
|
|
3153
3153
|
return 'application/octet-stream' !== exports1.types[extension] && (score0 > score1 || score0 === score1 && exports1.types[extension]?.slice(0, 12) === 'application/') || score0 > score1 ? type0 : type1;
|
|
3154
|
-
}(
|
|
3154
|
+
}(types[extension1], type);
|
|
3155
3155
|
legacyType !== types[extension1] && exports1._extensionConflicts.push([
|
|
3156
3156
|
extension1,
|
|
3157
3157
|
legacyType,
|
|
@@ -3580,7 +3580,7 @@ var __webpack_modules__ = {
|
|
|
3580
3580
|
return 'boolean' == typeof msg.finished ? !!(msg.finished || socket && !socket.writable) : 'boolean' == typeof msg.complete ? !!(msg.upgrade || !socket || !socket.readable || msg.complete && !msg.readable) : void 0;
|
|
3581
3581
|
}
|
|
3582
3582
|
},
|
|
3583
|
-
"../../node_modules/.pnpm/qs@6.
|
|
3583
|
+
"../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/formats.js" (module) {
|
|
3584
3584
|
"use strict";
|
|
3585
3585
|
var replace = String.prototype.replace, percentTwenties = /%20/g, Format_RFC3986 = 'RFC3986';
|
|
3586
3586
|
module.exports = {
|
|
@@ -3597,18 +3597,18 @@ var __webpack_modules__ = {
|
|
|
3597
3597
|
RFC3986: Format_RFC3986
|
|
3598
3598
|
};
|
|
3599
3599
|
},
|
|
3600
|
-
"../../node_modules/.pnpm/qs@6.
|
|
3600
|
+
"../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
3601
3601
|
"use strict";
|
|
3602
|
-
var stringify = __webpack_require__("../../node_modules/.pnpm/qs@6.
|
|
3602
|
+
var stringify = __webpack_require__("../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/stringify.js"), parse = __webpack_require__("../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/parse.js");
|
|
3603
3603
|
module.exports = {
|
|
3604
|
-
formats: __webpack_require__("../../node_modules/.pnpm/qs@6.
|
|
3604
|
+
formats: __webpack_require__("../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/formats.js"),
|
|
3605
3605
|
parse: parse,
|
|
3606
3606
|
stringify: stringify
|
|
3607
3607
|
};
|
|
3608
3608
|
},
|
|
3609
|
-
"../../node_modules/.pnpm/qs@6.
|
|
3609
|
+
"../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/parse.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
3610
3610
|
"use strict";
|
|
3611
|
-
var utils = __webpack_require__("../../node_modules/.pnpm/qs@6.
|
|
3611
|
+
var utils = __webpack_require__("../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/utils.js"), has = Object.prototype.hasOwnProperty, isArray = Array.isArray, defaults = {
|
|
3612
3612
|
allowDots: !1,
|
|
3613
3613
|
allowEmptyArrays: !1,
|
|
3614
3614
|
allowPrototypes: !1,
|
|
@@ -3628,6 +3628,7 @@ var __webpack_modules__ = {
|
|
|
3628
3628
|
parseArrays: !0,
|
|
3629
3629
|
plainObjects: !1,
|
|
3630
3630
|
strictDepth: !1,
|
|
3631
|
+
strictMerge: !0,
|
|
3631
3632
|
strictNullHandling: !1,
|
|
3632
3633
|
throwOnLimitExceeded: !1
|
|
3633
3634
|
}, parseArrayValue = function(val, options, currentArrayLength) {
|
|
@@ -3657,7 +3658,7 @@ var __webpack_modules__ = {
|
|
|
3657
3658
|
}
|
|
3658
3659
|
if (null !== key) {
|
|
3659
3660
|
var existing = has.call(obj, key);
|
|
3660
|
-
existing && 'combine' === options.duplicates ? obj[key] = utils.combine(obj[key], val, options.arrayLimit, options.plainObjects) : existing && 'last' !== options.duplicates || (obj[key] = val);
|
|
3661
|
+
existing && ('combine' === options.duplicates || part.indexOf('[]=') > -1) ? obj[key] = utils.combine(obj[key], val, options.arrayLimit, options.plainObjects) : existing && 'last' !== options.duplicates || (obj[key] = val);
|
|
3661
3662
|
}
|
|
3662
3663
|
}
|
|
3663
3664
|
return obj;
|
|
@@ -3743,6 +3744,7 @@ var __webpack_modules__ = {
|
|
|
3743
3744
|
parseArrays: !1 !== opts.parseArrays,
|
|
3744
3745
|
plainObjects: 'boolean' == typeof opts.plainObjects ? opts.plainObjects : defaults.plainObjects,
|
|
3745
3746
|
strictDepth: 'boolean' == typeof opts.strictDepth ? !!opts.strictDepth : defaults.strictDepth,
|
|
3747
|
+
strictMerge: 'boolean' == typeof opts.strictMerge ? !!opts.strictMerge : defaults.strictMerge,
|
|
3746
3748
|
strictNullHandling: 'boolean' == typeof opts.strictNullHandling ? opts.strictNullHandling : defaults.strictNullHandling,
|
|
3747
3749
|
throwOnLimitExceeded: 'boolean' == typeof opts.throwOnLimitExceeded && opts.throwOnLimitExceeded
|
|
3748
3750
|
};
|
|
@@ -3761,9 +3763,9 @@ var __webpack_modules__ = {
|
|
|
3761
3763
|
return !0 === options.allowSparse ? obj : utils.compact(obj);
|
|
3762
3764
|
};
|
|
3763
3765
|
},
|
|
3764
|
-
"../../node_modules/.pnpm/qs@6.
|
|
3766
|
+
"../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/stringify.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
3765
3767
|
"use strict";
|
|
3766
|
-
var getSideChannel = __webpack_require__("../../node_modules/.pnpm/side-channel@1.1.0/node_modules/side-channel/index.js"), utils = __webpack_require__("../../node_modules/.pnpm/qs@6.
|
|
3768
|
+
var getSideChannel = __webpack_require__("../../node_modules/.pnpm/side-channel@1.1.0/node_modules/side-channel/index.js"), utils = __webpack_require__("../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/utils.js"), formats = __webpack_require__("../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/formats.js"), has = Object.prototype.hasOwnProperty, arrayPrefixGenerators = {
|
|
3767
3769
|
brackets: function(prefix) {
|
|
3768
3770
|
return prefix + '[]';
|
|
3769
3771
|
},
|
|
@@ -3894,9 +3896,9 @@ var __webpack_modules__ = {
|
|
|
3894
3896
|
return options.charsetSentinel && ('iso-8859-1' === options.charset ? prefix += 'utf8=%26%2310003%3B&' : prefix += 'utf8=%E2%9C%93&'), joined.length > 0 ? prefix + joined : '';
|
|
3895
3897
|
};
|
|
3896
3898
|
},
|
|
3897
|
-
"../../node_modules/.pnpm/qs@6.
|
|
3899
|
+
"../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/utils.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
3898
3900
|
"use strict";
|
|
3899
|
-
var formats = __webpack_require__("../../node_modules/.pnpm/qs@6.
|
|
3901
|
+
var formats = __webpack_require__("../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/formats.js"), getSideChannel = __webpack_require__("../../node_modules/.pnpm/side-channel@1.1.0/node_modules/side-channel/index.js"), has = Object.prototype.hasOwnProperty, isArray = Array.isArray, overflowChannel = getSideChannel(), markOverflow = function(obj, maxIndex) {
|
|
3900
3902
|
return overflowChannel.set(obj, maxIndex), obj;
|
|
3901
3903
|
}, isOverflow = function(obj) {
|
|
3902
3904
|
return overflowChannel.has(obj);
|
|
@@ -4024,7 +4026,13 @@ var __webpack_modules__ = {
|
|
|
4024
4026
|
else if (isOverflow(target)) {
|
|
4025
4027
|
var newIndex = getMaxIndex(target) + 1;
|
|
4026
4028
|
target[newIndex] = source, setMaxIndex(target, newIndex);
|
|
4027
|
-
} else
|
|
4029
|
+
} else {
|
|
4030
|
+
if (options && options.strictMerge) return [
|
|
4031
|
+
target,
|
|
4032
|
+
source
|
|
4033
|
+
];
|
|
4034
|
+
(options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) && (target[source] = !0);
|
|
4035
|
+
}
|
|
4028
4036
|
return target;
|
|
4029
4037
|
}
|
|
4030
4038
|
if (!target || 'object' != typeof target) {
|
|
@@ -4325,7 +4333,7 @@ var __webpack_modules__ = {
|
|
|
4325
4333
|
return this._array.slice();
|
|
4326
4334
|
}
|
|
4327
4335
|
}
|
|
4328
|
-
exports1.
|
|
4336
|
+
exports1.C = ArraySet;
|
|
4329
4337
|
},
|
|
4330
4338
|
"../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/base64-vlq.js" (__unused_rspack_module, exports1, __webpack_require__) {
|
|
4331
4339
|
let base64 = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/base64.js");
|
|
@@ -4357,7 +4365,7 @@ var __webpack_modules__ = {
|
|
|
4357
4365
|
},
|
|
4358
4366
|
"../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/mapping-list.js" (__unused_rspack_module, exports1, __webpack_require__) {
|
|
4359
4367
|
let util = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/util.js");
|
|
4360
|
-
exports1.
|
|
4368
|
+
exports1.P = class {
|
|
4361
4369
|
constructor(){
|
|
4362
4370
|
this._array = [], this._sorted = !0, this._last = {
|
|
4363
4371
|
generatedLine: -1,
|
|
@@ -4392,7 +4400,7 @@ var __webpack_modules__ = {
|
|
|
4392
4400
|
};
|
|
4393
4401
|
},
|
|
4394
4402
|
"../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/source-map-consumer.js" (__unused_rspack_module, exports1, __webpack_require__) {
|
|
4395
|
-
let util = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/util.js"), binarySearch = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/binary-search.js"), ArraySet = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/array-set.js").
|
|
4403
|
+
let util = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/util.js"), binarySearch = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/binary-search.js"), ArraySet = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/array-set.js").C;
|
|
4396
4404
|
__webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/base64-vlq.js");
|
|
4397
4405
|
let readWasm = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/read-wasm.js"), wasm = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/wasm.js"), INTERNAL = Symbol("smcInternal");
|
|
4398
4406
|
class SourceMapConsumer {
|
|
@@ -4709,7 +4717,7 @@ var __webpack_modules__ = {
|
|
|
4709
4717
|
}
|
|
4710
4718
|
},
|
|
4711
4719
|
"../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/source-map-generator.js" (__unused_rspack_module, exports1, __webpack_require__) {
|
|
4712
|
-
let base64VLQ = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/base64-vlq.js"), util = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/util.js"), ArraySet = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/array-set.js").
|
|
4720
|
+
let base64VLQ = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/base64-vlq.js"), util = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/util.js"), ArraySet = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/array-set.js").C, MappingList = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/mapping-list.js").P;
|
|
4713
4721
|
class SourceMapGenerator {
|
|
4714
4722
|
constructor(aArgs){
|
|
4715
4723
|
aArgs || (aArgs = {}), this._file = util.getArg(aArgs, "file", null), this._sourceRoot = util.getArg(aArgs, "sourceRoot", null), this._skipValidation = util.getArg(aArgs, "skipValidation", !1), this._sources = new ArraySet(), this._names = new ArraySet(), this._mappings = new MappingList(), this._sourcesContents = null;
|
|
@@ -4822,10 +4830,10 @@ var __webpack_modules__ = {
|
|
|
4822
4830
|
return JSON.stringify(this.toJSON());
|
|
4823
4831
|
}
|
|
4824
4832
|
}
|
|
4825
|
-
SourceMapGenerator.prototype._version = 3, exports1.
|
|
4833
|
+
SourceMapGenerator.prototype._version = 3, exports1.x = SourceMapGenerator;
|
|
4826
4834
|
},
|
|
4827
4835
|
"../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/source-node.js" (__unused_rspack_module, exports1, __webpack_require__) {
|
|
4828
|
-
__webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/source-map-generator.js").
|
|
4836
|
+
__webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/source-map-generator.js").x, __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/util.js");
|
|
4829
4837
|
},
|
|
4830
4838
|
"../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/url.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
4831
4839
|
"use strict";
|
|
@@ -4875,13 +4883,13 @@ var __webpack_modules__ = {
|
|
|
4875
4883
|
return new URL1(url, base).toString();
|
|
4876
4884
|
}
|
|
4877
4885
|
function buildSafeBase(str) {
|
|
4878
|
-
let maxDotParts = str.split("..").length - 1, segment = function(
|
|
4886
|
+
let maxDotParts = str.split("..").length - 1, segment = function(str) {
|
|
4879
4887
|
let id = 0;
|
|
4880
4888
|
for(;;){
|
|
4881
4889
|
let ident = "p" + id++;
|
|
4882
4890
|
if (-1 === str.indexOf(ident)) return ident;
|
|
4883
4891
|
}
|
|
4884
|
-
}(
|
|
4892
|
+
}(str), base = `${PROTOCOL_AND_HOST}/`;
|
|
4885
4893
|
for(let i = 0; i < maxDotParts; i++)base += `${segment}/`;
|
|
4886
4894
|
return base;
|
|
4887
4895
|
}
|
|
@@ -4911,7 +4919,7 @@ var __webpack_modules__ = {
|
|
|
4911
4919
|
let base = buildSafeBase(aPath + aRoot), newPath = withBase(aPath, withBase(aRoot, base));
|
|
4912
4920
|
return computeRelativeURL(base, newPath);
|
|
4913
4921
|
}
|
|
4914
|
-
exports1.
|
|
4922
|
+
exports1.join = join, exports1.relative = function(rootURL, targetURL) {
|
|
4915
4923
|
let result = function(rootURL, targetURL) {
|
|
4916
4924
|
if (getURLType(rootURL) !== getURLType(targetURL)) return null;
|
|
4917
4925
|
let base = buildSafeBase(rootURL + targetURL), root = new URL1(rootURL, base), target = new URL1(targetURL, base);
|
|
@@ -5003,7 +5011,7 @@ var __webpack_modules__ = {
|
|
|
5003
5011
|
};
|
|
5004
5012
|
},
|
|
5005
5013
|
"../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/source-map.js" (__unused_rspack_module, exports1, __webpack_require__) {
|
|
5006
|
-
__webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/source-map-generator.js").
|
|
5014
|
+
__webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/source-map-generator.js").x, exports1.YK = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/source-map-consumer.js").SourceMapConsumer, __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/source-node.js");
|
|
5007
5015
|
},
|
|
5008
5016
|
"../../node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
5009
5017
|
"use strict";
|
|
@@ -5151,6 +5159,1833 @@ var __webpack_modules__ = {
|
|
|
5151
5159
|
}(stream)) for(var listener, listeners = stream.listeners('close'), i = 0; i < listeners.length; i++)('cleanup' === (listener = listeners[i]).name || 'onclose' === listener.name) && listener.call(stream);
|
|
5152
5160
|
};
|
|
5153
5161
|
},
|
|
5162
|
+
"./src/index.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
5163
|
+
"use strict";
|
|
5164
|
+
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
5165
|
+
RsdoctorSDKController: ()=>RsdoctorSDKController,
|
|
5166
|
+
RsdoctorSDK: ()=>RsdoctorSDK,
|
|
5167
|
+
findRoot: ()=>findRoot,
|
|
5168
|
+
RsdoctorPrimarySDK: ()=>RsdoctorPrimarySDK,
|
|
5169
|
+
openBrowser: ()=>openBrowser
|
|
5170
|
+
});
|
|
5171
|
+
var apis_namespaceObject = {};
|
|
5172
|
+
__webpack_require__.r(apis_namespaceObject), __webpack_require__.d(apis_namespaceObject, {
|
|
5173
|
+
AlertsAPI: ()=>AlertsAPI,
|
|
5174
|
+
DataAPI: ()=>DataAPI,
|
|
5175
|
+
FileSystemAPI: ()=>FileSystemAPI,
|
|
5176
|
+
GraphAPI: ()=>GraphAPI,
|
|
5177
|
+
LoaderAPI: ()=>LoaderAPI,
|
|
5178
|
+
PluginAPI: ()=>PluginAPI,
|
|
5179
|
+
ProjectAPI: ()=>ProjectAPI,
|
|
5180
|
+
RendererAPI: ()=>RendererAPI,
|
|
5181
|
+
ResolverAPI: ()=>ResolverAPI
|
|
5182
|
+
});
|
|
5183
|
+
var external_node_fs_ = __webpack_require__("node:fs"), external_node_fs_default = __webpack_require__.n(external_node_fs_);
|
|
5184
|
+
let index_js_namespaceObject = require("../compiled/fs-extra/index.js");
|
|
5185
|
+
var index_js_default = __webpack_require__.n(index_js_namespaceObject), external_path_ = __webpack_require__("path"), external_path_default = __webpack_require__.n(external_path_);
|
|
5186
|
+
let external_module_namespaceObject = require("module"), error_namespaceObject = require("@rsdoctor/utils/error"), types_namespaceObject = require("@rsdoctor/types");
|
|
5187
|
+
var source_map = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/source-map.js");
|
|
5188
|
+
let graph_namespaceObject = require("@rsdoctor/graph"), logger_namespaceObject = require("@rsdoctor/utils/logger"), build_namespaceObject = require("@rsdoctor/utils/build");
|
|
5189
|
+
var external_node_path_ = __webpack_require__("node:path"), external_node_path_default = __webpack_require__.n(external_node_path_), external_fs_ = __webpack_require__("fs"), external_fs_default = __webpack_require__.n(external_fs_);
|
|
5190
|
+
let external_node_querystring_namespaceObject = require("node:querystring"), mimes = {
|
|
5191
|
+
"3g2": "video/3gpp2",
|
|
5192
|
+
"3gp": "video/3gpp",
|
|
5193
|
+
"3gpp": "video/3gpp",
|
|
5194
|
+
"3mf": "model/3mf",
|
|
5195
|
+
aac: "audio/aac",
|
|
5196
|
+
ac: "application/pkix-attr-cert",
|
|
5197
|
+
adp: "audio/adpcm",
|
|
5198
|
+
adts: "audio/aac",
|
|
5199
|
+
ai: "application/postscript",
|
|
5200
|
+
aml: "application/automationml-aml+xml",
|
|
5201
|
+
amlx: "application/automationml-amlx+zip",
|
|
5202
|
+
amr: "audio/amr",
|
|
5203
|
+
apng: "image/apng",
|
|
5204
|
+
appcache: "text/cache-manifest",
|
|
5205
|
+
appinstaller: "application/appinstaller",
|
|
5206
|
+
appx: "application/appx",
|
|
5207
|
+
appxbundle: "application/appxbundle",
|
|
5208
|
+
asc: "application/pgp-keys",
|
|
5209
|
+
atom: "application/atom+xml",
|
|
5210
|
+
atomcat: "application/atomcat+xml",
|
|
5211
|
+
atomdeleted: "application/atomdeleted+xml",
|
|
5212
|
+
atomsvc: "application/atomsvc+xml",
|
|
5213
|
+
au: "audio/basic",
|
|
5214
|
+
avci: "image/avci",
|
|
5215
|
+
avcs: "image/avcs",
|
|
5216
|
+
avif: "image/avif",
|
|
5217
|
+
aw: "application/applixware",
|
|
5218
|
+
bdoc: "application/bdoc",
|
|
5219
|
+
bin: "application/octet-stream",
|
|
5220
|
+
bmp: "image/bmp",
|
|
5221
|
+
bpk: "application/octet-stream",
|
|
5222
|
+
btf: "image/prs.btif",
|
|
5223
|
+
btif: "image/prs.btif",
|
|
5224
|
+
buffer: "application/octet-stream",
|
|
5225
|
+
ccxml: "application/ccxml+xml",
|
|
5226
|
+
cdfx: "application/cdfx+xml",
|
|
5227
|
+
cdmia: "application/cdmi-capability",
|
|
5228
|
+
cdmic: "application/cdmi-container",
|
|
5229
|
+
cdmid: "application/cdmi-domain",
|
|
5230
|
+
cdmio: "application/cdmi-object",
|
|
5231
|
+
cdmiq: "application/cdmi-queue",
|
|
5232
|
+
cer: "application/pkix-cert",
|
|
5233
|
+
cgm: "image/cgm",
|
|
5234
|
+
cjs: "application/node",
|
|
5235
|
+
class: "application/java-vm",
|
|
5236
|
+
coffee: "text/coffeescript",
|
|
5237
|
+
conf: "text/plain",
|
|
5238
|
+
cpl: "application/cpl+xml",
|
|
5239
|
+
cpt: "application/mac-compactpro",
|
|
5240
|
+
crl: "application/pkix-crl",
|
|
5241
|
+
css: "text/css",
|
|
5242
|
+
csv: "text/csv",
|
|
5243
|
+
cu: "application/cu-seeme",
|
|
5244
|
+
cwl: "application/cwl",
|
|
5245
|
+
cww: "application/prs.cww",
|
|
5246
|
+
davmount: "application/davmount+xml",
|
|
5247
|
+
dbk: "application/docbook+xml",
|
|
5248
|
+
deb: "application/octet-stream",
|
|
5249
|
+
def: "text/plain",
|
|
5250
|
+
deploy: "application/octet-stream",
|
|
5251
|
+
dib: "image/bmp",
|
|
5252
|
+
"disposition-notification": "message/disposition-notification",
|
|
5253
|
+
dist: "application/octet-stream",
|
|
5254
|
+
distz: "application/octet-stream",
|
|
5255
|
+
dll: "application/octet-stream",
|
|
5256
|
+
dmg: "application/octet-stream",
|
|
5257
|
+
dms: "application/octet-stream",
|
|
5258
|
+
doc: "application/msword",
|
|
5259
|
+
dot: "application/msword",
|
|
5260
|
+
dpx: "image/dpx",
|
|
5261
|
+
drle: "image/dicom-rle",
|
|
5262
|
+
dsc: "text/prs.lines.tag",
|
|
5263
|
+
dssc: "application/dssc+der",
|
|
5264
|
+
dtd: "application/xml-dtd",
|
|
5265
|
+
dump: "application/octet-stream",
|
|
5266
|
+
dwd: "application/atsc-dwd+xml",
|
|
5267
|
+
ear: "application/java-archive",
|
|
5268
|
+
ecma: "application/ecmascript",
|
|
5269
|
+
elc: "application/octet-stream",
|
|
5270
|
+
emf: "image/emf",
|
|
5271
|
+
eml: "message/rfc822",
|
|
5272
|
+
emma: "application/emma+xml",
|
|
5273
|
+
emotionml: "application/emotionml+xml",
|
|
5274
|
+
eps: "application/postscript",
|
|
5275
|
+
epub: "application/epub+zip",
|
|
5276
|
+
exe: "application/octet-stream",
|
|
5277
|
+
exi: "application/exi",
|
|
5278
|
+
exp: "application/express",
|
|
5279
|
+
exr: "image/aces",
|
|
5280
|
+
ez: "application/andrew-inset",
|
|
5281
|
+
fdf: "application/fdf",
|
|
5282
|
+
fdt: "application/fdt+xml",
|
|
5283
|
+
fits: "image/fits",
|
|
5284
|
+
g3: "image/g3fax",
|
|
5285
|
+
gbr: "application/rpki-ghostbusters",
|
|
5286
|
+
geojson: "application/geo+json",
|
|
5287
|
+
gif: "image/gif",
|
|
5288
|
+
glb: "model/gltf-binary",
|
|
5289
|
+
gltf: "model/gltf+json",
|
|
5290
|
+
gml: "application/gml+xml",
|
|
5291
|
+
gpx: "application/gpx+xml",
|
|
5292
|
+
gram: "application/srgs",
|
|
5293
|
+
grxml: "application/srgs+xml",
|
|
5294
|
+
gxf: "application/gxf",
|
|
5295
|
+
gz: "application/gzip",
|
|
5296
|
+
h261: "video/h261",
|
|
5297
|
+
h263: "video/h263",
|
|
5298
|
+
h264: "video/h264",
|
|
5299
|
+
heic: "image/heic",
|
|
5300
|
+
heics: "image/heic-sequence",
|
|
5301
|
+
heif: "image/heif",
|
|
5302
|
+
heifs: "image/heif-sequence",
|
|
5303
|
+
hej2: "image/hej2k",
|
|
5304
|
+
held: "application/atsc-held+xml",
|
|
5305
|
+
hjson: "application/hjson",
|
|
5306
|
+
hlp: "application/winhlp",
|
|
5307
|
+
hqx: "application/mac-binhex40",
|
|
5308
|
+
hsj2: "image/hsj2",
|
|
5309
|
+
htm: "text/html",
|
|
5310
|
+
html: "text/html",
|
|
5311
|
+
ics: "text/calendar",
|
|
5312
|
+
ief: "image/ief",
|
|
5313
|
+
ifb: "text/calendar",
|
|
5314
|
+
iges: "model/iges",
|
|
5315
|
+
igs: "model/iges",
|
|
5316
|
+
img: "application/octet-stream",
|
|
5317
|
+
in: "text/plain",
|
|
5318
|
+
ini: "text/plain",
|
|
5319
|
+
ink: "application/inkml+xml",
|
|
5320
|
+
inkml: "application/inkml+xml",
|
|
5321
|
+
ipfix: "application/ipfix",
|
|
5322
|
+
iso: "application/octet-stream",
|
|
5323
|
+
its: "application/its+xml",
|
|
5324
|
+
jade: "text/jade",
|
|
5325
|
+
jar: "application/java-archive",
|
|
5326
|
+
jhc: "image/jphc",
|
|
5327
|
+
jls: "image/jls",
|
|
5328
|
+
jp2: "image/jp2",
|
|
5329
|
+
jpe: "image/jpeg",
|
|
5330
|
+
jpeg: "image/jpeg",
|
|
5331
|
+
jpf: "image/jpx",
|
|
5332
|
+
jpg: "image/jpeg",
|
|
5333
|
+
jpg2: "image/jp2",
|
|
5334
|
+
jpgm: "image/jpm",
|
|
5335
|
+
jpgv: "video/jpeg",
|
|
5336
|
+
jph: "image/jph",
|
|
5337
|
+
jpm: "image/jpm",
|
|
5338
|
+
jpx: "image/jpx",
|
|
5339
|
+
js: "text/javascript",
|
|
5340
|
+
json: "application/json",
|
|
5341
|
+
json5: "application/json5",
|
|
5342
|
+
jsonld: "application/ld+json",
|
|
5343
|
+
jsonml: "application/jsonml+json",
|
|
5344
|
+
jsx: "text/jsx",
|
|
5345
|
+
jt: "model/jt",
|
|
5346
|
+
jxr: "image/jxr",
|
|
5347
|
+
jxra: "image/jxra",
|
|
5348
|
+
jxrs: "image/jxrs",
|
|
5349
|
+
jxs: "image/jxs",
|
|
5350
|
+
jxsc: "image/jxsc",
|
|
5351
|
+
jxsi: "image/jxsi",
|
|
5352
|
+
jxss: "image/jxss",
|
|
5353
|
+
kar: "audio/midi",
|
|
5354
|
+
ktx: "image/ktx",
|
|
5355
|
+
ktx2: "image/ktx2",
|
|
5356
|
+
less: "text/less",
|
|
5357
|
+
lgr: "application/lgr+xml",
|
|
5358
|
+
list: "text/plain",
|
|
5359
|
+
litcoffee: "text/coffeescript",
|
|
5360
|
+
log: "text/plain",
|
|
5361
|
+
lostxml: "application/lost+xml",
|
|
5362
|
+
lrf: "application/octet-stream",
|
|
5363
|
+
m1v: "video/mpeg",
|
|
5364
|
+
m21: "application/mp21",
|
|
5365
|
+
m2a: "audio/mpeg",
|
|
5366
|
+
m2v: "video/mpeg",
|
|
5367
|
+
m3a: "audio/mpeg",
|
|
5368
|
+
m4a: "audio/mp4",
|
|
5369
|
+
m4p: "application/mp4",
|
|
5370
|
+
m4s: "video/iso.segment",
|
|
5371
|
+
ma: "application/mathematica",
|
|
5372
|
+
mads: "application/mads+xml",
|
|
5373
|
+
maei: "application/mmt-aei+xml",
|
|
5374
|
+
man: "text/troff",
|
|
5375
|
+
manifest: "text/cache-manifest",
|
|
5376
|
+
map: "application/json",
|
|
5377
|
+
mar: "application/octet-stream",
|
|
5378
|
+
markdown: "text/markdown",
|
|
5379
|
+
mathml: "application/mathml+xml",
|
|
5380
|
+
mb: "application/mathematica",
|
|
5381
|
+
mbox: "application/mbox",
|
|
5382
|
+
md: "text/markdown",
|
|
5383
|
+
mdx: "text/mdx",
|
|
5384
|
+
me: "text/troff",
|
|
5385
|
+
mesh: "model/mesh",
|
|
5386
|
+
meta4: "application/metalink4+xml",
|
|
5387
|
+
metalink: "application/metalink+xml",
|
|
5388
|
+
mets: "application/mets+xml",
|
|
5389
|
+
mft: "application/rpki-manifest",
|
|
5390
|
+
mid: "audio/midi",
|
|
5391
|
+
midi: "audio/midi",
|
|
5392
|
+
mime: "message/rfc822",
|
|
5393
|
+
mj2: "video/mj2",
|
|
5394
|
+
mjp2: "video/mj2",
|
|
5395
|
+
mjs: "text/javascript",
|
|
5396
|
+
mml: "text/mathml",
|
|
5397
|
+
mods: "application/mods+xml",
|
|
5398
|
+
mov: "video/quicktime",
|
|
5399
|
+
mp2: "audio/mpeg",
|
|
5400
|
+
mp21: "application/mp21",
|
|
5401
|
+
mp2a: "audio/mpeg",
|
|
5402
|
+
mp3: "audio/mpeg",
|
|
5403
|
+
mp4: "video/mp4",
|
|
5404
|
+
mp4a: "audio/mp4",
|
|
5405
|
+
mp4s: "application/mp4",
|
|
5406
|
+
mp4v: "video/mp4",
|
|
5407
|
+
mpd: "application/dash+xml",
|
|
5408
|
+
mpe: "video/mpeg",
|
|
5409
|
+
mpeg: "video/mpeg",
|
|
5410
|
+
mpf: "application/media-policy-dataset+xml",
|
|
5411
|
+
mpg: "video/mpeg",
|
|
5412
|
+
mpg4: "video/mp4",
|
|
5413
|
+
mpga: "audio/mpeg",
|
|
5414
|
+
mpp: "application/dash-patch+xml",
|
|
5415
|
+
mrc: "application/marc",
|
|
5416
|
+
mrcx: "application/marcxml+xml",
|
|
5417
|
+
ms: "text/troff",
|
|
5418
|
+
mscml: "application/mediaservercontrol+xml",
|
|
5419
|
+
msh: "model/mesh",
|
|
5420
|
+
msi: "application/octet-stream",
|
|
5421
|
+
msix: "application/msix",
|
|
5422
|
+
msixbundle: "application/msixbundle",
|
|
5423
|
+
msm: "application/octet-stream",
|
|
5424
|
+
msp: "application/octet-stream",
|
|
5425
|
+
mtl: "model/mtl",
|
|
5426
|
+
musd: "application/mmt-usd+xml",
|
|
5427
|
+
mxf: "application/mxf",
|
|
5428
|
+
mxmf: "audio/mobile-xmf",
|
|
5429
|
+
mxml: "application/xv+xml",
|
|
5430
|
+
n3: "text/n3",
|
|
5431
|
+
nb: "application/mathematica",
|
|
5432
|
+
nq: "application/n-quads",
|
|
5433
|
+
nt: "application/n-triples",
|
|
5434
|
+
obj: "model/obj",
|
|
5435
|
+
oda: "application/oda",
|
|
5436
|
+
oga: "audio/ogg",
|
|
5437
|
+
ogg: "audio/ogg",
|
|
5438
|
+
ogv: "video/ogg",
|
|
5439
|
+
ogx: "application/ogg",
|
|
5440
|
+
omdoc: "application/omdoc+xml",
|
|
5441
|
+
onepkg: "application/onenote",
|
|
5442
|
+
onetmp: "application/onenote",
|
|
5443
|
+
onetoc: "application/onenote",
|
|
5444
|
+
onetoc2: "application/onenote",
|
|
5445
|
+
opf: "application/oebps-package+xml",
|
|
5446
|
+
opus: "audio/ogg",
|
|
5447
|
+
otf: "font/otf",
|
|
5448
|
+
owl: "application/rdf+xml",
|
|
5449
|
+
oxps: "application/oxps",
|
|
5450
|
+
p10: "application/pkcs10",
|
|
5451
|
+
p7c: "application/pkcs7-mime",
|
|
5452
|
+
p7m: "application/pkcs7-mime",
|
|
5453
|
+
p7s: "application/pkcs7-signature",
|
|
5454
|
+
p8: "application/pkcs8",
|
|
5455
|
+
pdf: "application/pdf",
|
|
5456
|
+
pfr: "application/font-tdpfr",
|
|
5457
|
+
pgp: "application/pgp-encrypted",
|
|
5458
|
+
pkg: "application/octet-stream",
|
|
5459
|
+
pki: "application/pkixcmp",
|
|
5460
|
+
pkipath: "application/pkix-pkipath",
|
|
5461
|
+
pls: "application/pls+xml",
|
|
5462
|
+
png: "image/png",
|
|
5463
|
+
prc: "model/prc",
|
|
5464
|
+
prf: "application/pics-rules",
|
|
5465
|
+
provx: "application/provenance+xml",
|
|
5466
|
+
ps: "application/postscript",
|
|
5467
|
+
pskcxml: "application/pskc+xml",
|
|
5468
|
+
pti: "image/prs.pti",
|
|
5469
|
+
qt: "video/quicktime",
|
|
5470
|
+
raml: "application/raml+yaml",
|
|
5471
|
+
rapd: "application/route-apd+xml",
|
|
5472
|
+
rdf: "application/rdf+xml",
|
|
5473
|
+
relo: "application/p2p-overlay+xml",
|
|
5474
|
+
rif: "application/reginfo+xml",
|
|
5475
|
+
rl: "application/resource-lists+xml",
|
|
5476
|
+
rld: "application/resource-lists-diff+xml",
|
|
5477
|
+
rmi: "audio/midi",
|
|
5478
|
+
rnc: "application/relax-ng-compact-syntax",
|
|
5479
|
+
rng: "application/xml",
|
|
5480
|
+
roa: "application/rpki-roa",
|
|
5481
|
+
roff: "text/troff",
|
|
5482
|
+
rq: "application/sparql-query",
|
|
5483
|
+
rs: "application/rls-services+xml",
|
|
5484
|
+
rsat: "application/atsc-rsat+xml",
|
|
5485
|
+
rsd: "application/rsd+xml",
|
|
5486
|
+
rsheet: "application/urc-ressheet+xml",
|
|
5487
|
+
rss: "application/rss+xml",
|
|
5488
|
+
rtf: "text/rtf",
|
|
5489
|
+
rtx: "text/richtext",
|
|
5490
|
+
rusd: "application/route-usd+xml",
|
|
5491
|
+
s3m: "audio/s3m",
|
|
5492
|
+
sbml: "application/sbml+xml",
|
|
5493
|
+
scq: "application/scvp-cv-request",
|
|
5494
|
+
scs: "application/scvp-cv-response",
|
|
5495
|
+
sdp: "application/sdp",
|
|
5496
|
+
senmlx: "application/senml+xml",
|
|
5497
|
+
sensmlx: "application/sensml+xml",
|
|
5498
|
+
ser: "application/java-serialized-object",
|
|
5499
|
+
setpay: "application/set-payment-initiation",
|
|
5500
|
+
setreg: "application/set-registration-initiation",
|
|
5501
|
+
sgi: "image/sgi",
|
|
5502
|
+
sgm: "text/sgml",
|
|
5503
|
+
sgml: "text/sgml",
|
|
5504
|
+
shex: "text/shex",
|
|
5505
|
+
shf: "application/shf+xml",
|
|
5506
|
+
shtml: "text/html",
|
|
5507
|
+
sieve: "application/sieve",
|
|
5508
|
+
sig: "application/pgp-signature",
|
|
5509
|
+
sil: "audio/silk",
|
|
5510
|
+
silo: "model/mesh",
|
|
5511
|
+
siv: "application/sieve",
|
|
5512
|
+
slim: "text/slim",
|
|
5513
|
+
slm: "text/slim",
|
|
5514
|
+
sls: "application/route-s-tsid+xml",
|
|
5515
|
+
smi: "application/smil+xml",
|
|
5516
|
+
smil: "application/smil+xml",
|
|
5517
|
+
snd: "audio/basic",
|
|
5518
|
+
so: "application/octet-stream",
|
|
5519
|
+
spdx: "text/spdx",
|
|
5520
|
+
spp: "application/scvp-vp-response",
|
|
5521
|
+
spq: "application/scvp-vp-request",
|
|
5522
|
+
spx: "audio/ogg",
|
|
5523
|
+
sql: "application/sql",
|
|
5524
|
+
sru: "application/sru+xml",
|
|
5525
|
+
srx: "application/sparql-results+xml",
|
|
5526
|
+
ssdl: "application/ssdl+xml",
|
|
5527
|
+
ssml: "application/ssml+xml",
|
|
5528
|
+
stk: "application/hyperstudio",
|
|
5529
|
+
stl: "model/stl",
|
|
5530
|
+
stpx: "model/step+xml",
|
|
5531
|
+
stpxz: "model/step-xml+zip",
|
|
5532
|
+
stpz: "model/step+zip",
|
|
5533
|
+
styl: "text/stylus",
|
|
5534
|
+
stylus: "text/stylus",
|
|
5535
|
+
svg: "image/svg+xml",
|
|
5536
|
+
svgz: "image/svg+xml",
|
|
5537
|
+
swidtag: "application/swid+xml",
|
|
5538
|
+
t: "text/troff",
|
|
5539
|
+
t38: "image/t38",
|
|
5540
|
+
td: "application/urc-targetdesc+xml",
|
|
5541
|
+
tei: "application/tei+xml",
|
|
5542
|
+
teicorpus: "application/tei+xml",
|
|
5543
|
+
text: "text/plain",
|
|
5544
|
+
tfi: "application/thraud+xml",
|
|
5545
|
+
tfx: "image/tiff-fx",
|
|
5546
|
+
tif: "image/tiff",
|
|
5547
|
+
tiff: "image/tiff",
|
|
5548
|
+
toml: "application/toml",
|
|
5549
|
+
tr: "text/troff",
|
|
5550
|
+
trig: "application/trig",
|
|
5551
|
+
ts: "video/mp2t",
|
|
5552
|
+
tsd: "application/timestamped-data",
|
|
5553
|
+
tsv: "text/tab-separated-values",
|
|
5554
|
+
ttc: "font/collection",
|
|
5555
|
+
ttf: "font/ttf",
|
|
5556
|
+
ttl: "text/turtle",
|
|
5557
|
+
ttml: "application/ttml+xml",
|
|
5558
|
+
txt: "text/plain",
|
|
5559
|
+
u3d: "model/u3d",
|
|
5560
|
+
u8dsn: "message/global-delivery-status",
|
|
5561
|
+
u8hdr: "message/global-headers",
|
|
5562
|
+
u8mdn: "message/global-disposition-notification",
|
|
5563
|
+
u8msg: "message/global",
|
|
5564
|
+
ubj: "application/ubjson",
|
|
5565
|
+
uri: "text/uri-list",
|
|
5566
|
+
uris: "text/uri-list",
|
|
5567
|
+
urls: "text/uri-list",
|
|
5568
|
+
vcard: "text/vcard",
|
|
5569
|
+
vrml: "model/vrml",
|
|
5570
|
+
vtt: "text/vtt",
|
|
5571
|
+
vxml: "application/voicexml+xml",
|
|
5572
|
+
war: "application/java-archive",
|
|
5573
|
+
wasm: "application/wasm",
|
|
5574
|
+
wav: "audio/wav",
|
|
5575
|
+
weba: "audio/webm",
|
|
5576
|
+
webm: "video/webm",
|
|
5577
|
+
webmanifest: "application/manifest+json",
|
|
5578
|
+
webp: "image/webp",
|
|
5579
|
+
wgsl: "text/wgsl",
|
|
5580
|
+
wgt: "application/widget",
|
|
5581
|
+
wif: "application/watcherinfo+xml",
|
|
5582
|
+
wmf: "image/wmf",
|
|
5583
|
+
woff: "font/woff",
|
|
5584
|
+
woff2: "font/woff2",
|
|
5585
|
+
wrl: "model/vrml",
|
|
5586
|
+
wsdl: "application/wsdl+xml",
|
|
5587
|
+
wspolicy: "application/wspolicy+xml",
|
|
5588
|
+
x3d: "model/x3d+xml",
|
|
5589
|
+
x3db: "model/x3d+fastinfoset",
|
|
5590
|
+
x3dbz: "model/x3d+binary",
|
|
5591
|
+
x3dv: "model/x3d-vrml",
|
|
5592
|
+
x3dvz: "model/x3d+vrml",
|
|
5593
|
+
x3dz: "model/x3d+xml",
|
|
5594
|
+
xaml: "application/xaml+xml",
|
|
5595
|
+
xav: "application/xcap-att+xml",
|
|
5596
|
+
xca: "application/xcap-caps+xml",
|
|
5597
|
+
xcs: "application/calendar+xml",
|
|
5598
|
+
xdf: "application/xcap-diff+xml",
|
|
5599
|
+
xdssc: "application/dssc+xml",
|
|
5600
|
+
xel: "application/xcap-el+xml",
|
|
5601
|
+
xenc: "application/xenc+xml",
|
|
5602
|
+
xer: "application/patch-ops-error+xml",
|
|
5603
|
+
xfdf: "application/xfdf",
|
|
5604
|
+
xht: "application/xhtml+xml",
|
|
5605
|
+
xhtml: "application/xhtml+xml",
|
|
5606
|
+
xhvml: "application/xv+xml",
|
|
5607
|
+
xlf: "application/xliff+xml",
|
|
5608
|
+
xm: "audio/xm",
|
|
5609
|
+
xml: "text/xml",
|
|
5610
|
+
xns: "application/xcap-ns+xml",
|
|
5611
|
+
xop: "application/xop+xml",
|
|
5612
|
+
xpl: "application/xproc+xml",
|
|
5613
|
+
xsd: "application/xml",
|
|
5614
|
+
xsf: "application/prs.xsf+xml",
|
|
5615
|
+
xsl: "application/xml",
|
|
5616
|
+
xslt: "application/xml",
|
|
5617
|
+
xspf: "application/xspf+xml",
|
|
5618
|
+
xvm: "application/xv+xml",
|
|
5619
|
+
xvml: "application/xv+xml",
|
|
5620
|
+
yaml: "text/yaml",
|
|
5621
|
+
yang: "application/yang",
|
|
5622
|
+
yin: "application/yin+xml",
|
|
5623
|
+
yml: "text/yaml",
|
|
5624
|
+
zip: "application/zip"
|
|
5625
|
+
}, noop = ()=>{};
|
|
5626
|
+
function toAssume(uri, extns) {
|
|
5627
|
+
let i = 0, x, len = uri.length - 1;
|
|
5628
|
+
47 === uri.charCodeAt(len) && (uri = uri.substring(0, len));
|
|
5629
|
+
let arr = [], tmp = `${uri}/index`;
|
|
5630
|
+
for(; i < extns.length; i++)x = extns[i] ? `.${extns[i]}` : '', uri && arr.push(uri + x), arr.push(tmp + x);
|
|
5631
|
+
return arr;
|
|
5632
|
+
}
|
|
5633
|
+
function viaCache(cache, uri, extns) {
|
|
5634
|
+
let i = 0, data, arr = toAssume(uri, extns);
|
|
5635
|
+
for(; i < arr.length; i++)if (data = cache[arr[i]]) return data;
|
|
5636
|
+
}
|
|
5637
|
+
function viaLocal(dir, isEtag, uri, extns) {
|
|
5638
|
+
let abs, stats, name, headers, i = 0, arr = toAssume(uri, extns);
|
|
5639
|
+
for(; i < arr.length; i++)if ((abs = (0, external_node_path_.normalize)((0, external_node_path_.join)(dir, name = arr[i]))).startsWith(dir) && external_node_fs_.existsSync(abs)) {
|
|
5640
|
+
if ((stats = external_node_fs_.statSync(abs)).isDirectory()) continue;
|
|
5641
|
+
return (headers = toHeaders(name, stats, isEtag))['Cache-Control'] = isEtag ? 'no-cache' : 'no-store', {
|
|
5642
|
+
abs,
|
|
5643
|
+
stats,
|
|
5644
|
+
headers
|
|
5645
|
+
};
|
|
5646
|
+
}
|
|
5647
|
+
}
|
|
5648
|
+
function is404(req, res) {
|
|
5649
|
+
return res.statusCode = 404, res.end();
|
|
5650
|
+
}
|
|
5651
|
+
let ENCODING = {
|
|
5652
|
+
'.br': 'br',
|
|
5653
|
+
'.gz': 'gzip'
|
|
5654
|
+
};
|
|
5655
|
+
function toHeaders(name, stats, isEtag) {
|
|
5656
|
+
let tmp, idx, enc = ENCODING[name.slice(-3)], ctype = mimes[!~(idx = (tmp = ('' + name.slice(0, enc && -3)).trim().toLowerCase()).lastIndexOf('.')) ? tmp : tmp.substring(++idx)] || '';
|
|
5657
|
+
'text/html' === ctype && (ctype += ';charset=utf-8');
|
|
5658
|
+
let headers = {
|
|
5659
|
+
'Content-Length': stats.size,
|
|
5660
|
+
'Content-Type': ctype,
|
|
5661
|
+
'Last-Modified': stats.mtime.toUTCString()
|
|
5662
|
+
};
|
|
5663
|
+
return enc && (headers['Content-Encoding'] = enc), isEtag && (headers.ETag = `W/"${stats.size}-${stats.mtime.getTime()}"`), headers;
|
|
5664
|
+
}
|
|
5665
|
+
let common_namespaceObject = require("@rsdoctor/utils/common"), external_assert_namespaceObject = require("assert");
|
|
5666
|
+
var external_assert_default = __webpack_require__.n(external_assert_namespaceObject), body_parser = __webpack_require__("../../node_modules/.pnpm/body-parser@2.2.2/node_modules/body-parser/index.js"), body_parser_default = __webpack_require__.n(body_parser);
|
|
5667
|
+
let cors_index_js_namespaceObject = require("../compiled/cors/index.js");
|
|
5668
|
+
var cors_index_js_default = __webpack_require__.n(cors_index_js_namespaceObject), external_stream_ = __webpack_require__("stream");
|
|
5669
|
+
let external_socket_io_namespaceObject = require("socket.io");
|
|
5670
|
+
var external_util_ = __webpack_require__("util");
|
|
5671
|
+
class SocketAPILoader {
|
|
5672
|
+
constructor(options){
|
|
5673
|
+
this.options = options, this.dataLoader = new common_namespaceObject.Data.APIDataLoader(this);
|
|
5674
|
+
}
|
|
5675
|
+
async loadManifest() {
|
|
5676
|
+
return this.options.sdk.getManifestData();
|
|
5677
|
+
}
|
|
5678
|
+
async loadData(key) {
|
|
5679
|
+
let data = this.options.sdk.getStoreData(), res = data[key];
|
|
5680
|
+
return key.includes('.') && (res = key.split('.').reduce((t, k)=>t[k], data)), res;
|
|
5681
|
+
}
|
|
5682
|
+
get loadAPIData() {
|
|
5683
|
+
return this.dataLoader.loadAPI;
|
|
5684
|
+
}
|
|
5685
|
+
}
|
|
5686
|
+
class Socket {
|
|
5687
|
+
constructor(options){
|
|
5688
|
+
this.options = options, this.map = new Map(), this.loader = new SocketAPILoader({
|
|
5689
|
+
sdk: options.sdk
|
|
5690
|
+
});
|
|
5691
|
+
}
|
|
5692
|
+
bootstrap() {
|
|
5693
|
+
this.io = new external_socket_io_namespaceObject.Server(this.options.server, {
|
|
5694
|
+
cors: {
|
|
5695
|
+
origin: '*'
|
|
5696
|
+
},
|
|
5697
|
+
...this.options.socketOptions
|
|
5698
|
+
}), this.io.on('connection', (socket)=>{
|
|
5699
|
+
this.setupSocket(socket);
|
|
5700
|
+
});
|
|
5701
|
+
}
|
|
5702
|
+
setupSocket(socket) {
|
|
5703
|
+
Object.values(types_namespaceObject.SDK.ServerAPI.API).forEach((api)=>{
|
|
5704
|
+
socket.on(api, async (body, callback)=>{
|
|
5705
|
+
this.saveRequestToMap(api, body), callback(await this.getAPIResponse(api, body));
|
|
5706
|
+
});
|
|
5707
|
+
});
|
|
5708
|
+
}
|
|
5709
|
+
saveRequestToMap(api, body = null) {
|
|
5710
|
+
this.map.has(api) || this.map.set(api, []);
|
|
5711
|
+
let list = this.map.get(api);
|
|
5712
|
+
list.some((e)=>e === body || (0, external_util_.isDeepStrictEqual)(e, body)) || list.push(body);
|
|
5713
|
+
}
|
|
5714
|
+
async getAPIResponse(api, body) {
|
|
5715
|
+
let data = await this.loader.loadAPIData(api, body);
|
|
5716
|
+
return {
|
|
5717
|
+
req: {
|
|
5718
|
+
api,
|
|
5719
|
+
body
|
|
5720
|
+
},
|
|
5721
|
+
res: data
|
|
5722
|
+
};
|
|
5723
|
+
}
|
|
5724
|
+
async broadcast() {
|
|
5725
|
+
clearImmediate(this.timer), this.timer = setImmediate(async ()=>{
|
|
5726
|
+
let promises = [];
|
|
5727
|
+
this.map.forEach((bodies, api)=>{
|
|
5728
|
+
bodies.forEach((body)=>{
|
|
5729
|
+
promises.push((async ()=>{
|
|
5730
|
+
let res = await this.getAPIResponse(api, body);
|
|
5731
|
+
this.io.emit(api, res);
|
|
5732
|
+
})());
|
|
5733
|
+
});
|
|
5734
|
+
}), await Promise.all(promises);
|
|
5735
|
+
});
|
|
5736
|
+
}
|
|
5737
|
+
sendAPIData(api, msg) {
|
|
5738
|
+
this.io.sockets.emit(api, msg);
|
|
5739
|
+
}
|
|
5740
|
+
dispose() {
|
|
5741
|
+
this.io.disconnectSockets(), this.io.close();
|
|
5742
|
+
}
|
|
5743
|
+
}
|
|
5744
|
+
class Router {
|
|
5745
|
+
static{
|
|
5746
|
+
this.routes = {
|
|
5747
|
+
get: new Map(),
|
|
5748
|
+
post: new Map()
|
|
5749
|
+
};
|
|
5750
|
+
}
|
|
5751
|
+
static get(pathname) {
|
|
5752
|
+
return (target, propertyKey, descriptor)=>{
|
|
5753
|
+
let routes = Router.routes.get;
|
|
5754
|
+
return routes.has(target.constructor) || routes.set(target.constructor, []), routes.get(target.constructor).push([
|
|
5755
|
+
propertyKey,
|
|
5756
|
+
pathname
|
|
5757
|
+
]), descriptor;
|
|
5758
|
+
};
|
|
5759
|
+
}
|
|
5760
|
+
static post(pathname) {
|
|
5761
|
+
return (target, propertyKey, descriptor)=>{
|
|
5762
|
+
let routes = Router.routes.post;
|
|
5763
|
+
return routes.has(target.constructor) || routes.set(target.constructor, []), routes.get(target.constructor).push([
|
|
5764
|
+
propertyKey,
|
|
5765
|
+
pathname
|
|
5766
|
+
]), descriptor;
|
|
5767
|
+
};
|
|
5768
|
+
}
|
|
5769
|
+
constructor(options){
|
|
5770
|
+
this.options = options;
|
|
5771
|
+
}
|
|
5772
|
+
async setup() {
|
|
5773
|
+
let { apis, sdk, server } = this.options;
|
|
5774
|
+
apis.forEach((API)=>{
|
|
5775
|
+
let obj = new API(sdk, server);
|
|
5776
|
+
Router.routes.get.forEach((v, cons)=>{
|
|
5777
|
+
v.forEach(([key, pathname])=>{
|
|
5778
|
+
cons === API && server.get(pathname, this.wrapAPIFunction(obj, key));
|
|
5779
|
+
});
|
|
5780
|
+
}), Router.routes.post.forEach((v, cons)=>{
|
|
5781
|
+
v.forEach(([key, pathname])=>{
|
|
5782
|
+
cons === API && server.post(pathname, this.wrapAPIFunction(obj, key));
|
|
5783
|
+
});
|
|
5784
|
+
});
|
|
5785
|
+
});
|
|
5786
|
+
}
|
|
5787
|
+
wrapAPIFunction(api, key) {
|
|
5788
|
+
let { sdk, server } = this.options;
|
|
5789
|
+
return async (req, res)=>{
|
|
5790
|
+
let ctx = {
|
|
5791
|
+
req,
|
|
5792
|
+
res,
|
|
5793
|
+
sdk,
|
|
5794
|
+
server
|
|
5795
|
+
}, trap = new Proxy(api, {
|
|
5796
|
+
get: (target, key, receiver)=>'ctx' === key ? ctx : Reflect.get(target, key, receiver),
|
|
5797
|
+
set: (target, key, value, receiver)=>Reflect.set(target, key, value, receiver),
|
|
5798
|
+
defineProperty: (target, p, attrs)=>Reflect.defineProperty(target, p, attrs)
|
|
5799
|
+
}), fn = api[key], result = await fn.call(trap, trap);
|
|
5800
|
+
return 'string' == typeof result ? Buffer.from(result, 'utf-8') : result && 'object' == typeof result ? Buffer.from(JSON.stringify(result), 'utf-8') : result;
|
|
5801
|
+
};
|
|
5802
|
+
}
|
|
5803
|
+
}
|
|
5804
|
+
class BaseAPI {
|
|
5805
|
+
constructor(sdk, server){
|
|
5806
|
+
this.ctx = {
|
|
5807
|
+
sdk,
|
|
5808
|
+
server
|
|
5809
|
+
}, this.dataLoader = new common_namespaceObject.Data.APIDataLoader(this);
|
|
5810
|
+
}
|
|
5811
|
+
async loadManifest() {
|
|
5812
|
+
return this.ctx.sdk.getManifestData();
|
|
5813
|
+
}
|
|
5814
|
+
async loadData(key) {
|
|
5815
|
+
let data = this.ctx.sdk.getStoreData(), res = data[key];
|
|
5816
|
+
return key.includes('.') && (res = key.split('.').reduce((t, k)=>t[k], data)), res;
|
|
5817
|
+
}
|
|
5818
|
+
}
|
|
5819
|
+
function _ts_metadata(k, v) {
|
|
5820
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
5821
|
+
}
|
|
5822
|
+
class AlertsAPI extends BaseAPI {
|
|
5823
|
+
async getPackageRelationAlertDetails() {
|
|
5824
|
+
let { req } = this.ctx, { id, target } = req.body;
|
|
5825
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetPackageRelationAlertDetails, {
|
|
5826
|
+
id,
|
|
5827
|
+
target
|
|
5828
|
+
});
|
|
5829
|
+
}
|
|
5830
|
+
}
|
|
5831
|
+
function data_ts_decorate(decorators, target, key, desc) {
|
|
5832
|
+
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
5833
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
5834
|
+
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
5835
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5836
|
+
}
|
|
5837
|
+
function data_ts_metadata(k, v) {
|
|
5838
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
5839
|
+
}
|
|
5840
|
+
!function(decorators, target, key, desc) {
|
|
5841
|
+
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
5842
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
5843
|
+
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
5844
|
+
c > 3 && r && Object.defineProperty(target, key, r);
|
|
5845
|
+
}([
|
|
5846
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetPackageRelationAlertDetails),
|
|
5847
|
+
_ts_metadata("design:type", Function),
|
|
5848
|
+
_ts_metadata("design:paramtypes", []),
|
|
5849
|
+
_ts_metadata("design:returntype", Promise)
|
|
5850
|
+
], AlertsAPI.prototype, "getPackageRelationAlertDetails", null);
|
|
5851
|
+
class DataAPI extends BaseAPI {
|
|
5852
|
+
async loadDataByKey() {
|
|
5853
|
+
let { req } = this.ctx, { url } = req, { key } = req.body;
|
|
5854
|
+
return !key && url && (key = new URL(url, 'http://127.0.0.1').pathname.replace(/^\//, '')), await this.loadData(key);
|
|
5855
|
+
}
|
|
5856
|
+
async sendMessageToClient() {
|
|
5857
|
+
let { req, server } = this.ctx, { api, data } = req.body;
|
|
5858
|
+
await server.sendAPIDataToClient(api, data);
|
|
5859
|
+
}
|
|
5860
|
+
}
|
|
5861
|
+
function fs_ts_metadata(k, v) {
|
|
5862
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
5863
|
+
}
|
|
5864
|
+
data_ts_decorate([
|
|
5865
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.LoadDataByKey),
|
|
5866
|
+
data_ts_metadata("design:type", Function),
|
|
5867
|
+
data_ts_metadata("design:paramtypes", []),
|
|
5868
|
+
data_ts_metadata("design:returntype", Promise)
|
|
5869
|
+
], DataAPI.prototype, "loadDataByKey", null), data_ts_decorate([
|
|
5870
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.SendAPIDataToClient),
|
|
5871
|
+
data_ts_metadata("design:type", Function),
|
|
5872
|
+
data_ts_metadata("design:paramtypes", []),
|
|
5873
|
+
data_ts_metadata("design:returntype", Promise)
|
|
5874
|
+
], DataAPI.prototype, "sendMessageToClient", null);
|
|
5875
|
+
class FileSystemAPI extends BaseAPI {
|
|
5876
|
+
async applyErrorFix() {
|
|
5877
|
+
let { body } = this.ctx.req;
|
|
5878
|
+
return await this.ctx.sdk.applyErrorFix(body.id), 'success';
|
|
5879
|
+
}
|
|
5880
|
+
}
|
|
5881
|
+
function loader_ts_decorate(decorators, target, key, desc) {
|
|
5882
|
+
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
5883
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
5884
|
+
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
5885
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5886
|
+
}
|
|
5887
|
+
function loader_ts_metadata(k, v) {
|
|
5888
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
5889
|
+
}
|
|
5890
|
+
!function(decorators, target, key, desc) {
|
|
5891
|
+
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
5892
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
5893
|
+
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
5894
|
+
c > 3 && r && Object.defineProperty(target, key, r);
|
|
5895
|
+
}([
|
|
5896
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.ApplyErrorFix),
|
|
5897
|
+
fs_ts_metadata("design:type", Function),
|
|
5898
|
+
fs_ts_metadata("design:paramtypes", []),
|
|
5899
|
+
fs_ts_metadata("design:returntype", Promise)
|
|
5900
|
+
], FileSystemAPI.prototype, "applyErrorFix", null);
|
|
5901
|
+
class LoaderAPI extends BaseAPI {
|
|
5902
|
+
async reportLoader() {
|
|
5903
|
+
let { req, sdk } = this.ctx, { body } = req;
|
|
5904
|
+
return sdk.reportLoader(body), 'ok';
|
|
5905
|
+
}
|
|
5906
|
+
async reportSourceMap() {
|
|
5907
|
+
let { req: { body }, sdk } = this.ctx;
|
|
5908
|
+
return sdk.reportSourceMap(body), 'ok';
|
|
5909
|
+
}
|
|
5910
|
+
async getLoaderNames() {
|
|
5911
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetLoaderNames);
|
|
5912
|
+
}
|
|
5913
|
+
async getLoaderChartData() {
|
|
5914
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetLoaderChartData);
|
|
5915
|
+
}
|
|
5916
|
+
async getLoaderFileTree() {
|
|
5917
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileTree);
|
|
5918
|
+
}
|
|
5919
|
+
async getLoaderFileDetails() {
|
|
5920
|
+
let { req } = this.ctx, { path } = req.body;
|
|
5921
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileDetails, {
|
|
5922
|
+
path
|
|
5923
|
+
});
|
|
5924
|
+
}
|
|
5925
|
+
async getLoaderFolderStatistics() {
|
|
5926
|
+
let { req } = this.ctx, { folder } = req.body;
|
|
5927
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFolderStatistics, {
|
|
5928
|
+
folder
|
|
5929
|
+
});
|
|
5930
|
+
}
|
|
5931
|
+
async getLoaderFileFirstInput() {
|
|
5932
|
+
let { req } = this.ctx, { file } = req.body;
|
|
5933
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileFirstInput, {
|
|
5934
|
+
file
|
|
5935
|
+
});
|
|
5936
|
+
}
|
|
5937
|
+
async getLoaderFileInputAndOutput() {
|
|
5938
|
+
let { req } = this.ctx, { file, loader, loaderIndex } = req.body;
|
|
5939
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileInputAndOutput, {
|
|
5940
|
+
file,
|
|
5941
|
+
loader,
|
|
5942
|
+
loaderIndex
|
|
5943
|
+
});
|
|
5944
|
+
}
|
|
5945
|
+
}
|
|
5946
|
+
function graph_ts_decorate(decorators, target, key, desc) {
|
|
5947
|
+
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
5948
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
5949
|
+
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
5950
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5951
|
+
}
|
|
5952
|
+
function graph_ts_metadata(k, v) {
|
|
5953
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
5954
|
+
}
|
|
5955
|
+
loader_ts_decorate([
|
|
5956
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.ReportLoader),
|
|
5957
|
+
loader_ts_metadata("design:type", Function),
|
|
5958
|
+
loader_ts_metadata("design:paramtypes", []),
|
|
5959
|
+
loader_ts_metadata("design:returntype", Promise)
|
|
5960
|
+
], LoaderAPI.prototype, "reportLoader", null), loader_ts_decorate([
|
|
5961
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.ReportSourceMap),
|
|
5962
|
+
loader_ts_metadata("design:type", Function),
|
|
5963
|
+
loader_ts_metadata("design:paramtypes", []),
|
|
5964
|
+
loader_ts_metadata("design:returntype", Promise)
|
|
5965
|
+
], LoaderAPI.prototype, "reportSourceMap", null), loader_ts_decorate([
|
|
5966
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetLoaderNames),
|
|
5967
|
+
loader_ts_metadata("design:type", Function),
|
|
5968
|
+
loader_ts_metadata("design:paramtypes", []),
|
|
5969
|
+
loader_ts_metadata("design:returntype", Promise)
|
|
5970
|
+
], LoaderAPI.prototype, "getLoaderNames", null), loader_ts_decorate([
|
|
5971
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetLoaderChartData),
|
|
5972
|
+
loader_ts_metadata("design:type", Function),
|
|
5973
|
+
loader_ts_metadata("design:paramtypes", []),
|
|
5974
|
+
loader_ts_metadata("design:returntype", Promise)
|
|
5975
|
+
], LoaderAPI.prototype, "getLoaderChartData", null), loader_ts_decorate([
|
|
5976
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileTree),
|
|
5977
|
+
loader_ts_metadata("design:type", Function),
|
|
5978
|
+
loader_ts_metadata("design:paramtypes", []),
|
|
5979
|
+
loader_ts_metadata("design:returntype", Promise)
|
|
5980
|
+
], LoaderAPI.prototype, "getLoaderFileTree", null), loader_ts_decorate([
|
|
5981
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileDetails),
|
|
5982
|
+
loader_ts_metadata("design:type", Function),
|
|
5983
|
+
loader_ts_metadata("design:paramtypes", []),
|
|
5984
|
+
loader_ts_metadata("design:returntype", Promise)
|
|
5985
|
+
], LoaderAPI.prototype, "getLoaderFileDetails", null), loader_ts_decorate([
|
|
5986
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFolderStatistics),
|
|
5987
|
+
loader_ts_metadata("design:type", Function),
|
|
5988
|
+
loader_ts_metadata("design:paramtypes", []),
|
|
5989
|
+
loader_ts_metadata("design:returntype", Promise)
|
|
5990
|
+
], LoaderAPI.prototype, "getLoaderFolderStatistics", null), loader_ts_decorate([
|
|
5991
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileFirstInput),
|
|
5992
|
+
loader_ts_metadata("design:type", Function),
|
|
5993
|
+
loader_ts_metadata("design:paramtypes", []),
|
|
5994
|
+
loader_ts_metadata("design:returntype", Promise)
|
|
5995
|
+
], LoaderAPI.prototype, "getLoaderFileFirstInput", null), loader_ts_decorate([
|
|
5996
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileInputAndOutput),
|
|
5997
|
+
loader_ts_metadata("design:type", Function),
|
|
5998
|
+
loader_ts_metadata("design:paramtypes", []),
|
|
5999
|
+
loader_ts_metadata("design:returntype", Promise)
|
|
6000
|
+
], LoaderAPI.prototype, "getLoaderFileInputAndOutput", null);
|
|
6001
|
+
class GraphAPI extends BaseAPI {
|
|
6002
|
+
async getAssetsSummary() {
|
|
6003
|
+
let { req } = this.ctx, { withFileContent } = req.body;
|
|
6004
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetAssetsSummary, {
|
|
6005
|
+
withFileContent
|
|
6006
|
+
});
|
|
6007
|
+
}
|
|
6008
|
+
async getModuleGraphForAsset() {
|
|
6009
|
+
let { req } = this.ctx, { assetPath } = req.body;
|
|
6010
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetAssetDetails, {
|
|
6011
|
+
assetPath
|
|
6012
|
+
});
|
|
6013
|
+
}
|
|
6014
|
+
async getChunksByModuleId() {
|
|
6015
|
+
let { req } = this.ctx, { moduleId } = req.body;
|
|
6016
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetChunksByModuleId, {
|
|
6017
|
+
moduleId
|
|
6018
|
+
});
|
|
6019
|
+
}
|
|
6020
|
+
async getModuleDetails() {
|
|
6021
|
+
let { req } = this.ctx, { moduleId } = req.body;
|
|
6022
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetModuleDetails, {
|
|
6023
|
+
moduleId
|
|
6024
|
+
});
|
|
6025
|
+
}
|
|
6026
|
+
async getDependencyByResolvedRequest() {
|
|
6027
|
+
let { req } = this.ctx, { moduleIds = [] } = req.body;
|
|
6028
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetModulesByModuleIds, {
|
|
6029
|
+
moduleIds
|
|
6030
|
+
});
|
|
6031
|
+
}
|
|
6032
|
+
async getModuleCodeByModuleId() {
|
|
6033
|
+
let { req } = this.ctx, { moduleId } = req.body;
|
|
6034
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetModuleCodeByModuleId, {
|
|
6035
|
+
moduleId
|
|
6036
|
+
});
|
|
6037
|
+
}
|
|
6038
|
+
async getModuleCodeByModuleIds() {
|
|
6039
|
+
let { req } = this.ctx, { moduleIds } = req.body;
|
|
6040
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetModuleCodeByModuleIds, {
|
|
6041
|
+
moduleIds
|
|
6042
|
+
});
|
|
6043
|
+
}
|
|
6044
|
+
async getEntryModulesSummary() {
|
|
6045
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetEntryPoints);
|
|
6046
|
+
}
|
|
6047
|
+
}
|
|
6048
|
+
function plugin_ts_decorate(decorators, target, key, desc) {
|
|
6049
|
+
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
6050
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
6051
|
+
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
6052
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6053
|
+
}
|
|
6054
|
+
function plugin_ts_metadata(k, v) {
|
|
6055
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
6056
|
+
}
|
|
6057
|
+
graph_ts_decorate([
|
|
6058
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetAssetsSummary),
|
|
6059
|
+
graph_ts_metadata("design:type", Function),
|
|
6060
|
+
graph_ts_metadata("design:paramtypes", []),
|
|
6061
|
+
graph_ts_metadata("design:returntype", Promise)
|
|
6062
|
+
], GraphAPI.prototype, "getAssetsSummary", null), graph_ts_decorate([
|
|
6063
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetAssetDetails),
|
|
6064
|
+
graph_ts_metadata("design:type", Function),
|
|
6065
|
+
graph_ts_metadata("design:paramtypes", []),
|
|
6066
|
+
graph_ts_metadata("design:returntype", Promise)
|
|
6067
|
+
], GraphAPI.prototype, "getModuleGraphForAsset", null), graph_ts_decorate([
|
|
6068
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetChunksByModuleId),
|
|
6069
|
+
graph_ts_metadata("design:type", Function),
|
|
6070
|
+
graph_ts_metadata("design:paramtypes", []),
|
|
6071
|
+
graph_ts_metadata("design:returntype", Promise)
|
|
6072
|
+
], GraphAPI.prototype, "getChunksByModuleId", null), graph_ts_decorate([
|
|
6073
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetModuleDetails),
|
|
6074
|
+
graph_ts_metadata("design:type", Function),
|
|
6075
|
+
graph_ts_metadata("design:paramtypes", []),
|
|
6076
|
+
graph_ts_metadata("design:returntype", Promise)
|
|
6077
|
+
], GraphAPI.prototype, "getModuleDetails", null), graph_ts_decorate([
|
|
6078
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetModulesByModuleIds),
|
|
6079
|
+
graph_ts_metadata("design:type", Function),
|
|
6080
|
+
graph_ts_metadata("design:paramtypes", []),
|
|
6081
|
+
graph_ts_metadata("design:returntype", Promise)
|
|
6082
|
+
], GraphAPI.prototype, "getDependencyByResolvedRequest", null), graph_ts_decorate([
|
|
6083
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetModuleCodeByModuleId),
|
|
6084
|
+
graph_ts_metadata("design:type", Function),
|
|
6085
|
+
graph_ts_metadata("design:paramtypes", []),
|
|
6086
|
+
graph_ts_metadata("design:returntype", Promise)
|
|
6087
|
+
], GraphAPI.prototype, "getModuleCodeByModuleId", null), graph_ts_decorate([
|
|
6088
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetModuleCodeByModuleIds),
|
|
6089
|
+
graph_ts_metadata("design:type", Function),
|
|
6090
|
+
graph_ts_metadata("design:paramtypes", []),
|
|
6091
|
+
graph_ts_metadata("design:returntype", Promise)
|
|
6092
|
+
], GraphAPI.prototype, "getModuleCodeByModuleIds", null), graph_ts_decorate([
|
|
6093
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetEntryPoints),
|
|
6094
|
+
graph_ts_metadata("design:type", Function),
|
|
6095
|
+
graph_ts_metadata("design:paramtypes", []),
|
|
6096
|
+
graph_ts_metadata("design:returntype", Promise)
|
|
6097
|
+
], GraphAPI.prototype, "getEntryModulesSummary", null);
|
|
6098
|
+
class PluginAPI extends BaseAPI {
|
|
6099
|
+
async getPluginSummary() {
|
|
6100
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetPluginSummary);
|
|
6101
|
+
}
|
|
6102
|
+
async getPluginData() {
|
|
6103
|
+
let { req } = this.ctx, { hooks = [], tapNames = [] } = req.body;
|
|
6104
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetPluginData, {
|
|
6105
|
+
hooks,
|
|
6106
|
+
tapNames
|
|
6107
|
+
});
|
|
6108
|
+
}
|
|
6109
|
+
}
|
|
6110
|
+
plugin_ts_decorate([
|
|
6111
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetPluginSummary),
|
|
6112
|
+
plugin_ts_metadata("design:type", Function),
|
|
6113
|
+
plugin_ts_metadata("design:paramtypes", []),
|
|
6114
|
+
plugin_ts_metadata("design:returntype", Promise)
|
|
6115
|
+
], PluginAPI.prototype, "getPluginSummary", null), plugin_ts_decorate([
|
|
6116
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetPluginData),
|
|
6117
|
+
plugin_ts_metadata("design:type", Function),
|
|
6118
|
+
plugin_ts_metadata("design:paramtypes", []),
|
|
6119
|
+
plugin_ts_metadata("design:returntype", Promise)
|
|
6120
|
+
], PluginAPI.prototype, "getPluginData", null);
|
|
6121
|
+
var external_os_ = __webpack_require__("os"), external_os_default = __webpack_require__.n(external_os_);
|
|
6122
|
+
function getLocalIpAddress() {
|
|
6123
|
+
for (let iface of Object.values(external_os_default().networkInterfaces()))for (let alias of iface)if ('IPv4' === alias.family && !alias.internal) return alias.address;
|
|
6124
|
+
return '127.0.0.1';
|
|
6125
|
+
}
|
|
6126
|
+
function project_ts_decorate(decorators, target, key, desc) {
|
|
6127
|
+
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
6128
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
6129
|
+
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
6130
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6131
|
+
}
|
|
6132
|
+
function project_ts_metadata(k, v) {
|
|
6133
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
6134
|
+
}
|
|
6135
|
+
class ProjectAPI extends BaseAPI {
|
|
6136
|
+
async env() {
|
|
6137
|
+
let { server } = this.ctx;
|
|
6138
|
+
return {
|
|
6139
|
+
ip: getLocalIpAddress(),
|
|
6140
|
+
port: server.port
|
|
6141
|
+
};
|
|
6142
|
+
}
|
|
6143
|
+
async manifest() {
|
|
6144
|
+
let { sdk } = this.ctx;
|
|
6145
|
+
return JSON.stringify(sdk.getManifestData());
|
|
6146
|
+
}
|
|
6147
|
+
async getProjectInfo() {
|
|
6148
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetProjectInfo);
|
|
6149
|
+
}
|
|
6150
|
+
async getClientRoutes() {
|
|
6151
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetClientRoutes);
|
|
6152
|
+
}
|
|
6153
|
+
}
|
|
6154
|
+
function renderer_ts_metadata(k, v) {
|
|
6155
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
6156
|
+
}
|
|
6157
|
+
project_ts_decorate([
|
|
6158
|
+
Router.get(types_namespaceObject.SDK.ServerAPI.API.Env),
|
|
6159
|
+
project_ts_metadata("design:type", Function),
|
|
6160
|
+
project_ts_metadata("design:paramtypes", []),
|
|
6161
|
+
project_ts_metadata("design:returntype", Promise)
|
|
6162
|
+
], ProjectAPI.prototype, "env", null), project_ts_decorate([
|
|
6163
|
+
Router.get(types_namespaceObject.SDK.ServerAPI.API.Manifest),
|
|
6164
|
+
project_ts_metadata("design:type", Function),
|
|
6165
|
+
project_ts_metadata("design:paramtypes", []),
|
|
6166
|
+
project_ts_metadata("design:returntype", Promise)
|
|
6167
|
+
], ProjectAPI.prototype, "manifest", null), project_ts_decorate([
|
|
6168
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetProjectInfo),
|
|
6169
|
+
project_ts_metadata("design:type", Function),
|
|
6170
|
+
project_ts_metadata("design:paramtypes", []),
|
|
6171
|
+
project_ts_metadata("design:returntype", Promise)
|
|
6172
|
+
], ProjectAPI.prototype, "getProjectInfo", null), project_ts_decorate([
|
|
6173
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetClientRoutes),
|
|
6174
|
+
project_ts_metadata("design:type", Function),
|
|
6175
|
+
project_ts_metadata("design:paramtypes", []),
|
|
6176
|
+
project_ts_metadata("design:returntype", Promise)
|
|
6177
|
+
], ProjectAPI.prototype, "getClientRoutes", null);
|
|
6178
|
+
let renderer_require = (0, external_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
|
|
6179
|
+
class RendererAPI extends BaseAPI {
|
|
6180
|
+
async entryHtml() {
|
|
6181
|
+
let { server, res } = this.ctx, clientHtmlPath = server.innerClientPath ? server.innerClientPath : renderer_require.resolve('@rsdoctor/client'), clientHtml = external_node_fs_default().readFileSync(clientHtmlPath, 'utf-8');
|
|
6182
|
+
return res.setHeader('Content-Type', 'text/html'), res.setHeader('Cache-Control', 'no-store'), clientHtml;
|
|
6183
|
+
}
|
|
6184
|
+
}
|
|
6185
|
+
function resolver_ts_decorate(decorators, target, key, desc) {
|
|
6186
|
+
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
6187
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
6188
|
+
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
6189
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6190
|
+
}
|
|
6191
|
+
function resolver_ts_metadata(k, v) {
|
|
6192
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
6193
|
+
}
|
|
6194
|
+
!function(decorators, target, key, desc) {
|
|
6195
|
+
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
6196
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
6197
|
+
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
6198
|
+
c > 3 && r && Object.defineProperty(target, key, r);
|
|
6199
|
+
}([
|
|
6200
|
+
Router.get(types_namespaceObject.SDK.ServerAPI.API.EntryHtml),
|
|
6201
|
+
renderer_ts_metadata("design:type", Function),
|
|
6202
|
+
renderer_ts_metadata("design:paramtypes", []),
|
|
6203
|
+
renderer_ts_metadata("design:returntype", Promise)
|
|
6204
|
+
], RendererAPI.prototype, "entryHtml", null);
|
|
6205
|
+
class ResolverAPI extends BaseAPI {
|
|
6206
|
+
async getResolverFileTree() {
|
|
6207
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetResolverFileTree);
|
|
6208
|
+
}
|
|
6209
|
+
async getResolverFileDetails() {
|
|
6210
|
+
let { req } = this.ctx, { filepath } = req.body;
|
|
6211
|
+
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetResolverFileDetails, {
|
|
6212
|
+
filepath
|
|
6213
|
+
});
|
|
6214
|
+
}
|
|
6215
|
+
}
|
|
6216
|
+
resolver_ts_decorate([
|
|
6217
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetResolverFileTree),
|
|
6218
|
+
resolver_ts_metadata("design:type", Function),
|
|
6219
|
+
resolver_ts_metadata("design:paramtypes", []),
|
|
6220
|
+
resolver_ts_metadata("design:returntype", Promise)
|
|
6221
|
+
], ResolverAPI.prototype, "getResolverFileTree", null), resolver_ts_decorate([
|
|
6222
|
+
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetResolverFileDetails),
|
|
6223
|
+
resolver_ts_metadata("design:type", Function),
|
|
6224
|
+
resolver_ts_metadata("design:paramtypes", []),
|
|
6225
|
+
resolver_ts_metadata("design:returntype", Promise)
|
|
6226
|
+
], ResolverAPI.prototype, "getResolverFileDetails", null);
|
|
6227
|
+
var external_node_child_process_ = __webpack_require__("node:child_process");
|
|
6228
|
+
let execAsync = (0, __webpack_require__("node:util").promisify)(external_node_child_process_.exec), supportedChromiumBrowsers = [
|
|
6229
|
+
'Google Chrome Canary',
|
|
6230
|
+
'Google Chrome Dev',
|
|
6231
|
+
'Google Chrome Beta',
|
|
6232
|
+
'Google Chrome',
|
|
6233
|
+
'Microsoft Edge',
|
|
6234
|
+
'Brave Browser',
|
|
6235
|
+
'Vivaldi',
|
|
6236
|
+
'Chromium'
|
|
6237
|
+
], getTargetBrowser = async ()=>{
|
|
6238
|
+
let targetBrowser = process.env.BROWSER;
|
|
6239
|
+
if (!targetBrowser || !supportedChromiumBrowsers.includes(targetBrowser)) {
|
|
6240
|
+
let { stdout: ps } = await execAsync('ps cax');
|
|
6241
|
+
targetBrowser = supportedChromiumBrowsers.find((b)=>ps.includes(b));
|
|
6242
|
+
}
|
|
6243
|
+
return targetBrowser;
|
|
6244
|
+
};
|
|
6245
|
+
async function openBrowser(url, needEncodeURI = !0) {
|
|
6246
|
+
if ('darwin' === process.platform || 'win32' === process.platform) try {
|
|
6247
|
+
let targetBrowser = await getTargetBrowser();
|
|
6248
|
+
if (targetBrowser) return await execAsync(`osascript openChrome.applescript "${needEncodeURI ? encodeURI(url) : url}" "${targetBrowser}"`, {
|
|
6249
|
+
cwd: (0, external_node_path_.join)(__dirname, '../static')
|
|
6250
|
+
}), !0;
|
|
6251
|
+
logger_namespaceObject.logger.debug('Failed to find the target browser.');
|
|
6252
|
+
let { default: open } = await __webpack_require__.e("344").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js"));
|
|
6253
|
+
return await open(url), !0;
|
|
6254
|
+
} catch (err) {
|
|
6255
|
+
logger_namespaceObject.logger.debug("Failed to open Rsdoctor URL with apple script."), logger_namespaceObject.logger.debug(err);
|
|
6256
|
+
}
|
|
6257
|
+
else try {
|
|
6258
|
+
let { default: open } = await __webpack_require__.e("344").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js"));
|
|
6259
|
+
return await open(url), !0;
|
|
6260
|
+
} catch (err) {
|
|
6261
|
+
return logger_namespaceObject.logger.error('Failed to open Rsdoctor URL.'), logger_namespaceObject.logger.error(err), !1;
|
|
6262
|
+
}
|
|
6263
|
+
}
|
|
6264
|
+
let server_require = (0, external_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
|
|
6265
|
+
class RsdoctorServer {
|
|
6266
|
+
constructor(sdk, port = build_namespaceObject.Server.defaultPort, config){
|
|
6267
|
+
this.sdk = sdk, this.disposed = !0, this.get = (route, cb)=>{
|
|
6268
|
+
let { app } = this;
|
|
6269
|
+
return app.use(route, this.wrapNextHandleFunction('GET', cb)), app;
|
|
6270
|
+
}, this.post = (route, cb)=>{
|
|
6271
|
+
let { app } = this;
|
|
6272
|
+
return app.use(route, this.wrapNextHandleFunction('POST', cb)), app;
|
|
6273
|
+
}, this.dispose = async (exitCode)=>{
|
|
6274
|
+
if (this.disposed) {
|
|
6275
|
+
void 0 !== exitCode && process.exit(exitCode);
|
|
6276
|
+
return;
|
|
6277
|
+
}
|
|
6278
|
+
this.disposed = !0, this._server && await this._server.close(), this._socket && this._socket.dispose(), void 0 !== exitCode && process.exit(exitCode);
|
|
6279
|
+
}, external_assert_default()('number' == typeof port), this.port = port, this._router = new Router({
|
|
6280
|
+
sdk,
|
|
6281
|
+
server: this,
|
|
6282
|
+
apis: Object.values(apis_namespaceObject)
|
|
6283
|
+
}), this._innerClientPath = config?.innerClientPath || '', this._printServerUrl = !!common_namespaceObject.Lodash.isUndefined(config?.printServerUrl) || config?.printServerUrl;
|
|
6284
|
+
}
|
|
6285
|
+
get app() {
|
|
6286
|
+
return this._server.app;
|
|
6287
|
+
}
|
|
6288
|
+
get host() {
|
|
6289
|
+
return getLocalIpAddress();
|
|
6290
|
+
}
|
|
6291
|
+
get origin() {
|
|
6292
|
+
return `http://${this.host}:${this.port}`;
|
|
6293
|
+
}
|
|
6294
|
+
get socketUrl() {
|
|
6295
|
+
return {
|
|
6296
|
+
port: this.port,
|
|
6297
|
+
socketUrl: `ws://localhost:${this.port}`
|
|
6298
|
+
};
|
|
6299
|
+
}
|
|
6300
|
+
get innerClientPath() {
|
|
6301
|
+
return this._innerClientPath;
|
|
6302
|
+
}
|
|
6303
|
+
async bootstrap() {
|
|
6304
|
+
if (!this.disposed) return;
|
|
6305
|
+
let port = build_namespaceObject.Server.getPortSync(this.port);
|
|
6306
|
+
this.port = port, this._server = await build_namespaceObject.Server.createServer(port), this._socket = new Socket({
|
|
6307
|
+
sdk: this.sdk,
|
|
6308
|
+
server: this._server.server,
|
|
6309
|
+
port: this.port
|
|
6310
|
+
}), await this._socket.bootstrap(), common_namespaceObject.GlobalConfig.writeMcpPort(this.port, this.sdk.name), logger_namespaceObject.logger.debug(`Successfully wrote mcp.json for ${logger_namespaceObject.chalk.cyan(this.sdk.name)} builder`), this.disposed = !1, this.app.use(cors_index_js_default()()), this.app.use(body_parser_default().json({
|
|
6311
|
+
limit: '500mb'
|
|
6312
|
+
}));
|
|
6313
|
+
let clientHtmlPath = this._innerClientPath ? this._innerClientPath : server_require.resolve('@rsdoctor/client'), clientDistPath = external_path_default().resolve(clientHtmlPath, '..');
|
|
6314
|
+
this.app.use(function(dir, opts = {}) {
|
|
6315
|
+
dir = (0, external_node_path_.resolve)(dir || '.');
|
|
6316
|
+
let isNotFound = opts.onNoMatch || is404, setHeaders = opts.setHeaders || noop, extensions = opts.extensions || [
|
|
6317
|
+
'html',
|
|
6318
|
+
'htm'
|
|
6319
|
+
], gzips = opts.gzip && extensions.map((x)=>`${x}.gz`).concat('gz'), brots = opts.brotli && extensions.map((x)=>`${x}.br`).concat('br'), FILES = {}, fallback = '/', isEtag = !!opts.etag, isSPA = !!opts.single;
|
|
6320
|
+
if ('string' == typeof opts.single) {
|
|
6321
|
+
let idx = opts.single.lastIndexOf('.');
|
|
6322
|
+
fallback += ~idx ? opts.single.substring(0, idx) : opts.single;
|
|
6323
|
+
}
|
|
6324
|
+
let ignores = [];
|
|
6325
|
+
!1 !== opts.ignores && (ignores.push(/[/]([A-Za-z\s\d~$._-]+\.\w+){1,}$/), opts.dotfiles ? ignores.push(/\/\.\w/) : ignores.push(/\/\.well-known/), [].concat(opts.ignores || []).forEach((x)=>{
|
|
6326
|
+
ignores.push(RegExp(x, 'i'));
|
|
6327
|
+
}));
|
|
6328
|
+
let cc = null != opts.maxAge && `public,max-age=${opts.maxAge}`;
|
|
6329
|
+
cc && opts.immutable ? cc += ',immutable' : cc && 0 === opts.maxAge && (cc += ',must-revalidate'), opts.dev || function totalist(dir, callback, pre = '') {
|
|
6330
|
+
dir = (0, external_path_.resolve)('.', dir);
|
|
6331
|
+
let arr = (0, external_fs_.readdirSync)(dir), i = 0, abs, stats;
|
|
6332
|
+
for(; i < arr.length; i++)abs = (0, external_path_.join)(dir, arr[i]), (stats = (0, external_fs_.statSync)(abs)).isDirectory() ? totalist(abs, callback, (0, external_path_.join)(pre, arr[i])) : callback((0, external_path_.join)(pre, arr[i]), abs, stats);
|
|
6333
|
+
}(dir, (name, abs, stats)=>{
|
|
6334
|
+
if (/\.well-known[\\+\/]/.test(name)) ;
|
|
6335
|
+
else if (!opts.dotfiles && /(^\.|[\\+|\/+]\.)/.test(name)) return;
|
|
6336
|
+
let headers = toHeaders(name, stats, isEtag);
|
|
6337
|
+
cc && (headers['Cache-Control'] = cc), FILES['/' + name.normalize().replace(/\\+/g, '/')] = {
|
|
6338
|
+
abs,
|
|
6339
|
+
stats,
|
|
6340
|
+
headers
|
|
6341
|
+
};
|
|
6342
|
+
});
|
|
6343
|
+
let lookup = opts.dev ? viaLocal.bind(0, dir + external_node_path_.sep, isEtag) : viaCache.bind(0, FILES);
|
|
6344
|
+
return function(req, res, next) {
|
|
6345
|
+
let extns = [
|
|
6346
|
+
''
|
|
6347
|
+
], pathname = function(req) {
|
|
6348
|
+
let raw = req.url;
|
|
6349
|
+
if (null == raw) return;
|
|
6350
|
+
let prev = req._parsedUrl;
|
|
6351
|
+
if (prev && prev.raw === raw) return prev;
|
|
6352
|
+
let pathname = raw, search = '', query;
|
|
6353
|
+
if (raw.length > 1) {
|
|
6354
|
+
let idx = raw.indexOf('?', 1);
|
|
6355
|
+
-1 !== idx && (search = raw.substring(idx), pathname = raw.substring(0, idx), search.length > 1 && (query = external_node_querystring_namespaceObject.parse(search.substring(1))));
|
|
6356
|
+
}
|
|
6357
|
+
return req._parsedUrl = {
|
|
6358
|
+
pathname,
|
|
6359
|
+
search,
|
|
6360
|
+
query,
|
|
6361
|
+
raw
|
|
6362
|
+
};
|
|
6363
|
+
}(req).pathname, val = req.headers['accept-encoding'] || '';
|
|
6364
|
+
if (gzips && val.includes('gzip') && extns.unshift(...gzips), brots && /(br|brotli)/i.test(val) && extns.unshift(...brots), extns.push(...extensions), -1 !== pathname.indexOf('%')) try {
|
|
6365
|
+
pathname = decodeURI(pathname);
|
|
6366
|
+
} catch (err) {}
|
|
6367
|
+
let data = lookup(pathname, extns) || isSPA && !function(uri, arr) {
|
|
6368
|
+
for(let i = 0; i < arr.length; i++)if (arr[i].test(uri)) return !0;
|
|
6369
|
+
}(pathname, ignores) && lookup(fallback, extns);
|
|
6370
|
+
return data ? isEtag && req.headers['if-none-match'] === data.headers.ETag ? (res.writeHead(304), res.end()) : void ((gzips || brots) && res.setHeader('Vary', 'Accept-Encoding'), setHeaders(res, pathname, data.stats), function(req, res, file, stats, headers) {
|
|
6371
|
+
let code = 200, tmp, opts = {};
|
|
6372
|
+
for(let key in headers = {
|
|
6373
|
+
...headers
|
|
6374
|
+
})(tmp = res.getHeader(key)) && (headers[key] = tmp);
|
|
6375
|
+
if ((tmp = res.getHeader('content-type')) && (headers['Content-Type'] = tmp), req.headers.range) {
|
|
6376
|
+
code = 206;
|
|
6377
|
+
let [x, y] = req.headers.range.replace('bytes=', '').split('-'), end = opts.end = parseInt(y, 10) || stats.size - 1, start = opts.start = parseInt(x, 10) || 0;
|
|
6378
|
+
if (end >= stats.size && (end = stats.size - 1), start >= stats.size) return res.setHeader('Content-Range', `bytes */${stats.size}`), res.statusCode = 416, res.end();
|
|
6379
|
+
headers['Content-Range'] = `bytes ${start}-${end}/${stats.size}`, headers['Content-Length'] = end - start + 1, headers['Accept-Ranges'] = 'bytes';
|
|
6380
|
+
}
|
|
6381
|
+
res.writeHead(code, headers), external_node_fs_.createReadStream(file, opts).pipe(res);
|
|
6382
|
+
}(req, res, data.abs, data.stats, data.headers)) : next ? next() : isNotFound(req, res);
|
|
6383
|
+
};
|
|
6384
|
+
}(clientDistPath, {
|
|
6385
|
+
dev: !0
|
|
6386
|
+
})), this.app.use('/__open-in-editor', (req, res, next)=>{
|
|
6387
|
+
if ('GET' !== req.method && 'HEAD' !== req.method) return next();
|
|
6388
|
+
let url = new URL(req.url || '', "http://localhost"), file = url.searchParams.get('file'), editor = url.searchParams.get('editor') || void 0;
|
|
6389
|
+
if (!file) {
|
|
6390
|
+
res.statusCode = 400, res.end('Missing file parameter');
|
|
6391
|
+
return;
|
|
6392
|
+
}
|
|
6393
|
+
try {
|
|
6394
|
+
let launch = server_require('launch-editor'), responded = !1, safeEnd = (code, body)=>{
|
|
6395
|
+
responded || (responded = !0, res.statusCode = code, res.end(body));
|
|
6396
|
+
};
|
|
6397
|
+
launch(file, editor, (_fileName, errorMessage)=>{
|
|
6398
|
+
errorMessage && safeEnd(500, errorMessage);
|
|
6399
|
+
}), setTimeout(()=>{
|
|
6400
|
+
safeEnd(200, '');
|
|
6401
|
+
}, 200);
|
|
6402
|
+
} catch (err) {
|
|
6403
|
+
res.writableEnded || (res.statusCode = 500, res.end(err.message));
|
|
6404
|
+
}
|
|
6405
|
+
}), await this._router.setup(), process.once('exit', ()=>this.dispose()), process.once('SIGINT', ()=>this.dispose(0)), process.once('SIGTERM', ()=>this.dispose(0)), process.once('unhandledRejection', (reason)=>{
|
|
6406
|
+
console.error('Unhandled promise rejection:', reason), this.dispose(1);
|
|
6407
|
+
}), process.once('uncaughtException', (err, origin)=>{
|
|
6408
|
+
console.error('Uncaught exception:', err), origin && console.error('Exception origin:', origin), this.dispose(1);
|
|
6409
|
+
});
|
|
6410
|
+
}
|
|
6411
|
+
wrapNextHandleFunction(method, cb) {
|
|
6412
|
+
return async (req, res, next)=>{
|
|
6413
|
+
if (req.method?.toUpperCase() === method) {
|
|
6414
|
+
try {
|
|
6415
|
+
let body = await cb(req, res, next);
|
|
6416
|
+
if (res.setHeader('Access-Control-Allow-Origin', '*'), res.setHeader('Access-Control-Allow-Credentials', 'true'), res.statusCode = 200, Buffer.isBuffer(body)) {
|
|
6417
|
+
res.setHeader('Content-Length', body.byteLength);
|
|
6418
|
+
let ps = new external_stream_.PassThrough();
|
|
6419
|
+
ps.write(body), ps.end(), ps.pipe(res);
|
|
6420
|
+
} else body && 'object' == typeof body ? (res.writeHead(200, {
|
|
6421
|
+
'Content-Type': 'application/json;utf-8'
|
|
6422
|
+
}), res.write(JSON.stringify(body)), res.end()) : res.writeHead(200).end(body);
|
|
6423
|
+
} catch (error) {
|
|
6424
|
+
return res.statusCode = 500, res.end(error.message), next(error);
|
|
6425
|
+
}
|
|
6426
|
+
return;
|
|
6427
|
+
}
|
|
6428
|
+
await next();
|
|
6429
|
+
};
|
|
6430
|
+
}
|
|
6431
|
+
proxy(api, method, cb) {
|
|
6432
|
+
let idx = this.app.stack.findIndex((e)=>e.route === api);
|
|
6433
|
+
-1 === idx && (idx = this.app.stack.length - 1), this.app.stack.splice(idx, 0, {
|
|
6434
|
+
route: api,
|
|
6435
|
+
handle: this.wrapNextHandleFunction(method, cb)
|
|
6436
|
+
});
|
|
6437
|
+
}
|
|
6438
|
+
getClientUrl(route = 'homepage', ...args) {
|
|
6439
|
+
let relativeUrl = types_namespaceObject.SDK.ServerAPI.API.EntryHtml;
|
|
6440
|
+
if (route !== types_namespaceObject.Client.RsdoctorClientRoutes.BundleDiff) return relativeUrl;
|
|
6441
|
+
{
|
|
6442
|
+
let [baseline, current] = args, qs = common_namespaceObject.Bundle.getBundleDiffPageQueryString([
|
|
6443
|
+
baseline,
|
|
6444
|
+
current
|
|
6445
|
+
]);
|
|
6446
|
+
return `${relativeUrl}${qs}#${types_namespaceObject.Client.RsdoctorClientRoutes.BundleDiff}`;
|
|
6447
|
+
}
|
|
6448
|
+
}
|
|
6449
|
+
async openClientPage(...args) {
|
|
6450
|
+
let relativeUrl = this.getClientUrl(...args), needEncodeURI = arguments[0] === types_namespaceObject.Client.RsdoctorClientRoutes.BundleDiff, url = `http://${this.host}:${this.port}${relativeUrl}`, localhostUrl = `http://localhost:${this.port}${relativeUrl}`;
|
|
6451
|
+
await openBrowser(localhostUrl, !needEncodeURI), this._printServerUrl && logger_namespaceObject.logger.info(`${logger_namespaceObject.chalk.green(`${this.sdk.name} compiler's`)} analyzer running on: ${logger_namespaceObject.chalk.cyan(url)}`);
|
|
6452
|
+
}
|
|
6453
|
+
sendAPIDataToClient(api, msg) {
|
|
6454
|
+
this._socket?.sendAPIData(api, msg);
|
|
6455
|
+
}
|
|
6456
|
+
async broadcast() {
|
|
6457
|
+
await this._socket?.broadcast();
|
|
6458
|
+
}
|
|
6459
|
+
}
|
|
6460
|
+
class RsdoctorFakeServer extends RsdoctorServer {
|
|
6461
|
+
constructor(sdk, port = build_namespaceObject.Server.defaultPort){
|
|
6462
|
+
super(sdk, port), this.sdk = sdk, this.sdk = sdk;
|
|
6463
|
+
}
|
|
6464
|
+
async openClientPage() {}
|
|
6465
|
+
}
|
|
6466
|
+
let external_node_crypto_namespaceObject = require("node:crypto");
|
|
6467
|
+
var external_node_process_ = __webpack_require__("node:process"), external_node_process_default = __webpack_require__.n(external_node_process_);
|
|
6468
|
+
let external_tapable_namespaceObject = require("tapable"), dayjs_index_js_namespaceObject = require("../compiled/dayjs/index.js");
|
|
6469
|
+
function findRoot(startDir = process.cwd()) {
|
|
6470
|
+
let dir = startDir, firstPkgDir = null;
|
|
6471
|
+
for(; dir !== external_path_default().parse(dir).root;){
|
|
6472
|
+
if (external_fs_default().existsSync(external_path_default().join(dir, 'pnpm-workspace.yaml')) || external_fs_default().existsSync(external_path_default().join(dir, 'yarn.lock')) || external_fs_default().existsSync(external_path_default().join(dir, 'lerna.json'))) return dir;
|
|
6473
|
+
let pkgPath = external_path_default().join(dir, 'package.json');
|
|
6474
|
+
if (external_fs_default().existsSync(pkgPath) && (firstPkgDir || (firstPkgDir = dir), JSON.parse(external_fs_default().readFileSync(pkgPath, 'utf8')).workspaces)) return dir;
|
|
6475
|
+
dir = external_path_default().dirname(dir);
|
|
6476
|
+
}
|
|
6477
|
+
return firstPkgDir || null;
|
|
6478
|
+
}
|
|
6479
|
+
__webpack_require__.n(dayjs_index_js_namespaceObject)()().format('YYYYMMDD');
|
|
6480
|
+
class SDKCore {
|
|
6481
|
+
constructor({ name, root }){
|
|
6482
|
+
this.hooks = {
|
|
6483
|
+
afterSaveManifest: new external_tapable_namespaceObject.AsyncSeriesHook([
|
|
6484
|
+
'result'
|
|
6485
|
+
])
|
|
6486
|
+
}, this._envinfo = {}, this._clientRoutes = new Set([
|
|
6487
|
+
types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.Overall
|
|
6488
|
+
]), this.diskManifestPath = '', this._name = name, this.root = root, this.pid = external_node_process_default().pid, this._outputDir = external_node_path_default().join(this.outputDir || this.root, types_namespaceObject.Constants.RsdoctorOutputFolder);
|
|
6489
|
+
}
|
|
6490
|
+
get outputDir() {
|
|
6491
|
+
return this._outputDir;
|
|
6492
|
+
}
|
|
6493
|
+
get name() {
|
|
6494
|
+
return this._name;
|
|
6495
|
+
}
|
|
6496
|
+
async bootstrap() {
|
|
6497
|
+
let [cpu, memory, nodeVersion, yarnVersion, npmVersion, pnpmVersion] = await Promise.all([
|
|
6498
|
+
build_namespaceObject.EnvInfo.getCPUInfo(),
|
|
6499
|
+
build_namespaceObject.EnvInfo.getMemoryInfo(),
|
|
6500
|
+
build_namespaceObject.EnvInfo.getNodeVersion(),
|
|
6501
|
+
build_namespaceObject.EnvInfo.getYarnVersion(),
|
|
6502
|
+
build_namespaceObject.EnvInfo.getNpmVersion(),
|
|
6503
|
+
build_namespaceObject.EnvInfo.getPnpmVersion()
|
|
6504
|
+
]);
|
|
6505
|
+
this._envinfo = {
|
|
6506
|
+
...this._envinfo,
|
|
6507
|
+
cpu,
|
|
6508
|
+
memory,
|
|
6509
|
+
nodeVersion,
|
|
6510
|
+
yarnVersion,
|
|
6511
|
+
npmVersion,
|
|
6512
|
+
pnpmVersion
|
|
6513
|
+
};
|
|
6514
|
+
let hash = (0, external_node_crypto_namespaceObject.createHash)('md5').update([
|
|
6515
|
+
this.name,
|
|
6516
|
+
this.root,
|
|
6517
|
+
JSON.stringify(this._envinfo),
|
|
6518
|
+
Date.now()
|
|
6519
|
+
].join('_')).digest('hex');
|
|
6520
|
+
this.setHash(hash);
|
|
6521
|
+
}
|
|
6522
|
+
async dispose() {}
|
|
6523
|
+
setOutputDir(outputDir) {
|
|
6524
|
+
this._outputDir = outputDir;
|
|
6525
|
+
}
|
|
6526
|
+
setName(name) {
|
|
6527
|
+
this._name = name;
|
|
6528
|
+
}
|
|
6529
|
+
setHash(hash) {
|
|
6530
|
+
this.hash = hash;
|
|
6531
|
+
}
|
|
6532
|
+
getHash() {
|
|
6533
|
+
return this.hash;
|
|
6534
|
+
}
|
|
6535
|
+
getClientRoutes() {
|
|
6536
|
+
return [
|
|
6537
|
+
...this._clientRoutes
|
|
6538
|
+
];
|
|
6539
|
+
}
|
|
6540
|
+
addClientRoutes(routes) {
|
|
6541
|
+
routes.forEach((route)=>{
|
|
6542
|
+
this._clientRoutes.add(route);
|
|
6543
|
+
}), this.onDataReport();
|
|
6544
|
+
}
|
|
6545
|
+
async writePieces(storeData, _options) {
|
|
6546
|
+
let { outputDir } = this, manifest = external_node_path_default().resolve(outputDir, types_namespaceObject.Constants.RsdoctorOutputManifest);
|
|
6547
|
+
this.diskManifestPath = manifest, await build_namespaceObject.File.fse.ensureDir(outputDir);
|
|
6548
|
+
let urlsPromiseList = [];
|
|
6549
|
+
for (let key of Object.keys(storeData)){
|
|
6550
|
+
let data = storeData[key];
|
|
6551
|
+
if ('object' != typeof data) {
|
|
6552
|
+
urlsPromiseList.push({
|
|
6553
|
+
name: key,
|
|
6554
|
+
files: data
|
|
6555
|
+
});
|
|
6556
|
+
continue;
|
|
6557
|
+
}
|
|
6558
|
+
let jsonStr = await (async ()=>{
|
|
6559
|
+
try {
|
|
6560
|
+
if ('configs' === key) return JSON.stringify((0, common_namespaceObject.decycle)(data));
|
|
6561
|
+
return JSON.stringify(data);
|
|
6562
|
+
} catch (error) {
|
|
6563
|
+
return build_namespaceObject.Json.stringify(data);
|
|
6564
|
+
}
|
|
6565
|
+
})();
|
|
6566
|
+
if (Array.isArray(jsonStr)) {
|
|
6567
|
+
let urls = jsonStr.map((str, index)=>this.writeToFolder(str, outputDir, key, index + 1));
|
|
6568
|
+
urlsPromiseList.push(...urls);
|
|
6569
|
+
} else urlsPromiseList.push(this.writeToFolder(jsonStr, outputDir, key));
|
|
6570
|
+
}
|
|
6571
|
+
let dataUrls = await Promise.all(urlsPromiseList);
|
|
6572
|
+
logger_namespaceObject.logger.debug(`SDKCore.writePieces extraConfig: ${JSON.stringify(this.extraConfig)}`, '[SDKCore.writePieces]'), this.cloudData = {
|
|
6573
|
+
client: {
|
|
6574
|
+
enableRoutes: this.getClientRoutes()
|
|
6575
|
+
},
|
|
6576
|
+
data: dataUrls.reduce((t, item)=>(t[item.name] = Array.isArray(item.files) ? item.files.map((e)=>e.path).concat(t[item.name] || []) : item.files, t), {})
|
|
6577
|
+
};
|
|
6578
|
+
}
|
|
6579
|
+
async writeManifest() {
|
|
6580
|
+
let { cloudData: data, diskManifestPath } = this, dataStr = JSON.stringify(data, null, 2);
|
|
6581
|
+
logger_namespaceObject.logger.debug(`SDKCore.writeManifest extraConfig: ${this.extraConfig}`, '[SDKCore.writeManifest]');
|
|
6582
|
+
let dir = external_node_path_default().dirname(diskManifestPath), base = external_node_path_default().basename(diskManifestPath), tmpPath = external_node_path_default().join(dir, `${base}.${Date.now()}.${(0, external_node_crypto_namespaceObject.randomUUID)()}.tmp`);
|
|
6583
|
+
return await build_namespaceObject.File.fse.outputFile(tmpPath, dataStr), external_node_fs_default().renameSync(tmpPath, diskManifestPath), diskManifestPath;
|
|
6584
|
+
}
|
|
6585
|
+
async saveManifest(data, options) {
|
|
6586
|
+
await this.writePieces(data, options);
|
|
6587
|
+
let manifestDiskPath = await this.writeManifest();
|
|
6588
|
+
return await this.hooks.afterSaveManifest.promise({
|
|
6589
|
+
manifestWithShardingFiles: this.cloudData,
|
|
6590
|
+
manifestDiskPath
|
|
6591
|
+
}), manifestDiskPath;
|
|
6592
|
+
}
|
|
6593
|
+
writeToFolder(jsonStr, dir, key, index) {
|
|
6594
|
+
let sharding = new build_namespaceObject.File.FileSharding(common_namespaceObject.Algorithm.compressText(jsonStr)), folder = external_node_path_default().resolve(dir, key);
|
|
6595
|
+
return sharding.writeStringToFolder(folder, '', index).then((item)=>({
|
|
6596
|
+
name: key,
|
|
6597
|
+
files: item.map((el)=>({
|
|
6598
|
+
path: external_node_path_default().resolve(folder, el.filename),
|
|
6599
|
+
basename: el.filename,
|
|
6600
|
+
content: el.content
|
|
6601
|
+
}))
|
|
6602
|
+
}));
|
|
6603
|
+
}
|
|
6604
|
+
}
|
|
6605
|
+
let sdk_require = (0, external_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
|
|
6606
|
+
class RsdoctorSDK extends SDKCore {
|
|
6607
|
+
constructor(options){
|
|
6608
|
+
super(options), this._summary = {
|
|
6609
|
+
costs: []
|
|
6610
|
+
}, this._configs = [], this._errors = [], this._loader = [], this._loaderStart = [], this._resolver = [], this._plugin = {}, this._moduleGraph = new graph_namespaceObject.ModuleGraph(), this._chunkGraph = new graph_namespaceObject.ChunkGraph(), this._rawSourceMapCache = new Map(), this._sourceMap = new Map(), this.server = options.config?.noServer ? new RsdoctorFakeServer(this, void 0) : new RsdoctorServer(this, options.port, {
|
|
6611
|
+
innerClientPath: options.config?.innerClientPath || '',
|
|
6612
|
+
printServerUrl: options.config?.printLog?.serverUrls
|
|
6613
|
+
}), this.type = common_namespaceObject.Lodash.isNumber(options.type) ? options.type : types_namespaceObject.SDK.ToDataType.Normal, this.extraConfig = options.config, this.root = findRoot() ?? '';
|
|
6614
|
+
}
|
|
6615
|
+
async bootstrap() {
|
|
6616
|
+
logger_namespaceObject.logger.debug(`${Date.now()}`, '[RsdoctorSDK][bootstrap start]'), this.server && await this.server.bootstrap(), await super.bootstrap(), logger_namespaceObject.logger.debug(`${Date.now()} ${this.server.origin}`, '[RsdoctorSDK][bootstrap end]');
|
|
6617
|
+
}
|
|
6618
|
+
async dispose() {
|
|
6619
|
+
logger_namespaceObject.logger.debug(`${Date.now()}`, '[RsdoctorSDK][dispose start]'), this.server && await this.server.dispose(), await super.dispose(), logger_namespaceObject.logger.debug(`${Date.now()}`, '[RsdoctorSDK][dispose end]');
|
|
6620
|
+
}
|
|
6621
|
+
async applyErrorFix(id) {
|
|
6622
|
+
let { _errors: errors } = this, error = errors.find((err)=>err.id === id);
|
|
6623
|
+
if (!error || !error.path || !error.fixData || error.fixData.isFixed) return;
|
|
6624
|
+
let { path: filePath, fixData } = error, sameFileErrors = errors.filter((item)=>item.path === filePath && item !== error), content = (await external_node_fs_default().promises.readFile(filePath, 'utf-8')).toString(), startTxt = content.substring(0, fixData.start), endTxt = content.substring(fixData.end, content.length), offset = (fixData.newText ?? '').length - (fixData.end - fixData.start);
|
|
6625
|
+
for (let other of (content = startTxt + fixData.newText + endTxt, sameFileErrors)){
|
|
6626
|
+
let { fixData: otherFixData } = other;
|
|
6627
|
+
otherFixData && otherFixData.start >= fixData.end && (otherFixData.start += offset, otherFixData.end += offset);
|
|
6628
|
+
}
|
|
6629
|
+
await external_node_fs_default().promises.writeFile(filePath, content);
|
|
6630
|
+
}
|
|
6631
|
+
clear() {
|
|
6632
|
+
this._errors = [], this._loader = [], this._resolver = [], this._plugin = {}, this._moduleGraph = new graph_namespaceObject.ModuleGraph(), this._chunkGraph = new graph_namespaceObject.ChunkGraph();
|
|
6633
|
+
}
|
|
6634
|
+
clearSourceMapCache() {
|
|
6635
|
+
this._rawSourceMapCache = new Map(), this._sourceMap = new Map();
|
|
6636
|
+
}
|
|
6637
|
+
async getSourceMap(file) {
|
|
6638
|
+
let { _sourceMap: sourceMap, _rawSourceMapCache: rawMap } = this;
|
|
6639
|
+
if (sourceMap.has(file)) return sourceMap.get(file);
|
|
6640
|
+
let rawData = rawMap.get(file);
|
|
6641
|
+
if (!rawData || rawData.version < 0 || !rawData.sourcesContent?.[0] || !rawData.mappings) return Promise.resolve(void 0);
|
|
6642
|
+
try {
|
|
6643
|
+
let result = await new source_map.YK(rawData);
|
|
6644
|
+
return sourceMap.set(file, result), result;
|
|
6645
|
+
} catch (e) {
|
|
6646
|
+
return Promise.resolve(void 0);
|
|
6647
|
+
}
|
|
6648
|
+
}
|
|
6649
|
+
reportSourceMap(data) {
|
|
6650
|
+
this._rawSourceMapCache.set(data.file, data);
|
|
6651
|
+
}
|
|
6652
|
+
reportConfiguration(config) {
|
|
6653
|
+
config.root ??= this.root, this._configs.push(config), this.onDataReport();
|
|
6654
|
+
}
|
|
6655
|
+
reportError(errors) {
|
|
6656
|
+
errors.forEach((item)=>{
|
|
6657
|
+
this._errors.push(error_namespaceObject.DevToolError.from(item, {
|
|
6658
|
+
code: this.name
|
|
6659
|
+
}));
|
|
6660
|
+
}), this.onDataReport();
|
|
6661
|
+
}
|
|
6662
|
+
reportLoader(data) {
|
|
6663
|
+
data.forEach((item)=>{
|
|
6664
|
+
this.extraConfig?.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] && item.loaders.forEach((_loader)=>{
|
|
6665
|
+
_loader.input = void 0, _loader.result = void 0;
|
|
6666
|
+
});
|
|
6667
|
+
let match = this._loader.find((e)=>e.resource.path === item.resource.path);
|
|
6668
|
+
match ? match.loaders.push(...item.loaders) : (match = item, this._loader.push(item)), match.loaders.sort((a, b)=>a.startAt !== b.startAt ? a.startAt - b.startAt : a.isPitch ? b.isPitch ? a.loaderIndex - b.loaderIndex : -1 : b.isPitch ? 1 : b.loaderIndex - a.loaderIndex);
|
|
6669
|
+
}), this.onDataReport();
|
|
6670
|
+
}
|
|
6671
|
+
reportLoaderStartOrEnd(data) {
|
|
6672
|
+
let _builtinLoader = data.loaders[0];
|
|
6673
|
+
if (_builtinLoader.startAt) this._loaderStart.push(data);
|
|
6674
|
+
else if (_builtinLoader.endAt) {
|
|
6675
|
+
let matchLoaderStart = this._loaderStart.find((e)=>e.resource.path === data.resource.path && e.loaders[0].loader === _builtinLoader.loader);
|
|
6676
|
+
matchLoaderStart && (matchLoaderStart.loaders[0].result = _builtinLoader.result, matchLoaderStart.loaders[0].endAt = _builtinLoader.endAt, this.reportLoader([
|
|
6677
|
+
matchLoaderStart
|
|
6678
|
+
]));
|
|
6679
|
+
}
|
|
6680
|
+
}
|
|
6681
|
+
reportResolver(data) {
|
|
6682
|
+
data.forEach((item)=>this._resolver.push(item)), this.onDataReport();
|
|
6683
|
+
}
|
|
6684
|
+
reportPlugin(data) {
|
|
6685
|
+
Object.keys(data).forEach((hook)=>{
|
|
6686
|
+
this._plugin[hook] ? data[hook].forEach((item)=>{
|
|
6687
|
+
this._plugin[hook].push(item || void 0);
|
|
6688
|
+
}) : this._plugin[hook] = data[hook];
|
|
6689
|
+
}), this.onDataReport();
|
|
6690
|
+
}
|
|
6691
|
+
reportModuleGraph(data) {
|
|
6692
|
+
logger_namespaceObject.logger.debug(`data size: ${data.size()}`, '[SDK.reportModuleGraph][start]'), this._moduleGraph.fromInstance(data), this.createPackageGraph(), this.onDataReport(), logger_namespaceObject.logger.debug(`sdk._moduleGraph size: ${this._moduleGraph.size()}`, '[SDK reportModuleGraph][end]');
|
|
6693
|
+
}
|
|
6694
|
+
reportPackageGraph(data) {
|
|
6695
|
+
logger_namespaceObject.logger.debug('[SDK.reportPackageGraph][start]'), this._packageGraph || (this._packageGraph = data), this.onDataReport(), logger_namespaceObject.logger.debug(`sdk._packageGraph size: ${this._packageGraph.getPackages().length}`, '[SDK reportPackageGraph][end]');
|
|
6696
|
+
}
|
|
6697
|
+
reportChunkGraph(data) {
|
|
6698
|
+
this._chunkGraph.addAsset(...data.getAssets()), this._chunkGraph.addChunk(...data.getChunks()), this._chunkGraph.addEntryPoint(...data.getEntryPoints()), this.onDataReport();
|
|
6699
|
+
}
|
|
6700
|
+
reportSummaryData(part) {
|
|
6701
|
+
for (let key of [
|
|
6702
|
+
'costs'
|
|
6703
|
+
]){
|
|
6704
|
+
let v = part[key];
|
|
6705
|
+
v && ('object' == typeof v ? Array.isArray(v) ? this._summary[key] = [
|
|
6706
|
+
...this._summary[key] || [],
|
|
6707
|
+
...v
|
|
6708
|
+
] : this._summary[key] = {
|
|
6709
|
+
...this._summary[key] || {},
|
|
6710
|
+
...v
|
|
6711
|
+
} : this._summary[key] = v);
|
|
6712
|
+
}
|
|
6713
|
+
this.onDataReport();
|
|
6714
|
+
}
|
|
6715
|
+
createPackageGraph() {
|
|
6716
|
+
if (logger_namespaceObject.logger.debug(`sdk._moduleGraph size: ${this._moduleGraph.size()}`, '[SDK.createPackageGraph][start]'), !this._packageGraph) {
|
|
6717
|
+
let pkgGraph = graph_namespaceObject.PackageGraph.fromModuleGraph(this._moduleGraph, this.root, (path)=>{
|
|
6718
|
+
try {
|
|
6719
|
+
if (external_node_fs_default().existsSync(path)) return index_js_default().readJsonSync(path);
|
|
6720
|
+
} catch (error) {
|
|
6721
|
+
let { message, stack } = error;
|
|
6722
|
+
logger_namespaceObject.logger.debug(()=>`sdk.createPackageGraph error, path: ${path}, error message: ${stack || message}`, '[SDK.createPackageGraph][error]');
|
|
6723
|
+
}
|
|
6724
|
+
});
|
|
6725
|
+
this._packageGraph = pkgGraph, logger_namespaceObject.logger.debug(`sdk._packageGraph packages: ${this._packageGraph.getPackages().length}`, '[SDK.createPackageGraph][end]');
|
|
6726
|
+
}
|
|
6727
|
+
}
|
|
6728
|
+
async writeStore(options) {
|
|
6729
|
+
logger_namespaceObject.logger.debug("sdk.writeStore has run.", '[SDK.writeStore][end]');
|
|
6730
|
+
let htmlPath = '';
|
|
6731
|
+
if (this.extraConfig?.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief]) {
|
|
6732
|
+
let clientHtmlPath = this.extraConfig.innerClientPath ? this.extraConfig.innerClientPath : sdk_require.resolve('@rsdoctor/client');
|
|
6733
|
+
if (this.extraConfig?.brief?.type?.includes('json')) {
|
|
6734
|
+
let data = this.getStoreData(), clientRoutes = this.getClientRoutes();
|
|
6735
|
+
external_node_fs_default().mkdirSync(this.outputDir, {
|
|
6736
|
+
recursive: !0
|
|
6737
|
+
}), external_node_fs_default().writeFileSync(external_path_default().resolve(this.outputDir, this.extraConfig.brief.jsonOptions?.fileName ?? 'rsdoctor-data.json'), JSON.stringify({
|
|
6738
|
+
data,
|
|
6739
|
+
clientRoutes
|
|
6740
|
+
}, null, 2));
|
|
6741
|
+
}
|
|
6742
|
+
return this.extraConfig.brief?.type?.includes('html') && (htmlPath = this.inlineScriptsAndStyles(clientHtmlPath)), htmlPath;
|
|
6743
|
+
}
|
|
6744
|
+
return this.saveManifest(this.getStoreData(), options || {});
|
|
6745
|
+
}
|
|
6746
|
+
getStoreData() {
|
|
6747
|
+
let ctx = this, briefOptions = this.extraConfig?.brief, sections = briefOptions?.jsonOptions?.sections, isJsonType = briefOptions?.type?.includes('json');
|
|
6748
|
+
return {
|
|
6749
|
+
get hash () {
|
|
6750
|
+
return ctx.hash;
|
|
6751
|
+
},
|
|
6752
|
+
get root () {
|
|
6753
|
+
return ctx.root;
|
|
6754
|
+
},
|
|
6755
|
+
get envinfo () {
|
|
6756
|
+
return ctx._envinfo;
|
|
6757
|
+
},
|
|
6758
|
+
get pid () {
|
|
6759
|
+
return ctx.pid;
|
|
6760
|
+
},
|
|
6761
|
+
get errors () {
|
|
6762
|
+
if (isJsonType && sections && !sections.rules) return [];
|
|
6763
|
+
return ctx._errors.map((err)=>err.toData());
|
|
6764
|
+
},
|
|
6765
|
+
get configs () {
|
|
6766
|
+
return ctx._configs.slice();
|
|
6767
|
+
},
|
|
6768
|
+
get summary () {
|
|
6769
|
+
return {
|
|
6770
|
+
...ctx._summary
|
|
6771
|
+
};
|
|
6772
|
+
},
|
|
6773
|
+
get resolver () {
|
|
6774
|
+
return ctx._resolver.slice();
|
|
6775
|
+
},
|
|
6776
|
+
get loader () {
|
|
6777
|
+
return ctx._loader.slice();
|
|
6778
|
+
},
|
|
6779
|
+
get moduleGraph () {
|
|
6780
|
+
if (isJsonType && sections && !sections.moduleGraph) return {
|
|
6781
|
+
dependencies: [],
|
|
6782
|
+
modules: [],
|
|
6783
|
+
moduleGraphModules: [],
|
|
6784
|
+
exports: [],
|
|
6785
|
+
sideEffects: [],
|
|
6786
|
+
variables: [],
|
|
6787
|
+
layers: []
|
|
6788
|
+
};
|
|
6789
|
+
return ctx._moduleGraph.toData({
|
|
6790
|
+
contextPath: ctx._configs?.[0]?.config?.context || '',
|
|
6791
|
+
briefOptions
|
|
6792
|
+
});
|
|
6793
|
+
},
|
|
6794
|
+
get chunkGraph () {
|
|
6795
|
+
if (isJsonType && sections && !sections.chunkGraph) return {
|
|
6796
|
+
assets: [],
|
|
6797
|
+
chunks: [],
|
|
6798
|
+
entrypoints: []
|
|
6799
|
+
};
|
|
6800
|
+
return ctx._chunkGraph.toData(ctx.type);
|
|
6801
|
+
},
|
|
6802
|
+
get moduleCodeMap () {
|
|
6803
|
+
if (ctx.extraConfig?.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief]) return {};
|
|
6804
|
+
return ctx._moduleGraph.toCodeData(ctx.type);
|
|
6805
|
+
},
|
|
6806
|
+
get plugin () {
|
|
6807
|
+
return {
|
|
6808
|
+
...ctx._plugin
|
|
6809
|
+
};
|
|
6810
|
+
},
|
|
6811
|
+
get packageGraph () {
|
|
6812
|
+
return ctx._packageGraph ? ctx._packageGraph.toData() : {
|
|
6813
|
+
packages: [],
|
|
6814
|
+
dependencies: []
|
|
6815
|
+
};
|
|
6816
|
+
},
|
|
6817
|
+
get treeShaking () {
|
|
6818
|
+
if (ctx.extraConfig?.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] || !ctx.extraConfig?.features?.treeShaking) return;
|
|
6819
|
+
return ctx._moduleGraph.toTreeShakingData();
|
|
6820
|
+
},
|
|
6821
|
+
get otherReports () {
|
|
6822
|
+
return {
|
|
6823
|
+
treemapReportHtml: ''
|
|
6824
|
+
};
|
|
6825
|
+
}
|
|
6826
|
+
};
|
|
6827
|
+
}
|
|
6828
|
+
getManifestData() {
|
|
6829
|
+
let dataValue = this.getStoreData();
|
|
6830
|
+
return {
|
|
6831
|
+
client: {
|
|
6832
|
+
enableRoutes: this.getClientRoutes()
|
|
6833
|
+
},
|
|
6834
|
+
data: Object.keys(dataValue).reduce((t, e)=>(dataValue[e] && 'object' == typeof dataValue[e] ? t[e] = [
|
|
6835
|
+
`${this.server.origin}${types_namespaceObject.SDK.ServerAPI.API.LoadDataByKey}/${e}`
|
|
6836
|
+
] : t[e] = dataValue[e], t), {}),
|
|
6837
|
+
__LOCAL__SERVER__: !0,
|
|
6838
|
+
__SOCKET__PORT__: this.server.socketUrl.port.toString(),
|
|
6839
|
+
__SOCKET__URL__: this.server.socketUrl.socketUrl
|
|
6840
|
+
};
|
|
6841
|
+
}
|
|
6842
|
+
getRuleContext(_options) {
|
|
6843
|
+
return this.createPackageGraph(), {
|
|
6844
|
+
root: this.root,
|
|
6845
|
+
errors: this._errors.slice(),
|
|
6846
|
+
configs: this._configs.slice(),
|
|
6847
|
+
moduleGraph: this._moduleGraph,
|
|
6848
|
+
chunkGraph: this._chunkGraph,
|
|
6849
|
+
packageGraph: this._packageGraph,
|
|
6850
|
+
loader: this._loader.slice(),
|
|
6851
|
+
otherReports: {
|
|
6852
|
+
treemapReportHtml: ''
|
|
6853
|
+
}
|
|
6854
|
+
};
|
|
6855
|
+
}
|
|
6856
|
+
onDataReport() {
|
|
6857
|
+
this.server.broadcast();
|
|
6858
|
+
}
|
|
6859
|
+
addRsdoctorDataToHTML(storeData, htmlContent) {
|
|
6860
|
+
let compressTextScripts = `<script>window.${types_namespaceObject.Constants.WINDOW_RSDOCTOR_TAG}={}</script>`;
|
|
6861
|
+
for (let key of Object.keys(storeData)){
|
|
6862
|
+
let data = storeData[key], jsonStrFn = ()=>{
|
|
6863
|
+
try {
|
|
6864
|
+
if ('configs' === key) return JSON.stringify((0, common_namespaceObject.decycle)(data));
|
|
6865
|
+
return JSON.stringify(data);
|
|
6866
|
+
} catch (error) {
|
|
6867
|
+
return console.error(error), '';
|
|
6868
|
+
}
|
|
6869
|
+
}, compressText = common_namespaceObject.Algorithm.compressText(jsonStrFn());
|
|
6870
|
+
compressTextScripts = `${compressTextScripts} <script>window.${types_namespaceObject.Constants.WINDOW_RSDOCTOR_TAG}.${key}=${JSON.stringify(compressText)}</script>`;
|
|
6871
|
+
}
|
|
6872
|
+
return compressTextScripts = `${compressTextScripts} <script>window.${types_namespaceObject.Constants.WINDOW_RSDOCTOR_TAG}.enableRoutes=${JSON.stringify(this.getClientRoutes())}</script>`, htmlContent = htmlContent.replace('<body>', `<body>${compressTextScripts}`);
|
|
6873
|
+
}
|
|
6874
|
+
inlineScriptsAndStyles(htmlFilePath) {
|
|
6875
|
+
function resolveFilePath(basePath, filePath) {
|
|
6876
|
+
return filePath.startsWith('/') ? external_path_default().resolve(basePath, filePath.slice(1)) : external_path_default().resolve(basePath, filePath);
|
|
6877
|
+
}
|
|
6878
|
+
let htmlContent = external_node_fs_default().readFileSync(htmlFilePath, 'utf-8'), basePath = external_path_default().dirname(htmlFilePath), scriptSrcs = Array.from(htmlContent.matchAll(/<script\s+(?:defer="defer"|defer)\s+src=["'](.+?)["']><\/script>/g), (m)=>m[1]), cssHrefs = Array.from(htmlContent.matchAll(/<link\s+href=["'](.+?)["']\s+rel="stylesheet">/g), (m)=>m[1]);
|
|
6879
|
+
htmlContent = (htmlContent = htmlContent.replace(/<script\s+.*?src=["'].*?["']><\/script>/g, '')).replace(/<link\s+.*?rel=["']stylesheet["'].*?>/g, '');
|
|
6880
|
+
let inlinedScripts = scriptSrcs.map((src)=>{
|
|
6881
|
+
let scriptPath = resolveFilePath(basePath, src);
|
|
6882
|
+
try {
|
|
6883
|
+
let scriptContent = external_node_fs_default().readFileSync(scriptPath, 'utf-8');
|
|
6884
|
+
return `<script>${scriptContent}</script>`;
|
|
6885
|
+
} catch (error) {
|
|
6886
|
+
return console.error(`Could not read script at ${scriptPath}:`, error), '';
|
|
6887
|
+
}
|
|
6888
|
+
}).join(''), inlinedCss = cssHrefs.map((href)=>{
|
|
6889
|
+
let cssPath = resolveFilePath(basePath, href);
|
|
6890
|
+
try {
|
|
6891
|
+
let cssContent = external_node_fs_default().readFileSync(cssPath, 'utf-8');
|
|
6892
|
+
return `<style>${cssContent}</style>`;
|
|
6893
|
+
} catch (error) {
|
|
6894
|
+
return console.error(`Could not read CSS at ${cssPath}:`, error), '';
|
|
6895
|
+
}
|
|
6896
|
+
}).join(''), index = htmlContent.indexOf('</body>');
|
|
6897
|
+
htmlContent = htmlContent.slice(0, index) + inlinedCss + inlinedScripts + htmlContent.slice(index), htmlContent = this.addRsdoctorDataToHTML(this.getStoreData(), htmlContent);
|
|
6898
|
+
let outputFilePath = external_path_default().resolve(this.outputDir, this.extraConfig?.brief?.htmlOptions?.reportHtmlName || 'rsdoctor-report.html');
|
|
6899
|
+
return external_node_fs_default().mkdirSync(external_path_default().dirname(outputFilePath), {
|
|
6900
|
+
recursive: !0
|
|
6901
|
+
}), external_node_fs_default().writeFileSync(outputFilePath, htmlContent, {
|
|
6902
|
+
encoding: 'utf-8',
|
|
6903
|
+
flag: 'w'
|
|
6904
|
+
}), outputFilePath;
|
|
6905
|
+
}
|
|
6906
|
+
}
|
|
6907
|
+
class RsdoctorSlaveServer extends RsdoctorServer {
|
|
6908
|
+
constructor(sdk, port = build_namespaceObject.Server.defaultPort){
|
|
6909
|
+
super(sdk, port), this.sdk = sdk;
|
|
6910
|
+
}
|
|
6911
|
+
async openClientPage(...args) {
|
|
6912
|
+
return this.sdk.isMaster ? super.openClientPage(...args) : Promise.resolve();
|
|
6913
|
+
}
|
|
6914
|
+
}
|
|
6915
|
+
let primary_id = 1;
|
|
6916
|
+
class RsdoctorPrimarySDK extends RsdoctorSDK {
|
|
6917
|
+
constructor({ name, stage, controller, extraConfig, type }){
|
|
6918
|
+
super({
|
|
6919
|
+
name,
|
|
6920
|
+
root: controller.root
|
|
6921
|
+
});
|
|
6922
|
+
const lastSdk = controller.getLastSdk(), port = lastSdk ? lastSdk.server.port + 1 : this.server.port;
|
|
6923
|
+
this.id = primary_id++, this.stage = 'number' == typeof stage ? stage : 1, this.extraConfig = extraConfig, this.parent = controller, this.server = new RsdoctorSlaveServer(this, port), this.type = type, this.setName(name), this.clearSwitch();
|
|
6924
|
+
}
|
|
6925
|
+
clearSwitch() {
|
|
6926
|
+
this.uploadPieces = new Promise((resolve)=>{
|
|
6927
|
+
this.finishUploadPieceSwitch = resolve;
|
|
6928
|
+
});
|
|
6929
|
+
}
|
|
6930
|
+
get isMaster() {
|
|
6931
|
+
return this.parent.master === this;
|
|
6932
|
+
}
|
|
6933
|
+
async writePieces() {
|
|
6934
|
+
let { name, parent, isMaster, outputDir, finishUploadPieceSwitch } = this;
|
|
6935
|
+
this.setOutputDir(isMaster ? outputDir : external_path_default().join(parent.master.outputDir, '.slaves', name.replace(/\s+/g, '-'))), await super.writePieces(this.getStoreData()), finishUploadPieceSwitch?.();
|
|
6936
|
+
}
|
|
6937
|
+
async writeManifest() {
|
|
6938
|
+
let { parent, cloudData, dependencies } = this;
|
|
6939
|
+
dependencies?.length || await Promise.all(this.parent.slaves.filter((item)=>!item.dependencies?.length).map((item)=>item.uploadPieces)), cloudData && (cloudData.name = this.name, cloudData.series = parent.getSeriesData());
|
|
6940
|
+
let result = await super.writeManifest();
|
|
6941
|
+
return this.clearSwitch(), result;
|
|
6942
|
+
}
|
|
6943
|
+
getSeriesData(serverUrl = !1) {
|
|
6944
|
+
return this.parent.getSeriesData(serverUrl);
|
|
6945
|
+
}
|
|
6946
|
+
setName(name) {
|
|
6947
|
+
this._name = this.parent.hasName(name) ? `${name}-${primary_id}` : name;
|
|
6948
|
+
}
|
|
6949
|
+
getManifestData() {
|
|
6950
|
+
let data = super.getManifestData();
|
|
6951
|
+
return data.name = this.name, data.series = this.getSeriesData(!0), data;
|
|
6952
|
+
}
|
|
6953
|
+
}
|
|
6954
|
+
class RsdoctorSDKController {
|
|
6955
|
+
constructor(root = process.cwd()){
|
|
6956
|
+
this.slaves = [], this.root = '', this.root = root;
|
|
6957
|
+
}
|
|
6958
|
+
get master() {
|
|
6959
|
+
return this.slaves[0];
|
|
6960
|
+
}
|
|
6961
|
+
getLastSdk() {
|
|
6962
|
+
return this.slaves[this.slaves.length - 1];
|
|
6963
|
+
}
|
|
6964
|
+
hasName(name) {
|
|
6965
|
+
return !!this.slaves.find((item)=>item.name === name);
|
|
6966
|
+
}
|
|
6967
|
+
getSeriesData(serverUrl = !1) {
|
|
6968
|
+
return this.slaves.map((item)=>{
|
|
6969
|
+
let data = {
|
|
6970
|
+
name: item.name,
|
|
6971
|
+
path: item.diskManifestPath,
|
|
6972
|
+
stage: item.stage
|
|
6973
|
+
};
|
|
6974
|
+
return serverUrl && (data.origin = item.server.origin), data;
|
|
6975
|
+
});
|
|
6976
|
+
}
|
|
6977
|
+
createSlave({ name, stage, extraConfig, type }) {
|
|
6978
|
+
let slave = new RsdoctorPrimarySDK({
|
|
6979
|
+
name,
|
|
6980
|
+
stage,
|
|
6981
|
+
controller: this,
|
|
6982
|
+
extraConfig,
|
|
6983
|
+
type
|
|
6984
|
+
});
|
|
6985
|
+
return this.slaves.push(slave), this.slaves.sort((a, b)=>a.stage - b.stage), slave;
|
|
6986
|
+
}
|
|
6987
|
+
}
|
|
6988
|
+
},
|
|
5154
6989
|
async_hooks (module) {
|
|
5155
6990
|
"use strict";
|
|
5156
6991
|
module.exports = require("async_hooks");
|
|
@@ -5309,1835 +7144,8 @@ __webpack_require__.m = __webpack_modules__, __webpack_require__.n = (module)=>{
|
|
|
5309
7144
|
})(require("./" + __webpack_require__.u(chunkId)));
|
|
5310
7145
|
};
|
|
5311
7146
|
})();
|
|
5312
|
-
var __webpack_exports__ =
|
|
5313
|
-
for(var __rspack_i in
|
|
5314
|
-
"use strict";
|
|
5315
|
-
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
5316
|
-
RsdoctorSDKController: ()=>RsdoctorSDKController,
|
|
5317
|
-
RsdoctorSDK: ()=>RsdoctorSDK,
|
|
5318
|
-
findRoot: ()=>findRoot,
|
|
5319
|
-
RsdoctorPrimarySDK: ()=>RsdoctorPrimarySDK,
|
|
5320
|
-
openBrowser: ()=>openBrowser
|
|
5321
|
-
});
|
|
5322
|
-
var apis_namespaceObject = {};
|
|
5323
|
-
__webpack_require__.r(apis_namespaceObject), __webpack_require__.d(apis_namespaceObject, {
|
|
5324
|
-
AlertsAPI: ()=>AlertsAPI,
|
|
5325
|
-
DataAPI: ()=>DataAPI,
|
|
5326
|
-
FileSystemAPI: ()=>FileSystemAPI,
|
|
5327
|
-
GraphAPI: ()=>GraphAPI,
|
|
5328
|
-
LoaderAPI: ()=>LoaderAPI,
|
|
5329
|
-
PluginAPI: ()=>PluginAPI,
|
|
5330
|
-
ProjectAPI: ()=>ProjectAPI,
|
|
5331
|
-
RendererAPI: ()=>RendererAPI,
|
|
5332
|
-
ResolverAPI: ()=>ResolverAPI
|
|
5333
|
-
});
|
|
5334
|
-
var external_node_fs_ = __webpack_require__("node:fs"), external_node_fs_default = __webpack_require__.n(external_node_fs_);
|
|
5335
|
-
let index_js_namespaceObject = require("../compiled/fs-extra/index.js");
|
|
5336
|
-
var index_js_default = __webpack_require__.n(index_js_namespaceObject), external_path_ = __webpack_require__("path"), external_path_default = __webpack_require__.n(external_path_);
|
|
5337
|
-
let external_module_namespaceObject = require("module"), error_namespaceObject = require("@rsdoctor/utils/error"), types_namespaceObject = require("@rsdoctor/types");
|
|
5338
|
-
var source_map = __webpack_require__("../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/source-map.js");
|
|
5339
|
-
let graph_namespaceObject = require("@rsdoctor/graph"), logger_namespaceObject = require("@rsdoctor/utils/logger"), build_namespaceObject = require("@rsdoctor/utils/build");
|
|
5340
|
-
var external_node_path_ = __webpack_require__("node:path"), external_node_path_default = __webpack_require__.n(external_node_path_), external_fs_ = __webpack_require__("fs"), external_fs_default = __webpack_require__.n(external_fs_);
|
|
5341
|
-
let external_node_querystring_namespaceObject = require("node:querystring"), mimes = {
|
|
5342
|
-
"3g2": "video/3gpp2",
|
|
5343
|
-
"3gp": "video/3gpp",
|
|
5344
|
-
"3gpp": "video/3gpp",
|
|
5345
|
-
"3mf": "model/3mf",
|
|
5346
|
-
aac: "audio/aac",
|
|
5347
|
-
ac: "application/pkix-attr-cert",
|
|
5348
|
-
adp: "audio/adpcm",
|
|
5349
|
-
adts: "audio/aac",
|
|
5350
|
-
ai: "application/postscript",
|
|
5351
|
-
aml: "application/automationml-aml+xml",
|
|
5352
|
-
amlx: "application/automationml-amlx+zip",
|
|
5353
|
-
amr: "audio/amr",
|
|
5354
|
-
apng: "image/apng",
|
|
5355
|
-
appcache: "text/cache-manifest",
|
|
5356
|
-
appinstaller: "application/appinstaller",
|
|
5357
|
-
appx: "application/appx",
|
|
5358
|
-
appxbundle: "application/appxbundle",
|
|
5359
|
-
asc: "application/pgp-keys",
|
|
5360
|
-
atom: "application/atom+xml",
|
|
5361
|
-
atomcat: "application/atomcat+xml",
|
|
5362
|
-
atomdeleted: "application/atomdeleted+xml",
|
|
5363
|
-
atomsvc: "application/atomsvc+xml",
|
|
5364
|
-
au: "audio/basic",
|
|
5365
|
-
avci: "image/avci",
|
|
5366
|
-
avcs: "image/avcs",
|
|
5367
|
-
avif: "image/avif",
|
|
5368
|
-
aw: "application/applixware",
|
|
5369
|
-
bdoc: "application/bdoc",
|
|
5370
|
-
bin: "application/octet-stream",
|
|
5371
|
-
bmp: "image/bmp",
|
|
5372
|
-
bpk: "application/octet-stream",
|
|
5373
|
-
btf: "image/prs.btif",
|
|
5374
|
-
btif: "image/prs.btif",
|
|
5375
|
-
buffer: "application/octet-stream",
|
|
5376
|
-
ccxml: "application/ccxml+xml",
|
|
5377
|
-
cdfx: "application/cdfx+xml",
|
|
5378
|
-
cdmia: "application/cdmi-capability",
|
|
5379
|
-
cdmic: "application/cdmi-container",
|
|
5380
|
-
cdmid: "application/cdmi-domain",
|
|
5381
|
-
cdmio: "application/cdmi-object",
|
|
5382
|
-
cdmiq: "application/cdmi-queue",
|
|
5383
|
-
cer: "application/pkix-cert",
|
|
5384
|
-
cgm: "image/cgm",
|
|
5385
|
-
cjs: "application/node",
|
|
5386
|
-
class: "application/java-vm",
|
|
5387
|
-
coffee: "text/coffeescript",
|
|
5388
|
-
conf: "text/plain",
|
|
5389
|
-
cpl: "application/cpl+xml",
|
|
5390
|
-
cpt: "application/mac-compactpro",
|
|
5391
|
-
crl: "application/pkix-crl",
|
|
5392
|
-
css: "text/css",
|
|
5393
|
-
csv: "text/csv",
|
|
5394
|
-
cu: "application/cu-seeme",
|
|
5395
|
-
cwl: "application/cwl",
|
|
5396
|
-
cww: "application/prs.cww",
|
|
5397
|
-
davmount: "application/davmount+xml",
|
|
5398
|
-
dbk: "application/docbook+xml",
|
|
5399
|
-
deb: "application/octet-stream",
|
|
5400
|
-
def: "text/plain",
|
|
5401
|
-
deploy: "application/octet-stream",
|
|
5402
|
-
dib: "image/bmp",
|
|
5403
|
-
"disposition-notification": "message/disposition-notification",
|
|
5404
|
-
dist: "application/octet-stream",
|
|
5405
|
-
distz: "application/octet-stream",
|
|
5406
|
-
dll: "application/octet-stream",
|
|
5407
|
-
dmg: "application/octet-stream",
|
|
5408
|
-
dms: "application/octet-stream",
|
|
5409
|
-
doc: "application/msword",
|
|
5410
|
-
dot: "application/msword",
|
|
5411
|
-
dpx: "image/dpx",
|
|
5412
|
-
drle: "image/dicom-rle",
|
|
5413
|
-
dsc: "text/prs.lines.tag",
|
|
5414
|
-
dssc: "application/dssc+der",
|
|
5415
|
-
dtd: "application/xml-dtd",
|
|
5416
|
-
dump: "application/octet-stream",
|
|
5417
|
-
dwd: "application/atsc-dwd+xml",
|
|
5418
|
-
ear: "application/java-archive",
|
|
5419
|
-
ecma: "application/ecmascript",
|
|
5420
|
-
elc: "application/octet-stream",
|
|
5421
|
-
emf: "image/emf",
|
|
5422
|
-
eml: "message/rfc822",
|
|
5423
|
-
emma: "application/emma+xml",
|
|
5424
|
-
emotionml: "application/emotionml+xml",
|
|
5425
|
-
eps: "application/postscript",
|
|
5426
|
-
epub: "application/epub+zip",
|
|
5427
|
-
exe: "application/octet-stream",
|
|
5428
|
-
exi: "application/exi",
|
|
5429
|
-
exp: "application/express",
|
|
5430
|
-
exr: "image/aces",
|
|
5431
|
-
ez: "application/andrew-inset",
|
|
5432
|
-
fdf: "application/fdf",
|
|
5433
|
-
fdt: "application/fdt+xml",
|
|
5434
|
-
fits: "image/fits",
|
|
5435
|
-
g3: "image/g3fax",
|
|
5436
|
-
gbr: "application/rpki-ghostbusters",
|
|
5437
|
-
geojson: "application/geo+json",
|
|
5438
|
-
gif: "image/gif",
|
|
5439
|
-
glb: "model/gltf-binary",
|
|
5440
|
-
gltf: "model/gltf+json",
|
|
5441
|
-
gml: "application/gml+xml",
|
|
5442
|
-
gpx: "application/gpx+xml",
|
|
5443
|
-
gram: "application/srgs",
|
|
5444
|
-
grxml: "application/srgs+xml",
|
|
5445
|
-
gxf: "application/gxf",
|
|
5446
|
-
gz: "application/gzip",
|
|
5447
|
-
h261: "video/h261",
|
|
5448
|
-
h263: "video/h263",
|
|
5449
|
-
h264: "video/h264",
|
|
5450
|
-
heic: "image/heic",
|
|
5451
|
-
heics: "image/heic-sequence",
|
|
5452
|
-
heif: "image/heif",
|
|
5453
|
-
heifs: "image/heif-sequence",
|
|
5454
|
-
hej2: "image/hej2k",
|
|
5455
|
-
held: "application/atsc-held+xml",
|
|
5456
|
-
hjson: "application/hjson",
|
|
5457
|
-
hlp: "application/winhlp",
|
|
5458
|
-
hqx: "application/mac-binhex40",
|
|
5459
|
-
hsj2: "image/hsj2",
|
|
5460
|
-
htm: "text/html",
|
|
5461
|
-
html: "text/html",
|
|
5462
|
-
ics: "text/calendar",
|
|
5463
|
-
ief: "image/ief",
|
|
5464
|
-
ifb: "text/calendar",
|
|
5465
|
-
iges: "model/iges",
|
|
5466
|
-
igs: "model/iges",
|
|
5467
|
-
img: "application/octet-stream",
|
|
5468
|
-
in: "text/plain",
|
|
5469
|
-
ini: "text/plain",
|
|
5470
|
-
ink: "application/inkml+xml",
|
|
5471
|
-
inkml: "application/inkml+xml",
|
|
5472
|
-
ipfix: "application/ipfix",
|
|
5473
|
-
iso: "application/octet-stream",
|
|
5474
|
-
its: "application/its+xml",
|
|
5475
|
-
jade: "text/jade",
|
|
5476
|
-
jar: "application/java-archive",
|
|
5477
|
-
jhc: "image/jphc",
|
|
5478
|
-
jls: "image/jls",
|
|
5479
|
-
jp2: "image/jp2",
|
|
5480
|
-
jpe: "image/jpeg",
|
|
5481
|
-
jpeg: "image/jpeg",
|
|
5482
|
-
jpf: "image/jpx",
|
|
5483
|
-
jpg: "image/jpeg",
|
|
5484
|
-
jpg2: "image/jp2",
|
|
5485
|
-
jpgm: "image/jpm",
|
|
5486
|
-
jpgv: "video/jpeg",
|
|
5487
|
-
jph: "image/jph",
|
|
5488
|
-
jpm: "image/jpm",
|
|
5489
|
-
jpx: "image/jpx",
|
|
5490
|
-
js: "text/javascript",
|
|
5491
|
-
json: "application/json",
|
|
5492
|
-
json5: "application/json5",
|
|
5493
|
-
jsonld: "application/ld+json",
|
|
5494
|
-
jsonml: "application/jsonml+json",
|
|
5495
|
-
jsx: "text/jsx",
|
|
5496
|
-
jt: "model/jt",
|
|
5497
|
-
jxr: "image/jxr",
|
|
5498
|
-
jxra: "image/jxra",
|
|
5499
|
-
jxrs: "image/jxrs",
|
|
5500
|
-
jxs: "image/jxs",
|
|
5501
|
-
jxsc: "image/jxsc",
|
|
5502
|
-
jxsi: "image/jxsi",
|
|
5503
|
-
jxss: "image/jxss",
|
|
5504
|
-
kar: "audio/midi",
|
|
5505
|
-
ktx: "image/ktx",
|
|
5506
|
-
ktx2: "image/ktx2",
|
|
5507
|
-
less: "text/less",
|
|
5508
|
-
lgr: "application/lgr+xml",
|
|
5509
|
-
list: "text/plain",
|
|
5510
|
-
litcoffee: "text/coffeescript",
|
|
5511
|
-
log: "text/plain",
|
|
5512
|
-
lostxml: "application/lost+xml",
|
|
5513
|
-
lrf: "application/octet-stream",
|
|
5514
|
-
m1v: "video/mpeg",
|
|
5515
|
-
m21: "application/mp21",
|
|
5516
|
-
m2a: "audio/mpeg",
|
|
5517
|
-
m2v: "video/mpeg",
|
|
5518
|
-
m3a: "audio/mpeg",
|
|
5519
|
-
m4a: "audio/mp4",
|
|
5520
|
-
m4p: "application/mp4",
|
|
5521
|
-
m4s: "video/iso.segment",
|
|
5522
|
-
ma: "application/mathematica",
|
|
5523
|
-
mads: "application/mads+xml",
|
|
5524
|
-
maei: "application/mmt-aei+xml",
|
|
5525
|
-
man: "text/troff",
|
|
5526
|
-
manifest: "text/cache-manifest",
|
|
5527
|
-
map: "application/json",
|
|
5528
|
-
mar: "application/octet-stream",
|
|
5529
|
-
markdown: "text/markdown",
|
|
5530
|
-
mathml: "application/mathml+xml",
|
|
5531
|
-
mb: "application/mathematica",
|
|
5532
|
-
mbox: "application/mbox",
|
|
5533
|
-
md: "text/markdown",
|
|
5534
|
-
mdx: "text/mdx",
|
|
5535
|
-
me: "text/troff",
|
|
5536
|
-
mesh: "model/mesh",
|
|
5537
|
-
meta4: "application/metalink4+xml",
|
|
5538
|
-
metalink: "application/metalink+xml",
|
|
5539
|
-
mets: "application/mets+xml",
|
|
5540
|
-
mft: "application/rpki-manifest",
|
|
5541
|
-
mid: "audio/midi",
|
|
5542
|
-
midi: "audio/midi",
|
|
5543
|
-
mime: "message/rfc822",
|
|
5544
|
-
mj2: "video/mj2",
|
|
5545
|
-
mjp2: "video/mj2",
|
|
5546
|
-
mjs: "text/javascript",
|
|
5547
|
-
mml: "text/mathml",
|
|
5548
|
-
mods: "application/mods+xml",
|
|
5549
|
-
mov: "video/quicktime",
|
|
5550
|
-
mp2: "audio/mpeg",
|
|
5551
|
-
mp21: "application/mp21",
|
|
5552
|
-
mp2a: "audio/mpeg",
|
|
5553
|
-
mp3: "audio/mpeg",
|
|
5554
|
-
mp4: "video/mp4",
|
|
5555
|
-
mp4a: "audio/mp4",
|
|
5556
|
-
mp4s: "application/mp4",
|
|
5557
|
-
mp4v: "video/mp4",
|
|
5558
|
-
mpd: "application/dash+xml",
|
|
5559
|
-
mpe: "video/mpeg",
|
|
5560
|
-
mpeg: "video/mpeg",
|
|
5561
|
-
mpf: "application/media-policy-dataset+xml",
|
|
5562
|
-
mpg: "video/mpeg",
|
|
5563
|
-
mpg4: "video/mp4",
|
|
5564
|
-
mpga: "audio/mpeg",
|
|
5565
|
-
mpp: "application/dash-patch+xml",
|
|
5566
|
-
mrc: "application/marc",
|
|
5567
|
-
mrcx: "application/marcxml+xml",
|
|
5568
|
-
ms: "text/troff",
|
|
5569
|
-
mscml: "application/mediaservercontrol+xml",
|
|
5570
|
-
msh: "model/mesh",
|
|
5571
|
-
msi: "application/octet-stream",
|
|
5572
|
-
msix: "application/msix",
|
|
5573
|
-
msixbundle: "application/msixbundle",
|
|
5574
|
-
msm: "application/octet-stream",
|
|
5575
|
-
msp: "application/octet-stream",
|
|
5576
|
-
mtl: "model/mtl",
|
|
5577
|
-
musd: "application/mmt-usd+xml",
|
|
5578
|
-
mxf: "application/mxf",
|
|
5579
|
-
mxmf: "audio/mobile-xmf",
|
|
5580
|
-
mxml: "application/xv+xml",
|
|
5581
|
-
n3: "text/n3",
|
|
5582
|
-
nb: "application/mathematica",
|
|
5583
|
-
nq: "application/n-quads",
|
|
5584
|
-
nt: "application/n-triples",
|
|
5585
|
-
obj: "model/obj",
|
|
5586
|
-
oda: "application/oda",
|
|
5587
|
-
oga: "audio/ogg",
|
|
5588
|
-
ogg: "audio/ogg",
|
|
5589
|
-
ogv: "video/ogg",
|
|
5590
|
-
ogx: "application/ogg",
|
|
5591
|
-
omdoc: "application/omdoc+xml",
|
|
5592
|
-
onepkg: "application/onenote",
|
|
5593
|
-
onetmp: "application/onenote",
|
|
5594
|
-
onetoc: "application/onenote",
|
|
5595
|
-
onetoc2: "application/onenote",
|
|
5596
|
-
opf: "application/oebps-package+xml",
|
|
5597
|
-
opus: "audio/ogg",
|
|
5598
|
-
otf: "font/otf",
|
|
5599
|
-
owl: "application/rdf+xml",
|
|
5600
|
-
oxps: "application/oxps",
|
|
5601
|
-
p10: "application/pkcs10",
|
|
5602
|
-
p7c: "application/pkcs7-mime",
|
|
5603
|
-
p7m: "application/pkcs7-mime",
|
|
5604
|
-
p7s: "application/pkcs7-signature",
|
|
5605
|
-
p8: "application/pkcs8",
|
|
5606
|
-
pdf: "application/pdf",
|
|
5607
|
-
pfr: "application/font-tdpfr",
|
|
5608
|
-
pgp: "application/pgp-encrypted",
|
|
5609
|
-
pkg: "application/octet-stream",
|
|
5610
|
-
pki: "application/pkixcmp",
|
|
5611
|
-
pkipath: "application/pkix-pkipath",
|
|
5612
|
-
pls: "application/pls+xml",
|
|
5613
|
-
png: "image/png",
|
|
5614
|
-
prc: "model/prc",
|
|
5615
|
-
prf: "application/pics-rules",
|
|
5616
|
-
provx: "application/provenance+xml",
|
|
5617
|
-
ps: "application/postscript",
|
|
5618
|
-
pskcxml: "application/pskc+xml",
|
|
5619
|
-
pti: "image/prs.pti",
|
|
5620
|
-
qt: "video/quicktime",
|
|
5621
|
-
raml: "application/raml+yaml",
|
|
5622
|
-
rapd: "application/route-apd+xml",
|
|
5623
|
-
rdf: "application/rdf+xml",
|
|
5624
|
-
relo: "application/p2p-overlay+xml",
|
|
5625
|
-
rif: "application/reginfo+xml",
|
|
5626
|
-
rl: "application/resource-lists+xml",
|
|
5627
|
-
rld: "application/resource-lists-diff+xml",
|
|
5628
|
-
rmi: "audio/midi",
|
|
5629
|
-
rnc: "application/relax-ng-compact-syntax",
|
|
5630
|
-
rng: "application/xml",
|
|
5631
|
-
roa: "application/rpki-roa",
|
|
5632
|
-
roff: "text/troff",
|
|
5633
|
-
rq: "application/sparql-query",
|
|
5634
|
-
rs: "application/rls-services+xml",
|
|
5635
|
-
rsat: "application/atsc-rsat+xml",
|
|
5636
|
-
rsd: "application/rsd+xml",
|
|
5637
|
-
rsheet: "application/urc-ressheet+xml",
|
|
5638
|
-
rss: "application/rss+xml",
|
|
5639
|
-
rtf: "text/rtf",
|
|
5640
|
-
rtx: "text/richtext",
|
|
5641
|
-
rusd: "application/route-usd+xml",
|
|
5642
|
-
s3m: "audio/s3m",
|
|
5643
|
-
sbml: "application/sbml+xml",
|
|
5644
|
-
scq: "application/scvp-cv-request",
|
|
5645
|
-
scs: "application/scvp-cv-response",
|
|
5646
|
-
sdp: "application/sdp",
|
|
5647
|
-
senmlx: "application/senml+xml",
|
|
5648
|
-
sensmlx: "application/sensml+xml",
|
|
5649
|
-
ser: "application/java-serialized-object",
|
|
5650
|
-
setpay: "application/set-payment-initiation",
|
|
5651
|
-
setreg: "application/set-registration-initiation",
|
|
5652
|
-
sgi: "image/sgi",
|
|
5653
|
-
sgm: "text/sgml",
|
|
5654
|
-
sgml: "text/sgml",
|
|
5655
|
-
shex: "text/shex",
|
|
5656
|
-
shf: "application/shf+xml",
|
|
5657
|
-
shtml: "text/html",
|
|
5658
|
-
sieve: "application/sieve",
|
|
5659
|
-
sig: "application/pgp-signature",
|
|
5660
|
-
sil: "audio/silk",
|
|
5661
|
-
silo: "model/mesh",
|
|
5662
|
-
siv: "application/sieve",
|
|
5663
|
-
slim: "text/slim",
|
|
5664
|
-
slm: "text/slim",
|
|
5665
|
-
sls: "application/route-s-tsid+xml",
|
|
5666
|
-
smi: "application/smil+xml",
|
|
5667
|
-
smil: "application/smil+xml",
|
|
5668
|
-
snd: "audio/basic",
|
|
5669
|
-
so: "application/octet-stream",
|
|
5670
|
-
spdx: "text/spdx",
|
|
5671
|
-
spp: "application/scvp-vp-response",
|
|
5672
|
-
spq: "application/scvp-vp-request",
|
|
5673
|
-
spx: "audio/ogg",
|
|
5674
|
-
sql: "application/sql",
|
|
5675
|
-
sru: "application/sru+xml",
|
|
5676
|
-
srx: "application/sparql-results+xml",
|
|
5677
|
-
ssdl: "application/ssdl+xml",
|
|
5678
|
-
ssml: "application/ssml+xml",
|
|
5679
|
-
stk: "application/hyperstudio",
|
|
5680
|
-
stl: "model/stl",
|
|
5681
|
-
stpx: "model/step+xml",
|
|
5682
|
-
stpxz: "model/step-xml+zip",
|
|
5683
|
-
stpz: "model/step+zip",
|
|
5684
|
-
styl: "text/stylus",
|
|
5685
|
-
stylus: "text/stylus",
|
|
5686
|
-
svg: "image/svg+xml",
|
|
5687
|
-
svgz: "image/svg+xml",
|
|
5688
|
-
swidtag: "application/swid+xml",
|
|
5689
|
-
t: "text/troff",
|
|
5690
|
-
t38: "image/t38",
|
|
5691
|
-
td: "application/urc-targetdesc+xml",
|
|
5692
|
-
tei: "application/tei+xml",
|
|
5693
|
-
teicorpus: "application/tei+xml",
|
|
5694
|
-
text: "text/plain",
|
|
5695
|
-
tfi: "application/thraud+xml",
|
|
5696
|
-
tfx: "image/tiff-fx",
|
|
5697
|
-
tif: "image/tiff",
|
|
5698
|
-
tiff: "image/tiff",
|
|
5699
|
-
toml: "application/toml",
|
|
5700
|
-
tr: "text/troff",
|
|
5701
|
-
trig: "application/trig",
|
|
5702
|
-
ts: "video/mp2t",
|
|
5703
|
-
tsd: "application/timestamped-data",
|
|
5704
|
-
tsv: "text/tab-separated-values",
|
|
5705
|
-
ttc: "font/collection",
|
|
5706
|
-
ttf: "font/ttf",
|
|
5707
|
-
ttl: "text/turtle",
|
|
5708
|
-
ttml: "application/ttml+xml",
|
|
5709
|
-
txt: "text/plain",
|
|
5710
|
-
u3d: "model/u3d",
|
|
5711
|
-
u8dsn: "message/global-delivery-status",
|
|
5712
|
-
u8hdr: "message/global-headers",
|
|
5713
|
-
u8mdn: "message/global-disposition-notification",
|
|
5714
|
-
u8msg: "message/global",
|
|
5715
|
-
ubj: "application/ubjson",
|
|
5716
|
-
uri: "text/uri-list",
|
|
5717
|
-
uris: "text/uri-list",
|
|
5718
|
-
urls: "text/uri-list",
|
|
5719
|
-
vcard: "text/vcard",
|
|
5720
|
-
vrml: "model/vrml",
|
|
5721
|
-
vtt: "text/vtt",
|
|
5722
|
-
vxml: "application/voicexml+xml",
|
|
5723
|
-
war: "application/java-archive",
|
|
5724
|
-
wasm: "application/wasm",
|
|
5725
|
-
wav: "audio/wav",
|
|
5726
|
-
weba: "audio/webm",
|
|
5727
|
-
webm: "video/webm",
|
|
5728
|
-
webmanifest: "application/manifest+json",
|
|
5729
|
-
webp: "image/webp",
|
|
5730
|
-
wgsl: "text/wgsl",
|
|
5731
|
-
wgt: "application/widget",
|
|
5732
|
-
wif: "application/watcherinfo+xml",
|
|
5733
|
-
wmf: "image/wmf",
|
|
5734
|
-
woff: "font/woff",
|
|
5735
|
-
woff2: "font/woff2",
|
|
5736
|
-
wrl: "model/vrml",
|
|
5737
|
-
wsdl: "application/wsdl+xml",
|
|
5738
|
-
wspolicy: "application/wspolicy+xml",
|
|
5739
|
-
x3d: "model/x3d+xml",
|
|
5740
|
-
x3db: "model/x3d+fastinfoset",
|
|
5741
|
-
x3dbz: "model/x3d+binary",
|
|
5742
|
-
x3dv: "model/x3d-vrml",
|
|
5743
|
-
x3dvz: "model/x3d+vrml",
|
|
5744
|
-
x3dz: "model/x3d+xml",
|
|
5745
|
-
xaml: "application/xaml+xml",
|
|
5746
|
-
xav: "application/xcap-att+xml",
|
|
5747
|
-
xca: "application/xcap-caps+xml",
|
|
5748
|
-
xcs: "application/calendar+xml",
|
|
5749
|
-
xdf: "application/xcap-diff+xml",
|
|
5750
|
-
xdssc: "application/dssc+xml",
|
|
5751
|
-
xel: "application/xcap-el+xml",
|
|
5752
|
-
xenc: "application/xenc+xml",
|
|
5753
|
-
xer: "application/patch-ops-error+xml",
|
|
5754
|
-
xfdf: "application/xfdf",
|
|
5755
|
-
xht: "application/xhtml+xml",
|
|
5756
|
-
xhtml: "application/xhtml+xml",
|
|
5757
|
-
xhvml: "application/xv+xml",
|
|
5758
|
-
xlf: "application/xliff+xml",
|
|
5759
|
-
xm: "audio/xm",
|
|
5760
|
-
xml: "text/xml",
|
|
5761
|
-
xns: "application/xcap-ns+xml",
|
|
5762
|
-
xop: "application/xop+xml",
|
|
5763
|
-
xpl: "application/xproc+xml",
|
|
5764
|
-
xsd: "application/xml",
|
|
5765
|
-
xsf: "application/prs.xsf+xml",
|
|
5766
|
-
xsl: "application/xml",
|
|
5767
|
-
xslt: "application/xml",
|
|
5768
|
-
xspf: "application/xspf+xml",
|
|
5769
|
-
xvm: "application/xv+xml",
|
|
5770
|
-
xvml: "application/xv+xml",
|
|
5771
|
-
yaml: "text/yaml",
|
|
5772
|
-
yang: "application/yang",
|
|
5773
|
-
yin: "application/yin+xml",
|
|
5774
|
-
yml: "text/yaml",
|
|
5775
|
-
zip: "application/zip"
|
|
5776
|
-
}, noop = ()=>{};
|
|
5777
|
-
function toAssume(uri, extns) {
|
|
5778
|
-
let i = 0, x, len = uri.length - 1;
|
|
5779
|
-
47 === uri.charCodeAt(len) && (uri = uri.substring(0, len));
|
|
5780
|
-
let arr = [], tmp = `${uri}/index`;
|
|
5781
|
-
for(; i < extns.length; i++)x = extns[i] ? `.${extns[i]}` : '', uri && arr.push(uri + x), arr.push(tmp + x);
|
|
5782
|
-
return arr;
|
|
5783
|
-
}
|
|
5784
|
-
function viaCache(cache, uri, extns) {
|
|
5785
|
-
let i = 0, data, arr = toAssume(uri, extns);
|
|
5786
|
-
for(; i < arr.length; i++)if (data = cache[arr[i]]) return data;
|
|
5787
|
-
}
|
|
5788
|
-
function viaLocal(dir, isEtag, uri, extns) {
|
|
5789
|
-
let abs, stats, name, headers, i = 0, arr = toAssume(uri, extns);
|
|
5790
|
-
for(; i < arr.length; i++)if ((abs = (0, external_node_path_.normalize)((0, external_node_path_.join)(dir, name = arr[i]))).startsWith(dir) && external_node_fs_.existsSync(abs)) {
|
|
5791
|
-
if ((stats = external_node_fs_.statSync(abs)).isDirectory()) continue;
|
|
5792
|
-
return (headers = toHeaders(name, stats, isEtag))['Cache-Control'] = isEtag ? 'no-cache' : 'no-store', {
|
|
5793
|
-
abs,
|
|
5794
|
-
stats,
|
|
5795
|
-
headers
|
|
5796
|
-
};
|
|
5797
|
-
}
|
|
5798
|
-
}
|
|
5799
|
-
function is404(req, res) {
|
|
5800
|
-
return res.statusCode = 404, res.end();
|
|
5801
|
-
}
|
|
5802
|
-
let ENCODING = {
|
|
5803
|
-
'.br': 'br',
|
|
5804
|
-
'.gz': 'gzip'
|
|
5805
|
-
};
|
|
5806
|
-
function toHeaders(name, stats, isEtag) {
|
|
5807
|
-
let tmp, idx, enc = ENCODING[name.slice(-3)], ctype = mimes[!~(idx = (tmp = ('' + name.slice(0, enc && -3)).trim().toLowerCase()).lastIndexOf('.')) ? tmp : tmp.substring(++idx)] || '';
|
|
5808
|
-
'text/html' === ctype && (ctype += ';charset=utf-8');
|
|
5809
|
-
let headers = {
|
|
5810
|
-
'Content-Length': stats.size,
|
|
5811
|
-
'Content-Type': ctype,
|
|
5812
|
-
'Last-Modified': stats.mtime.toUTCString()
|
|
5813
|
-
};
|
|
5814
|
-
return enc && (headers['Content-Encoding'] = enc), isEtag && (headers.ETag = `W/"${stats.size}-${stats.mtime.getTime()}"`), headers;
|
|
5815
|
-
}
|
|
5816
|
-
let common_namespaceObject = require("@rsdoctor/utils/common"), external_assert_namespaceObject = require("assert");
|
|
5817
|
-
var external_assert_default = __webpack_require__.n(external_assert_namespaceObject), body_parser = __webpack_require__("../../node_modules/.pnpm/body-parser@2.2.2/node_modules/body-parser/index.js"), body_parser_default = __webpack_require__.n(body_parser);
|
|
5818
|
-
let cors_index_js_namespaceObject = require("../compiled/cors/index.js");
|
|
5819
|
-
var cors_index_js_default = __webpack_require__.n(cors_index_js_namespaceObject), external_stream_ = __webpack_require__("stream");
|
|
5820
|
-
let external_socket_io_namespaceObject = require("socket.io");
|
|
5821
|
-
var external_util_ = __webpack_require__("util");
|
|
5822
|
-
class SocketAPILoader {
|
|
5823
|
-
constructor(options){
|
|
5824
|
-
this.options = options, this.dataLoader = new common_namespaceObject.Data.APIDataLoader(this);
|
|
5825
|
-
}
|
|
5826
|
-
async loadManifest() {
|
|
5827
|
-
return this.options.sdk.getManifestData();
|
|
5828
|
-
}
|
|
5829
|
-
async loadData(key) {
|
|
5830
|
-
let data = this.options.sdk.getStoreData(), res = data[key];
|
|
5831
|
-
return key.includes('.') && (res = key.split('.').reduce((t, k)=>t[k], data)), res;
|
|
5832
|
-
}
|
|
5833
|
-
get loadAPIData() {
|
|
5834
|
-
return this.dataLoader.loadAPI;
|
|
5835
|
-
}
|
|
5836
|
-
}
|
|
5837
|
-
class Socket {
|
|
5838
|
-
constructor(options){
|
|
5839
|
-
this.options = options, this.map = new Map(), this.loader = new SocketAPILoader({
|
|
5840
|
-
sdk: options.sdk
|
|
5841
|
-
});
|
|
5842
|
-
}
|
|
5843
|
-
bootstrap() {
|
|
5844
|
-
this.io = new external_socket_io_namespaceObject.Server(this.options.server, {
|
|
5845
|
-
cors: {
|
|
5846
|
-
origin: '*'
|
|
5847
|
-
},
|
|
5848
|
-
...this.options.socketOptions
|
|
5849
|
-
}), this.io.on('connection', (socket)=>{
|
|
5850
|
-
this.setupSocket(socket);
|
|
5851
|
-
});
|
|
5852
|
-
}
|
|
5853
|
-
setupSocket(socket) {
|
|
5854
|
-
Object.values(types_namespaceObject.SDK.ServerAPI.API).forEach((api)=>{
|
|
5855
|
-
socket.on(api, async (body, callback)=>{
|
|
5856
|
-
this.saveRequestToMap(api, body), callback(await this.getAPIResponse(api, body));
|
|
5857
|
-
});
|
|
5858
|
-
});
|
|
5859
|
-
}
|
|
5860
|
-
saveRequestToMap(api, body = null) {
|
|
5861
|
-
this.map.has(api) || this.map.set(api, []);
|
|
5862
|
-
let list = this.map.get(api);
|
|
5863
|
-
list.some((e)=>e === body || (0, external_util_.isDeepStrictEqual)(e, body)) || list.push(body);
|
|
5864
|
-
}
|
|
5865
|
-
async getAPIResponse(api, body) {
|
|
5866
|
-
let data = await this.loader.loadAPIData(api, body);
|
|
5867
|
-
return {
|
|
5868
|
-
req: {
|
|
5869
|
-
api,
|
|
5870
|
-
body
|
|
5871
|
-
},
|
|
5872
|
-
res: data
|
|
5873
|
-
};
|
|
5874
|
-
}
|
|
5875
|
-
async broadcast() {
|
|
5876
|
-
clearImmediate(this.timer), this.timer = setImmediate(async ()=>{
|
|
5877
|
-
let promises = [];
|
|
5878
|
-
this.map.forEach((bodies, api)=>{
|
|
5879
|
-
bodies.forEach((body)=>{
|
|
5880
|
-
promises.push((async ()=>{
|
|
5881
|
-
let res = await this.getAPIResponse(api, body);
|
|
5882
|
-
this.io.emit(api, res);
|
|
5883
|
-
})());
|
|
5884
|
-
});
|
|
5885
|
-
}), await Promise.all(promises);
|
|
5886
|
-
});
|
|
5887
|
-
}
|
|
5888
|
-
sendAPIData(api, msg) {
|
|
5889
|
-
this.io.sockets.emit(api, msg);
|
|
5890
|
-
}
|
|
5891
|
-
dispose() {
|
|
5892
|
-
this.io.disconnectSockets(), this.io.close();
|
|
5893
|
-
}
|
|
5894
|
-
}
|
|
5895
|
-
class Router {
|
|
5896
|
-
static{
|
|
5897
|
-
this.routes = {
|
|
5898
|
-
get: new Map(),
|
|
5899
|
-
post: new Map()
|
|
5900
|
-
};
|
|
5901
|
-
}
|
|
5902
|
-
static get(pathname) {
|
|
5903
|
-
return (target, propertyKey, descriptor)=>{
|
|
5904
|
-
let routes = Router.routes.get;
|
|
5905
|
-
return routes.has(target.constructor) || routes.set(target.constructor, []), routes.get(target.constructor).push([
|
|
5906
|
-
propertyKey,
|
|
5907
|
-
pathname
|
|
5908
|
-
]), descriptor;
|
|
5909
|
-
};
|
|
5910
|
-
}
|
|
5911
|
-
static post(pathname) {
|
|
5912
|
-
return (target, propertyKey, descriptor)=>{
|
|
5913
|
-
let routes = Router.routes.post;
|
|
5914
|
-
return routes.has(target.constructor) || routes.set(target.constructor, []), routes.get(target.constructor).push([
|
|
5915
|
-
propertyKey,
|
|
5916
|
-
pathname
|
|
5917
|
-
]), descriptor;
|
|
5918
|
-
};
|
|
5919
|
-
}
|
|
5920
|
-
constructor(options){
|
|
5921
|
-
this.options = options;
|
|
5922
|
-
}
|
|
5923
|
-
async setup() {
|
|
5924
|
-
let { apis, sdk, server } = this.options;
|
|
5925
|
-
apis.forEach((API)=>{
|
|
5926
|
-
let obj = new API(sdk, server);
|
|
5927
|
-
Router.routes.get.forEach((v, cons)=>{
|
|
5928
|
-
v.forEach(([key, pathname])=>{
|
|
5929
|
-
cons === API && server.get(pathname, this.wrapAPIFunction(obj, key));
|
|
5930
|
-
});
|
|
5931
|
-
}), Router.routes.post.forEach((v, cons)=>{
|
|
5932
|
-
v.forEach(([key, pathname])=>{
|
|
5933
|
-
cons === API && server.post(pathname, this.wrapAPIFunction(obj, key));
|
|
5934
|
-
});
|
|
5935
|
-
});
|
|
5936
|
-
});
|
|
5937
|
-
}
|
|
5938
|
-
wrapAPIFunction(api, key) {
|
|
5939
|
-
let { sdk, server } = this.options;
|
|
5940
|
-
return async (req, res)=>{
|
|
5941
|
-
let ctx = {
|
|
5942
|
-
req,
|
|
5943
|
-
res,
|
|
5944
|
-
sdk,
|
|
5945
|
-
server
|
|
5946
|
-
}, trap = new Proxy(api, {
|
|
5947
|
-
get: (target, key, receiver)=>'ctx' === key ? ctx : Reflect.get(target, key, receiver),
|
|
5948
|
-
set: (target, key, value, receiver)=>Reflect.set(target, key, value, receiver),
|
|
5949
|
-
defineProperty: (target, p, attrs)=>Reflect.defineProperty(target, p, attrs)
|
|
5950
|
-
}), fn = api[key], result = await fn.call(trap, trap);
|
|
5951
|
-
return 'string' == typeof result ? Buffer.from(result, 'utf-8') : result && 'object' == typeof result ? Buffer.from(JSON.stringify(result), 'utf-8') : result;
|
|
5952
|
-
};
|
|
5953
|
-
}
|
|
5954
|
-
}
|
|
5955
|
-
class BaseAPI {
|
|
5956
|
-
constructor(sdk, server){
|
|
5957
|
-
this.ctx = {
|
|
5958
|
-
sdk,
|
|
5959
|
-
server
|
|
5960
|
-
}, this.dataLoader = new common_namespaceObject.Data.APIDataLoader(this);
|
|
5961
|
-
}
|
|
5962
|
-
async loadManifest() {
|
|
5963
|
-
return this.ctx.sdk.getManifestData();
|
|
5964
|
-
}
|
|
5965
|
-
async loadData(key) {
|
|
5966
|
-
let data = this.ctx.sdk.getStoreData(), res = data[key];
|
|
5967
|
-
return key.includes('.') && (res = key.split('.').reduce((t, k)=>t[k], data)), res;
|
|
5968
|
-
}
|
|
5969
|
-
}
|
|
5970
|
-
function _ts_metadata(k, v) {
|
|
5971
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
5972
|
-
}
|
|
5973
|
-
class AlertsAPI extends BaseAPI {
|
|
5974
|
-
async getPackageRelationAlertDetails() {
|
|
5975
|
-
let { req } = this.ctx, { id, target } = req.body;
|
|
5976
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetPackageRelationAlertDetails, {
|
|
5977
|
-
id,
|
|
5978
|
-
target
|
|
5979
|
-
});
|
|
5980
|
-
}
|
|
5981
|
-
}
|
|
5982
|
-
function data_ts_decorate(decorators, target, key, desc) {
|
|
5983
|
-
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
5984
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
5985
|
-
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
5986
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5987
|
-
}
|
|
5988
|
-
function data_ts_metadata(k, v) {
|
|
5989
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
5990
|
-
}
|
|
5991
|
-
!function(decorators, target, key, desc) {
|
|
5992
|
-
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
5993
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
5994
|
-
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
5995
|
-
c > 3 && r && Object.defineProperty(target, key, r);
|
|
5996
|
-
}([
|
|
5997
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetPackageRelationAlertDetails),
|
|
5998
|
-
_ts_metadata("design:type", Function),
|
|
5999
|
-
_ts_metadata("design:paramtypes", []),
|
|
6000
|
-
_ts_metadata("design:returntype", Promise)
|
|
6001
|
-
], AlertsAPI.prototype, "getPackageRelationAlertDetails", null);
|
|
6002
|
-
class DataAPI extends BaseAPI {
|
|
6003
|
-
async loadDataByKey() {
|
|
6004
|
-
let { req } = this.ctx, { url } = req, { key } = req.body;
|
|
6005
|
-
return !key && url && (key = new URL(url, 'http://127.0.0.1').pathname.replace(/^\//, '')), await this.loadData(key);
|
|
6006
|
-
}
|
|
6007
|
-
async sendMessageToClient() {
|
|
6008
|
-
let { req, server } = this.ctx, { api, data } = req.body;
|
|
6009
|
-
await server.sendAPIDataToClient(api, data);
|
|
6010
|
-
}
|
|
6011
|
-
}
|
|
6012
|
-
function fs_ts_metadata(k, v) {
|
|
6013
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
6014
|
-
}
|
|
6015
|
-
data_ts_decorate([
|
|
6016
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.LoadDataByKey),
|
|
6017
|
-
data_ts_metadata("design:type", Function),
|
|
6018
|
-
data_ts_metadata("design:paramtypes", []),
|
|
6019
|
-
data_ts_metadata("design:returntype", Promise)
|
|
6020
|
-
], DataAPI.prototype, "loadDataByKey", null), data_ts_decorate([
|
|
6021
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.SendAPIDataToClient),
|
|
6022
|
-
data_ts_metadata("design:type", Function),
|
|
6023
|
-
data_ts_metadata("design:paramtypes", []),
|
|
6024
|
-
data_ts_metadata("design:returntype", Promise)
|
|
6025
|
-
], DataAPI.prototype, "sendMessageToClient", null);
|
|
6026
|
-
class FileSystemAPI extends BaseAPI {
|
|
6027
|
-
async applyErrorFix() {
|
|
6028
|
-
let { body } = this.ctx.req;
|
|
6029
|
-
return await this.ctx.sdk.applyErrorFix(body.id), 'success';
|
|
6030
|
-
}
|
|
6031
|
-
}
|
|
6032
|
-
function loader_ts_decorate(decorators, target, key, desc) {
|
|
6033
|
-
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
6034
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
6035
|
-
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
6036
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6037
|
-
}
|
|
6038
|
-
function loader_ts_metadata(k, v) {
|
|
6039
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
6040
|
-
}
|
|
6041
|
-
!function(decorators, target, key, desc) {
|
|
6042
|
-
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
6043
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
6044
|
-
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
6045
|
-
c > 3 && r && Object.defineProperty(target, key, r);
|
|
6046
|
-
}([
|
|
6047
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.ApplyErrorFix),
|
|
6048
|
-
fs_ts_metadata("design:type", Function),
|
|
6049
|
-
fs_ts_metadata("design:paramtypes", []),
|
|
6050
|
-
fs_ts_metadata("design:returntype", Promise)
|
|
6051
|
-
], FileSystemAPI.prototype, "applyErrorFix", null);
|
|
6052
|
-
class LoaderAPI extends BaseAPI {
|
|
6053
|
-
async reportLoader() {
|
|
6054
|
-
let { req, sdk } = this.ctx, { body } = req;
|
|
6055
|
-
return sdk.reportLoader(body), 'ok';
|
|
6056
|
-
}
|
|
6057
|
-
async reportSourceMap() {
|
|
6058
|
-
let { req: { body }, sdk } = this.ctx;
|
|
6059
|
-
return sdk.reportSourceMap(body), 'ok';
|
|
6060
|
-
}
|
|
6061
|
-
async getLoaderNames() {
|
|
6062
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetLoaderNames);
|
|
6063
|
-
}
|
|
6064
|
-
async getLoaderChartData() {
|
|
6065
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetLoaderChartData);
|
|
6066
|
-
}
|
|
6067
|
-
async getLoaderFileTree() {
|
|
6068
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileTree);
|
|
6069
|
-
}
|
|
6070
|
-
async getLoaderFileDetails() {
|
|
6071
|
-
let { req } = this.ctx, { path } = req.body;
|
|
6072
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileDetails, {
|
|
6073
|
-
path
|
|
6074
|
-
});
|
|
6075
|
-
}
|
|
6076
|
-
async getLoaderFolderStatistics() {
|
|
6077
|
-
let { req } = this.ctx, { folder } = req.body;
|
|
6078
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFolderStatistics, {
|
|
6079
|
-
folder
|
|
6080
|
-
});
|
|
6081
|
-
}
|
|
6082
|
-
async getLoaderFileFirstInput() {
|
|
6083
|
-
let { req } = this.ctx, { file } = req.body;
|
|
6084
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileFirstInput, {
|
|
6085
|
-
file
|
|
6086
|
-
});
|
|
6087
|
-
}
|
|
6088
|
-
async getLoaderFileInputAndOutput() {
|
|
6089
|
-
let { req } = this.ctx, { file, loader, loaderIndex } = req.body;
|
|
6090
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileInputAndOutput, {
|
|
6091
|
-
file,
|
|
6092
|
-
loader,
|
|
6093
|
-
loaderIndex
|
|
6094
|
-
});
|
|
6095
|
-
}
|
|
6096
|
-
}
|
|
6097
|
-
function graph_ts_decorate(decorators, target, key, desc) {
|
|
6098
|
-
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
6099
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
6100
|
-
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
6101
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6102
|
-
}
|
|
6103
|
-
function graph_ts_metadata(k, v) {
|
|
6104
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
6105
|
-
}
|
|
6106
|
-
loader_ts_decorate([
|
|
6107
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.ReportLoader),
|
|
6108
|
-
loader_ts_metadata("design:type", Function),
|
|
6109
|
-
loader_ts_metadata("design:paramtypes", []),
|
|
6110
|
-
loader_ts_metadata("design:returntype", Promise)
|
|
6111
|
-
], LoaderAPI.prototype, "reportLoader", null), loader_ts_decorate([
|
|
6112
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.ReportSourceMap),
|
|
6113
|
-
loader_ts_metadata("design:type", Function),
|
|
6114
|
-
loader_ts_metadata("design:paramtypes", []),
|
|
6115
|
-
loader_ts_metadata("design:returntype", Promise)
|
|
6116
|
-
], LoaderAPI.prototype, "reportSourceMap", null), loader_ts_decorate([
|
|
6117
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetLoaderNames),
|
|
6118
|
-
loader_ts_metadata("design:type", Function),
|
|
6119
|
-
loader_ts_metadata("design:paramtypes", []),
|
|
6120
|
-
loader_ts_metadata("design:returntype", Promise)
|
|
6121
|
-
], LoaderAPI.prototype, "getLoaderNames", null), loader_ts_decorate([
|
|
6122
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetLoaderChartData),
|
|
6123
|
-
loader_ts_metadata("design:type", Function),
|
|
6124
|
-
loader_ts_metadata("design:paramtypes", []),
|
|
6125
|
-
loader_ts_metadata("design:returntype", Promise)
|
|
6126
|
-
], LoaderAPI.prototype, "getLoaderChartData", null), loader_ts_decorate([
|
|
6127
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileTree),
|
|
6128
|
-
loader_ts_metadata("design:type", Function),
|
|
6129
|
-
loader_ts_metadata("design:paramtypes", []),
|
|
6130
|
-
loader_ts_metadata("design:returntype", Promise)
|
|
6131
|
-
], LoaderAPI.prototype, "getLoaderFileTree", null), loader_ts_decorate([
|
|
6132
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileDetails),
|
|
6133
|
-
loader_ts_metadata("design:type", Function),
|
|
6134
|
-
loader_ts_metadata("design:paramtypes", []),
|
|
6135
|
-
loader_ts_metadata("design:returntype", Promise)
|
|
6136
|
-
], LoaderAPI.prototype, "getLoaderFileDetails", null), loader_ts_decorate([
|
|
6137
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFolderStatistics),
|
|
6138
|
-
loader_ts_metadata("design:type", Function),
|
|
6139
|
-
loader_ts_metadata("design:paramtypes", []),
|
|
6140
|
-
loader_ts_metadata("design:returntype", Promise)
|
|
6141
|
-
], LoaderAPI.prototype, "getLoaderFolderStatistics", null), loader_ts_decorate([
|
|
6142
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileFirstInput),
|
|
6143
|
-
loader_ts_metadata("design:type", Function),
|
|
6144
|
-
loader_ts_metadata("design:paramtypes", []),
|
|
6145
|
-
loader_ts_metadata("design:returntype", Promise)
|
|
6146
|
-
], LoaderAPI.prototype, "getLoaderFileFirstInput", null), loader_ts_decorate([
|
|
6147
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileInputAndOutput),
|
|
6148
|
-
loader_ts_metadata("design:type", Function),
|
|
6149
|
-
loader_ts_metadata("design:paramtypes", []),
|
|
6150
|
-
loader_ts_metadata("design:returntype", Promise)
|
|
6151
|
-
], LoaderAPI.prototype, "getLoaderFileInputAndOutput", null);
|
|
6152
|
-
class GraphAPI extends BaseAPI {
|
|
6153
|
-
async getAssetsSummary() {
|
|
6154
|
-
let { req } = this.ctx, { withFileContent } = req.body;
|
|
6155
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetAssetsSummary, {
|
|
6156
|
-
withFileContent
|
|
6157
|
-
});
|
|
6158
|
-
}
|
|
6159
|
-
async getModuleGraphForAsset() {
|
|
6160
|
-
let { req } = this.ctx, { assetPath } = req.body;
|
|
6161
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetAssetDetails, {
|
|
6162
|
-
assetPath
|
|
6163
|
-
});
|
|
6164
|
-
}
|
|
6165
|
-
async getChunksByModuleId() {
|
|
6166
|
-
let { req } = this.ctx, { moduleId } = req.body;
|
|
6167
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetChunksByModuleId, {
|
|
6168
|
-
moduleId
|
|
6169
|
-
});
|
|
6170
|
-
}
|
|
6171
|
-
async getModuleDetails() {
|
|
6172
|
-
let { req } = this.ctx, { moduleId } = req.body;
|
|
6173
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetModuleDetails, {
|
|
6174
|
-
moduleId
|
|
6175
|
-
});
|
|
6176
|
-
}
|
|
6177
|
-
async getDependencyByResolvedRequest() {
|
|
6178
|
-
let { req } = this.ctx, { moduleIds = [] } = req.body;
|
|
6179
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetModulesByModuleIds, {
|
|
6180
|
-
moduleIds
|
|
6181
|
-
});
|
|
6182
|
-
}
|
|
6183
|
-
async getModuleCodeByModuleId() {
|
|
6184
|
-
let { req } = this.ctx, { moduleId } = req.body;
|
|
6185
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetModuleCodeByModuleId, {
|
|
6186
|
-
moduleId
|
|
6187
|
-
});
|
|
6188
|
-
}
|
|
6189
|
-
async getModuleCodeByModuleIds() {
|
|
6190
|
-
let { req } = this.ctx, { moduleIds } = req.body;
|
|
6191
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetModuleCodeByModuleIds, {
|
|
6192
|
-
moduleIds
|
|
6193
|
-
});
|
|
6194
|
-
}
|
|
6195
|
-
async getEntryModulesSummary() {
|
|
6196
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetEntryPoints);
|
|
6197
|
-
}
|
|
6198
|
-
}
|
|
6199
|
-
function plugin_ts_decorate(decorators, target, key, desc) {
|
|
6200
|
-
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
6201
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
6202
|
-
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
6203
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6204
|
-
}
|
|
6205
|
-
function plugin_ts_metadata(k, v) {
|
|
6206
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
6207
|
-
}
|
|
6208
|
-
graph_ts_decorate([
|
|
6209
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetAssetsSummary),
|
|
6210
|
-
graph_ts_metadata("design:type", Function),
|
|
6211
|
-
graph_ts_metadata("design:paramtypes", []),
|
|
6212
|
-
graph_ts_metadata("design:returntype", Promise)
|
|
6213
|
-
], GraphAPI.prototype, "getAssetsSummary", null), graph_ts_decorate([
|
|
6214
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetAssetDetails),
|
|
6215
|
-
graph_ts_metadata("design:type", Function),
|
|
6216
|
-
graph_ts_metadata("design:paramtypes", []),
|
|
6217
|
-
graph_ts_metadata("design:returntype", Promise)
|
|
6218
|
-
], GraphAPI.prototype, "getModuleGraphForAsset", null), graph_ts_decorate([
|
|
6219
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetChunksByModuleId),
|
|
6220
|
-
graph_ts_metadata("design:type", Function),
|
|
6221
|
-
graph_ts_metadata("design:paramtypes", []),
|
|
6222
|
-
graph_ts_metadata("design:returntype", Promise)
|
|
6223
|
-
], GraphAPI.prototype, "getChunksByModuleId", null), graph_ts_decorate([
|
|
6224
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetModuleDetails),
|
|
6225
|
-
graph_ts_metadata("design:type", Function),
|
|
6226
|
-
graph_ts_metadata("design:paramtypes", []),
|
|
6227
|
-
graph_ts_metadata("design:returntype", Promise)
|
|
6228
|
-
], GraphAPI.prototype, "getModuleDetails", null), graph_ts_decorate([
|
|
6229
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetModulesByModuleIds),
|
|
6230
|
-
graph_ts_metadata("design:type", Function),
|
|
6231
|
-
graph_ts_metadata("design:paramtypes", []),
|
|
6232
|
-
graph_ts_metadata("design:returntype", Promise)
|
|
6233
|
-
], GraphAPI.prototype, "getDependencyByResolvedRequest", null), graph_ts_decorate([
|
|
6234
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetModuleCodeByModuleId),
|
|
6235
|
-
graph_ts_metadata("design:type", Function),
|
|
6236
|
-
graph_ts_metadata("design:paramtypes", []),
|
|
6237
|
-
graph_ts_metadata("design:returntype", Promise)
|
|
6238
|
-
], GraphAPI.prototype, "getModuleCodeByModuleId", null), graph_ts_decorate([
|
|
6239
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetModuleCodeByModuleIds),
|
|
6240
|
-
graph_ts_metadata("design:type", Function),
|
|
6241
|
-
graph_ts_metadata("design:paramtypes", []),
|
|
6242
|
-
graph_ts_metadata("design:returntype", Promise)
|
|
6243
|
-
], GraphAPI.prototype, "getModuleCodeByModuleIds", null), graph_ts_decorate([
|
|
6244
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetEntryPoints),
|
|
6245
|
-
graph_ts_metadata("design:type", Function),
|
|
6246
|
-
graph_ts_metadata("design:paramtypes", []),
|
|
6247
|
-
graph_ts_metadata("design:returntype", Promise)
|
|
6248
|
-
], GraphAPI.prototype, "getEntryModulesSummary", null);
|
|
6249
|
-
class PluginAPI extends BaseAPI {
|
|
6250
|
-
async getPluginSummary() {
|
|
6251
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetPluginSummary);
|
|
6252
|
-
}
|
|
6253
|
-
async getPluginData() {
|
|
6254
|
-
let { req } = this.ctx, { hooks = [], tapNames = [] } = req.body;
|
|
6255
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetPluginData, {
|
|
6256
|
-
hooks,
|
|
6257
|
-
tapNames
|
|
6258
|
-
});
|
|
6259
|
-
}
|
|
6260
|
-
}
|
|
6261
|
-
plugin_ts_decorate([
|
|
6262
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetPluginSummary),
|
|
6263
|
-
plugin_ts_metadata("design:type", Function),
|
|
6264
|
-
plugin_ts_metadata("design:paramtypes", []),
|
|
6265
|
-
plugin_ts_metadata("design:returntype", Promise)
|
|
6266
|
-
], PluginAPI.prototype, "getPluginSummary", null), plugin_ts_decorate([
|
|
6267
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetPluginData),
|
|
6268
|
-
plugin_ts_metadata("design:type", Function),
|
|
6269
|
-
plugin_ts_metadata("design:paramtypes", []),
|
|
6270
|
-
plugin_ts_metadata("design:returntype", Promise)
|
|
6271
|
-
], PluginAPI.prototype, "getPluginData", null);
|
|
6272
|
-
var external_os_ = __webpack_require__("os"), external_os_default = __webpack_require__.n(external_os_);
|
|
6273
|
-
function getLocalIpAddress() {
|
|
6274
|
-
for (let iface of Object.values(external_os_default().networkInterfaces()))for (let alias of iface)if ('IPv4' === alias.family && !alias.internal) return alias.address;
|
|
6275
|
-
return '127.0.0.1';
|
|
6276
|
-
}
|
|
6277
|
-
function project_ts_decorate(decorators, target, key, desc) {
|
|
6278
|
-
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
6279
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
6280
|
-
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
6281
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6282
|
-
}
|
|
6283
|
-
function project_ts_metadata(k, v) {
|
|
6284
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
6285
|
-
}
|
|
6286
|
-
class ProjectAPI extends BaseAPI {
|
|
6287
|
-
async env() {
|
|
6288
|
-
let { server } = this.ctx;
|
|
6289
|
-
return {
|
|
6290
|
-
ip: getLocalIpAddress(),
|
|
6291
|
-
port: server.port
|
|
6292
|
-
};
|
|
6293
|
-
}
|
|
6294
|
-
async manifest() {
|
|
6295
|
-
let { sdk } = this.ctx;
|
|
6296
|
-
return JSON.stringify(sdk.getManifestData());
|
|
6297
|
-
}
|
|
6298
|
-
async getProjectInfo() {
|
|
6299
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetProjectInfo);
|
|
6300
|
-
}
|
|
6301
|
-
async getClientRoutes() {
|
|
6302
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetClientRoutes);
|
|
6303
|
-
}
|
|
6304
|
-
}
|
|
6305
|
-
function renderer_ts_metadata(k, v) {
|
|
6306
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
6307
|
-
}
|
|
6308
|
-
project_ts_decorate([
|
|
6309
|
-
Router.get(types_namespaceObject.SDK.ServerAPI.API.Env),
|
|
6310
|
-
project_ts_metadata("design:type", Function),
|
|
6311
|
-
project_ts_metadata("design:paramtypes", []),
|
|
6312
|
-
project_ts_metadata("design:returntype", Promise)
|
|
6313
|
-
], ProjectAPI.prototype, "env", null), project_ts_decorate([
|
|
6314
|
-
Router.get(types_namespaceObject.SDK.ServerAPI.API.Manifest),
|
|
6315
|
-
project_ts_metadata("design:type", Function),
|
|
6316
|
-
project_ts_metadata("design:paramtypes", []),
|
|
6317
|
-
project_ts_metadata("design:returntype", Promise)
|
|
6318
|
-
], ProjectAPI.prototype, "manifest", null), project_ts_decorate([
|
|
6319
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetProjectInfo),
|
|
6320
|
-
project_ts_metadata("design:type", Function),
|
|
6321
|
-
project_ts_metadata("design:paramtypes", []),
|
|
6322
|
-
project_ts_metadata("design:returntype", Promise)
|
|
6323
|
-
], ProjectAPI.prototype, "getProjectInfo", null), project_ts_decorate([
|
|
6324
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetClientRoutes),
|
|
6325
|
-
project_ts_metadata("design:type", Function),
|
|
6326
|
-
project_ts_metadata("design:paramtypes", []),
|
|
6327
|
-
project_ts_metadata("design:returntype", Promise)
|
|
6328
|
-
], ProjectAPI.prototype, "getClientRoutes", null);
|
|
6329
|
-
let renderer_require = (0, external_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
|
|
6330
|
-
class RendererAPI extends BaseAPI {
|
|
6331
|
-
async entryHtml() {
|
|
6332
|
-
let { server, res } = this.ctx, clientHtmlPath = server.innerClientPath ? server.innerClientPath : renderer_require.resolve('@rsdoctor/client'), clientHtml = external_node_fs_default().readFileSync(clientHtmlPath, 'utf-8');
|
|
6333
|
-
return res.setHeader('Content-Type', 'text/html'), res.setHeader('Cache-Control', 'no-store'), clientHtml;
|
|
6334
|
-
}
|
|
6335
|
-
}
|
|
6336
|
-
function resolver_ts_decorate(decorators, target, key, desc) {
|
|
6337
|
-
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
6338
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
6339
|
-
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
6340
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6341
|
-
}
|
|
6342
|
-
function resolver_ts_metadata(k, v) {
|
|
6343
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
6344
|
-
}
|
|
6345
|
-
!function(decorators, target, key, desc) {
|
|
6346
|
-
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
6347
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
6348
|
-
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
6349
|
-
c > 3 && r && Object.defineProperty(target, key, r);
|
|
6350
|
-
}([
|
|
6351
|
-
Router.get(types_namespaceObject.SDK.ServerAPI.API.EntryHtml),
|
|
6352
|
-
renderer_ts_metadata("design:type", Function),
|
|
6353
|
-
renderer_ts_metadata("design:paramtypes", []),
|
|
6354
|
-
renderer_ts_metadata("design:returntype", Promise)
|
|
6355
|
-
], RendererAPI.prototype, "entryHtml", null);
|
|
6356
|
-
class ResolverAPI extends BaseAPI {
|
|
6357
|
-
async getResolverFileTree() {
|
|
6358
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetResolverFileTree);
|
|
6359
|
-
}
|
|
6360
|
-
async getResolverFileDetails() {
|
|
6361
|
-
let { req } = this.ctx, { filepath } = req.body;
|
|
6362
|
-
return this.dataLoader.loadAPI(types_namespaceObject.SDK.ServerAPI.API.GetResolverFileDetails, {
|
|
6363
|
-
filepath
|
|
6364
|
-
});
|
|
6365
|
-
}
|
|
6366
|
-
}
|
|
6367
|
-
resolver_ts_decorate([
|
|
6368
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetResolverFileTree),
|
|
6369
|
-
resolver_ts_metadata("design:type", Function),
|
|
6370
|
-
resolver_ts_metadata("design:paramtypes", []),
|
|
6371
|
-
resolver_ts_metadata("design:returntype", Promise)
|
|
6372
|
-
], ResolverAPI.prototype, "getResolverFileTree", null), resolver_ts_decorate([
|
|
6373
|
-
Router.post(types_namespaceObject.SDK.ServerAPI.API.GetResolverFileDetails),
|
|
6374
|
-
resolver_ts_metadata("design:type", Function),
|
|
6375
|
-
resolver_ts_metadata("design:paramtypes", []),
|
|
6376
|
-
resolver_ts_metadata("design:returntype", Promise)
|
|
6377
|
-
], ResolverAPI.prototype, "getResolverFileDetails", null);
|
|
6378
|
-
var external_node_child_process_ = __webpack_require__("node:child_process");
|
|
6379
|
-
let execAsync = (0, __webpack_require__("node:util").promisify)(external_node_child_process_.exec), supportedChromiumBrowsers = [
|
|
6380
|
-
'Google Chrome Canary',
|
|
6381
|
-
'Google Chrome Dev',
|
|
6382
|
-
'Google Chrome Beta',
|
|
6383
|
-
'Google Chrome',
|
|
6384
|
-
'Microsoft Edge',
|
|
6385
|
-
'Brave Browser',
|
|
6386
|
-
'Vivaldi',
|
|
6387
|
-
'Chromium'
|
|
6388
|
-
], getTargetBrowser = async ()=>{
|
|
6389
|
-
let targetBrowser = process.env.BROWSER;
|
|
6390
|
-
if (!targetBrowser || !supportedChromiumBrowsers.includes(targetBrowser)) {
|
|
6391
|
-
let { stdout: ps } = await execAsync('ps cax');
|
|
6392
|
-
targetBrowser = supportedChromiumBrowsers.find((b)=>ps.includes(b));
|
|
6393
|
-
}
|
|
6394
|
-
return targetBrowser;
|
|
6395
|
-
};
|
|
6396
|
-
async function openBrowser(url, needEncodeURI = !0) {
|
|
6397
|
-
if ('darwin' === process.platform || 'win32' === process.platform) try {
|
|
6398
|
-
let targetBrowser = await getTargetBrowser();
|
|
6399
|
-
if (targetBrowser) return await execAsync(`osascript openChrome.applescript "${needEncodeURI ? encodeURI(url) : url}" "${targetBrowser}"`, {
|
|
6400
|
-
cwd: (0, external_node_path_.join)(__dirname, '../static')
|
|
6401
|
-
}), !0;
|
|
6402
|
-
logger_namespaceObject.logger.debug('Failed to find the target browser.');
|
|
6403
|
-
let { default: open } = await __webpack_require__.e("344").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js"));
|
|
6404
|
-
return await open(url), !0;
|
|
6405
|
-
} catch (err) {
|
|
6406
|
-
logger_namespaceObject.logger.debug("Failed to open Rsdoctor URL with apple script."), logger_namespaceObject.logger.debug(err);
|
|
6407
|
-
}
|
|
6408
|
-
else try {
|
|
6409
|
-
let { default: open } = await __webpack_require__.e("344").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js"));
|
|
6410
|
-
return await open(url), !0;
|
|
6411
|
-
} catch (err) {
|
|
6412
|
-
return logger_namespaceObject.logger.error('Failed to open Rsdoctor URL.'), logger_namespaceObject.logger.error(err), !1;
|
|
6413
|
-
}
|
|
6414
|
-
}
|
|
6415
|
-
let server_require = (0, external_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
|
|
6416
|
-
class RsdoctorServer {
|
|
6417
|
-
constructor(sdk, port = build_namespaceObject.Server.defaultPort, config){
|
|
6418
|
-
this.sdk = sdk, this.disposed = !0, this.get = (route, cb)=>{
|
|
6419
|
-
let { app } = this;
|
|
6420
|
-
return app.use(route, this.wrapNextHandleFunction('GET', cb)), app;
|
|
6421
|
-
}, this.post = (route, cb)=>{
|
|
6422
|
-
let { app } = this;
|
|
6423
|
-
return app.use(route, this.wrapNextHandleFunction('POST', cb)), app;
|
|
6424
|
-
}, this.dispose = async (exitCode)=>{
|
|
6425
|
-
if (this.disposed) {
|
|
6426
|
-
void 0 !== exitCode && process.exit(exitCode);
|
|
6427
|
-
return;
|
|
6428
|
-
}
|
|
6429
|
-
this.disposed = !0, this._server && await this._server.close(), this._socket && this._socket.dispose(), void 0 !== exitCode && process.exit(exitCode);
|
|
6430
|
-
}, external_assert_default()('number' == typeof port), this.port = port, this._router = new Router({
|
|
6431
|
-
sdk,
|
|
6432
|
-
server: this,
|
|
6433
|
-
apis: Object.values(apis_namespaceObject)
|
|
6434
|
-
}), this._innerClientPath = config?.innerClientPath || '', this._printServerUrl = !!common_namespaceObject.Lodash.isUndefined(config?.printServerUrl) || config?.printServerUrl;
|
|
6435
|
-
}
|
|
6436
|
-
get app() {
|
|
6437
|
-
return this._server.app;
|
|
6438
|
-
}
|
|
6439
|
-
get host() {
|
|
6440
|
-
return getLocalIpAddress();
|
|
6441
|
-
}
|
|
6442
|
-
get origin() {
|
|
6443
|
-
return `http://${this.host}:${this.port}`;
|
|
6444
|
-
}
|
|
6445
|
-
get socketUrl() {
|
|
6446
|
-
return {
|
|
6447
|
-
port: this.port,
|
|
6448
|
-
socketUrl: `ws://localhost:${this.port}`
|
|
6449
|
-
};
|
|
6450
|
-
}
|
|
6451
|
-
get innerClientPath() {
|
|
6452
|
-
return this._innerClientPath;
|
|
6453
|
-
}
|
|
6454
|
-
async bootstrap() {
|
|
6455
|
-
if (!this.disposed) return;
|
|
6456
|
-
let port = build_namespaceObject.Server.getPortSync(this.port);
|
|
6457
|
-
this.port = port, this._server = await build_namespaceObject.Server.createServer(port), this._socket = new Socket({
|
|
6458
|
-
sdk: this.sdk,
|
|
6459
|
-
server: this._server.server,
|
|
6460
|
-
port: this.port
|
|
6461
|
-
}), await this._socket.bootstrap(), common_namespaceObject.GlobalConfig.writeMcpPort(this.port, this.sdk.name), logger_namespaceObject.logger.debug(`Successfully wrote mcp.json for ${logger_namespaceObject.chalk.cyan(this.sdk.name)} builder`), this.disposed = !1, this.app.use(cors_index_js_default()()), this.app.use(body_parser_default().json({
|
|
6462
|
-
limit: '500mb'
|
|
6463
|
-
}));
|
|
6464
|
-
let clientHtmlPath = this._innerClientPath ? this._innerClientPath : server_require.resolve('@rsdoctor/client'), clientDistPath = external_path_default().resolve(clientHtmlPath, '..');
|
|
6465
|
-
this.app.use(function(dir, opts = {}) {
|
|
6466
|
-
dir = (0, external_node_path_.resolve)(dir || '.');
|
|
6467
|
-
let isNotFound = opts.onNoMatch || is404, setHeaders = opts.setHeaders || noop, extensions = opts.extensions || [
|
|
6468
|
-
'html',
|
|
6469
|
-
'htm'
|
|
6470
|
-
], gzips = opts.gzip && extensions.map((x)=>`${x}.gz`).concat('gz'), brots = opts.brotli && extensions.map((x)=>`${x}.br`).concat('br'), FILES = {}, fallback = '/', isEtag = !!opts.etag, isSPA = !!opts.single;
|
|
6471
|
-
if ('string' == typeof opts.single) {
|
|
6472
|
-
let idx = opts.single.lastIndexOf('.');
|
|
6473
|
-
fallback += ~idx ? opts.single.substring(0, idx) : opts.single;
|
|
6474
|
-
}
|
|
6475
|
-
let ignores = [];
|
|
6476
|
-
!1 !== opts.ignores && (ignores.push(/[/]([A-Za-z\s\d~$._-]+\.\w+){1,}$/), opts.dotfiles ? ignores.push(/\/\.\w/) : ignores.push(/\/\.well-known/), [].concat(opts.ignores || []).forEach((x)=>{
|
|
6477
|
-
ignores.push(RegExp(x, 'i'));
|
|
6478
|
-
}));
|
|
6479
|
-
let cc = null != opts.maxAge && `public,max-age=${opts.maxAge}`;
|
|
6480
|
-
cc && opts.immutable ? cc += ',immutable' : cc && 0 === opts.maxAge && (cc += ',must-revalidate'), opts.dev || function totalist(dir, callback, pre = '') {
|
|
6481
|
-
dir = (0, external_path_.resolve)('.', dir);
|
|
6482
|
-
let arr = (0, external_fs_.readdirSync)(dir), i = 0, abs, stats;
|
|
6483
|
-
for(; i < arr.length; i++)abs = (0, external_path_.join)(dir, arr[i]), (stats = (0, external_fs_.statSync)(abs)).isDirectory() ? totalist(abs, callback, (0, external_path_.join)(pre, arr[i])) : callback((0, external_path_.join)(pre, arr[i]), abs, stats);
|
|
6484
|
-
}(dir, (name, abs, stats)=>{
|
|
6485
|
-
if (/\.well-known[\\+\/]/.test(name)) ;
|
|
6486
|
-
else if (!opts.dotfiles && /(^\.|[\\+|\/+]\.)/.test(name)) return;
|
|
6487
|
-
let headers = toHeaders(name, stats, isEtag);
|
|
6488
|
-
cc && (headers['Cache-Control'] = cc), FILES['/' + name.normalize().replace(/\\+/g, '/')] = {
|
|
6489
|
-
abs,
|
|
6490
|
-
stats,
|
|
6491
|
-
headers
|
|
6492
|
-
};
|
|
6493
|
-
});
|
|
6494
|
-
let lookup = opts.dev ? viaLocal.bind(0, dir + external_node_path_.sep, isEtag) : viaCache.bind(0, FILES);
|
|
6495
|
-
return function(req, res, next) {
|
|
6496
|
-
let extns = [
|
|
6497
|
-
''
|
|
6498
|
-
], pathname = function(req) {
|
|
6499
|
-
let raw = req.url;
|
|
6500
|
-
if (null == raw) return;
|
|
6501
|
-
let prev = req._parsedUrl;
|
|
6502
|
-
if (prev && prev.raw === raw) return prev;
|
|
6503
|
-
let pathname = raw, search = '', query;
|
|
6504
|
-
if (raw.length > 1) {
|
|
6505
|
-
let idx = raw.indexOf('?', 1);
|
|
6506
|
-
-1 !== idx && (search = raw.substring(idx), pathname = raw.substring(0, idx), search.length > 1 && (query = external_node_querystring_namespaceObject.parse(search.substring(1))));
|
|
6507
|
-
}
|
|
6508
|
-
return req._parsedUrl = {
|
|
6509
|
-
pathname,
|
|
6510
|
-
search,
|
|
6511
|
-
query,
|
|
6512
|
-
raw
|
|
6513
|
-
};
|
|
6514
|
-
}(req).pathname, val = req.headers['accept-encoding'] || '';
|
|
6515
|
-
if (gzips && val.includes('gzip') && extns.unshift(...gzips), brots && /(br|brotli)/i.test(val) && extns.unshift(...brots), extns.push(...extensions), -1 !== pathname.indexOf('%')) try {
|
|
6516
|
-
pathname = decodeURI(pathname);
|
|
6517
|
-
} catch (err) {}
|
|
6518
|
-
let data = lookup(pathname, extns) || isSPA && !function(uri, arr) {
|
|
6519
|
-
for(let i = 0; i < arr.length; i++)if (arr[i].test(uri)) return !0;
|
|
6520
|
-
}(pathname, ignores) && lookup(fallback, extns);
|
|
6521
|
-
return data ? isEtag && req.headers['if-none-match'] === data.headers.ETag ? (res.writeHead(304), res.end()) : void ((gzips || brots) && res.setHeader('Vary', 'Accept-Encoding'), setHeaders(res, pathname, data.stats), function(req, res, file, stats, headers) {
|
|
6522
|
-
let code = 200, tmp, opts = {};
|
|
6523
|
-
for(let key in headers = {
|
|
6524
|
-
...headers
|
|
6525
|
-
})(tmp = res.getHeader(key)) && (headers[key] = tmp);
|
|
6526
|
-
if ((tmp = res.getHeader('content-type')) && (headers['Content-Type'] = tmp), req.headers.range) {
|
|
6527
|
-
code = 206;
|
|
6528
|
-
let [x, y] = req.headers.range.replace('bytes=', '').split('-'), end = opts.end = parseInt(y, 10) || stats.size - 1, start = opts.start = parseInt(x, 10) || 0;
|
|
6529
|
-
if (end >= stats.size && (end = stats.size - 1), start >= stats.size) return res.setHeader('Content-Range', `bytes */${stats.size}`), res.statusCode = 416, res.end();
|
|
6530
|
-
headers['Content-Range'] = `bytes ${start}-${end}/${stats.size}`, headers['Content-Length'] = end - start + 1, headers['Accept-Ranges'] = 'bytes';
|
|
6531
|
-
}
|
|
6532
|
-
res.writeHead(code, headers), external_node_fs_.createReadStream(file, opts).pipe(res);
|
|
6533
|
-
}(req, res, data.abs, data.stats, data.headers)) : next ? next() : isNotFound(req, res);
|
|
6534
|
-
};
|
|
6535
|
-
}(clientDistPath, {
|
|
6536
|
-
dev: !0
|
|
6537
|
-
})), this.app.use('/__open-in-editor', (req, res, next)=>{
|
|
6538
|
-
if ('GET' !== req.method && 'HEAD' !== req.method) return next();
|
|
6539
|
-
let url = new URL(req.url || '', "http://localhost"), file = url.searchParams.get('file'), editor = url.searchParams.get('editor') || void 0;
|
|
6540
|
-
if (!file) {
|
|
6541
|
-
res.statusCode = 400, res.end('Missing file parameter');
|
|
6542
|
-
return;
|
|
6543
|
-
}
|
|
6544
|
-
try {
|
|
6545
|
-
let launch = server_require('launch-editor'), responded = !1, safeEnd = (code, body)=>{
|
|
6546
|
-
responded || (responded = !0, res.statusCode = code, res.end(body));
|
|
6547
|
-
};
|
|
6548
|
-
launch(file, editor, (_fileName, errorMessage)=>{
|
|
6549
|
-
errorMessage && safeEnd(500, errorMessage);
|
|
6550
|
-
}), setTimeout(()=>{
|
|
6551
|
-
safeEnd(200, '');
|
|
6552
|
-
}, 200);
|
|
6553
|
-
} catch (err) {
|
|
6554
|
-
res.writableEnded || (res.statusCode = 500, res.end(err.message));
|
|
6555
|
-
}
|
|
6556
|
-
}), await this._router.setup(), process.once('exit', ()=>this.dispose()), process.once('SIGINT', ()=>this.dispose(0)), process.once('SIGTERM', ()=>this.dispose(0)), process.once('unhandledRejection', (reason)=>{
|
|
6557
|
-
console.error('Unhandled promise rejection:', reason), this.dispose(1);
|
|
6558
|
-
}), process.once('uncaughtException', (err, origin)=>{
|
|
6559
|
-
console.error('Uncaught exception:', err), origin && console.error('Exception origin:', origin), this.dispose(1);
|
|
6560
|
-
});
|
|
6561
|
-
}
|
|
6562
|
-
wrapNextHandleFunction(method, cb) {
|
|
6563
|
-
return async (req, res, next)=>{
|
|
6564
|
-
if (req.method?.toUpperCase() === method) {
|
|
6565
|
-
try {
|
|
6566
|
-
let body = await cb(req, res, next);
|
|
6567
|
-
if (res.setHeader('Access-Control-Allow-Origin', '*'), res.setHeader('Access-Control-Allow-Credentials', 'true'), res.statusCode = 200, Buffer.isBuffer(body)) {
|
|
6568
|
-
res.setHeader('Content-Length', body.byteLength);
|
|
6569
|
-
let ps = new external_stream_.PassThrough();
|
|
6570
|
-
ps.write(body), ps.end(), ps.pipe(res);
|
|
6571
|
-
} else body && 'object' == typeof body ? (res.writeHead(200, {
|
|
6572
|
-
'Content-Type': 'application/json;utf-8'
|
|
6573
|
-
}), res.write(JSON.stringify(body)), res.end()) : res.writeHead(200).end(body);
|
|
6574
|
-
} catch (error) {
|
|
6575
|
-
return res.statusCode = 500, res.end(error.message), next(error);
|
|
6576
|
-
}
|
|
6577
|
-
return;
|
|
6578
|
-
}
|
|
6579
|
-
await next();
|
|
6580
|
-
};
|
|
6581
|
-
}
|
|
6582
|
-
proxy(api, method, cb) {
|
|
6583
|
-
let idx = this.app.stack.findIndex((e)=>e.route === api);
|
|
6584
|
-
-1 === idx && (idx = this.app.stack.length - 1), this.app.stack.splice(idx, 0, {
|
|
6585
|
-
route: api,
|
|
6586
|
-
handle: this.wrapNextHandleFunction(method, cb)
|
|
6587
|
-
});
|
|
6588
|
-
}
|
|
6589
|
-
getClientUrl(route = 'homepage', ...args) {
|
|
6590
|
-
let relativeUrl = types_namespaceObject.SDK.ServerAPI.API.EntryHtml;
|
|
6591
|
-
if (route !== types_namespaceObject.Client.RsdoctorClientRoutes.BundleDiff) return relativeUrl;
|
|
6592
|
-
{
|
|
6593
|
-
let [baseline, current] = args, qs = common_namespaceObject.Bundle.getBundleDiffPageQueryString([
|
|
6594
|
-
baseline,
|
|
6595
|
-
current
|
|
6596
|
-
]);
|
|
6597
|
-
return `${relativeUrl}${qs}#${types_namespaceObject.Client.RsdoctorClientRoutes.BundleDiff}`;
|
|
6598
|
-
}
|
|
6599
|
-
}
|
|
6600
|
-
async openClientPage(...args) {
|
|
6601
|
-
let relativeUrl = this.getClientUrl(...args), needEncodeURI = arguments[0] === types_namespaceObject.Client.RsdoctorClientRoutes.BundleDiff, url = `http://${this.host}:${this.port}${relativeUrl}`, localhostUrl = `http://localhost:${this.port}${relativeUrl}`;
|
|
6602
|
-
await openBrowser(localhostUrl, !needEncodeURI), this._printServerUrl && logger_namespaceObject.logger.info(`${logger_namespaceObject.chalk.green(`${this.sdk.name} compiler's`)} analyzer running on: ${logger_namespaceObject.chalk.cyan(url)}`);
|
|
6603
|
-
}
|
|
6604
|
-
sendAPIDataToClient(api, msg) {
|
|
6605
|
-
this._socket?.sendAPIData(api, msg);
|
|
6606
|
-
}
|
|
6607
|
-
async broadcast() {
|
|
6608
|
-
await this._socket?.broadcast();
|
|
6609
|
-
}
|
|
6610
|
-
}
|
|
6611
|
-
class RsdoctorFakeServer extends RsdoctorServer {
|
|
6612
|
-
constructor(sdk, port = build_namespaceObject.Server.defaultPort){
|
|
6613
|
-
super(sdk, port), this.sdk = sdk, this.sdk = sdk;
|
|
6614
|
-
}
|
|
6615
|
-
async openClientPage() {}
|
|
6616
|
-
}
|
|
6617
|
-
let external_node_crypto_namespaceObject = require("node:crypto");
|
|
6618
|
-
var external_node_process_ = __webpack_require__("node:process"), external_node_process_default = __webpack_require__.n(external_node_process_);
|
|
6619
|
-
let external_tapable_namespaceObject = require("tapable"), dayjs_index_js_namespaceObject = require("../compiled/dayjs/index.js");
|
|
6620
|
-
function findRoot(startDir = process.cwd()) {
|
|
6621
|
-
let dir = startDir, firstPkgDir = null;
|
|
6622
|
-
for(; dir !== external_path_default().parse(dir).root;){
|
|
6623
|
-
if (external_fs_default().existsSync(external_path_default().join(dir, 'pnpm-workspace.yaml')) || external_fs_default().existsSync(external_path_default().join(dir, 'yarn.lock')) || external_fs_default().existsSync(external_path_default().join(dir, 'lerna.json'))) return dir;
|
|
6624
|
-
let pkgPath = external_path_default().join(dir, 'package.json');
|
|
6625
|
-
if (external_fs_default().existsSync(pkgPath) && (firstPkgDir || (firstPkgDir = dir), JSON.parse(external_fs_default().readFileSync(pkgPath, 'utf8')).workspaces)) return dir;
|
|
6626
|
-
dir = external_path_default().dirname(dir);
|
|
6627
|
-
}
|
|
6628
|
-
return firstPkgDir || null;
|
|
6629
|
-
}
|
|
6630
|
-
__webpack_require__.n(dayjs_index_js_namespaceObject)()().format('YYYYMMDD');
|
|
6631
|
-
class SDKCore {
|
|
6632
|
-
constructor({ name, root }){
|
|
6633
|
-
this.hooks = {
|
|
6634
|
-
afterSaveManifest: new external_tapable_namespaceObject.AsyncSeriesHook([
|
|
6635
|
-
'result'
|
|
6636
|
-
])
|
|
6637
|
-
}, this._envinfo = {}, this._clientRoutes = new Set([
|
|
6638
|
-
types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.Overall
|
|
6639
|
-
]), this.diskManifestPath = '', this._name = name, this.root = root, this.pid = external_node_process_default().pid, this._outputDir = external_node_path_default().join(this.outputDir || this.root, types_namespaceObject.Constants.RsdoctorOutputFolder);
|
|
6640
|
-
}
|
|
6641
|
-
get outputDir() {
|
|
6642
|
-
return this._outputDir;
|
|
6643
|
-
}
|
|
6644
|
-
get name() {
|
|
6645
|
-
return this._name;
|
|
6646
|
-
}
|
|
6647
|
-
async bootstrap() {
|
|
6648
|
-
let [cpu, memory, nodeVersion, yarnVersion, npmVersion, pnpmVersion] = await Promise.all([
|
|
6649
|
-
build_namespaceObject.EnvInfo.getCPUInfo(),
|
|
6650
|
-
build_namespaceObject.EnvInfo.getMemoryInfo(),
|
|
6651
|
-
build_namespaceObject.EnvInfo.getNodeVersion(),
|
|
6652
|
-
build_namespaceObject.EnvInfo.getYarnVersion(),
|
|
6653
|
-
build_namespaceObject.EnvInfo.getNpmVersion(),
|
|
6654
|
-
build_namespaceObject.EnvInfo.getPnpmVersion()
|
|
6655
|
-
]);
|
|
6656
|
-
this._envinfo = {
|
|
6657
|
-
...this._envinfo,
|
|
6658
|
-
cpu,
|
|
6659
|
-
memory,
|
|
6660
|
-
nodeVersion,
|
|
6661
|
-
yarnVersion,
|
|
6662
|
-
npmVersion,
|
|
6663
|
-
pnpmVersion
|
|
6664
|
-
};
|
|
6665
|
-
let hash = (0, external_node_crypto_namespaceObject.createHash)('md5').update([
|
|
6666
|
-
this.name,
|
|
6667
|
-
this.root,
|
|
6668
|
-
JSON.stringify(this._envinfo),
|
|
6669
|
-
Date.now()
|
|
6670
|
-
].join('_')).digest('hex');
|
|
6671
|
-
this.setHash(hash);
|
|
6672
|
-
}
|
|
6673
|
-
async dispose() {}
|
|
6674
|
-
setOutputDir(outputDir) {
|
|
6675
|
-
this._outputDir = outputDir;
|
|
6676
|
-
}
|
|
6677
|
-
setName(name) {
|
|
6678
|
-
this._name = name;
|
|
6679
|
-
}
|
|
6680
|
-
setHash(hash) {
|
|
6681
|
-
this.hash = hash;
|
|
6682
|
-
}
|
|
6683
|
-
getHash() {
|
|
6684
|
-
return this.hash;
|
|
6685
|
-
}
|
|
6686
|
-
getClientRoutes() {
|
|
6687
|
-
return [
|
|
6688
|
-
...this._clientRoutes
|
|
6689
|
-
];
|
|
6690
|
-
}
|
|
6691
|
-
addClientRoutes(routes) {
|
|
6692
|
-
routes.forEach((route)=>{
|
|
6693
|
-
this._clientRoutes.add(route);
|
|
6694
|
-
}), this.onDataReport();
|
|
6695
|
-
}
|
|
6696
|
-
async writePieces(storeData, _options) {
|
|
6697
|
-
let { outputDir } = this, manifest = external_node_path_default().resolve(outputDir, types_namespaceObject.Constants.RsdoctorOutputManifest);
|
|
6698
|
-
this.diskManifestPath = manifest, await build_namespaceObject.File.fse.ensureDir(outputDir);
|
|
6699
|
-
let urlsPromiseList = [];
|
|
6700
|
-
for (let key of Object.keys(storeData)){
|
|
6701
|
-
let data = storeData[key];
|
|
6702
|
-
if ('object' != typeof data) {
|
|
6703
|
-
urlsPromiseList.push({
|
|
6704
|
-
name: key,
|
|
6705
|
-
files: data
|
|
6706
|
-
});
|
|
6707
|
-
continue;
|
|
6708
|
-
}
|
|
6709
|
-
let jsonStr = await (async ()=>{
|
|
6710
|
-
try {
|
|
6711
|
-
if ('configs' === key) return JSON.stringify((0, common_namespaceObject.decycle)(data));
|
|
6712
|
-
return JSON.stringify(data);
|
|
6713
|
-
} catch (error) {
|
|
6714
|
-
return build_namespaceObject.Json.stringify(data);
|
|
6715
|
-
}
|
|
6716
|
-
})();
|
|
6717
|
-
if (Array.isArray(jsonStr)) {
|
|
6718
|
-
let urls = jsonStr.map((str, index)=>this.writeToFolder(str, outputDir, key, index + 1));
|
|
6719
|
-
urlsPromiseList.push(...urls);
|
|
6720
|
-
} else urlsPromiseList.push(this.writeToFolder(jsonStr, outputDir, key));
|
|
6721
|
-
}
|
|
6722
|
-
let dataUrls = await Promise.all(urlsPromiseList);
|
|
6723
|
-
logger_namespaceObject.logger.debug(`SDKCore.writePieces extraConfig: ${JSON.stringify(this.extraConfig)}`, '[SDKCore.writePieces]'), this.cloudData = {
|
|
6724
|
-
client: {
|
|
6725
|
-
enableRoutes: this.getClientRoutes()
|
|
6726
|
-
},
|
|
6727
|
-
data: dataUrls.reduce((t, item)=>(t[item.name] = Array.isArray(item.files) ? item.files.map((e)=>e.path).concat(t[item.name] || []) : item.files, t), {})
|
|
6728
|
-
};
|
|
6729
|
-
}
|
|
6730
|
-
async writeManifest() {
|
|
6731
|
-
let { cloudData: data, diskManifestPath } = this, dataStr = JSON.stringify(data, null, 2);
|
|
6732
|
-
logger_namespaceObject.logger.debug(`SDKCore.writeManifest extraConfig: ${this.extraConfig}`, '[SDKCore.writeManifest]');
|
|
6733
|
-
let dir = external_node_path_default().dirname(diskManifestPath), base = external_node_path_default().basename(diskManifestPath), tmpPath = external_node_path_default().join(dir, `${base}.${Date.now()}.${(0, external_node_crypto_namespaceObject.randomUUID)()}.tmp`);
|
|
6734
|
-
return await build_namespaceObject.File.fse.outputFile(tmpPath, dataStr), external_node_fs_default().renameSync(tmpPath, diskManifestPath), diskManifestPath;
|
|
6735
|
-
}
|
|
6736
|
-
async saveManifest(data, options) {
|
|
6737
|
-
await this.writePieces(data, options);
|
|
6738
|
-
let manifestDiskPath = await this.writeManifest();
|
|
6739
|
-
return await this.hooks.afterSaveManifest.promise({
|
|
6740
|
-
manifestWithShardingFiles: this.cloudData,
|
|
6741
|
-
manifestDiskPath
|
|
6742
|
-
}), manifestDiskPath;
|
|
6743
|
-
}
|
|
6744
|
-
writeToFolder(jsonStr, dir, key, index) {
|
|
6745
|
-
let sharding = new build_namespaceObject.File.FileSharding(common_namespaceObject.Algorithm.compressText(jsonStr)), folder = external_node_path_default().resolve(dir, key);
|
|
6746
|
-
return sharding.writeStringToFolder(folder, '', index).then((item)=>({
|
|
6747
|
-
name: key,
|
|
6748
|
-
files: item.map((el)=>({
|
|
6749
|
-
path: external_node_path_default().resolve(folder, el.filename),
|
|
6750
|
-
basename: el.filename,
|
|
6751
|
-
content: el.content
|
|
6752
|
-
}))
|
|
6753
|
-
}));
|
|
6754
|
-
}
|
|
6755
|
-
}
|
|
6756
|
-
let sdk_require = (0, external_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
|
|
6757
|
-
class RsdoctorSDK extends SDKCore {
|
|
6758
|
-
constructor(options){
|
|
6759
|
-
super(options), this._summary = {
|
|
6760
|
-
costs: []
|
|
6761
|
-
}, this._configs = [], this._errors = [], this._loader = [], this._loaderStart = [], this._resolver = [], this._plugin = {}, this._moduleGraph = new graph_namespaceObject.ModuleGraph(), this._chunkGraph = new graph_namespaceObject.ChunkGraph(), this._rawSourceMapCache = new Map(), this._sourceMap = new Map(), this.server = options.config?.noServer ? new RsdoctorFakeServer(this, void 0) : new RsdoctorServer(this, options.port, {
|
|
6762
|
-
innerClientPath: options.config?.innerClientPath || '',
|
|
6763
|
-
printServerUrl: options.config?.printLog?.serverUrls
|
|
6764
|
-
}), this.type = common_namespaceObject.Lodash.isNumber(options.type) ? options.type : types_namespaceObject.SDK.ToDataType.Normal, this.extraConfig = options.config, this.root = findRoot() ?? '';
|
|
6765
|
-
}
|
|
6766
|
-
async bootstrap() {
|
|
6767
|
-
logger_namespaceObject.logger.debug(`${Date.now()}`, '[RsdoctorSDK][bootstrap start]'), this.server && await this.server.bootstrap(), await super.bootstrap(), logger_namespaceObject.logger.debug(`${Date.now()} ${this.server.origin}`, '[RsdoctorSDK][bootstrap end]');
|
|
6768
|
-
}
|
|
6769
|
-
async dispose() {
|
|
6770
|
-
logger_namespaceObject.logger.debug(`${Date.now()}`, '[RsdoctorSDK][dispose start]'), this.server && await this.server.dispose(), await super.dispose(), logger_namespaceObject.logger.debug(`${Date.now()}`, '[RsdoctorSDK][dispose end]');
|
|
6771
|
-
}
|
|
6772
|
-
async applyErrorFix(id) {
|
|
6773
|
-
let { _errors: errors } = this, error = errors.find((err)=>err.id === id);
|
|
6774
|
-
if (!error || !error.path || !error.fixData || error.fixData.isFixed) return;
|
|
6775
|
-
let { path: filePath, fixData } = error, sameFileErrors = errors.filter((item)=>item.path === filePath && item !== error), content = (await external_node_fs_default().promises.readFile(filePath, 'utf-8')).toString(), startTxt = content.substring(0, fixData.start), endTxt = content.substring(fixData.end, content.length), offset = (fixData.newText ?? '').length - (fixData.end - fixData.start);
|
|
6776
|
-
for (let other of (content = startTxt + fixData.newText + endTxt, sameFileErrors)){
|
|
6777
|
-
let { fixData: otherFixData } = other;
|
|
6778
|
-
otherFixData && otherFixData.start >= fixData.end && (otherFixData.start += offset, otherFixData.end += offset);
|
|
6779
|
-
}
|
|
6780
|
-
await external_node_fs_default().promises.writeFile(filePath, content);
|
|
6781
|
-
}
|
|
6782
|
-
clear() {
|
|
6783
|
-
this._errors = [], this._loader = [], this._resolver = [], this._plugin = {}, this._moduleGraph = new graph_namespaceObject.ModuleGraph(), this._chunkGraph = new graph_namespaceObject.ChunkGraph();
|
|
6784
|
-
}
|
|
6785
|
-
clearSourceMapCache() {
|
|
6786
|
-
this._rawSourceMapCache = new Map(), this._sourceMap = new Map();
|
|
6787
|
-
}
|
|
6788
|
-
async getSourceMap(file) {
|
|
6789
|
-
let { _sourceMap: sourceMap, _rawSourceMapCache: rawMap } = this;
|
|
6790
|
-
if (sourceMap.has(file)) return sourceMap.get(file);
|
|
6791
|
-
let rawData = rawMap.get(file);
|
|
6792
|
-
if (!rawData || rawData.version < 0 || !rawData.sourcesContent?.[0] || !rawData.mappings) return Promise.resolve(void 0);
|
|
6793
|
-
try {
|
|
6794
|
-
let result = await new source_map.SourceMapConsumer(rawData);
|
|
6795
|
-
return sourceMap.set(file, result), result;
|
|
6796
|
-
} catch (e) {
|
|
6797
|
-
return Promise.resolve(void 0);
|
|
6798
|
-
}
|
|
6799
|
-
}
|
|
6800
|
-
reportSourceMap(data) {
|
|
6801
|
-
this._rawSourceMapCache.set(data.file, data);
|
|
6802
|
-
}
|
|
6803
|
-
reportConfiguration(config) {
|
|
6804
|
-
config.root ??= this.root, this._configs.push(config), this.onDataReport();
|
|
6805
|
-
}
|
|
6806
|
-
reportError(errors) {
|
|
6807
|
-
errors.forEach((item)=>{
|
|
6808
|
-
this._errors.push(error_namespaceObject.DevToolError.from(item, {
|
|
6809
|
-
code: this.name
|
|
6810
|
-
}));
|
|
6811
|
-
}), this.onDataReport();
|
|
6812
|
-
}
|
|
6813
|
-
reportLoader(data) {
|
|
6814
|
-
data.forEach((item)=>{
|
|
6815
|
-
this.extraConfig?.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] && item.loaders.forEach((_loader)=>{
|
|
6816
|
-
_loader.input = void 0, _loader.result = void 0;
|
|
6817
|
-
});
|
|
6818
|
-
let match = this._loader.find((e)=>e.resource.path === item.resource.path);
|
|
6819
|
-
match ? match.loaders.push(...item.loaders) : (match = item, this._loader.push(item)), match.loaders.sort((a, b)=>a.startAt !== b.startAt ? a.startAt - b.startAt : a.isPitch ? b.isPitch ? a.loaderIndex - b.loaderIndex : -1 : b.isPitch ? 1 : b.loaderIndex - a.loaderIndex);
|
|
6820
|
-
}), this.onDataReport();
|
|
6821
|
-
}
|
|
6822
|
-
reportLoaderStartOrEnd(data) {
|
|
6823
|
-
let _builtinLoader = data.loaders[0];
|
|
6824
|
-
if (_builtinLoader.startAt) this._loaderStart.push(data);
|
|
6825
|
-
else if (_builtinLoader.endAt) {
|
|
6826
|
-
let matchLoaderStart = this._loaderStart.find((e)=>e.resource.path === data.resource.path && e.loaders[0].loader === _builtinLoader.loader);
|
|
6827
|
-
matchLoaderStart && (matchLoaderStart.loaders[0].result = _builtinLoader.result, matchLoaderStart.loaders[0].endAt = _builtinLoader.endAt, this.reportLoader([
|
|
6828
|
-
matchLoaderStart
|
|
6829
|
-
]));
|
|
6830
|
-
}
|
|
6831
|
-
}
|
|
6832
|
-
reportResolver(data) {
|
|
6833
|
-
data.forEach((item)=>this._resolver.push(item)), this.onDataReport();
|
|
6834
|
-
}
|
|
6835
|
-
reportPlugin(data) {
|
|
6836
|
-
Object.keys(data).forEach((hook)=>{
|
|
6837
|
-
this._plugin[hook] ? data[hook].forEach((item)=>{
|
|
6838
|
-
this._plugin[hook].push(item || void 0);
|
|
6839
|
-
}) : this._plugin[hook] = data[hook];
|
|
6840
|
-
}), this.onDataReport();
|
|
6841
|
-
}
|
|
6842
|
-
reportModuleGraph(data) {
|
|
6843
|
-
logger_namespaceObject.logger.debug(`data size: ${data.size()}`, '[SDK.reportModuleGraph][start]'), this._moduleGraph.fromInstance(data), this.createPackageGraph(), this.onDataReport(), logger_namespaceObject.logger.debug(`sdk._moduleGraph size: ${this._moduleGraph.size()}`, '[SDK reportModuleGraph][end]');
|
|
6844
|
-
}
|
|
6845
|
-
reportPackageGraph(data) {
|
|
6846
|
-
logger_namespaceObject.logger.debug('[SDK.reportPackageGraph][start]'), this._packageGraph || (this._packageGraph = data), this.onDataReport(), logger_namespaceObject.logger.debug(`sdk._packageGraph size: ${this._packageGraph.getPackages().length}`, '[SDK reportPackageGraph][end]');
|
|
6847
|
-
}
|
|
6848
|
-
reportChunkGraph(data) {
|
|
6849
|
-
this._chunkGraph.addAsset(...data.getAssets()), this._chunkGraph.addChunk(...data.getChunks()), this._chunkGraph.addEntryPoint(...data.getEntryPoints()), this.onDataReport();
|
|
6850
|
-
}
|
|
6851
|
-
reportSummaryData(part) {
|
|
6852
|
-
for (let key of [
|
|
6853
|
-
'costs'
|
|
6854
|
-
]){
|
|
6855
|
-
let v = part[key];
|
|
6856
|
-
v && ('object' == typeof v ? Array.isArray(v) ? this._summary[key] = [
|
|
6857
|
-
...this._summary[key] || [],
|
|
6858
|
-
...v
|
|
6859
|
-
] : this._summary[key] = {
|
|
6860
|
-
...this._summary[key] || {},
|
|
6861
|
-
...v
|
|
6862
|
-
} : this._summary[key] = v);
|
|
6863
|
-
}
|
|
6864
|
-
this.onDataReport();
|
|
6865
|
-
}
|
|
6866
|
-
createPackageGraph() {
|
|
6867
|
-
if (logger_namespaceObject.logger.debug(`sdk._moduleGraph size: ${this._moduleGraph.size()}`, '[SDK.createPackageGraph][start]'), !this._packageGraph) {
|
|
6868
|
-
let pkgGraph = graph_namespaceObject.PackageGraph.fromModuleGraph(this._moduleGraph, this.root, (path)=>{
|
|
6869
|
-
try {
|
|
6870
|
-
if (external_node_fs_default().existsSync(path)) return index_js_default().readJsonSync(path);
|
|
6871
|
-
} catch (error) {
|
|
6872
|
-
let { message, stack } = error;
|
|
6873
|
-
logger_namespaceObject.logger.debug(()=>`sdk.createPackageGraph error, path: ${path}, error message: ${stack || message}`, '[SDK.createPackageGraph][error]');
|
|
6874
|
-
}
|
|
6875
|
-
});
|
|
6876
|
-
this._packageGraph = pkgGraph, logger_namespaceObject.logger.debug(`sdk._packageGraph packages: ${this._packageGraph.getPackages().length}`, '[SDK.createPackageGraph][end]');
|
|
6877
|
-
}
|
|
6878
|
-
}
|
|
6879
|
-
async writeStore(options) {
|
|
6880
|
-
logger_namespaceObject.logger.debug("sdk.writeStore has run.", '[SDK.writeStore][end]');
|
|
6881
|
-
let htmlPath = '';
|
|
6882
|
-
if (this.extraConfig?.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief]) {
|
|
6883
|
-
let clientHtmlPath = this.extraConfig.innerClientPath ? this.extraConfig.innerClientPath : sdk_require.resolve('@rsdoctor/client');
|
|
6884
|
-
if (this.extraConfig?.brief?.type?.includes('json')) {
|
|
6885
|
-
let data = this.getStoreData(), clientRoutes = this.getClientRoutes();
|
|
6886
|
-
external_node_fs_default().mkdirSync(this.outputDir, {
|
|
6887
|
-
recursive: !0
|
|
6888
|
-
}), external_node_fs_default().writeFileSync(external_path_default().resolve(this.outputDir, this.extraConfig.brief.jsonOptions?.fileName ?? 'rsdoctor-data.json'), JSON.stringify({
|
|
6889
|
-
data,
|
|
6890
|
-
clientRoutes
|
|
6891
|
-
}, null, 2));
|
|
6892
|
-
}
|
|
6893
|
-
return this.extraConfig.brief?.type?.includes('html') && (htmlPath = this.inlineScriptsAndStyles(clientHtmlPath)), htmlPath;
|
|
6894
|
-
}
|
|
6895
|
-
return this.saveManifest(this.getStoreData(), options || {});
|
|
6896
|
-
}
|
|
6897
|
-
getStoreData() {
|
|
6898
|
-
let ctx = this, briefOptions = this.extraConfig?.brief, sections = briefOptions?.jsonOptions?.sections, isJsonType = briefOptions?.type?.includes('json');
|
|
6899
|
-
return {
|
|
6900
|
-
get hash () {
|
|
6901
|
-
return ctx.hash;
|
|
6902
|
-
},
|
|
6903
|
-
get root () {
|
|
6904
|
-
return ctx.root;
|
|
6905
|
-
},
|
|
6906
|
-
get envinfo () {
|
|
6907
|
-
return ctx._envinfo;
|
|
6908
|
-
},
|
|
6909
|
-
get pid () {
|
|
6910
|
-
return ctx.pid;
|
|
6911
|
-
},
|
|
6912
|
-
get errors () {
|
|
6913
|
-
if (isJsonType && sections && !sections.rules) return [];
|
|
6914
|
-
return ctx._errors.map((err)=>err.toData());
|
|
6915
|
-
},
|
|
6916
|
-
get configs () {
|
|
6917
|
-
return ctx._configs.slice();
|
|
6918
|
-
},
|
|
6919
|
-
get summary () {
|
|
6920
|
-
return {
|
|
6921
|
-
...ctx._summary
|
|
6922
|
-
};
|
|
6923
|
-
},
|
|
6924
|
-
get resolver () {
|
|
6925
|
-
return ctx._resolver.slice();
|
|
6926
|
-
},
|
|
6927
|
-
get loader () {
|
|
6928
|
-
return ctx._loader.slice();
|
|
6929
|
-
},
|
|
6930
|
-
get moduleGraph () {
|
|
6931
|
-
if (isJsonType && sections && !sections.moduleGraph) return {
|
|
6932
|
-
dependencies: [],
|
|
6933
|
-
modules: [],
|
|
6934
|
-
moduleGraphModules: [],
|
|
6935
|
-
exports: [],
|
|
6936
|
-
sideEffects: [],
|
|
6937
|
-
variables: [],
|
|
6938
|
-
layers: []
|
|
6939
|
-
};
|
|
6940
|
-
return ctx._moduleGraph.toData({
|
|
6941
|
-
contextPath: ctx._configs?.[0]?.config?.context || '',
|
|
6942
|
-
briefOptions
|
|
6943
|
-
});
|
|
6944
|
-
},
|
|
6945
|
-
get chunkGraph () {
|
|
6946
|
-
if (isJsonType && sections && !sections.chunkGraph) return {
|
|
6947
|
-
assets: [],
|
|
6948
|
-
chunks: [],
|
|
6949
|
-
entrypoints: []
|
|
6950
|
-
};
|
|
6951
|
-
return ctx._chunkGraph.toData(ctx.type);
|
|
6952
|
-
},
|
|
6953
|
-
get moduleCodeMap () {
|
|
6954
|
-
if (ctx.extraConfig?.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief]) return {};
|
|
6955
|
-
return ctx._moduleGraph.toCodeData(ctx.type);
|
|
6956
|
-
},
|
|
6957
|
-
get plugin () {
|
|
6958
|
-
return {
|
|
6959
|
-
...ctx._plugin
|
|
6960
|
-
};
|
|
6961
|
-
},
|
|
6962
|
-
get packageGraph () {
|
|
6963
|
-
return ctx._packageGraph ? ctx._packageGraph.toData() : {
|
|
6964
|
-
packages: [],
|
|
6965
|
-
dependencies: []
|
|
6966
|
-
};
|
|
6967
|
-
},
|
|
6968
|
-
get treeShaking () {
|
|
6969
|
-
if (ctx.extraConfig?.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] || !ctx.extraConfig?.features?.treeShaking) return;
|
|
6970
|
-
return ctx._moduleGraph.toTreeShakingData();
|
|
6971
|
-
},
|
|
6972
|
-
get otherReports () {
|
|
6973
|
-
return {
|
|
6974
|
-
treemapReportHtml: ''
|
|
6975
|
-
};
|
|
6976
|
-
}
|
|
6977
|
-
};
|
|
6978
|
-
}
|
|
6979
|
-
getManifestData() {
|
|
6980
|
-
let dataValue = this.getStoreData();
|
|
6981
|
-
return {
|
|
6982
|
-
client: {
|
|
6983
|
-
enableRoutes: this.getClientRoutes()
|
|
6984
|
-
},
|
|
6985
|
-
data: Object.keys(dataValue).reduce((t, e)=>(dataValue[e] && 'object' == typeof dataValue[e] ? t[e] = [
|
|
6986
|
-
`${this.server.origin}${types_namespaceObject.SDK.ServerAPI.API.LoadDataByKey}/${e}`
|
|
6987
|
-
] : t[e] = dataValue[e], t), {}),
|
|
6988
|
-
__LOCAL__SERVER__: !0,
|
|
6989
|
-
__SOCKET__PORT__: this.server.socketUrl.port.toString(),
|
|
6990
|
-
__SOCKET__URL__: this.server.socketUrl.socketUrl
|
|
6991
|
-
};
|
|
6992
|
-
}
|
|
6993
|
-
getRuleContext(_options) {
|
|
6994
|
-
return this.createPackageGraph(), {
|
|
6995
|
-
root: this.root,
|
|
6996
|
-
errors: this._errors.slice(),
|
|
6997
|
-
configs: this._configs.slice(),
|
|
6998
|
-
moduleGraph: this._moduleGraph,
|
|
6999
|
-
chunkGraph: this._chunkGraph,
|
|
7000
|
-
packageGraph: this._packageGraph,
|
|
7001
|
-
loader: this._loader.slice(),
|
|
7002
|
-
otherReports: {
|
|
7003
|
-
treemapReportHtml: ''
|
|
7004
|
-
}
|
|
7005
|
-
};
|
|
7006
|
-
}
|
|
7007
|
-
onDataReport() {
|
|
7008
|
-
this.server.broadcast();
|
|
7009
|
-
}
|
|
7010
|
-
addRsdoctorDataToHTML(storeData, htmlContent) {
|
|
7011
|
-
let compressTextScripts = `<script>window.${types_namespaceObject.Constants.WINDOW_RSDOCTOR_TAG}={}</script>`;
|
|
7012
|
-
for (let key of Object.keys(storeData)){
|
|
7013
|
-
let data = storeData[key], jsonStrFn = ()=>{
|
|
7014
|
-
try {
|
|
7015
|
-
if ('configs' === key) return JSON.stringify((0, common_namespaceObject.decycle)(data));
|
|
7016
|
-
return JSON.stringify(data);
|
|
7017
|
-
} catch (error) {
|
|
7018
|
-
return console.error(error), '';
|
|
7019
|
-
}
|
|
7020
|
-
}, compressText = common_namespaceObject.Algorithm.compressText(jsonStrFn());
|
|
7021
|
-
compressTextScripts = `${compressTextScripts} <script>window.${types_namespaceObject.Constants.WINDOW_RSDOCTOR_TAG}.${key}=${JSON.stringify(compressText)}</script>`;
|
|
7022
|
-
}
|
|
7023
|
-
return compressTextScripts = `${compressTextScripts} <script>window.${types_namespaceObject.Constants.WINDOW_RSDOCTOR_TAG}.enableRoutes=${JSON.stringify(this.getClientRoutes())}</script>`, htmlContent = htmlContent.replace('<body>', `<body>${compressTextScripts}`);
|
|
7024
|
-
}
|
|
7025
|
-
inlineScriptsAndStyles(htmlFilePath) {
|
|
7026
|
-
var basePath, basePath1;
|
|
7027
|
-
function resolveFilePath(basePath, filePath) {
|
|
7028
|
-
return filePath.startsWith('/') ? external_path_default().resolve(basePath, filePath.slice(1)) : external_path_default().resolve(basePath, filePath);
|
|
7029
|
-
}
|
|
7030
|
-
let htmlContent = external_node_fs_default().readFileSync(htmlFilePath, 'utf-8'), basePath2 = external_path_default().dirname(htmlFilePath), scriptSrcs = Array.from(htmlContent.matchAll(/<script\s+(?:defer="defer"|defer)\s+src=["'](.+?)["']><\/script>/g), (m)=>m[1]), cssHrefs = Array.from(htmlContent.matchAll(/<link\s+href=["'](.+?)["']\s+rel="stylesheet">/g), (m)=>m[1]);
|
|
7031
|
-
htmlContent = (htmlContent = htmlContent.replace(/<script\s+.*?src=["'].*?["']><\/script>/g, '')).replace(/<link\s+.*?rel=["']stylesheet["'].*?>/g, '');
|
|
7032
|
-
let inlinedScripts = (basePath = basePath2, scriptSrcs.map((src)=>{
|
|
7033
|
-
let scriptPath = resolveFilePath(basePath, src);
|
|
7034
|
-
try {
|
|
7035
|
-
let scriptContent = external_node_fs_default().readFileSync(scriptPath, 'utf-8');
|
|
7036
|
-
return `<script>${scriptContent}</script>`;
|
|
7037
|
-
} catch (error) {
|
|
7038
|
-
return console.error(`Could not read script at ${scriptPath}:`, error), '';
|
|
7039
|
-
}
|
|
7040
|
-
}).join('')), inlinedCss = (basePath1 = basePath2, cssHrefs.map((href)=>{
|
|
7041
|
-
let cssPath = resolveFilePath(basePath1, href);
|
|
7042
|
-
try {
|
|
7043
|
-
let cssContent = external_node_fs_default().readFileSync(cssPath, 'utf-8');
|
|
7044
|
-
return `<style>${cssContent}</style>`;
|
|
7045
|
-
} catch (error) {
|
|
7046
|
-
return console.error(`Could not read CSS at ${cssPath}:`, error), '';
|
|
7047
|
-
}
|
|
7048
|
-
}).join('')), index = htmlContent.indexOf('</body>');
|
|
7049
|
-
htmlContent = htmlContent.slice(0, index) + inlinedCss + inlinedScripts + htmlContent.slice(index), htmlContent = this.addRsdoctorDataToHTML(this.getStoreData(), htmlContent);
|
|
7050
|
-
let outputFilePath = external_path_default().resolve(this.outputDir, this.extraConfig?.brief?.htmlOptions?.reportHtmlName || 'rsdoctor-report.html');
|
|
7051
|
-
return external_node_fs_default().mkdirSync(external_path_default().dirname(outputFilePath), {
|
|
7052
|
-
recursive: !0
|
|
7053
|
-
}), external_node_fs_default().writeFileSync(outputFilePath, htmlContent, {
|
|
7054
|
-
encoding: 'utf-8',
|
|
7055
|
-
flag: 'w'
|
|
7056
|
-
}), outputFilePath;
|
|
7057
|
-
}
|
|
7058
|
-
}
|
|
7059
|
-
class RsdoctorSlaveServer extends RsdoctorServer {
|
|
7060
|
-
constructor(sdk, port = build_namespaceObject.Server.defaultPort){
|
|
7061
|
-
super(sdk, port), this.sdk = sdk;
|
|
7062
|
-
}
|
|
7063
|
-
async openClientPage(...args) {
|
|
7064
|
-
return this.sdk.isMaster ? super.openClientPage(...args) : Promise.resolve();
|
|
7065
|
-
}
|
|
7066
|
-
}
|
|
7067
|
-
let primary_id = 1;
|
|
7068
|
-
class RsdoctorPrimarySDK extends RsdoctorSDK {
|
|
7069
|
-
constructor({ name, stage, controller, extraConfig, type }){
|
|
7070
|
-
super({
|
|
7071
|
-
name,
|
|
7072
|
-
root: controller.root
|
|
7073
|
-
});
|
|
7074
|
-
const lastSdk = controller.getLastSdk(), port = lastSdk ? lastSdk.server.port + 1 : this.server.port;
|
|
7075
|
-
this.id = primary_id++, this.stage = 'number' == typeof stage ? stage : 1, this.extraConfig = extraConfig, this.parent = controller, this.server = new RsdoctorSlaveServer(this, port), this.type = type, this.setName(name), this.clearSwitch();
|
|
7076
|
-
}
|
|
7077
|
-
clearSwitch() {
|
|
7078
|
-
this.uploadPieces = new Promise((resolve)=>{
|
|
7079
|
-
this.finishUploadPieceSwitch = resolve;
|
|
7080
|
-
});
|
|
7081
|
-
}
|
|
7082
|
-
get isMaster() {
|
|
7083
|
-
return this.parent.master === this;
|
|
7084
|
-
}
|
|
7085
|
-
async writePieces() {
|
|
7086
|
-
let { name, parent, isMaster, outputDir, finishUploadPieceSwitch } = this;
|
|
7087
|
-
this.setOutputDir(isMaster ? outputDir : external_path_default().join(parent.master.outputDir, '.slaves', name.replace(/\s+/g, '-'))), await super.writePieces(this.getStoreData()), finishUploadPieceSwitch?.();
|
|
7088
|
-
}
|
|
7089
|
-
async writeManifest() {
|
|
7090
|
-
let { parent, cloudData, dependencies } = this;
|
|
7091
|
-
dependencies?.length || await Promise.all(this.parent.slaves.filter((item)=>!item.dependencies?.length).map((item)=>item.uploadPieces)), cloudData && (cloudData.name = this.name, cloudData.series = parent.getSeriesData());
|
|
7092
|
-
let result = await super.writeManifest();
|
|
7093
|
-
return this.clearSwitch(), result;
|
|
7094
|
-
}
|
|
7095
|
-
getSeriesData(serverUrl = !1) {
|
|
7096
|
-
return this.parent.getSeriesData(serverUrl);
|
|
7097
|
-
}
|
|
7098
|
-
setName(name) {
|
|
7099
|
-
this._name = this.parent.hasName(name) ? `${name}-${primary_id}` : name;
|
|
7100
|
-
}
|
|
7101
|
-
getManifestData() {
|
|
7102
|
-
let data = super.getManifestData();
|
|
7103
|
-
return data.name = this.name, data.series = this.getSeriesData(!0), data;
|
|
7104
|
-
}
|
|
7105
|
-
}
|
|
7106
|
-
class RsdoctorSDKController {
|
|
7107
|
-
constructor(root = process.cwd()){
|
|
7108
|
-
this.slaves = [], this.root = '', this.root = root;
|
|
7109
|
-
}
|
|
7110
|
-
get master() {
|
|
7111
|
-
return this.slaves[0];
|
|
7112
|
-
}
|
|
7113
|
-
getLastSdk() {
|
|
7114
|
-
return this.slaves[this.slaves.length - 1];
|
|
7115
|
-
}
|
|
7116
|
-
hasName(name) {
|
|
7117
|
-
return !!this.slaves.find((item)=>item.name === name);
|
|
7118
|
-
}
|
|
7119
|
-
getSeriesData(serverUrl = !1) {
|
|
7120
|
-
return this.slaves.map((item)=>{
|
|
7121
|
-
let data = {
|
|
7122
|
-
name: item.name,
|
|
7123
|
-
path: item.diskManifestPath,
|
|
7124
|
-
stage: item.stage
|
|
7125
|
-
};
|
|
7126
|
-
return serverUrl && (data.origin = item.server.origin), data;
|
|
7127
|
-
});
|
|
7128
|
-
}
|
|
7129
|
-
createSlave({ name, stage, extraConfig, type }) {
|
|
7130
|
-
let slave = new RsdoctorPrimarySDK({
|
|
7131
|
-
name,
|
|
7132
|
-
stage,
|
|
7133
|
-
controller: this,
|
|
7134
|
-
extraConfig,
|
|
7135
|
-
type
|
|
7136
|
-
});
|
|
7137
|
-
return this.slaves.push(slave), this.slaves.sort((a, b)=>a.stage - b.stage), slave;
|
|
7138
|
-
}
|
|
7139
|
-
}
|
|
7140
|
-
})(), exports.RsdoctorPrimarySDK = __webpack_exports__.RsdoctorPrimarySDK, exports.RsdoctorSDK = __webpack_exports__.RsdoctorSDK, exports.RsdoctorSDKController = __webpack_exports__.RsdoctorSDKController, exports.findRoot = __webpack_exports__.findRoot, exports.openBrowser = __webpack_exports__.openBrowser, __webpack_exports__)-1 === [
|
|
7147
|
+
var __webpack_exports__ = __webpack_require__("./src/index.ts");
|
|
7148
|
+
for(var __rspack_i in exports.RsdoctorPrimarySDK = __webpack_exports__.RsdoctorPrimarySDK, exports.RsdoctorSDK = __webpack_exports__.RsdoctorSDK, exports.RsdoctorSDKController = __webpack_exports__.RsdoctorSDKController, exports.findRoot = __webpack_exports__.findRoot, exports.openBrowser = __webpack_exports__.openBrowser, __webpack_exports__)-1 === [
|
|
7141
7149
|
"RsdoctorPrimarySDK",
|
|
7142
7150
|
"RsdoctorSDK",
|
|
7143
7151
|
"RsdoctorSDKController",
|