devfab 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -31
- package/dist/common/models.esm.js +2 -2
- package/dist/common/models.js +2 -2
- package/dist/common/require.esm.js +2 -2
- package/dist/common/require.js +2 -2
- package/dist/common/utils.esm.js +2 -2
- package/dist/common/utils.js +2 -2
- package/dist/index.esm.js +2 -2
- package/dist/index.js +2 -2
- package/dist/index.umd.js +2 -2
- package/lib/devfab.js +130 -125
- package/lib/devfab.min.js +2 -2
- package/lib/devfab.require.js +74 -122
- package/lib/devfab.require.min.js +2 -2
- package/package.json +1 -1
package/lib/devfab.js
CHANGED
|
@@ -326,8 +326,6 @@
|
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
330
|
-
|
|
331
329
|
// ======================================================
|
|
332
330
|
/** vim: et:ts=4:sw=4:sts=4
|
|
333
331
|
* @license RequireJS 2.3.2 Copyright jQuery Foundation and other contributors.
|
|
@@ -337,8 +335,7 @@
|
|
|
337
335
|
// problems with requirejs.exec()/transpiler plugins that may not be strict.
|
|
338
336
|
/* jslint regexp: true, nomen: true, sloppy: true */
|
|
339
337
|
/* global window, navigator, document, importScripts, setTimeout, opera */
|
|
340
|
-
var
|
|
341
|
-
window.__devfab_requirejs = __devfab_requirejs;
|
|
338
|
+
var __requirejs = {};
|
|
342
339
|
(function (global, setTimeout) {
|
|
343
340
|
var requirejs, require, define;
|
|
344
341
|
var req;
|
|
@@ -2343,22 +2340,22 @@
|
|
|
2343
2340
|
// eslint-disable-next-line no-eval
|
|
2344
2341
|
return eval(text);
|
|
2345
2342
|
};
|
|
2346
|
-
|
|
2347
|
-
|
|
2343
|
+
__requirejs.require = require;
|
|
2344
|
+
__requirejs.define = define;
|
|
2348
2345
|
// Set up with config info.
|
|
2349
2346
|
req(cfg);
|
|
2350
|
-
})(
|
|
2347
|
+
})(typeof window !== 'undefined' ? window : globalThis, typeof setTimeout === 'undefined' ? undefined : setTimeout)
|
|
2351
2348
|
|
|
2352
2349
|
/* ----------------------------------------------------------------------------
|
|
2353
2350
|
* 以下为本地适配层,不属于 RequireJS 原始文件内容。
|
|
2354
2351
|
* -------------------------------------------------------------------------- */;
|
|
2355
2352
|
(function (global) {
|
|
2356
|
-
if (
|
|
2353
|
+
if (__requirejs.__requirejsAdapterApplied) {
|
|
2357
2354
|
return;
|
|
2358
2355
|
}
|
|
2359
|
-
|
|
2360
|
-
var rawRequire =
|
|
2361
|
-
var rawDefine =
|
|
2356
|
+
__requirejs.__requirejsAdapterApplied = true;
|
|
2357
|
+
var rawRequire = __requirejs.require;
|
|
2358
|
+
var rawDefine = __requirejs.define;
|
|
2362
2359
|
var require = function require(_domain, _deps, _callback, _errback) {
|
|
2363
2360
|
var domain = _domain;
|
|
2364
2361
|
var deps = _deps;
|
|
@@ -2420,10 +2417,15 @@
|
|
|
2420
2417
|
require[prop] = rawRequire[prop];
|
|
2421
2418
|
}
|
|
2422
2419
|
}
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2420
|
+
|
|
2421
|
+
// 标记本身是为了让人能**验证**适配层究竟有没有生效(测试与现场排查都用它),
|
|
2422
|
+
// 不然「域前缀到底拼没拼」只能靠猜。
|
|
2423
|
+
require.__devfabAdapterApplied = true;
|
|
2424
|
+
define.__devfabAdapterApplied = true;
|
|
2425
|
+
__requirejs._require = rawRequire;
|
|
2426
|
+
__requirejs._define = rawDefine;
|
|
2427
|
+
__requirejs.require = require;
|
|
2428
|
+
__requirejs.define = define;
|
|
2427
2429
|
})();
|
|
2428
2430
|
|
|
2429
2431
|
/**
|
|
@@ -2746,7 +2748,7 @@
|
|
|
2746
2748
|
*/
|
|
2747
2749
|
|
|
2748
2750
|
/** 默认盯防的 key:出现即说明宿主的关键设施被动过 */
|
|
2749
|
-
var DEFAULT_WATCH = ['$', 'jQuery', 'define', 'require', 'requirejs', 'devfab', '__devfab'
|
|
2751
|
+
var DEFAULT_WATCH = ['$', 'jQuery', 'define', 'require', 'requirejs', 'devfab', '__devfab'];
|
|
2750
2752
|
var GlobalGuard = /*#__PURE__*/function () {
|
|
2751
2753
|
function GlobalGuard(options) {
|
|
2752
2754
|
_classCallCheck(this, GlobalGuard);
|
|
@@ -2933,22 +2935,30 @@
|
|
|
2933
2935
|
};
|
|
2934
2936
|
var BaseFileRequire = /*#__PURE__*/function () {
|
|
2935
2937
|
/**
|
|
2936
|
-
* args
|
|
2937
|
-
* - 底层加载器覆盖:`define` / `require` / `undef` / `requireConfig` / `importer`
|
|
2938
|
+
* args 只接受**参数与策略**,不接受加载器覆盖:
|
|
2938
2939
|
* - 加载策略:`version` / `timeout` / `retry` / `strict` / `baseUrl` / `manifest`
|
|
2939
2940
|
* / `origins` / `lockVersion` / `verifyHash` / `pollution` / `watch` / `maxPollution`
|
|
2940
|
-
*
|
|
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)` 在运行时改。
|
|
2941
2949
|
*/
|
|
2942
2950
|
function BaseFileRequire(args) {
|
|
2943
|
-
var
|
|
2951
|
+
var _this$__require;
|
|
2944
2952
|
_classCallCheck(this, BaseFileRequire);
|
|
2945
2953
|
var o = args || {};
|
|
2946
|
-
|
|
2954
|
+
// 只有显式传参才写全局。模块加载时会 new 一次单例,若无条件写 false,
|
|
2955
|
+
// 宿主在 import 之前设好的 `window.__devfab.debug` 会被抹掉。
|
|
2956
|
+
if (o.debug !== undefined) this.debug = !!o.debug;
|
|
2947
2957
|
this.__rootPath = undefined;
|
|
2948
|
-
this.__define =
|
|
2949
|
-
this.__require =
|
|
2950
|
-
this.__undef =
|
|
2951
|
-
this.__requireConfig =
|
|
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);
|
|
2952
2962
|
this.__import = o.importer || null;
|
|
2953
2963
|
this._setTimer = o.setTimeout || function (fn, ms) {
|
|
2954
2964
|
return setTimeout(fn, ms);
|
|
@@ -2969,15 +2979,34 @@
|
|
|
2969
2979
|
}
|
|
2970
2980
|
|
|
2971
2981
|
/**
|
|
2972
|
-
*
|
|
2973
|
-
*
|
|
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` 三句话效果完全一致。
|
|
2974
2989
|
*/
|
|
2975
2990
|
return _createClass(BaseFileRequire, [{
|
|
2991
|
+
key: "debug",
|
|
2992
|
+
get: function get() {
|
|
2993
|
+
var ns = typeof window !== 'undefined' ? window.__devfab : null;
|
|
2994
|
+
return !!(ns && ns.debug);
|
|
2995
|
+
},
|
|
2996
|
+
set: function set(value) {
|
|
2997
|
+
if (typeof window === 'undefined') return;
|
|
2998
|
+
window.__devfab = window.__devfab || {};
|
|
2999
|
+
window.__devfab.debug = !!value;
|
|
3000
|
+
}
|
|
3001
|
+
|
|
3002
|
+
/**
|
|
3003
|
+
* urlArgs 只能配在真正在用的那个 require 上。AMD 通道固定用内嵌 RequireJS,
|
|
3004
|
+
* 所以这里只从传入的加载器上取 config,不再回落到任何全局。
|
|
3005
|
+
*/
|
|
3006
|
+
}, {
|
|
2976
3007
|
key: "_pickRequireConfig",
|
|
2977
3008
|
value: function _pickRequireConfig(loader) {
|
|
2978
|
-
|
|
2979
|
-
var req = loader && typeof loader.config === 'function' ? loader : (_window$__devfab_requ3 = window.__devfab_requirejs) === null || _window$__devfab_requ3 === void 0 ? void 0 : _window$__devfab_requ3.require;
|
|
2980
|
-
return req && typeof req.config === 'function' ? req.config.bind(req) : null;
|
|
3009
|
+
return loader && typeof loader.config === 'function' ? loader.config.bind(loader) : null;
|
|
2981
3010
|
}
|
|
2982
3011
|
}, {
|
|
2983
3012
|
key: "_guardOptions",
|
|
@@ -3010,7 +3039,7 @@
|
|
|
3010
3039
|
key: "configure",
|
|
3011
3040
|
value: function configure(options) {
|
|
3012
3041
|
var o = options || {};
|
|
3013
|
-
if (o.debug !== undefined) this.
|
|
3042
|
+
if (o.debug !== undefined) this.debug = !!o.debug;
|
|
3014
3043
|
if (o.version !== undefined) this.setVersion(o.version);
|
|
3015
3044
|
if (o.timeout !== undefined) this.options.timeout = Math.max(0, toNumber(o.timeout, this.options.timeout));
|
|
3016
3045
|
if (o.retry !== undefined) this.options.retry = Math.max(0, toNumber(o.retry, this.options.retry));
|
|
@@ -3060,47 +3089,12 @@
|
|
|
3060
3089
|
return this.options.version;
|
|
3061
3090
|
}
|
|
3062
3091
|
|
|
3063
|
-
/**
|
|
3064
|
-
* 导出本实例的配置快照,供 `create()` 派生新实例时继承。
|
|
3065
|
-
*
|
|
3066
|
-
* 为什么需要:`create()` 原先是彻底干净的实例,于是宿主在单例上
|
|
3067
|
-
* `configure({ manifest, lockVersion })` 之后,`_utils/models/_extend.js` 里那句
|
|
3068
|
-
* `FileRequire.create({ require }).require(...)` 完全不受约束 —— 扩展脚本主链路上
|
|
3069
|
-
* 登记制与版本锁等于没开。派生时继承配置,这个缺口才闭合。
|
|
3070
|
-
*
|
|
3071
|
-
* 刻意**不包含加载器**(`define` / `require` / `undef` / `requireConfig` / `importer`):
|
|
3072
|
-
* 构造函数会按当前 `window.__devfab_requirejs` 重新取,派生实例拿到的是「此刻真正
|
|
3073
|
-
* 在用的那个加载器」,而不是父实例构造时捕获的旧引用。要指定加载器请显式传,
|
|
3074
|
-
* `create({ require })` 会覆盖。
|
|
3075
|
-
*/
|
|
3076
|
-
}, {
|
|
3077
|
-
key: "_snapshotConfig",
|
|
3078
|
-
value: function _snapshotConfig() {
|
|
3079
|
-
return {
|
|
3080
|
-
__debug: this.__debug,
|
|
3081
|
-
version: this.options.version,
|
|
3082
|
-
timeout: this.options.timeout,
|
|
3083
|
-
retry: this.options.retry,
|
|
3084
|
-
strict: this.options.strict,
|
|
3085
|
-
baseUrl: this.options.baseUrl,
|
|
3086
|
-
manifest: this.policy.manifest,
|
|
3087
|
-
origins: this.policy.origins,
|
|
3088
|
-
lockVersion: this.policy.lockVersion,
|
|
3089
|
-
verifyHash: this.policy.verifyHash,
|
|
3090
|
-
fetch: this.policy.fetch,
|
|
3091
|
-
pollution: this.guard.enabled,
|
|
3092
|
-
watch: this.guard.watch,
|
|
3093
|
-
maxPollution: this.guard.maxPollution,
|
|
3094
|
-
target: this.guard.target
|
|
3095
|
-
};
|
|
3096
|
-
}
|
|
3097
|
-
|
|
3098
3092
|
/** 策略 + 兜底配置摘要,宿主启动时打一行日志排查效率最高 */
|
|
3099
3093
|
}, {
|
|
3100
3094
|
key: "describe",
|
|
3101
3095
|
value: function describe() {
|
|
3102
3096
|
return Object.assign({}, this.options, {
|
|
3103
|
-
debug: this.
|
|
3097
|
+
debug: this.debug,
|
|
3104
3098
|
policy: this.policy.describe(),
|
|
3105
3099
|
pollutionGuard: this.guard.enabled,
|
|
3106
3100
|
canUndef: typeof this.__undef === 'function',
|
|
@@ -3408,15 +3402,10 @@
|
|
|
3408
3402
|
}
|
|
3409
3403
|
_inherits(FileRequireClass, _BaseFileRequire);
|
|
3410
3404
|
return _createClass(FileRequireClass, [{
|
|
3411
|
-
key: "
|
|
3412
|
-
value: function
|
|
3405
|
+
key: "provide",
|
|
3406
|
+
value: function provide(path, files, callback) {
|
|
3413
3407
|
this._define(path, files, callback);
|
|
3414
3408
|
}
|
|
3415
|
-
}, {
|
|
3416
|
-
key: "defineScript",
|
|
3417
|
-
value: function defineScript(o) {
|
|
3418
|
-
this.provideScript(o);
|
|
3419
|
-
}
|
|
3420
3409
|
}, {
|
|
3421
3410
|
key: "provideScript",
|
|
3422
3411
|
value: function provideScript(o) {
|
|
@@ -3426,11 +3415,11 @@
|
|
|
3426
3415
|
return o;
|
|
3427
3416
|
};
|
|
3428
3417
|
}
|
|
3429
|
-
this.
|
|
3418
|
+
this.provide([], callback);
|
|
3430
3419
|
}
|
|
3431
3420
|
}, {
|
|
3432
|
-
key: "
|
|
3433
|
-
value: function
|
|
3421
|
+
key: "inject",
|
|
3422
|
+
value: function inject(path, files, callback) {
|
|
3434
3423
|
this._load(path, files, callback);
|
|
3435
3424
|
}
|
|
3436
3425
|
}, {
|
|
@@ -3458,35 +3447,24 @@
|
|
|
3458
3447
|
if (typeof error === 'function') {
|
|
3459
3448
|
error(result);
|
|
3460
3449
|
} else {
|
|
3461
|
-
self.
|
|
3450
|
+
self.debug && console.error('[devfab][FileRequire][injectScript] error: ', result);
|
|
3462
3451
|
}
|
|
3463
3452
|
}
|
|
3464
3453
|
}
|
|
3465
|
-
this.
|
|
3466
|
-
}
|
|
3467
|
-
}, {
|
|
3468
|
-
key: "requireScript",
|
|
3469
|
-
value: function requireScript(_path, _files, _callback) {
|
|
3470
|
-
this.injectScript(_path, _files, _callback);
|
|
3454
|
+
this.inject(path, files, onCallback);
|
|
3471
3455
|
}
|
|
3472
3456
|
}]);
|
|
3473
3457
|
}(BaseFileRequire);
|
|
3458
|
+
/**
|
|
3459
|
+
* 全局唯一的加载器实例。
|
|
3460
|
+
*
|
|
3461
|
+
* 加载策略(清单 / 白名单 / 版本锁)、全局污染观测、超时重试
|
|
3462
|
+
* 都是**部署级**约定,一个页面只应该有一套。
|
|
3463
|
+
*/
|
|
3474
3464
|
var FileRequire = new FileRequireClass();
|
|
3475
|
-
FileRequire.create = function (args) {
|
|
3476
|
-
return new FileRequireClass(_objectSpread2(_objectSpread2({}, this._snapshotConfig()), args));
|
|
3477
|
-
};
|
|
3478
|
-
|
|
3479
|
-
window.__devfab = Object.assign({}, window.__devfab);
|
|
3480
|
-
window.__devfab.FileRequire = FileRequire;
|
|
3481
|
-
window.__devfab.filePolicy = {
|
|
3482
|
-
LoadPolicy: LoadPolicy,
|
|
3483
|
-
GlobalGuard: GlobalGuard,
|
|
3484
|
-
CODE_POLICY: CODE_POLICY,
|
|
3485
|
-
CODE_TIMEOUT: CODE_TIMEOUT
|
|
3486
|
-
};
|
|
3487
3465
|
|
|
3488
3466
|
function isDebug(debug) {
|
|
3489
|
-
return debug || window.
|
|
3467
|
+
return debug || !!(typeof window !== 'undefined' && window.__devfab && window.__devfab.debug);
|
|
3490
3468
|
}
|
|
3491
3469
|
function QueryString(_url) {
|
|
3492
3470
|
this.pathname = '';
|
|
@@ -3553,12 +3531,12 @@
|
|
|
3553
3531
|
};
|
|
3554
3532
|
this.init();
|
|
3555
3533
|
}
|
|
3556
|
-
|
|
3557
|
-
if (
|
|
3534
|
+
function equalsIgnoreCase(str1, str2) {
|
|
3535
|
+
if (!str1 || !str2) {
|
|
3558
3536
|
return false;
|
|
3559
3537
|
}
|
|
3560
|
-
return
|
|
3561
|
-
}
|
|
3538
|
+
return str1.toLowerCase() === str2.toLowerCase();
|
|
3539
|
+
}
|
|
3562
3540
|
function _appendUrl(restUrl, params) {
|
|
3563
3541
|
if (!params) {
|
|
3564
3542
|
return restUrl;
|
|
@@ -3805,9 +3783,9 @@
|
|
|
3805
3783
|
isDebug() && console.log('[devfab][ajax]: [doRequest]: options.params["requestHeaders"] ERR : ', e);
|
|
3806
3784
|
}
|
|
3807
3785
|
var queryJson = null;
|
|
3808
|
-
if (
|
|
3786
|
+
if (equalsIgnoreCase(method, 'get') || equalsIgnoreCase(method, 'delete')) {
|
|
3809
3787
|
url = _appendUrl(url, options.params);
|
|
3810
|
-
} else if (
|
|
3788
|
+
} else if (equalsIgnoreCase(method, 'post') || equalsIgnoreCase(method, 'put')) {
|
|
3811
3789
|
queryJson = JSON.stringify(options.params);
|
|
3812
3790
|
}
|
|
3813
3791
|
if (options.jsonp) {
|
|
@@ -4831,7 +4809,7 @@
|
|
|
4831
4809
|
config[attr].options.requestHeaders = requestHeaders;
|
|
4832
4810
|
}
|
|
4833
4811
|
if ((_this$getProxy = this.getProxy()) !== null && _this$getProxy !== void 0 && _this$getProxy[attr]) {
|
|
4834
|
-
|
|
4812
|
+
isDebug() && console.warn("[devfab][baseModel.prototype.setProxy]: Proxy ".concat(attr, " already exists on the model. Please change the name of ").concat(attr, " and try again"));
|
|
4835
4813
|
}
|
|
4836
4814
|
}
|
|
4837
4815
|
this._set_data('proxy', DynamicProxy.create(_objectSpread2(_objectSpread2({}, ((_this$getProxy2 = this.getProxy()) === null || _this$getProxy2 === void 0 ? void 0 : _this$getProxy2.config) || {}), config)));
|
|
@@ -5443,7 +5421,15 @@
|
|
|
5443
5421
|
}]);
|
|
5444
5422
|
}(BaseModel$1);
|
|
5445
5423
|
|
|
5446
|
-
function
|
|
5424
|
+
function missingLoaderResult(filesStr) {
|
|
5425
|
+
return {
|
|
5426
|
+
code: 404,
|
|
5427
|
+
message: "params.fileRequire is required, the files: ".concat(filesStr),
|
|
5428
|
+
data: [],
|
|
5429
|
+
warnings: []
|
|
5430
|
+
};
|
|
5431
|
+
}
|
|
5432
|
+
function loadScripts(_fileRequire, _path, _files, _callback, _params) {
|
|
5447
5433
|
var _params2;
|
|
5448
5434
|
var path = _path;
|
|
5449
5435
|
var files = _files;
|
|
@@ -5458,10 +5444,17 @@
|
|
|
5458
5444
|
var viewModel = ((_params2 = params) === null || _params2 === void 0 ? void 0 : _params2.viewModel) || this;
|
|
5459
5445
|
files = Array.isArray(files) ? files : [];
|
|
5460
5446
|
var filesStr = files.join(',');
|
|
5461
|
-
|
|
5462
|
-
require: _require
|
|
5463
|
-
}).require(path, files, function (result) {
|
|
5447
|
+
if (!_fileRequire || typeof _fileRequire.inject !== 'function') {
|
|
5464
5448
|
var _callback2;
|
|
5449
|
+
var result = missingLoaderResult(filesStr);
|
|
5450
|
+
if (isDebug()) {
|
|
5451
|
+
console.error("[devfab][models][extend][loadScripts] ".concat(result.message));
|
|
5452
|
+
}
|
|
5453
|
+
(_callback2 = callback) === null || _callback2 === void 0 || _callback2(result);
|
|
5454
|
+
return result;
|
|
5455
|
+
}
|
|
5456
|
+
return _fileRequire.inject(path, files, function (result) {
|
|
5457
|
+
var _callback3;
|
|
5465
5458
|
if (result.code == 0 && Array.isArray(result.data)) {
|
|
5466
5459
|
for (var i = 0, len = result.data.length; i < len; i++) {
|
|
5467
5460
|
var content = result.data[i];
|
|
@@ -5488,10 +5481,10 @@
|
|
|
5488
5481
|
}
|
|
5489
5482
|
}
|
|
5490
5483
|
}
|
|
5491
|
-
if (result.code != 0 &&
|
|
5484
|
+
if (result.code != 0 && isDebug()) {
|
|
5492
5485
|
console.info("[devfab][models][extend][loadScripts] ".concat(filesStr, " \n [message]: ").concat(result.message, " \n").concat(result.error ? ' \n [error]: ' : ''), result.error);
|
|
5493
5486
|
}
|
|
5494
|
-
(
|
|
5487
|
+
(_callback3 = callback) === null || _callback3 === void 0 || _callback3(result);
|
|
5495
5488
|
});
|
|
5496
5489
|
}
|
|
5497
5490
|
function initExtendScripts(params) {
|
|
@@ -5500,7 +5493,7 @@
|
|
|
5500
5493
|
// eslint-disable-next-line no-debugger
|
|
5501
5494
|
debugger;
|
|
5502
5495
|
}
|
|
5503
|
-
var
|
|
5496
|
+
var fileRequire = params.fileRequire,
|
|
5504
5497
|
extendScriptParams = params.extendScriptParams,
|
|
5505
5498
|
_params$readyEventNam = params.readyEventName,
|
|
5506
5499
|
readyEventName = _params$readyEventNam === void 0 ? 'extendReady' : _params$readyEventNam;
|
|
@@ -5510,12 +5503,12 @@
|
|
|
5510
5503
|
filepath = _ref.filepath,
|
|
5511
5504
|
scriptUrl = _ref.scriptUrl;
|
|
5512
5505
|
if (!enableJs) {
|
|
5513
|
-
|
|
5506
|
+
isDebug() && console.info("[devfab][extend][js] not enable extend script");
|
|
5514
5507
|
self.execute(readyEventName, self);
|
|
5515
5508
|
return;
|
|
5516
5509
|
}
|
|
5517
5510
|
if (!scriptUrl) {
|
|
5518
|
-
|
|
5511
|
+
isDebug() && console.info("[devfab][extend][js] extend script is not defined");
|
|
5519
5512
|
self.execute(readyEventName, self);
|
|
5520
5513
|
return;
|
|
5521
5514
|
}
|
|
@@ -5525,14 +5518,14 @@
|
|
|
5525
5518
|
if (self.getEnv && self.getEnv('everyCommonExtend')) {
|
|
5526
5519
|
extendFiles.push(self.getEnv('everyCommonExtend'));
|
|
5527
5520
|
}
|
|
5528
|
-
loadScripts.call(self,
|
|
5521
|
+
loadScripts.call(self, fileRequire, extendFilePath, extendFiles, function (result) {
|
|
5529
5522
|
self.execute(readyEventName, self, result);
|
|
5530
5523
|
});
|
|
5531
5524
|
}
|
|
5532
5525
|
var initExtScripts = /*#__PURE__*/function () {
|
|
5533
5526
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(data, viewModel, params) {
|
|
5534
5527
|
var _viewModel$getParams, _exturls;
|
|
5535
|
-
var
|
|
5528
|
+
var fileRequire, extendScriptParams, _ref3, _ref3$enableExtJs, enableExtJs, _ref3$exturlsField, exturlsField, extscripturls, exturls;
|
|
5536
5529
|
return _regenerator().w(function (_context2) {
|
|
5537
5530
|
while (1) switch (_context2.n) {
|
|
5538
5531
|
case 0:
|
|
@@ -5540,20 +5533,20 @@
|
|
|
5540
5533
|
// eslint-disable-next-line no-debugger
|
|
5541
5534
|
debugger;
|
|
5542
5535
|
}
|
|
5543
|
-
|
|
5536
|
+
fileRequire = params.fileRequire, extendScriptParams = params.extendScriptParams;
|
|
5544
5537
|
_ref3 = extendScriptParams || {}, _ref3$enableExtJs = _ref3.enableExtJs, enableExtJs = _ref3$enableExtJs === void 0 ? false : _ref3$enableExtJs, _ref3$exturlsField = _ref3.exturlsField, exturlsField = _ref3$exturlsField === void 0 ? 'extscripturls' : _ref3$exturlsField;
|
|
5545
5538
|
if (enableExtJs) {
|
|
5546
5539
|
_context2.n = 1;
|
|
5547
5540
|
break;
|
|
5548
5541
|
}
|
|
5549
|
-
|
|
5542
|
+
isDebug() && console.info("[devfab][extend][exturls] ext script is not enable");
|
|
5550
5543
|
return _context2.a(2, Promise.resolve(true));
|
|
5551
5544
|
case 1:
|
|
5552
5545
|
if (data) {
|
|
5553
5546
|
_context2.n = 2;
|
|
5554
5547
|
break;
|
|
5555
5548
|
}
|
|
5556
|
-
|
|
5549
|
+
isDebug() && console.info("[devfab][extend][exturls] script data is null");
|
|
5557
5550
|
return _context2.a(2, Promise.resolve(true));
|
|
5558
5551
|
case 2:
|
|
5559
5552
|
extscripturls = data === null || data === void 0 ? void 0 : data[exturlsField];
|
|
@@ -5593,7 +5586,7 @@
|
|
|
5593
5586
|
case 4:
|
|
5594
5587
|
data[exturlsField] = exturls;
|
|
5595
5588
|
return _context2.a(2, new Promise(function (resolve, reject) {
|
|
5596
|
-
loadScripts.call(viewModel,
|
|
5589
|
+
loadScripts.call(viewModel, fileRequire, exturls, function (result) {
|
|
5597
5590
|
resolve(result);
|
|
5598
5591
|
});
|
|
5599
5592
|
}));
|
|
@@ -5696,7 +5689,7 @@
|
|
|
5696
5689
|
var _vm, _vm$destroyVM;
|
|
5697
5690
|
(_vm = vm) === null || _vm === void 0 || (_vm$destroyVM = _vm.destroyVM) === null || _vm$destroyVM === void 0 || _vm$destroyVM.call(_vm);
|
|
5698
5691
|
vm = null;
|
|
5699
|
-
|
|
5692
|
+
isDebug() && console.info("[devfab][models][initVM]: destory vm ".concat(new Date().toString()));
|
|
5700
5693
|
});
|
|
5701
5694
|
vm.on('extendReady', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
5702
5695
|
var promises;
|
|
@@ -5708,7 +5701,7 @@
|
|
|
5708
5701
|
_context.n = 1;
|
|
5709
5702
|
return Promise.all(promises);
|
|
5710
5703
|
case 1:
|
|
5711
|
-
|
|
5704
|
+
isDebug() && console.info("[devfab][models][initVM]: after vm init ".concat(new Date().toString()));
|
|
5712
5705
|
callback === null || callback === void 0 || callback(vm, meta);
|
|
5713
5706
|
case 2:
|
|
5714
5707
|
return _context.a(2);
|
|
@@ -5738,13 +5731,24 @@
|
|
|
5738
5731
|
};
|
|
5739
5732
|
|
|
5740
5733
|
var devfab = {
|
|
5741
|
-
debug
|
|
5742
|
-
|
|
5734
|
+
get debug() {
|
|
5735
|
+
return !!(window.__devfab && window.__devfab.debug);
|
|
5736
|
+
},
|
|
5737
|
+
set debug(value) {
|
|
5738
|
+
window.__devfab = window.__devfab || {};
|
|
5739
|
+
window.__devfab.debug = !!value;
|
|
5740
|
+
},
|
|
5743
5741
|
define: function define() {
|
|
5744
|
-
FileRequire.
|
|
5742
|
+
FileRequire.provide.apply(FileRequire, arguments);
|
|
5745
5743
|
},
|
|
5746
5744
|
require: function require() {
|
|
5747
|
-
FileRequire.
|
|
5745
|
+
FileRequire.inject.apply(FileRequire, arguments);
|
|
5746
|
+
},
|
|
5747
|
+
provide: function provide() {
|
|
5748
|
+
FileRequire.provide.apply(FileRequire, arguments);
|
|
5749
|
+
},
|
|
5750
|
+
inject: function inject() {
|
|
5751
|
+
FileRequire.inject.apply(FileRequire, arguments);
|
|
5748
5752
|
},
|
|
5749
5753
|
provideScript: function provideScript() {
|
|
5750
5754
|
FileRequire.provideScript.apply(FileRequire, arguments);
|
|
@@ -5752,6 +5756,7 @@
|
|
|
5752
5756
|
injectScript: function injectScript() {
|
|
5753
5757
|
FileRequire.injectScript.apply(FileRequire, arguments);
|
|
5754
5758
|
},
|
|
5759
|
+
FileRequire: FileRequire,
|
|
5755
5760
|
utils: _objectSpread2(_objectSpread2({}, utils), {}, {
|
|
5756
5761
|
builder: utils.Builder.create(),
|
|
5757
5762
|
cache: utils.Cache.create(),
|