devfab 2.1.0 → 2.2.1

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/lib/devfab.js CHANGED
@@ -2372,7 +2372,12 @@
2372
2372
  domain = [];
2373
2373
  }
2374
2374
  if (Array.isArray(domain) && Array.isArray(deps)) {
2375
- domain = domain.join('/');
2375
+ // domain = domain.join('/')
2376
+ var domainList = domain;
2377
+ domain = '';
2378
+ domainList.forEach(function (item) {
2379
+ domain += "".concat(item.substr(0, 1) === '/' ? '' : '/').concat(item);
2380
+ });
2376
2381
  }
2377
2382
  var newdeps = domain ? [] : deps;
2378
2383
  if (typeof domain === 'string' && domain && Array.isArray(deps)) {
@@ -2397,7 +2402,12 @@
2397
2402
  domain = [];
2398
2403
  }
2399
2404
  if (Array.isArray(domain) && Array.isArray(deps)) {
2400
- domain = domain.join('/');
2405
+ // domain = domain.join('/')
2406
+ var domainList = domain;
2407
+ domain = '';
2408
+ domainList.forEach(function (item) {
2409
+ domain += "".concat(item.substr(0, 1) === '/' ? '' : '/').concat(item);
2410
+ });
2401
2411
  }
2402
2412
  var newdeps = domain ? [] : deps;
2403
2413
  if (typeof domain === 'string' && domain && Array.isArray(deps)) {
@@ -2734,127 +2744,6 @@
2734
2744
  }]);
2735
2745
  }();
2736
2746
 
2737
- /**
2738
- * 全局污染检测:加载前后 diff window 的 key 集合。
2739
- *
2740
- * 为什么需要:二开脚本直接跑在宿主 window 上,A 客户的脚本改了一个全局变量,
2741
- * B 客户就跟着崩,而且现场无法归因。真做 iframe / Proxy 沙箱成本极高,
2742
- * 但「加载完能告诉你动了哪些全局」只需要几十行,能挡住大半这类事故。
2743
- *
2744
- * 边界(这是观测,不是隔离):
2745
- * - 事后告警,不阻止副作用——脚本已经执行过了;
2746
- * - 并发加载时窗口会重叠,归因以「最后完成的一批」结算,可能不准;
2747
- * - 只比较可枚举自有属性的**引用**,`window.foo.bar = 1` 这类深层改动检测不到。
2748
- */
2749
-
2750
- /** 默认盯防的 key:出现即说明宿主的关键设施被动过 */
2751
- var DEFAULT_WATCH = ['$', 'jQuery', 'define', 'require', 'requirejs', 'devfab', '__devfab'];
2752
- var GlobalGuard = /*#__PURE__*/function () {
2753
- function GlobalGuard(options) {
2754
- _classCallCheck(this, GlobalGuard);
2755
- var o = options || {};
2756
- this.maxPollution = o.maxPollution === undefined ? 3 : Number(o.maxPollution);
2757
- this.watch = [].concat(o.watch || DEFAULT_WATCH);
2758
- this.target = o.target || (typeof window !== 'undefined' ? window : null);
2759
- this.enabled = o.enabled === undefined ? true : !!o.enabled;
2760
- this._pending = 0;
2761
- this._before = null;
2762
- this.lastWarnings = [];
2763
- }
2764
- return _createClass(GlobalGuard, [{
2765
- key: "_snapshot",
2766
- value: function _snapshot() {
2767
- var map = new Map();
2768
- var target = this.target;
2769
- if (!target) return map;
2770
- Object.keys(target).forEach(function (key) {
2771
- map.set(key, target[key]);
2772
- });
2773
- return map;
2774
- }
2775
- }, {
2776
- key: "_diff",
2777
- value: function _diff() {
2778
- var _this = this;
2779
- var before = this._before;
2780
- var after = this._snapshot();
2781
- var warnings = [];
2782
- if (!before) return warnings;
2783
- after.forEach(function (value, key) {
2784
- var watched = _this.watch.indexOf(key) !== -1;
2785
- if (!before.has(key)) {
2786
- warnings.push({
2787
- type: 'added',
2788
- key: key,
2789
- watched: watched
2790
- });
2791
- return;
2792
- }
2793
- if (before.get(key) !== value) {
2794
- warnings.push({
2795
- type: 'overwritten',
2796
- key: key,
2797
- watched: watched
2798
- });
2799
- }
2800
- });
2801
- // 命中盯防名单,或新增数量超过阈值,才认为「值得提醒」。
2802
- // 1~2 个自有全局是正常写法,全报会把信号淹掉。
2803
- var watchedCount = warnings.filter(function (item) {
2804
- return item.watched;
2805
- }).length;
2806
- var addedCount = warnings.filter(function (item) {
2807
- return item.type === 'added';
2808
- }).length;
2809
- if (!watchedCount && addedCount <= this.maxPollution) return [];
2810
- return warnings;
2811
- }
2812
-
2813
- /**
2814
- * 开始观测。返回的 `end()` 幂等,重复调用只有第一次有效,
2815
- * 这样超时分支和 errback 分支可以都调,不会把计数搞负。
2816
- */
2817
- }, {
2818
- key: "begin",
2819
- value: function begin() {
2820
- var _this2 = this;
2821
- if (!this.enabled || !this.target) {
2822
- return {
2823
- end: function end() {
2824
- return [];
2825
- }
2826
- };
2827
- }
2828
- this._pending++;
2829
- if (this._pending === 1) this._before = this._snapshot();
2830
- var done = false;
2831
- return {
2832
- end: function end() {
2833
- if (done) return [];
2834
- done = true;
2835
- _this2._pending--;
2836
- // 还有并发批次没结束,交给最后结束的那一批结算
2837
- if (_this2._pending > 0) return [];
2838
- var warnings = _this2._diff();
2839
- _this2._before = null;
2840
- _this2.lastWarnings = warnings;
2841
- return warnings;
2842
- }
2843
- };
2844
- }
2845
- }, {
2846
- key: "configure",
2847
- value: function configure(options) {
2848
- var o = options || {};
2849
- if (o.enabled !== undefined) this.enabled = !!o.enabled;
2850
- if (o.maxPollution !== undefined) this.maxPollution = Number(o.maxPollution);
2851
- if (o.watch !== undefined) this.watch = [].concat(o.watch || []);
2852
- if (o.target !== undefined) this.target = o.target || null;
2853
- return this;
2854
- }
2855
- }]);
2856
- }();
2857
-
2858
2747
  /** 加载超时:RequireJS 自己的 waitSeconds 默认 30s,这个定时器是更早的兜底 */
