@trickfilm400/rollup-plugin-off-main-thread 2.2.3-fix

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 (90) hide show
  1. package/.github/workflows/ci.yml +32 -0
  2. package/.travis.yml +8 -0
  3. package/CODEOWNERS +1 -0
  4. package/CONTRIBUTING +27 -0
  5. package/CONTRIBUTORS +11 -0
  6. package/Dockerfile +20 -0
  7. package/LICENSE +202 -0
  8. package/README.md +97 -0
  9. package/index.js +318 -0
  10. package/karma.conf.js +46 -0
  11. package/loader.ejs +76 -0
  12. package/package.json +39 -0
  13. package/renovate.json +3 -0
  14. package/run_tests.js +105 -0
  15. package/tests/amd-function-name.test.js +33 -0
  16. package/tests/asset-in-worker.test.js +33 -0
  17. package/tests/dynamic-import.test.js +33 -0
  18. package/tests/fixtures/amd-function-name/a.js +16 -0
  19. package/tests/fixtures/amd-function-name/build/runner.html +15 -0
  20. package/tests/fixtures/amd-function-name/config.json +3 -0
  21. package/tests/fixtures/amd-function-name/entry.js +22 -0
  22. package/tests/fixtures/assets-in-worker/build/assets/my-asset-620b911b.bin +1 -0
  23. package/tests/fixtures/assets-in-worker/build/runner.html +15 -0
  24. package/tests/fixtures/assets-in-worker/entry.js +17 -0
  25. package/tests/fixtures/assets-in-worker/rollup.config.js +25 -0
  26. package/tests/fixtures/assets-in-worker/worker.js +18 -0
  27. package/tests/fixtures/dynamic-import/a.js +16 -0
  28. package/tests/fixtures/dynamic-import/build/runner.html +15 -0
  29. package/tests/fixtures/dynamic-import/entry.js +14 -0
  30. package/tests/fixtures/empty.js +0 -0
  31. package/tests/fixtures/import-meta/a.js +16 -0
  32. package/tests/fixtures/import-meta/build/runner.html +15 -0
  33. package/tests/fixtures/import-meta/entry.js +14 -0
  34. package/tests/fixtures/import-meta-worker/a.js +12 -0
  35. package/tests/fixtures/import-meta-worker/build/runner.html +15 -0
  36. package/tests/fixtures/import-meta-worker/entry.js +22 -0
  37. package/tests/fixtures/import-worker-url/a.js +16 -0
  38. package/tests/fixtures/import-worker-url/b.js +16 -0
  39. package/tests/fixtures/import-worker-url/build/runner.html +15 -0
  40. package/tests/fixtures/import-worker-url/entry.js +21 -0
  41. package/tests/fixtures/import-worker-url/worker.js +17 -0
  42. package/tests/fixtures/import-worker-url-custom-scheme/a.js +16 -0
  43. package/tests/fixtures/import-worker-url-custom-scheme/b.js +16 -0
  44. package/tests/fixtures/import-worker-url-custom-scheme/build/runner.html +15 -0
  45. package/tests/fixtures/import-worker-url-custom-scheme/config.json +3 -0
  46. package/tests/fixtures/import-worker-url-custom-scheme/entry.js +21 -0
  47. package/tests/fixtures/import-worker-url-custom-scheme/worker.js +17 -0
  48. package/tests/fixtures/module-worker/a.js +20 -0
  49. package/tests/fixtures/module-worker/b.js +20 -0
  50. package/tests/fixtures/module-worker/build/runner.html +15 -0
  51. package/tests/fixtures/module-worker/entry.js +17 -0
  52. package/tests/fixtures/module-worker/rollup.config.js +4 -0
  53. package/tests/fixtures/module-worker/worker.js +17 -0
  54. package/tests/fixtures/more-workers/a.js +16 -0
  55. package/tests/fixtures/more-workers/b.js +16 -0
  56. package/tests/fixtures/more-workers/build/runner.html +15 -0
  57. package/tests/fixtures/more-workers/entry.js +34 -0
  58. package/tests/fixtures/more-workers/worker_a.js +16 -0
  59. package/tests/fixtures/more-workers/worker_b.js +18 -0
  60. package/tests/fixtures/public-path/a.js +16 -0
  61. package/tests/fixtures/public-path/build/runner.html +15 -0
  62. package/tests/fixtures/public-path/config.json +3 -0
  63. package/tests/fixtures/public-path/entry.js +14 -0
  64. package/tests/fixtures/simple-bundle/a.js +16 -0
  65. package/tests/fixtures/simple-bundle/build/runner.html +15 -0
  66. package/tests/fixtures/simple-bundle/entry.js +16 -0
  67. package/tests/fixtures/single-default/a.js +14 -0
  68. package/tests/fixtures/single-default/build/runner.html +15 -0
  69. package/tests/fixtures/single-default/entry.js +16 -0
  70. package/tests/fixtures/url-import-meta-worker/a.js +17 -0
  71. package/tests/fixtures/url-import-meta-worker/b.js +16 -0
  72. package/tests/fixtures/url-import-meta-worker/build/runner.html +15 -0
  73. package/tests/fixtures/url-import-meta-worker/entry.js +20 -0
  74. package/tests/fixtures/url-import-meta-worker/worker.js +16 -0
  75. package/tests/fixtures/worker/a.js +17 -0
  76. package/tests/fixtures/worker/b.js +16 -0
  77. package/tests/fixtures/worker/build/runner.html +15 -0
  78. package/tests/fixtures/worker/entry.js +18 -0
  79. package/tests/fixtures/worker/worker.js +16 -0
  80. package/tests/import-meta-worker.test.js +37 -0
  81. package/tests/import-meta.test.js +33 -0
  82. package/tests/import-worker-url-custom-scheme.test.js +42 -0
  83. package/tests/import-worker-url.test.js +41 -0
  84. package/tests/module-worker.test.js +47 -0
  85. package/tests/more-workers.test.js +33 -0
  86. package/tests/public-path.test.js +33 -0
  87. package/tests/simple-bundle.test.js +33 -0
  88. package/tests/single-default.test.js +33 -0
  89. package/tests/url-import-meta-worker.test.js +34 -0
  90. package/tests/worker.test.js +33 -0
