@lumjs/core 1.9.0 → 1.10.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/TODO.md +0 -1
- package/lib/context.js +29 -23
- package/lib/index.js +2 -1
- package/package.json +9 -7
package/TODO.md
CHANGED
package/lib/context.js
CHANGED
|
@@ -21,37 +21,43 @@
|
|
|
21
21
|
* @property {object} root - See {@link module:@lumjs/core/types.root}
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
const {root,B,F,U,O,isComplex,def} = require('./types');
|
|
24
|
+
const {root,B,F,U,O,isComplex,isObj,def} = require('./types');
|
|
25
25
|
|
|
26
26
|
const ctx = {root};
|
|
27
|
-
|
|
28
27
|
const rootHas = what => typeof root[what] !== U;
|
|
29
28
|
const cd = def(ctx, true);
|
|
29
|
+
const CJS = {};
|
|
30
|
+
const AMD = {};
|
|
31
|
+
const cjs = def(CJS, true);
|
|
32
|
+
const amd = def(AMD, true);
|
|
33
|
+
const isLumV5 = typeof module.$lib === O && module.$lib.$cached === module;
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
if (typeof module !== O || module === null) return false;
|
|
34
|
-
if (!ctx.hasRequire) return false;
|
|
35
|
-
if (!isComplex(module.exports)) return false;
|
|
36
|
-
if (typeof module.$lib === O && typeof module.$lib.$cached === O)
|
|
37
|
-
return false; // It's our fake CommonJS emulation layer.
|
|
38
|
-
// Okay, all tests are okay.
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
cd('AMD', typeof define === F && define.amd)
|
|
35
|
+
cd('hasDefine', typeof define === F)
|
|
43
36
|
('hasRequire', typeof require === F)
|
|
44
37
|
('hasExports', typeof exports !== U)
|
|
45
38
|
('hasModule', typeof module === O && module !== null)
|
|
46
|
-
('
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
39
|
+
('hasModuleExports', isComplex(module.exports))
|
|
40
|
+
;
|
|
41
|
+
|
|
42
|
+
cjs('standard', ctx.hasModule && ctx.hasRequire)
|
|
43
|
+
('nodeLike', CJS.standard && ctx.hasExports)
|
|
44
|
+
('isLumV5', CJS.nodeLike && isLumV5)
|
|
45
|
+
('isWebpack', CJS.nodeLike && require.resolve === require)
|
|
46
|
+
('inBrowser', CJS.isLumV5 || CJS.isWebpack)
|
|
47
|
+
;
|
|
48
|
+
|
|
49
|
+
amd('isSupported', ctx.hasDefine && isObj(define.amd))
|
|
50
|
+
('isRequireJS', AMD.isSupported && typeof requirejs === F)
|
|
51
|
+
|
|
52
|
+
cd('CJS', CJS)
|
|
53
|
+
('AMD', AMD)
|
|
54
|
+
('isNode', CJS.nodeLike && !CJS.inBrowser)
|
|
55
|
+
('isWindow', rootHas('window'))
|
|
56
|
+
('isWorker', rootHas('WorkerGlobalScope'))
|
|
57
|
+
('isServiceWorker', rootHas('ServiceWorkerGlobalScope'))
|
|
58
|
+
('isDedicatedWorker', rootHas('DedicatedWorkerGlobalScope'))
|
|
59
|
+
('isSharedWorker', rootHas('SharedWorkerGlobalScope'))
|
|
60
|
+
('isBrowser', !ctx.isNode && (ctx.isWindow || ctx.isWorker))
|
|
55
61
|
;
|
|
56
62
|
|
|
57
63
|
/**
|
package/lib/index.js
CHANGED
|
@@ -80,7 +80,8 @@ lazy(exports, 'obj', () => require('./obj'), E);
|
|
|
80
80
|
* @name module:@lumjs/core.opt
|
|
81
81
|
* @type {module:@lumjs/core/opt}
|
|
82
82
|
*/
|
|
83
|
-
|
|
83
|
+
const optOpts = {enumerable: true, def:{autoDesc: false}}
|
|
84
|
+
lazy(exports, 'opt', () => require('./opt'), optOpts);
|
|
84
85
|
|
|
85
86
|
// Get a bunch of properties from a submodule.
|
|
86
87
|
function from(submod, ...libs)
|
package/package.json
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumjs/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"exports":
|
|
6
6
|
{
|
|
7
7
|
".": "./lib/index.js",
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
"./arrays": "./lib/arrays.js",
|
|
10
10
|
"./context": "./lib/context.js",
|
|
11
|
-
"./
|
|
11
|
+
"./enum": "./lib/enum.js",
|
|
12
12
|
"./flags": "./lib/flags.js",
|
|
13
|
-
"./obj": "./lib/obj/index.js",
|
|
14
|
-
"./opt": "./lib/opt.js",
|
|
15
|
-
"./modules": "./lib/modules.js",
|
|
16
13
|
"./meta": "./lib/meta.js",
|
|
17
|
-
"./
|
|
14
|
+
"./modules": "./lib/modules.js",
|
|
15
|
+
"./obj": "./lib/obj/index.js",
|
|
18
16
|
"./observable": "./lib/observable.js",
|
|
17
|
+
"./opt": "./lib/opt.js",
|
|
18
|
+
"./strings": "./lib/strings.js",
|
|
19
|
+
"./types": "./lib/types/index.js",
|
|
20
|
+
|
|
19
21
|
"./package.json": "./package.json"
|
|
20
22
|
},
|
|
21
23
|
"license": "MIT",
|