@lynx-js/testing-environment 0.1.2 → 0.1.3

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/dist/index.cjs CHANGED
@@ -40,6 +40,7 @@ const external_events_namespaceObject = require("events");
40
40
  var external_events_default = /*#__PURE__*/ __webpack_require__.n(external_events_namespaceObject);
41
41
  const GlobalThis_cjs_namespaceObject = require("./lynx/GlobalThis.cjs");
42
42
  const ElementPAPI_cjs_namespaceObject = require("./lynx/ElementPAPI.cjs");
43
+ const external_console_namespaceObject = require("console");
43
44
  function _define_property(obj, key, value) {
44
45
  if (key in obj) Object.defineProperty(obj, key, {
45
46
  value: value,
@@ -146,6 +147,13 @@ function createPolyfills() {
146
147
  __LoadLepusChunk
147
148
  };
148
149
  }
150
+ function createPreconfiguredConsole() {
151
+ const console1 = new external_console_namespaceObject.Console(process.stdout, process.stderr);
152
+ console1.profile = ()=>{};
153
+ console1.profileEnd = ()=>{};
154
+ console1.alog = ()=>{};
155
+ return console1;
156
+ }
149
157
  function injectMainThreadGlobals(target, polyfills) {
150
158
  var _globalThis_onInjectMainThreadGlobals, _globalThis;
151
159
  __injectElementApi(target);
@@ -153,6 +161,7 @@ function injectMainThreadGlobals(target, polyfills) {
153
161
  if (void 0 === target) target = globalThis;
154
162
  target.__DEV__ = true;
155
163
  target.__PROFILE__ = true;
164
+ target.__ALOG__ = true;
156
165
  target.__JS__ = false;
157
166
  target.__LEPUS__ = true;
158
167
  target.__BACKGROUND__ = false;
@@ -172,8 +181,7 @@ function injectMainThreadGlobals(target, polyfills) {
172
181
  };
173
182
  target.requestAnimationFrame = setTimeout;
174
183
  target.cancelAnimationFrame = clearTimeout;
175
- target.console.profile = ()=>{};
176
- target.console.profileEnd = ()=>{};
184
+ target.console = createPreconfiguredConsole();
177
185
  target.__LoadLepusChunk = __LoadLepusChunk;
178
186
  null == (_globalThis_onInjectMainThreadGlobals = (_globalThis = globalThis).onInjectMainThreadGlobals) || _globalThis_onInjectMainThreadGlobals.call(_globalThis, target);
179
187
  }
@@ -207,6 +215,7 @@ function injectBackgroundThreadGlobals(target, polyfills) {
207
215
  if (void 0 === target) target = globalThis;
208
216
  target.__DEV__ = true;
209
217
  target.__PROFILE__ = true;
218
+ target.__ALOG__ = true;
210
219
  target.__JS__ = true;
211
220
  target.__LEPUS__ = false;
212
221
  target.__BACKGROUND__ = true;
@@ -246,8 +255,7 @@ function injectBackgroundThreadGlobals(target, polyfills) {
246
255
  };
247
256
  target.requestAnimationFrame = setTimeout;
248
257
  target.cancelAnimationFrame = clearTimeout;
249
- target.console.profile = ()=>{};
250
- target.console.profileEnd = ()=>{};
258
+ target.console = createPreconfiguredConsole();
251
259
  target.SystemInfo = {
252
260
  platform: 'iOS',
253
261
  pixelRatio: 3,
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import events from "events";
2
2
  import { createGlobalThis } from "./lynx/GlobalThis.js";
3
3
  import { initElementTree } from "./lynx/ElementPAPI.js";
4
+ import { Console } from "console";
4
5
  function _define_property(obj, key, value) {
5
6
  if (key in obj) Object.defineProperty(obj, key, {
6
7
  value: value,
@@ -107,6 +108,13 @@ function createPolyfills() {
107
108
  __LoadLepusChunk
108
109
  };
109
110
  }
111
+ function createPreconfiguredConsole() {
112
+ const console1 = new Console(process.stdout, process.stderr);
113
+ console1.profile = ()=>{};
114
+ console1.profileEnd = ()=>{};
115
+ console1.alog = ()=>{};
116
+ return console1;
117
+ }
110
118
  function injectMainThreadGlobals(target, polyfills) {
111
119
  var _globalThis_onInjectMainThreadGlobals, _globalThis;
112
120
  __injectElementApi(target);
@@ -114,6 +122,7 @@ function injectMainThreadGlobals(target, polyfills) {
114
122
  if (void 0 === target) target = globalThis;
115
123
  target.__DEV__ = true;
116
124
  target.__PROFILE__ = true;
125
+ target.__ALOG__ = true;
117
126
  target.__JS__ = false;
118
127
  target.__LEPUS__ = true;
119
128
  target.__BACKGROUND__ = false;
@@ -133,8 +142,7 @@ function injectMainThreadGlobals(target, polyfills) {
133
142
  };
134
143
  target.requestAnimationFrame = setTimeout;
135
144
  target.cancelAnimationFrame = clearTimeout;
136
- target.console.profile = ()=>{};
137
- target.console.profileEnd = ()=>{};
145
+ target.console = createPreconfiguredConsole();
138
146
  target.__LoadLepusChunk = __LoadLepusChunk;
139
147
  null == (_globalThis_onInjectMainThreadGlobals = (_globalThis = globalThis).onInjectMainThreadGlobals) || _globalThis_onInjectMainThreadGlobals.call(_globalThis, target);
140
148
  }
@@ -168,6 +176,7 @@ function injectBackgroundThreadGlobals(target, polyfills) {
168
176
  if (void 0 === target) target = globalThis;
169
177
  target.__DEV__ = true;
170
178
  target.__PROFILE__ = true;
179
+ target.__ALOG__ = true;
171
180
  target.__JS__ = true;
172
181
  target.__LEPUS__ = false;
173
182
  target.__BACKGROUND__ = true;
@@ -207,8 +216,7 @@ function injectBackgroundThreadGlobals(target, polyfills) {
207
216
  };
208
217
  target.requestAnimationFrame = setTimeout;
209
218
  target.cancelAnimationFrame = clearTimeout;
210
- target.console.profile = ()=>{};
211
- target.console.profileEnd = ()=>{};
219
+ target.console = createPreconfiguredConsole();
212
220
  target.SystemInfo = {
213
221
  platform: 'iOS',
214
222
  pixelRatio: 3,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/testing-environment",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "A subset of a Lynx environment to be useful for testing",
5
5
  "keywords": [
6
6
  "Lynx",