@trickfilm400/rollup-plugin-off-main-thread 2.4.3 → 3.0.0-pre1

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.
Files changed (157) hide show
  1. package/.travis.yml +8 -8
  2. package/CONTRIBUTING +27 -27
  3. package/CONTRIBUTORS +11 -11
  4. package/LICENSE +202 -202
  5. package/README.md +97 -97
  6. package/index.js +318 -318
  7. package/karma.conf.js +46 -46
  8. package/loader.ejs +76 -76
  9. package/package.json +42 -42
  10. package/run_tests.js +105 -105
  11. package/tests/amd-function-name.test.js +33 -33
  12. package/tests/asset-in-worker.test.js +33 -33
  13. package/tests/dynamic-import.test.js +33 -33
  14. package/tests/fixtures/amd-function-name/a.js +16 -16
  15. package/tests/fixtures/amd-function-name/build/a-29701bae.js +22 -0
  16. package/tests/fixtures/amd-function-name/build/a-REsyh-LW.js +22 -0
  17. package/tests/fixtures/amd-function-name/build/a-bd62e735.js +22 -0
  18. package/tests/fixtures/amd-function-name/build/entry.js +95 -0
  19. package/tests/fixtures/amd-function-name/build/runner.html +15 -15
  20. package/tests/fixtures/amd-function-name/config.json +3 -3
  21. package/tests/fixtures/amd-function-name/entry.js +22 -22
  22. package/tests/fixtures/assets-in-worker/build/assets/my-asset-8db90352.bin +1 -0
  23. package/tests/fixtures/assets-in-worker/build/assets/my-asset-C4yNwep_.bin +1 -0
  24. package/tests/fixtures/assets-in-worker/build/entry.js +90 -0
  25. package/tests/fixtures/assets-in-worker/build/runner.html +15 -15
  26. package/tests/fixtures/assets-in-worker/build/worker-2a7f7c23.js +91 -0
  27. package/tests/fixtures/assets-in-worker/build/worker-5cc2068a.js +92 -0
  28. package/tests/fixtures/assets-in-worker/build/worker-CtBAebZB.js +92 -0
  29. package/tests/fixtures/assets-in-worker/entry.js +17 -17
  30. package/tests/fixtures/assets-in-worker/rollup.config.js +25 -25
  31. package/tests/fixtures/assets-in-worker/worker.js +18 -18
  32. package/tests/fixtures/dynamic-import/a.js +16 -16
  33. package/tests/fixtures/dynamic-import/build/a-Dqjf2iqw.js +22 -0
  34. package/tests/fixtures/dynamic-import/build/a-b9a1bf8d.js +22 -0
  35. package/tests/fixtures/dynamic-import/build/a-f1483003.js +22 -0
  36. package/tests/fixtures/dynamic-import/build/entry.js +87 -0
  37. package/tests/fixtures/dynamic-import/build/runner.html +15 -15
  38. package/tests/fixtures/dynamic-import/entry.js +14 -14
  39. package/tests/fixtures/import-meta/a.js +16 -16
  40. package/tests/fixtures/import-meta/build/a-115d949a.js +22 -0
  41. package/tests/fixtures/import-meta/build/a-550898d2.js +22 -0
  42. package/tests/fixtures/import-meta/build/a-BFYklafB.js +22 -0
  43. package/tests/fixtures/import-meta/build/entry.js +87 -0
  44. package/tests/fixtures/import-meta/build/runner.html +15 -15
  45. package/tests/fixtures/import-meta/entry.js +14 -14
  46. package/tests/fixtures/import-meta-worker/a.js +12 -12
  47. package/tests/fixtures/import-meta-worker/build/a-23c670a1.js +83 -0
  48. package/tests/fixtures/import-meta-worker/build/a-9c89b629.js +85 -0
  49. package/tests/fixtures/import-meta-worker/build/a-CrtsJ3Po.js +83 -0
  50. package/tests/fixtures/import-meta-worker/build/a-e0498c05.js +83 -0
  51. package/tests/fixtures/import-meta-worker/build/entry.js +94 -0
  52. package/tests/fixtures/import-meta-worker/build/runner.html +15 -15
  53. package/tests/fixtures/import-meta-worker/entry.js +22 -22
  54. package/tests/fixtures/import-worker-url/a.js +16 -16
  55. package/tests/fixtures/import-worker-url/b.js +16 -16
  56. package/tests/fixtures/import-worker-url/build/b-64a9d830.js +22 -0
  57. package/tests/fixtures/import-worker-url/build/b-725e92c1.js +5 -0
  58. package/tests/fixtures/import-worker-url/build/entry.js +95 -0
  59. package/tests/fixtures/import-worker-url/build/runner.html +15 -15
  60. package/tests/fixtures/import-worker-url/build/worker-Bq6uP7t8.js +123 -0
  61. package/tests/fixtures/import-worker-url/build/worker-ef1d7c89.js +106 -0
  62. package/tests/fixtures/import-worker-url/build/worker-f5690442.js +105 -0
  63. package/tests/fixtures/import-worker-url/entry.js +21 -21
  64. package/tests/fixtures/import-worker-url/worker.js +17 -17
  65. package/tests/fixtures/import-worker-url-custom-scheme/a.js +16 -16
  66. package/tests/fixtures/import-worker-url-custom-scheme/b.js +16 -16
  67. package/tests/fixtures/import-worker-url-custom-scheme/build/b-725e92c1.js +5 -0
  68. package/tests/fixtures/import-worker-url-custom-scheme/build/b-74a80c25.js +22 -0
  69. package/tests/fixtures/import-worker-url-custom-scheme/build/entry.js +95 -0
  70. package/tests/fixtures/import-worker-url-custom-scheme/build/runner.html +15 -15
  71. package/tests/fixtures/import-worker-url-custom-scheme/build/worker-Bq6uP7t8.js +123 -0
  72. package/tests/fixtures/import-worker-url-custom-scheme/build/worker-e37d535c.js +105 -0
  73. package/tests/fixtures/import-worker-url-custom-scheme/build/worker-ef1d7c89.js +106 -0
  74. package/tests/fixtures/import-worker-url-custom-scheme/config.json +3 -3
  75. package/tests/fixtures/import-worker-url-custom-scheme/entry.js +21 -21
  76. package/tests/fixtures/import-worker-url-custom-scheme/worker.js +17 -17
  77. package/tests/fixtures/module-worker/a.js +20 -20
  78. package/tests/fixtures/module-worker/b.js +20 -20
  79. package/tests/fixtures/module-worker/build/b-8d8ba280.js +20 -0
  80. package/tests/fixtures/module-worker/build/b-ZxqdL95j.js +21 -0
  81. package/tests/fixtures/module-worker/build/b-f6cfc895.js +21 -0
  82. package/tests/fixtures/module-worker/build/entry.js +17 -0
  83. package/tests/fixtures/module-worker/build/runner.html +15 -15
  84. package/tests/fixtures/module-worker/build/worker-41a1c649.js +1 -0
  85. package/tests/fixtures/module-worker/build/worker-50885fe8.js +38 -0
  86. package/tests/fixtures/module-worker/build/worker-9fb0618d.js +39 -0
  87. package/tests/fixtures/module-worker/build/worker-DWbjHYfx.js +39 -0
  88. package/tests/fixtures/module-worker/entry.js +17 -17
  89. package/tests/fixtures/module-worker/rollup.config.js +4 -4
  90. package/tests/fixtures/module-worker/worker.js +17 -17
  91. package/tests/fixtures/more-workers/a.js +16 -16
  92. package/tests/fixtures/more-workers/b.js +16 -16
  93. package/tests/fixtures/more-workers/build/b-Dok_VKGN.js +22 -0
  94. package/tests/fixtures/more-workers/build/b-e9bb9f94.js +22 -0
  95. package/tests/fixtures/more-workers/build/b-f31d0f9f.js +22 -0
  96. package/tests/fixtures/more-workers/build/entry.js +107 -0
  97. package/tests/fixtures/more-workers/build/runner.html +15 -15
  98. package/tests/fixtures/more-workers/build/worker_a-25924b0d.js +105 -0
  99. package/tests/fixtures/more-workers/build/worker_a-DtsyxKtN.js +105 -0
  100. package/tests/fixtures/more-workers/build/worker_a-b8e0ca8d.js +104 -0
  101. package/tests/fixtures/more-workers/build/worker_b-477edb2c.js +91 -0
  102. package/tests/fixtures/more-workers/build/worker_b-60981e1f.js +91 -0
  103. package/tests/fixtures/more-workers/build/worker_b-CG60Lcld.js +91 -0
  104. package/tests/fixtures/more-workers/entry.js +34 -34
  105. package/tests/fixtures/more-workers/worker_a.js +16 -16
  106. package/tests/fixtures/more-workers/worker_b.js +18 -18
  107. package/tests/fixtures/public-path/a.js +16 -16
  108. package/tests/fixtures/public-path/build/a-1fb502b9.js +22 -0
  109. package/tests/fixtures/public-path/build/a-Dqjf2iqw.js +22 -0
  110. package/tests/fixtures/public-path/build/a-b9a1bf8d.js +22 -0
  111. package/tests/fixtures/public-path/build/entry.js +87 -0
  112. package/tests/fixtures/public-path/build/runner.html +15 -15
  113. package/tests/fixtures/public-path/config.json +3 -3
  114. package/tests/fixtures/public-path/entry.js +14 -14
  115. package/tests/fixtures/simple-bundle/a.js +16 -16
  116. package/tests/fixtures/simple-bundle/build/entry.js +105 -0
  117. package/tests/fixtures/simple-bundle/build/runner.html +15 -15
  118. package/tests/fixtures/simple-bundle/entry.js +16 -16
  119. package/tests/fixtures/single-default/a.js +14 -14
  120. package/tests/fixtures/single-default/build/entry.js +103 -0
  121. package/tests/fixtures/single-default/build/runner.html +15 -15
  122. package/tests/fixtures/single-default/entry.js +16 -16
  123. package/tests/fixtures/url-import-meta-worker/a.js +17 -17
  124. package/tests/fixtures/url-import-meta-worker/b.js +16 -16
  125. package/tests/fixtures/url-import-meta-worker/build/b-258f8a6b.js +22 -0
  126. package/tests/fixtures/url-import-meta-worker/build/b-8c5ed926.js +22 -0
  127. package/tests/fixtures/url-import-meta-worker/build/b-CNJP1XvI.js +22 -0
  128. package/tests/fixtures/url-import-meta-worker/build/entry.js +91 -0
  129. package/tests/fixtures/url-import-meta-worker/build/runner.html +15 -15
  130. package/tests/fixtures/url-import-meta-worker/build/worker-9a661671.js +105 -0
  131. package/tests/fixtures/url-import-meta-worker/build/worker-S2Vh56Q-.js +106 -0
  132. package/tests/fixtures/url-import-meta-worker/build/worker-e833ae5d.js +106 -0
  133. package/tests/fixtures/url-import-meta-worker/entry.js +20 -20
  134. package/tests/fixtures/url-import-meta-worker/worker.js +16 -16
  135. package/tests/fixtures/worker/a.js +17 -17
  136. package/tests/fixtures/worker/b.js +16 -16
  137. package/tests/fixtures/worker/build/b-258f8a6b.js +22 -0
  138. package/tests/fixtures/worker/build/b-CNJP1XvI.js +22 -0
  139. package/tests/fixtures/worker/build/b-a9f43d76.js +22 -0
  140. package/tests/fixtures/worker/build/entry.js +91 -0
  141. package/tests/fixtures/worker/build/runner.html +15 -15
  142. package/tests/fixtures/worker/build/worker-S2Vh56Q-.js +106 -0
  143. package/tests/fixtures/worker/build/worker-b4897a54.js +105 -0
  144. package/tests/fixtures/worker/build/worker-e833ae5d.js +106 -0
  145. package/tests/fixtures/worker/entry.js +18 -18
  146. package/tests/fixtures/worker/worker.js +16 -16
  147. package/tests/import-meta-worker.test.js +37 -37
  148. package/tests/import-meta.test.js +33 -33
  149. package/tests/import-worker-url-custom-scheme.test.js +42 -42
  150. package/tests/import-worker-url.test.js +41 -41
  151. package/tests/module-worker.test.js +47 -47
  152. package/tests/more-workers.test.js +33 -33
  153. package/tests/public-path.test.js +33 -33
  154. package/tests/simple-bundle.test.js +33 -33
  155. package/tests/single-default.test.js +33 -33
  156. package/tests/url-import-meta-worker.test.js +34 -34
  157. package/tests/worker.test.js +33 -33
