@lynx-js/web-mainthread-apis 0.13.1 → 0.13.2
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/CHANGELOG.md +17 -0
- package/dist/MainThreadRuntime.d.ts +1 -1
- package/dist/MainThreadRuntime.js +14 -3
- package/dist/loadMainThread.js +3 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @lynx-js/web-mainthread-apis
|
|
2
2
|
|
|
3
|
+
## 0.13.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: allow lynx code to get JS engine provided properties on globalThis ([#786](https://github.com/lynx-family/lynx-stack/pull/786))
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
globalThis.Reflect; // this will be the Reflect Object
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Note that `assigning to the globalThis` is still not allowed.
|
|
14
|
+
|
|
15
|
+
- fix: corrupt mainthread module cache ([#806](https://github.com/lynx-family/lynx-stack/pull/806))
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`8cdd288`](https://github.com/lynx-family/lynx-stack/commit/8cdd28884288b9456aee3a919d6edbf72da1c67b)]:
|
|
18
|
+
- @lynx-js/web-constants@0.13.2
|
|
19
|
+
|
|
3
20
|
## 0.13.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -128,9 +128,20 @@ export class MainThreadRuntime {
|
|
|
128
128
|
* @private
|
|
129
129
|
*/
|
|
130
130
|
__lynxGlobalBindingValues = {};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
globalThis = new Proxy(this, {
|
|
132
|
+
get: (target, prop) => {
|
|
133
|
+
// @ts-expect-error
|
|
134
|
+
return target[prop] ?? globalThis[prop];
|
|
135
|
+
},
|
|
136
|
+
set: (target, prop, value) => {
|
|
137
|
+
// @ts-expect-error
|
|
138
|
+
target[prop] = value;
|
|
139
|
+
return true;
|
|
140
|
+
},
|
|
141
|
+
ownKeys(target) {
|
|
142
|
+
return Reflect.ownKeys(target).filter((key) => key !== 'globalThis');
|
|
143
|
+
},
|
|
144
|
+
});
|
|
134
145
|
SystemInfo;
|
|
135
146
|
lynx;
|
|
136
147
|
__globalProps;
|
package/dist/loadMainThread.js
CHANGED
|
@@ -19,7 +19,7 @@ export function loadMainThread(backgroundThreadRpc, docu, commitDocument, markTi
|
|
|
19
19
|
const { styleInfo, pageConfig, customSections, cardType, lepusCode } = template;
|
|
20
20
|
markTimingInternal('decode_start');
|
|
21
21
|
const lepusCodeEntries = await Promise.all(Object.entries(lepusCode).map(async ([name, url]) => {
|
|
22
|
-
const cachedModule = moduleCache[
|
|
22
|
+
const cachedModule = moduleCache[url];
|
|
23
23
|
if (cachedModule) {
|
|
24
24
|
return [name, cachedModule];
|
|
25
25
|
}
|
|
@@ -28,7 +28,7 @@ export function loadMainThread(backgroundThreadRpc, docu, commitDocument, markTi
|
|
|
28
28
|
await import(/* webpackIgnore: true */ url);
|
|
29
29
|
const module = globalThis.module;
|
|
30
30
|
Object.assign(globalThis, { module: {} });
|
|
31
|
-
moduleCache[
|
|
31
|
+
moduleCache[url] = module;
|
|
32
32
|
return [name, module];
|
|
33
33
|
}
|
|
34
34
|
}));
|
|
@@ -109,7 +109,7 @@ export function loadMainThread(backgroundThreadRpc, docu, commitDocument, markTi
|
|
|
109
109
|
publicComponentEvent,
|
|
110
110
|
postExposure,
|
|
111
111
|
},
|
|
112
|
-
})
|
|
112
|
+
});
|
|
113
113
|
markTimingInternal('decode_end');
|
|
114
114
|
entry(runtime);
|
|
115
115
|
jsContext.__start(); // start the jsContext after the runtime is created
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-mainthread-apis",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"css-tree": "^3.1.0",
|
|
27
27
|
"hyphenate-style-name": "^1.1.0",
|
|
28
|
-
"@lynx-js/web-constants": "0.13.
|
|
28
|
+
"@lynx-js/web-constants": "0.13.2",
|
|
29
29
|
"@lynx-js/web-style-transformer": "0.3.0"
|
|
30
30
|
}
|
|
31
31
|
}
|