@lumjs/core 1.38.4 → 1.38.6

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/context.js CHANGED
@@ -29,9 +29,9 @@
29
29
  * @property {boolean} CJS.isWebpack - Webpack bundler detected.
30
30
  * @property {boolean} CJS.inBrowser - `CJS.isLumV5 || CJS.isWebpack`
31
31
  * @property {object} Node - Node.js detection.
32
- * @property {boolean} Node.isSane - `CJS.nodeLike && !CJS.inBrowser`
33
32
  * @property {boolean} Node.hasProcess - A global `process` object exists.
34
- * @property {boolean} Node.ok - `Node.isSane && Node.hasProcess`
33
+ * @property {boolean} Node.ok - `Node.hasProcess && !CJS.inBrowser`
34
+ * @property {boolean} Node.isSane - DEPRECATED: now an alias for Node.ok
35
35
  * @property {?string} Node.ver - `process.versions.node ?? null`
36
36
  * @property {?object} Node.versions - `process.versions ?? null`
37
37
  * @property {Array} Node.args - Command line arguments.
@@ -45,19 +45,21 @@
45
45
  * @property {object} root - See {@link module:@lumjs/core/types.root}
46
46
  */
47
47
 
48
- const {root,B,F,U,O,isComplex,isObj,def} = require('./types');
48
+ const {root,B,F,U,O,isComplex,isObj} = require('./types');
49
+ const { df, dfor } = require('./obj');
49
50
 
51
+ const fo = {enumerable: true}
50
52
  const ctx = {root};
51
53
  const rootHas = what => typeof root[what] !== U;
52
- const cd = def(ctx, true);
54
+ const cd = dfor(ctx, fo);
53
55
  const CJS = {};
54
56
  const AMD = {};
55
57
  const Node = {};
56
58
  const Elec = {};
57
- const cjs = def(CJS, true);
58
- const amd = def(AMD, true);
59
- const node = def(Node, true);
60
- const elec = def(Elec, true);
59
+ const cjs = dfor(CJS, fo);
60
+ const amd = dfor(AMD, fo);
61
+ const node = dfor(Node, fo);
62
+ const elec = dfor(Elec, fo);
61
63
  const isLumV5 = typeof module.$lib === O && module.$lib.$cached === module;
62
64
 
63
65
  cd('hasDefine', typeof define === F)
@@ -74,9 +76,9 @@ cjs('standard', ctx.hasModule && ctx.hasRequire)
74
76
  ('isWebpack', CJS.nodeLike && require.resolve === require)
75
77
  ('inBrowser', CJS.isLumV5 || CJS.isWebpack)
76
78
 
77
- node('isSane', CJS.nodeLike && !CJS.inBrowser)
78
- ('hasProcess', typeof process === O && process !== null)
79
- ('ok', Node.isSane && Node.hasProcess)
79
+ node('hasProcess', typeof process === O && process !== null)
80
+ ('ok', Node.hasProcess && !CJS.inBrowser)
81
+ ('isSane', Node.ok) // <- TODO: Remove this in v2.x
80
82
  ('versions', Node.hasProcess ? process.versions : null)
81
83
  ('ver', Node.hasProcess ? process.versions.node : null)
82
84
  ('args', {get: function()
@@ -137,7 +139,7 @@ function hasRoot(ns)
137
139
  {
138
140
  if (typeof hasRoot[ns] === B) return hasRoot[ns];
139
141
  const result = rootHas(ns);
140
- def(hasRoot, ns, {value: result, enumerable: true});
142
+ df(hasRoot, ns, {value: result, enumerable: true});
141
143
  return result;
142
144
  }
143
145