@@ -0,0 +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
+ }
@@ -0,0 +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>
@@ -0,0 +1,3 @@
1
+ {
2
+ "amdFunctionName": "foo"
3
+ }
@@ -0,0 +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
+ });
@@ -0,0 +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>
@@ -0,0 +1,17 @@
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
+ const w = new Worker("./worker.js");
15
+ w.addEventListener("message", ev => {
16
+ window.parent.postMessage(ev.data, "*");
17
+ });
@@ -0,0 +1,25 @@
1
+ const MARKER = "my-special-import";
2
+ module.exports = (config, outputOptions, omt) => {
3
+ config.plugins = [
4
+ omt(),
5
+ {
6
+ resolveId(id) {
7
+ if (id !== MARKER) {
8
+ return;
9
+ }
10
+ return id;
11
+ },
12
+ load(id) {
13
+ if (id !== MARKER) {
14
+ return;
15
+ }
16
+ const referenceId = this.emitFile({
17
+ type: "asset",
18
+ name: "my-asset.bin",
19
+ source: "assetcontent"
20
+ });
21
+ return `export default import.meta.ROLLUP_FILE_URL_${referenceId}`;
22
+ }
23
+ }
24
+ ];
25
+ };
@@ -0,0 +1,18 @@
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 url from "my-special-import";
15
+
16
+ fetch(url)
17
+ .then(resp => resp.text())
18
+ .then(text => postMessage(text));
@@ -0,0 +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
+ window.parent.postMessage("a", "*");
16
+ }
@@ -0,0 +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>
@@ -0,0 +1,14 @@
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 => m.default());
File without changes
@@ -0,0 +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
+ window.parent.postMessage(import.meta.url, "*");
16
+ }
@@ -0,0 +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>
@@ -0,0 +1,14 @@
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 => m.default());
@@ -0,0 +1,12 @@
1
+ let worker;
2
+
3
+ if (self.document) {
4
+ worker = new Worker(import.meta.url);
5
+ }
6
+ if (self.postMessage) {
7
+ setTimeout(() => {
8
+ postMessage("a");
9
+ }, 500);
10
+ }
11
+
12
+ export { worker };
@@ -0,0 +1,15 @@
1
+ <!--
2
+ Copyright 2020 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,22 @@
1
+ /**
2
+ * Copyright 2020 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
+ import { worker } from "./a.js";
14
+ if (worker) {
15
+ worker.addEventListener("message", ev => {
16
+ window.parent.postMessage(ev.data, "*");
17
+ });
18
+ }
19
+ // This should not get bundled into the worker module
20
+ if (self.postMessage) {
21
+ postMessage("xxx");
22
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2020 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
+ self.postMessage("a");
16
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2020 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 1;
16
+ }
@@ -0,0 +1,15 @@
1
+ <!--
2
+ Copyright 2020 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,21 @@
1
+ /**
2
+ * Copyright 2020 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
+ import workerURL from "omt:./worker.js";
14
+
15
+ // Set this, so it can be picked up in the test.
16
+ self.workerURL = workerURL;
17
+
18
+ const w = new Worker(workerURL);
19
+ w.addEventListener("message", ev => {
20
+ window.parent.postMessage(ev.data, "*");
21
+ });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright 2020 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 from "./a.js";
15
+
16
+ a();
17
+ import("./b.js");
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2020 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
+ self.postMessage("a");
16
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2020 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 1;
16
+ }
@@ -0,0 +1,15 @@
1
+ <!--
2
+ Copyright 2020 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,3 @@
1
+ {
2
+ "urlLoaderScheme": "fancy-custom-scheme"
3
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright 2020 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
+ import workerURL from "fancy-custom-scheme:./worker.js";
14
+
15
+ // Set this, so it can be picked up in the test.
16
+ self.workerURL = workerURL;
17
+
18
+ const w = new Worker(workerURL);
19
+ w.addEventListener("message", ev => {
20
+ window.parent.postMessage(ev.data, "*");
21
+ });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright 2020 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 from "./a.js";
15
+
16
+ a();
17
+ import("./b.js");
@@ -0,0 +1,20 @@
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 async function(f) {
15
+ self.postMessage(f());
16
+ }
17
+
18
+ export function someValue() {
19
+ return self.String("a");
20
+ }
@@ -0,0 +1,20 @@
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 for side-effects (of which there are none)
15
+ // to make sure that a.js gets its own chunk.
16
+ import {someValue} from "./a.js";
17
+
18
+ export default function() {
19
+ return someValue();
20
+ }
@@ -0,0 +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" type="module"></script>
@@ -0,0 +1,17 @@
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
+ const w = new Worker("./worker.js", { type: "module" });
15
+ w.addEventListener("message", ev => {
16
+ window.parent.postMessage(ev.data, "*");
17
+ });
@@ -0,0 +1,4 @@
1
+ module.exports = (config, outputOptions, omt) => {
2
+ outputOptions.format = "esm";
3
+ config.plugins = [omt()];
4
+ };
@@ -0,0 +1,17 @@
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 from "./a.js";
15
+ import("./b.js").then(({default: f}) => {
16
+ a(f);
17
+ })
@@ -0,0 +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
+ self.postMessage("a");
16
+ }
@@ -0,0 +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
+ self.postMessage("b");
16
+ }
@@ -0,0 +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>