2859
2748
  var CODE_TIMEOUT = 504;
2860
2749
 
@@ -2877,10 +2766,8 @@
2877
2766
  var path = _path;
2878
2767
  var files = _files;
2879
2768
  var callback = _callback;
2880
- // 单参形式:(files, callback) 或 (files)。判据是「第一个是数组、第二个不是数组」,
2881
- // 放宽到非函数是因为 loadModules([url]) 这种不带回调的调用很常见。
2882
2769
  if (Array.isArray(_path) && !Array.isArray(_files)) {
2883
- path = params === null || params === void 0 ? void 0 : params.path;
2770
+ path = undefined;
2884
2771
  files = _path;
2885
2772
  callback = typeof _files === 'function' ? _files : _callback;
2886
2773
  }
@@ -2889,8 +2776,7 @@
2889
2776
  var result = {
2890
2777
  code: 0,
2891
2778
  message: '',
2892
- data: [],
2893
- warnings: []
2779
+ data: []
2894
2780
  };
2895
2781
  if (params.type === 'require' && typeof params.require !== 'function' || params.type === 'define' && typeof params.define !== 'function' //
2896
2782
  ) {
@@ -2930,64 +2816,44 @@
2930
2816
  version: '',
2931
2817
  timeout: 15000,
2932
2818
  retry: 0,
2933
- strict: false,
2934
2819
  baseUrl: ''
2935
2820
  };