@@ -1,33 +1,33 @@
1
- /**
2
- * Copyright 2018 Google Inc. All Rights Reserved.
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- * http://www.apache.org/licenses/LICENSE-2.0
7
- * Unless required by applicable law or agreed to in writing, software
8
- * distributed under the License is distributed on an "AS IS" BASIS,
9
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- * See the License for the specific language governing permissions and
11
- * limitations under the License.
12
- */
13
-
14
- describe("Assets in workers", function() {
15
- beforeEach(function() {
16
- this.ifr = document.createElement("iframe");
17
- document.body.append(this.ifr);
18
- });
19
-
20
- afterEach(function() {
21
- this.ifr.remove();
22
- });
23
-
24
- it("can be fetched", function(done) {
25
- window.addEventListener("message", function l(ev) {
26
- if (ev.data === "assetcontent") {
27
- window.removeEventListener("message", l);
28
- done();
29
- }
30
- });
31
- this.ifr.src = "/base/tests/fixtures/assets-in-worker/build/runner.html";
32
- });
33
- });
1
+ /**
2
+ * Copyright 2018 Google Inc. All Rights Reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS,
9
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ * See the License for the specific language governing permissions and
11
+ * limitations under the License.
12
+ */
13
+
14
+ describe("Assets in workers", function() {
15
+ beforeEach(function() {
16
+ this.ifr = document.createElement("iframe");
17
+ document.body.append(this.ifr);
18
+ });
19
+
20
+ afterEach(function() {
21
+ this.ifr.remove();
22
+ });
23
+
24
+ it("can be fetched", function(done) {
25
+ window.addEventListener("message", function l(ev) {
26
+ if (ev.data === "assetcontent") {
27
+ window.removeEventListener("message", l);
28
+ done();
29
+ }
30
+ });
31
+ this.ifr.src = "/base/tests/fixtures/assets-in-worker/build/runner.html";
32
+ });
33
+ });
@@ -1,33 +1,33 @@
1
- /**
2
- * Copyright 2018 Google Inc. All Rights Reserved.
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- * http://www.apache.org/licenses/LICENSE-2.0
7
- * Unless required by applicable law or agreed to in writing, software
8
- * distributed under the License is distributed on an "AS IS" BASIS,
9
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- * See the License for the specific language governing permissions and
11
- * limitations under the License.
12
- */
13
-
14
- describe("Dynamic import", function() {
15
- beforeEach(function() {
16
- this.ifr = document.createElement("iframe");
17
- document.body.append(this.ifr);
18
- });
19
-
20
- afterEach(function() {
21
- this.ifr.remove();
22
- });
23
-
24
- it("loads transpiled modules", function(done) {
25
- window.addEventListener("message", function l(ev) {
26
- if (ev.data === "a") {
27
- window.removeEventListener("message", l);
28
- done();
29
- }
30
- });
31
- this.ifr.src = "/base/tests/fixtures/dynamic-import/build/runner.html";
32
- });
33
- });
1
+ /**
2
+ * Copyright 2018 Google Inc. All Rights Reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS,
9
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ * See the License for the specific language governing permissions and
11
+ * limitations under the License.
12
+ */
13
+
14
+ describe("Dynamic import", function() {
15
+ beforeEach(function() {
16
+ this.ifr = document.createElement("iframe");
17
+ document.body.append(this.ifr);
18
+ });
19
+
20
+ afterEach(function() {
21
+ this.ifr.remove();
22
+ });
23
+
24
+ it("loads transpiled modules", function(done) {
25
+ window.addEventListener("message", function l(ev) {
26
+ if (ev.data === "a") {
27
+ window.removeEventListener("message", l);
28
+ done();
29
+ }
30
+ });
31
+ this.ifr.src = "/base/tests/fixtures/dynamic-import/build/runner.html";
32
+ });
33
+ });
@@ -1,16 +1,16 @@
1
- /**
2
- * Copyright 2018 Google Inc. All Rights Reserved.
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- * http://www.apache.org/licenses/LICENSE-2.0
7
- * Unless required by applicable law or agreed to in writing, software
8
- * distributed under the License is distributed on an "AS IS" BASIS,
9
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- * See the License for the specific language governing permissions and
11
- * limitations under the License.
12
- */
13
-
14
- export default function() {
15
- return 4;
16
- }
1
+ /**
2
+ * Copyright 2018 Google Inc. All Rights Reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS,
9
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ * See the License for the specific language governing permissions and
11
+ * limitations under the License.
12
+ */
13
+
14
+ export default function() {
15
+ return 4;
16
+ }
@@ -0,0 +1,22 @@
1
+ foo(['exports'], (function (exports) { 'use strict';
2
+
3
+ /**
4
+ * Copyright 2018 Google Inc. All Rights Reserved.
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+
16
+ function a() {
17
+ return 4;
18
+ }
19
+
20
+ exports.default = a;
21
+
22
+ }));
@@ -0,0 +1,22 @@
1
+ foo(['exports'], (function (exports) { 'use strict';
2
+
3
+ /**
4
+ * Copyright 2018 Google Inc. All Rights Reserved.
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+
16
+ function a() {
17
+ return 4;
18
+ }
19
+
20
+ exports.default = a;
21
+
22
+ }));
@@ -0,0 +1,22 @@
1
+ foo(['exports'], (function (exports) { 'use strict';
2
+
3
+ /**
4
+ * Copyright 2018 Google Inc. All Rights Reserved.
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+
16
+ function a() {
17
+ return 4;
18
+ }
19
+
20
+ exports["default"] = a;
21
+
22
+ }));
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Copyright 2018 Google Inc. All Rights Reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS,
9
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ * See the License for the specific language governing permissions and
11
+ * limitations under the License.
12
+ */
13
+
14
+ // If the loader is already loaded, just stop.
15
+ if (!self.foo) {
16
+ let registry = {};
17
+
18
+ // Used for `eval` and `importScripts` where we can't get script URL by other means.
19
+ // In both cases, it's safe to use a global var because those functions are synchronous.
20
+ let nextDefineUri;
21
+
22
+ const singleRequire = (uri, parentUri) => {
23
+ uri = new URL(uri + ".js", parentUri).href;
24
+ return registry[uri] || (
25
+
26
+ new Promise(resolve => {
27
+ if ("document" in self) {
28
+ const script = document.createElement("script");
29
+ script.src = uri;
30
+ script.onload = resolve;
31
+ document.head.appendChild(script);
32
+ } else {
33
+ nextDefineUri = uri;
34
+ importScripts(uri);
35
+ resolve();
36
+ }
37
+ })
38
+
39
+ .then(() => {
40
+ let promise = registry[uri];
41
+ if (!promise) {
42
+ throw new Error(`Module ${uri} didn’t register its module`);
43
+ }
44
+ return promise;
45
+ })
46
+ );
47
+ };
48
+
49
+ self.foo = (depsNames, factory) => {
50
+ const uri = nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href;
51
+ if (registry[uri]) {
52
+ // Module is already loading or loaded.
53
+ return;
54
+ }
55
+ let exports = {};
56
+ const require = depUri => singleRequire(depUri, uri);
57
+ const specialDeps = {
58
+ module: { uri },
59
+ exports,
60
+ require
61
+ };
62
+ registry[uri] = Promise.all(depsNames.map(
63
+ depName => specialDeps[depName] || require(depName)
64
+ )).then(deps => {
65
+ factory(...deps);
66
+ return exports;
67
+ });
68
+ };
69
+ }
70
+ foo(['require'], (function (require) { 'use strict';
71
+
72
+ /**
73
+ * Copyright 2018 Google Inc. All Rights Reserved.
74
+ * Licensed under the Apache License, Version 2.0 (the "License");
75
+ * you may not use this file except in compliance with the License.
76
+ * You may obtain a copy of the License at
77
+ * http://www.apache.org/licenses/LICENSE-2.0
78
+ * Unless required by applicable law or agreed to in writing, software
79
+ * distributed under the License is distributed on an "AS IS" BASIS,
80
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
81
+ * See the License for the specific language governing permissions and
82
+ * limitations under the License.
83
+ */
84
+
85
+ require('./a-REsyh-LW').then(m => {
86
+ if (m.default() != 4) {
87
+ return;
88
+ }
89
+ if (!self.foo) {
90
+ return;
91
+ }
92
+ window.parent.postMessage("a", "*");
93
+ });
94
+
95
+ }));
@@ -1,15 +1,15 @@
1
- <!--
2
- Copyright 2018 Google Inc. All Rights Reserved.
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
- http://www.apache.org/licenses/LICENSE-2.0
7
- Unless required by applicable law or agreed to in writing, software
8
- distributed under the License is distributed on an "AS IS" BASIS,
9
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- See the License for the specific language governing permissions and
11
- limitations under the License.
12
- -->
13
-
14
- <!doctype html>
15
- <script src="entry.js"></script>
1
+ <!--
2
+ Copyright 2018 Google Inc. All Rights Reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ -->
13
+
14
+ <!doctype html>
15
+ <script src="entry.js"></script>
@@ -1,3 +1,3 @@
1
- {
2
- "amdFunctionName": "foo"
3
- }
1
+ {
2
+ "amdFunctionName": "foo"
3
+ }
@@ -1,22 +1,22 @@
1
- /**
2
- * Copyright 2018 Google Inc. All Rights Reserved.
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- * http://www.apache.org/licenses/LICENSE-2.0
7
- * Unless required by applicable law or agreed to in writing, software
8
- * distributed under the License is distributed on an "AS IS" BASIS,
9
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- * See the License for the specific language governing permissions and
11
- * limitations under the License.
12
- */
13
-
14
- import("./a.js").then(m => {
15
- if (m.default() != 4) {
16
- return;
17
- }
18
- if (!self.foo) {
19
- return;
20
- }
21
- window.parent.postMessage("a", "*");
22
- });
1
+ /**
2
+ * Copyright 2018 Google Inc. All Rights Reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS,
9
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ * See the License for the specific language governing permissions and
11
+ * limitations under the License.
12
+ */
13
+
14
+ import("./a.js").then(m => {
15
+ if (m.default() != 4) {
16
+ return;
17
+ }
18
+ if (!self.foo) {
19
+ return;
20
+ }
21
+ window.parent.postMessage("a", "*");
22
+ });
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Copyright 2018 Google Inc. All Rights Reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS,
9
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ * See the License for the specific language governing permissions and
11
+ * limitations under the License.
12
+ */
13
+
14
+ // If the loader is already loaded, just stop.
15
+ if (!self.define) {
16
+ let registry = {};
17
+
18
+ // Used for `eval` and `importScripts` where we can't get script URL by other means.
19
+ // In both cases, it's safe to use a global var because those functions are synchronous.
20
+ let nextDefineUri;
21
+
22
+ const singleRequire = (uri, parentUri) => {
23
+ uri = new URL(uri + ".js", parentUri).href;
24
+ return registry[uri] || (
25
+
26
+ new Promise(resolve => {
27
+ if ("document" in self) {
28
+ const script = document.createElement("script");
29
+ script.src = uri;
30
+ script.onload = resolve;
31
+ document.head.appendChild(script);
32
+ } else {
33
+ nextDefineUri = uri;
34
+ importScripts(uri);
35
+ resolve();
36
+ }
37
+ })
38
+
39
+ .then(() => {
40
+ let promise = registry[uri];
41
+ if (!promise) {
42
+ throw new Error(`Module ${uri} didn’t register its module`);
43
+ }
44
+ return promise;
45
+ })
46
+ );
47
+ };
48
+
49
+ self.define = (depsNames, factory) => {
50
+ const uri = nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href;
51
+ if (registry[uri]) {
52
+ // Module is already loading or loaded.
53
+ return;
54
+ }
55
+ let exports = {};
56
+ const require = depUri => singleRequire(depUri, uri);
57
+ const specialDeps = {
58
+ module: { uri },
59
+ exports,
60
+ require
61
+ };
62
+ registry[uri] = Promise.all(depsNames.map(
63
+ depName => specialDeps[depName] || require(depName)
64
+ )).then(deps => {
65
+ factory(...deps);
66
+ return exports;
67
+ });
68
+ };
69
+ }
70
+ define(['module', 'require'], (function (module, require) { 'use strict';
71
+
72
+ /**
73
+ * Copyright 2018 Google Inc. All Rights Reserved.
74
+ * Licensed under the Apache License, Version 2.0 (the "License");
75
+ * you may not use this file except in compliance with the License.
76
+ * You may obtain a copy of the License at
77
+ * http://www.apache.org/licenses/LICENSE-2.0
78
+ * Unless required by applicable law or agreed to in writing, software
79
+ * distributed under the License is distributed on an "AS IS" BASIS,
80
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
81
+ * See the License for the specific language governing permissions and
82
+ * limitations under the License.
83
+ */
84
+
85
+ const w = new Worker(new URL("worker-CtBAebZB.js", module.uri));
86
+ w.addEventListener("message", ev => {
87
+ window.parent.postMessage(ev.data, "*");
88
+ });
89
+
90
+ }));
@@ -1,15 +1,15 @@
1
- <!--
2
- Copyright 2018 Google Inc. All Rights Reserved.
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
- http://www.apache.org/licenses/LICENSE-2.0
7
- Unless required by applicable law or agreed to in writing, software
8
- distributed under the License is distributed on an "AS IS" BASIS,
9
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- See the License for the specific language governing permissions and
11
- limitations under the License.
12
- -->
13
-
14
- <!doctype html>
15
- <script src="entry.js"></script>
1
+ <!--
2
+ Copyright 2018 Google Inc. All Rights Reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ -->
13
+
14
+ <!doctype html>
15
+ <script src="entry.js"></script>
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Copyright 2018 Google Inc. All Rights Reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS,
9
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ * See the License for the specific language governing permissions and
11
+ * limitations under the License.
12
+ */
13
+
14
+ // If the loader is already loaded, just stop.
15
+ if (!self.define) {
16
+ let registry = {};
17
+
18
+ // Used for `eval` and `importScripts` where we can't get script URL by other means.
19
+ // In both cases, it's safe to use a global var because those functions are synchronous.
20
+ let nextDefineUri;
21
+
22
+ const singleRequire = (uri, parentUri) => {
23
+ uri = new URL(uri + ".js", parentUri).href;
24
+ return registry[uri] || (
25
+
26
+ new Promise(resolve => {
27
+ if ("document" in self) {
28
+ const script = document.createElement("script");
29
+ script.src = uri;
30
+ script.onload = resolve;
31
+ document.head.appendChild(script);
32
+ } else {
33
+ nextDefineUri = uri;
34
+ importScripts(uri);
35
+ resolve();
36
+ }
37
+ })
38
+
39
+ .then(() => {
40
+ let promise = registry[uri];
41
+ if (!promise) {
42
+ throw new Error(`Module ${uri} didn’t register its module`);
43
+ }
44
+ return promise;
45
+ })
46
+ );
47
+ };
48
+
49
+ self.define = (depsNames, factory) => {
50
+ const uri = nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href;
51
+ if (registry[uri]) {
52
+ // Module is already loading or loaded.
53
+ return;
54
+ }
55
+ let exports = {};
56
+ const require = depUri => singleRequire(depUri, uri);
57
+ const specialDeps = {
58
+ module: { uri },
59
+ exports,
60
+ require
61
+ };
62
+ registry[uri] = Promise.all(depsNames.map(
63
+ depName => specialDeps[depName] || require(depName)
64
+ )).then(deps => {
65
+ factory(...deps);
66
+ return exports;
67
+ });
68
+ };
69
+ }
70
+ define(['require'], (function (require) { 'use strict';
71
+
72
+ var url = "assets/my-asset-620b911b.bin";
73
+
74
+ /**
75
+ * Copyright 2018 Google Inc. All Rights Reserved.
76
+ * Licensed under the Apache License, Version 2.0 (the "License");
77
+ * you may not use this file except in compliance with the License.
78
+ * You may obtain a copy of the License at
79
+ * http://www.apache.org/licenses/LICENSE-2.0
80
+ * Unless required by applicable law or agreed to in writing, software
81
+ * distributed under the License is distributed on an "AS IS" BASIS,
82
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
83
+ * See the License for the specific language governing permissions and
84
+ * limitations under the License.
85
+ */
86
+
87
+ fetch(url)
88
+ .then(resp => resp.text())
89
+ .then(text => postMessage(text));
90
+
91
+ }));