@lynx-js/runtime-wrapper-webpack-plugin 0.0.10 → 0.1.1

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @lynx-js/runtime-wrapper-webpack-plugin
2
2
 
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix `requestAnimationFrame` is not working. ([#1021](https://github.com/lynx-family/lynx-stack/pull/1021))
8
+
9
+ ## 0.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Add parameter forwarding for Browser Object Model (BOM) APIs. ([#787](https://github.com/lynx-family/lynx-stack/pull/787))
14
+
15
+ This allows direct access to APIs like `fetch`, `requestAnimationFrame`.
16
+
3
17
  ## 0.0.10
4
18
 
5
19
  ### Patch Changes
@@ -17,7 +17,30 @@ const defaultInjectVars = [
17
17
  'Behavior',
18
18
  'LynxJSBI',
19
19
  'lynx',
20
+ // BOM API
20
21
  'window',
22
+ 'document',
23
+ 'frames',
24
+ 'self',
25
+ 'location',
26
+ 'navigator',
27
+ 'localStorage',
28
+ 'history',
29
+ 'Caches',
30
+ 'screen',
31
+ 'alert',
32
+ 'confirm',
33
+ 'prompt',
34
+ 'fetch',
35
+ 'XMLHttpRequest',
36
+ '__WebSocket__', // We would provide `WebSocket` using `ProvidePlugin`
37
+ 'webkit',
38
+ 'Reporter',
39
+ 'print',
40
+ 'global',
41
+ // Lynx API
42
+ 'requestAnimationFrame',
43
+ 'cancelAnimationFrame',
21
44
  ];
22
45
  /**
23
46
  * RuntimeWrapperWebpackPlugin adds runtime wrappers to JavaScript and allow to be loaded by Lynx.
@@ -156,7 +179,9 @@ const amdBanner = ({ injectStr, moduleId, overrideRuntimePromise, targetSdkVersi
156
179
  lynx = lynx || {};
157
180
  lynx.targetSdkVersion=lynx.targetSdkVersion||${JSON.stringify(targetSdkVersion)};
158
181
  ${overrideRuntimePromise ? `var Promise = lynx.Promise;` : ''}
159
- var fetch = lynx.fetch;
182
+ fetch = fetch || lynx.fetch;
183
+ requestAnimationFrame = requestAnimationFrame || lynx.requestAnimationFrame;
184
+ cancelAnimationFrame = cancelAnimationFrame || lynx.cancelAnimationFrame;
160
185
  `);
161
186
  };
162
187
  const amdFooter = (moduleId) => `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/runtime-wrapper-webpack-plugin",
3
- "version": "0.0.10",
3
+ "version": "0.1.1",
4
4
  "description": "Use runtime wrapper which allow JavaScript to be load by Lynx.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -35,8 +35,8 @@
35
35
  "@lynx-js/webpack-runtime-globals": "0.0.5"
36
36
  },
37
37
  "devDependencies": {
38
- "@microsoft/api-extractor": "7.52.7",
39
- "webpack": "^5.99.8",
38
+ "@microsoft/api-extractor": "7.52.8",
39
+ "webpack": "^5.99.9",
40
40
  "@lynx-js/test-tools": "0.0.0"
41
41
  },
42
42
  "engines": {