2936
2821
  var BaseFileRequire = /*#__PURE__*/function () {
2937
- /**
2938
- * args 只接受**参数与策略**,不接受加载器覆盖:
2939
- * - 加载策略:`version` / `timeout` / `retry` / `strict` / `baseUrl` / `manifest`
2940
- * / `origins` / `lockVersion` / `verifyHash` / `pollution` / `watch` / `maxPollution`
2941
- * - 通道与时钟:`importer`(ESM 通道用的 import 函数)、`setTimeout` / `clearTimeout`
2942
- *
2943
- * 刻意**不再接受** `define` / `require` / `undef` / `requireConfig`:
2944
- * 这四个是 AMD 加载器本体,AMD 通道只走内嵌的 RequireJS 2.3.2。以前允许覆盖的
2945
- * 后果是「宿主传了自己的 require,但 undef 仍取内嵌的那份」,两套注册表混用,
2946
- * 而且被覆盖时是静默的。要换通道请用 `loadModules()`,不要替换加载器。
2947
- *
2948
- * 其余配置一律走 `configure(options)` 在运行时改。
2949
- */
2950
2822
  function BaseFileRequire(args) {
2951
- var _this$__require;
2952
2823
  _classCallCheck(this, BaseFileRequire);
2953
- var o = args || {};
2954
- // 只有显式传参才写全局。模块加载时会 new 一次单例,若无条件写 false,
2955
- // 宿主在 import 之前设好的 `window.__devfab.debug` 会被抹掉。
2956
- if (o.debug !== undefined) this.debug = !!o.debug;
2957
- this.__rootPath = undefined;
2958
- this.__define = __requirejs.define;
2959
- this.__require = __requirejs.require;
2960
- this.__undef = typeof ((_this$__require = this.__require) === null || _this$__require === void 0 ? void 0 : _this$__require.undef) === 'function' ? this.__require.undef : null;
2961
- this.__requireConfig = this._pickRequireConfig(this.__require);
2962
- this.__import = o.importer || null;
2963
- this._setTimer = o.setTimeout || function (fn, ms) {
2964
- return setTimeout(fn, ms);
2965
- };
2966
- this._clearTimer = o.clearTimeout || function (id) {
2967
- return clearTimeout(id);
2968
- };
2969
- this.options = {
2970
- version: o.version ? String(o.version) : DEFAULT_OPTIONS.version,
2971
- timeout: o.timeout === undefined ? DEFAULT_OPTIONS.timeout : Math.max(0, toNumber(o.timeout, 0)),
2972
- retry: o.retry === undefined ? DEFAULT_OPTIONS.retry : Math.max(0, toNumber(o.retry, 0)),
2973
- strict: !!o.strict,
2974
- baseUrl: o.baseUrl || DEFAULT_OPTIONS.baseUrl
2975
- };
2976
- this.policy = new LoadPolicy(o);
2977
- this.guard = new GlobalGuard(this._guardOptions(o));
2978
- if (this.options.version) this._applyUrlArgs();
2824
+ this.__init(args);
2979
2825
  }
2980
-
2981
- /**
2982
- * 调试开关的**唯一来源**是 `window.__devfab.debug`。
2983
- *
2984
- * 为什么做成访问器:这个开关被三处读——加载器这里、`_utils/models/_extend.js` 的
2985
- * 扩展脚本装配、`_utils/string.js` 的 isDebug。以前各读各的(实例字段 /
2986
- * `window.__devfab.debug` / `window.devfab.debug`),宿主开了一个另两个不生效,
2987
- * 排查时看起来像「日志不打印」。统一读写同一个位置后,`FileRequire.configure({debug:true})`、
2988
- * `FileRequire.debug = true`、`window.__devfab.debug = true` 三句话效果完全一致。
2989
- */
2990
2826
  return _createClass(BaseFileRequire, [{
2827
+ key: "__init",
2828
+ value: function __init(args) {
2829
+ var o = args || {};
2830
+ if (o.debug !== undefined) this.debug = !!o.debug;
2831
+ var require = __requirejs.require;
2832
+ this.__data = {
2833
+ /* --- 加载器句柄与通道:AMD 通道只走内嵌 RequireJS --- */
2834
+ define: __requirejs.define,
2835
+ require: require,
2836
+ undef: typeof (require === null || require === void 0 ? void 0 : require.undef) === 'function' ? require.undef : null,
2837
+ requireConfig: this._pickRequireConfig(require),
2838
+ importImpl: o.importer || null,
2839
+ setTimer: o.setTimeout || function (fn, ms) {
2840
+ return setTimeout(fn, ms);
2841
+ },
2842
+ clearTimer: o.clearTimeout || function (id) {
2843
+ return clearTimeout(id);
2844
+ },
2845
+ /* --- 配置与策略 --- */
2846
+ options: {
2847
+ version: o.version ? String(o.version) : DEFAULT_OPTIONS.version,
2848
+ timeout: o.timeout === undefined ? DEFAULT_OPTIONS.timeout : Math.max(0, toNumber(o.timeout, 0)),
2849
+ retry: o.retry === undefined ? DEFAULT_OPTIONS.retry : Math.max(0, toNumber(o.retry, 0)),
2850
+ baseUrl: o.baseUrl || DEFAULT_OPTIONS.baseUrl
2851
+ },
2852
+ policy: new LoadPolicy(o)
2853
+ };
2854
+ if (this.__data.options.version) this._applyUrlArgs();
2855
+ }
2856
+ }, {
2991
2857
  key: "debug",
2992
2858
  get: function get() {
2993
2859
  var ns = typeof window !== 'undefined' ? window.__devfab : null;
@@ -3008,48 +2874,26 @@
3008
2874
  value: function _pickRequireConfig(loader) {
3009
2875
  return loader && typeof loader.config === 'function' ? loader.config.bind(loader) : null;
3010
2876
  }
3011
- }, {
3012
- key: "_guardOptions",
3013
- value: function _guardOptions(o) {
3014
- if (o.pollution === false) {
3015
- return {
3016
- enabled: false,
3017
- target: o.target
3018
- };
3019
- }
3020
- if (o.pollution && _typeof(o.pollution) === 'object') {
3021
- return Object.assign({
3022
- target: o.target
3023
- }, o.pollution);
3024
- }
3025
- return {
3026
- target: o.target,
3027
- watch: o.watch,
3028
- maxPollution: o.maxPollution,
3029
- enabled: o.pollution === undefined ? true : !!o.pollution
3030
- };
3031
- }
3032
2877
 
3033
2878
  /* ------------------------------ 配置 ------------------------------ */
3034
2879
 
3035
2880
  /** 运行时增量配置(宿主切版本、换清单、改重试次数都走这里)
3036
- * 加载策略:版本、超时、重试、清单、白名单、全局污染检测
2881
+ * 加载策略:版本、超时、重试、清单、白名单
3037
2882
  */
3038
2883
  }, {
3039
2884
  key: "configure",
3040
2885
  value: function configure(options) {
3041
2886
  var o = options || {};
2887
+ var _this$__data = this.__data,
2888
+ config = _this$__data.options,
2889
+ policy = _this$__data.policy;
3042
2890
  if (o.debug !== undefined) this.debug = !!o.debug;
3043
2891
  if (o.version !== undefined) this.setVersion(o.version);
3044
- if (o.timeout !== undefined) this.options.timeout = Math.max(0, toNumber(o.timeout, this.options.timeout));
3045
- if (o.retry !== undefined) this.options.retry = Math.max(0, toNumber(o.retry, this.options.retry));
3046
- if (o.strict !== undefined) this.options.strict = !!o.strict;
3047
- if (o.baseUrl !== undefined) this.options.baseUrl = o.baseUrl || '';
2892
+ if (o.timeout !== undefined) config.timeout = Math.max(0, toNumber(o.timeout, config.timeout));
2893
+ if (o.retry !== undefined) config.retry = Math.max(0, toNumber(o.retry, config.retry));
2894
+ if (o.baseUrl !== undefined) config.baseUrl = o.baseUrl || '';
3048
2895
  if (o.manifest !== undefined || o.origins !== undefined || o.lockVersion !== undefined || o.verifyHash !== undefined || o.fetch !== undefined) {
3049
- this.policy.configure(o);
3050
- }
3051
- if (o.pollution !== undefined) this.guard.configure(this._guardOptions(o));else if (o.watch !== undefined || o.maxPollution !== undefined || o.target !== undefined) {
3052
- this.guard.configure(o);
2896
+ policy.configure(o);
3053
2897
  }
3054
2898
  return this;
3055
2899
  }
@@ -3064,19 +2908,22 @@
3064
2908
  }, {
3065
2909
  key: "setVersion",
3066
2910
  value: function setVersion(version) {
3067
- this.options.version = version ? String(version) : '';
2911
+ this.__data.options.version = version ? String(version) : '';
3068
2912
  this._applyUrlArgs();
3069
2913
  return this;
3070
2914
  }
3071
2915
  }, {
3072
2916
  key: "_applyUrlArgs",
3073
2917
  value: function _applyUrlArgs() {
3074
- if (typeof this.__requireConfig !== 'function') {
2918
+ var _this$__data2 = this.__data,
2919
+ requireConfig = _this$__data2.requireConfig,
2920
+ options = _this$__data2.options;
2921
+ if (typeof requireConfig !== 'function') {
3075
2922
  return false;
3076
2923
  }
3077
2924
  try {
3078
- this.__requireConfig({
3079
- urlArgs: this.options.version ? "v=".concat(encodeURIComponent(this.options.version)) : ''
2925
+ requireConfig({
2926
+ urlArgs: options.version ? "v=".concat(encodeURIComponent(options.version)) : ''
3080
2927
  });
3081
2928
  return true;
3082
2929
  } catch (err) {
@@ -3086,19 +2933,23 @@
3086
2933
  }, {
3087
2934
  key: "getVersion",
3088
2935
  value: function getVersion() {
3089
- return this.options.version;
2936
+ return this.__data.options.version;
3090
2937
  }
3091
2938
 
3092
2939
  /** 策略 + 兜底配置摘要,宿主启动时打一行日志排查效率最高 */
3093
2940
  }, {
3094
2941
  key: "describe",
3095
2942
  value: function describe() {
3096
- return Object.assign({}, this.options, {
2943
+ var _this$__data3 = this.__data,
2944
+ options = _this$__data3.options,
2945
+ policy = _this$__data3.policy,
2946
+ undef = _this$__data3.undef,
2947
+ importImpl = _this$__data3.importImpl;
2948
+ return Object.assign({}, options, {
3097
2949
  debug: this.debug,
3098
- policy: this.policy.describe(),
3099
- pollutionGuard: this.guard.enabled,
3100
- canUndef: typeof this.__undef === 'function',
3101
- canNativeImport: typeof (this.__import || nativeImport) === 'function'
2950
+ policy: policy.describe(),
2951
+ canUndef: typeof undef === 'function',
2952
+ canNativeImport: typeof (importImpl || nativeImport) === 'function'
3102
2953
  });
3103
2954
  }
3104
2955
 
@@ -3107,8 +2958,7 @@
3107
2958
  key: "_define",
3108
2959
  value: function _define(_path, _files, _callback) {
3109
2960
  var params = {
3110
- path: this.__rootPath,
3111
- define: this.__define,
2961
+ define: this.__data.define,
3112
2962
  type: 'define'
3113
2963
  };
3114
2964
  var _parseArgs = parseArgs(_path, _files, _callback, params),
@@ -3120,28 +2970,16 @@
3120
2970
  callback === null || callback === void 0 || callback(result);
3121
2971
  return;
3122
2972
  }
3123
- this.__define(path, files, callback);
3124
- }
3125
- }, {
3126
- key: "_mergeWarnings",
3127
- value: function _mergeWarnings(prev, next) {
3128
- var list = (prev || []).slice();
3129
- (next || []).forEach(function (item) {
3130
- var exists = list.some(function (one) {
3131
- return one.type === item.type && one.key === item.key;
3132
- });
3133
- if (!exists) list.push(item);
3134
- });
3135
- return list;
2973
+ this.__data.define(path, files, callback);
3136
2974
  }
3137
2975
  }, {
3138
2976
  key: "_undefModules",
3139
2977
  value: function _undefModules(moduleIds) {
3140
- var _this = this;
3141
- if (typeof this.__undef !== 'function') return;
2978
+ var undef = this.__data.undef;
2979
+ if (typeof undef !== 'function') return;
3142
2980
  moduleIds.forEach(function (id) {
3143
2981
  try {
3144
- _this.__undef(id);
2982
+ undef(id);
3145
2983
  } catch (err) {
3146
2984
  // undef 只对曾经顶层 require 过的模块有效;抛错说明它还没进注册表,忽略即可
3147
2985
  }
@@ -3149,18 +2987,22 @@
3149
2987
  }
3150
2988
 
3151
2989
  /**
3152
- * 统一加载入口:策略校验 -> 观测 -> 计时 / 重试 -> 结算。
2990
+ * 统一加载入口:策略校验 -> 计时 / 重试 -> 结算。
3153
2991
  * 默认配置(version 空、retry 0、timeout 15s)下的行为与原来一致,
3154
- * 只是多了一个「更早失败」的兜底和 warnings 字段。
2992
+ * 只是多了一个「更早失败」的兜底。
3155
2993
  */
3156
2994
  }, {
3157
2995
  key: "_load",
3158
2996
  value: function _load(_path, _files, _callback) {
3159
- var _this2 = this;
3160
- var config = this.options;
2997
+ var _this = this;
2998
+ var _this$__data4 = this.__data,
2999
+ config = _this$__data4.options,
3000
+ policy = _this$__data4.policy,
3001
+ require = _this$__data4.require,
3002
+ setTimer = _this$__data4.setTimer,
3003
+ clearTimer = _this$__data4.clearTimer;
3161
3004
  var params = {
3162
- path: this.__rootPath,
3163
- require: this.__require,
3005
+ require: require,
3164
3006
  type: 'require'
3165
3007
  };
3166
3008
  var _parseArgs2 = parseArgs(_path, _files, _callback, params),
@@ -3174,7 +3016,7 @@
3174
3016
  return;
3175
3017
  }
3176
3018
  var moduleIds = toModuleIds(path, files);
3177
- var denied = this.policy.checkModules(moduleIds);
3019
+ var denied = policy.checkModules(moduleIds);
3178
3020
  if (denied) {
3179
3021
  result.code = denied.code;
3180
3022
  result.message = denied.message;
@@ -3184,40 +3026,26 @@
3184
3026
  var settled = false;
3185
3027
  var attempt = 0;
3186
3028
  var timer = null;
3187
- var scoop = null;
3188
- var closeScoop = function closeScoop() {
3189
- if (!scoop) return;
3190
- result.warnings = _this2._mergeWarnings(result.warnings, scoop.end());
3191
- scoop = null;
3192
- };
3193
3029
  var finish = function finish() {
3194
3030
  if (settled) return;
3195
3031
  settled = true;
3196
3032
  if (timer !== null) {
3197
- _this2._clearTimer(timer);
3033
+ clearTimer(timer);
3198
3034
  timer = null;
3199
3035
  }
3200
- closeScoop();
3201
- if (config.strict && result.warnings.length) {
3202
- result.code = 500;
3203
- result.message = "Global pollution detection failed\uFF1A".concat(result.warnings.map(function (item) {
3204
- return "".concat(item.type, ":").concat(item.key);
3205
- }).join(', '));
3206
- }
3207
3036
  callback === null || callback === void 0 || callback(result);
3208
3037
  };
3209
3038
  var start = function start() {
3210
3039
  attempt++;
3211
- scoop = _this2.guard.begin();
3212
3040
  if (config.timeout > 0) {
3213
- timer = _this2._setTimer(function () {
3041
+ timer = setTimer(function () {
3214
3042
  if (settled) return;
3215
3043
  var err = new Error("load timeout after ".concat(config.timeout, "ms: ").concat(filesStr));
3216
3044
  err.__devfabTimeout = true;
3217
3045
  retryOrFail(err, "files load timeout after ".concat(config.timeout, "ms, the files: ").concat(filesStr));
3218
3046
  }, config.timeout);
3219
3047
  }
3220
- _this2.__require(path, files, function () {
3048
+ require(path, files, function () {
3221
3049
  for (var _len = arguments.length, contents = new Array(_len), _key = 0; _key < _len; _key++) {
3222
3050
  contents[_key] = arguments[_key];
3223
3051
  }
@@ -3230,13 +3058,12 @@
3230
3058
  var retryOrFail = function retryOrFail(err, message) {
3231
3059
  if (settled) return;
3232
3060
  if (timer !== null) {
3233
- _this2._clearTimer(timer);
3061
+ clearTimer(timer);
3234
3062
  timer = null;
3235
3063
  }
3236
3064
  if (attempt <= config.retry) {
3237
- closeScoop();
3238
3065
  // 不 undef 就会复用上一次的失败状态,重试形同虚设
3239
- _this2._undefModules(moduleIds);
3066
+ _this._undefModules(moduleIds);
3240
3067
  start();
3241
3068
  return;
3242
3069
  }
@@ -3269,7 +3096,8 @@
3269
3096
  value: function resolveUrl(rel) {
3270
3097
  var raw = String(rel == null ? '' : rel);
3271
3098
  if (/^[a-z][a-z0-9+.-]*:/i.test(raw) || /^\/\//.test(raw)) return raw;
3272
- var base = this.options.baseUrl || (typeof document !== 'undefined' && document.baseURI ? document.baseURI : '');
3099
+ var baseUrl = this.__data.options.baseUrl;
3100
+ var base = baseUrl || (typeof document !== 'undefined' && document.baseURI ? document.baseURI : '');
3273
3101
  if (!base) return raw;
3274
3102
  try {
3275
3103
  return new URL(raw, base).href;
@@ -3280,9 +3108,11 @@
3280
3108
  }, {
3281
3109
  key: "_importOne",
3282
3110
  value: function _importOne(moduleId) {
3283
- var _this3 = this;
3111
+ var _this$__data5 = this.__data,
3112
+ policy = _this$__data5.policy,
3113
+ importImpl = _this$__data5.importImpl;
3284
3114
  var url = this.resolveUrl(moduleId);
3285
- var originDenied = this.policy.checkOrigin(url);
3115
+ var originDenied = policy.checkOrigin(url);
3286
3116
  if (originDenied) {
3287
3117
  return Promise.resolve({
3288
3118
  ok: false,
@@ -3290,10 +3120,10 @@
3290
3120
  message: originDenied.message
3291
3121
  });
3292
3122
  }
3293
- var entry = this.policy.entryOf(moduleId);
3123
+ var entry = policy.entryOf(moduleId);
3294
3124
  var expected = entry && entry.sha256;
3295
3125
  var run = function run() {
3296
- var importer = _this3.__import || nativeImport;
3126
+ var importer = importImpl || nativeImport;
3297
3127
  if (typeof importer !== 'function') {
3298
3128
  return Promise.resolve({
3299
3129
  ok: false,
@@ -3318,7 +3148,7 @@
3318
3148
  });
3319
3149
  };
3320
3150
  if (!expected) return run();
3321
- return this.policy.verify(url, expected).then(function (verified) {
3151
+ return policy.verify(url, expected).then(function (verified) {
3322
3152
  if (!verified.ok) {
3323
3153
  return {
3324
3154
  ok: false,
@@ -3340,9 +3170,9 @@
3340
3170
  }, {
3341
3171
  key: "loadModules",
3342
3172
  value: function loadModules(_path, _files, _callback) {
3343
- var _this4 = this;
3173
+ var _this2 = this;
3174
+ var policy = this.__data.policy;
3344
3175
  var params = {
3345
- path: this.__rootPath,
3346
3176
  type: 'module'
3347
3177
  };
3348
3178
  var _parseArgs3 = parseArgs(_path, _files, _callback, params),
@@ -3356,7 +3186,7 @@
3356
3186
  callback === null || callback === void 0 || callback(r);
3357
3187
  return r;
3358
3188
  };
3359
- var denied = this.policy.checkModules(moduleIds);
3189
+ var denied = policy.checkModules(moduleIds);
3360
3190
  if (denied) {
3361
3191
  result.code = denied.code;
3362
3192
  result.message = denied.message;
@@ -3365,11 +3195,9 @@
3365
3195
  if (!files.length) {
3366
3196
  return Promise.resolve(settle(result));
3367
3197
  }
3368
- var scoop = this.guard.begin();
3369
3198
  return Promise.all(moduleIds.map(function (id) {
3370
- return _this4._importOne(id);
3199
+ return _this2._importOne(id);
3371
3200
  })).then(function (list) {
3372
- result.warnings = scoop.end();
3373
3201
  var failed = list.filter(function (item) {
3374
3202
  return !item.ok;
3375
3203
  });