@lynx-js/testing-environment 0.1.1 → 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 +12 -4
- package/dist/index.js +15 -7
- package/dist/lynx/ElementPAPI.cjs +6 -3
- package/dist/lynx/ElementPAPI.js +6 -3
- package/package.json +1 -1
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
|
|
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
|
|
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
|
-
import
|
|
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,
|
|
@@ -74,7 +75,7 @@ function createPolyfills() {
|
|
|
74
75
|
]);
|
|
75
76
|
}
|
|
76
77
|
};
|
|
77
|
-
const ee = new
|
|
78
|
+
const ee = new events();
|
|
78
79
|
ee.dispatchEvent = ({ type, data })=>{
|
|
79
80
|
const isMainThread = __MAIN_THREAD__;
|
|
80
81
|
lynxTestingEnv.switchToBackgroundThread();
|
|
@@ -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
|
|
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;
|
|
@@ -181,7 +190,7 @@ function injectBackgroundThreadGlobals(target, polyfills) {
|
|
|
181
190
|
updateData: {}
|
|
182
191
|
}
|
|
183
192
|
};
|
|
184
|
-
const globalEventEmitter = new
|
|
193
|
+
const globalEventEmitter = new events();
|
|
185
194
|
globalEventEmitter.trigger = globalEventEmitter.emit;
|
|
186
195
|
globalEventEmitter.toggle = globalEventEmitter.emit;
|
|
187
196
|
target.lynx = {
|
|
@@ -207,8 +216,7 @@ function injectBackgroundThreadGlobals(target, polyfills) {
|
|
|
207
216
|
};
|
|
208
217
|
target.requestAnimationFrame = setTimeout;
|
|
209
218
|
target.cancelAnimationFrame = clearTimeout;
|
|
210
|
-
target.console
|
|
211
|
-
target.console.profileEnd = ()=>{};
|
|
219
|
+
target.console = createPreconfiguredConsole();
|
|
212
220
|
target.SystemInfo = {
|
|
213
221
|
platform: 'iOS',
|
|
214
222
|
pixelRatio: 3,
|
|
@@ -178,9 +178,12 @@ const initElementTree = ()=>{
|
|
|
178
178
|
}
|
|
179
179
|
__RemoveElement(parent, child) {
|
|
180
180
|
let ch = parent.firstChild;
|
|
181
|
-
while(ch)
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
while(ch){
|
|
182
|
+
if (ch === child) {
|
|
183
|
+
parent.removeChild(ch);
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
ch = ch.nextSibling;
|
|
184
187
|
}
|
|
185
188
|
}
|
|
186
189
|
__InsertElementBefore(parent, child, ref) {
|
package/dist/lynx/ElementPAPI.js
CHANGED
|
@@ -150,9 +150,12 @@ const initElementTree = ()=>{
|
|
|
150
150
|
}
|
|
151
151
|
__RemoveElement(parent, child) {
|
|
152
152
|
let ch = parent.firstChild;
|
|
153
|
-
while(ch)
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
while(ch){
|
|
154
|
+
if (ch === child) {
|
|
155
|
+
parent.removeChild(ch);
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
ch = ch.nextSibling;
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
__InsertElementBefore(parent, child, ref) {
|