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

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,13 @@
1
1
  # @lynx-js/runtime-wrapper-webpack-plugin
2
2
 
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add parameter forwarding for Browser Object Model (BOM) APIs. ([#787](https://github.com/lynx-family/lynx-stack/pull/787))
8
+
9
+ This allows direct access to APIs like `fetch`, `requestAnimationFrame`.
10
+
3
11
  ## 0.0.10
4
12
 
5
13
  ### Patch Changes
@@ -17,7 +17,31 @@ 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
+ '__Function__', // We should allow using `Function`
41
+ 'global',
42
+ // Lynx API
43
+ 'requestAnimationFrame',
44
+ 'cancelAnimationFrame',
21
45
  ];
22
46
  /**
23
47
  * RuntimeWrapperWebpackPlugin adds runtime wrappers to JavaScript and allow to be loaded by Lynx.
@@ -156,7 +180,9 @@ const amdBanner = ({ injectStr, moduleId, overrideRuntimePromise, targetSdkVersi
156
180
  lynx = lynx || {};
157
181
  lynx.targetSdkVersion=lynx.targetSdkVersion||${JSON.stringify(targetSdkVersion)};
158
182
  ${overrideRuntimePromise ? `var Promise = lynx.Promise;` : ''}
159
- var fetch = lynx.fetch;
183
+ fetch = fetch || lynx.fetch;
184
+ requestAnimationFrame = requestAnimationFrame || lynx.requestAnimationFrame;
185
+ cancelAnimationFrame = cancelAnimationFrame || lynx.cancelAnimationFrame;
160
186
  `);
161
187
  };
162
188
  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.0",
4
4
  "description": "Use runtime wrapper which allow JavaScript to be load by Lynx.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -35,7 +35,7 @@
35
35
  "@lynx-js/webpack-runtime-globals": "0.0.5"
36
36
  },
37
37
  "devDependencies": {
38
- "@microsoft/api-extractor": "7.52.7",
38
+ "@microsoft/api-extractor": "7.52.8",
39
39
  "webpack": "^5.99.8",
40
40
  "@lynx-js/test-tools": "0.0.0"
41
41
  },