@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.
- package/.github/workflows/ci.yml +32 -0
- package/.travis.yml +8 -0
- package/CODEOWNERS +1 -0
- package/CONTRIBUTING +27 -0
- package/CONTRIBUTORS +11 -0
- package/Dockerfile +20 -0
- package/LICENSE +202 -0
- package/README.md +97 -0
- package/index.js +318 -0
- package/karma.conf.js +46 -0
- package/loader.ejs +76 -0
- package/package.json +39 -0
- package/renovate.json +3 -0
- package/run_tests.js +105 -0
- package/tests/amd-function-name.test.js +33 -0
- package/tests/asset-in-worker.test.js +33 -0
- package/tests/dynamic-import.test.js +33 -0
- package/tests/fixtures/amd-function-name/a.js +16 -0
- package/tests/fixtures/amd-function-name/build/runner.html +15 -0
- package/tests/fixtures/amd-function-name/config.json +3 -0
- package/tests/fixtures/amd-function-name/entry.js +22 -0
- package/tests/fixtures/assets-in-worker/build/assets/my-asset-620b911b.bin +1 -0
- package/tests/fixtures/assets-in-worker/build/runner.html +15 -0
- package/tests/fixtures/assets-in-worker/entry.js +17 -0
- package/tests/fixtures/assets-in-worker/rollup.config.js +25 -0
- package/tests/fixtures/assets-in-worker/worker.js +18 -0
- package/tests/fixtures/dynamic-import/a.js +16 -0
- package/tests/fixtures/dynamic-import/build/runner.html +15 -0
- package/tests/fixtures/dynamic-import/entry.js +14 -0
- package/tests/fixtures/empty.js +0 -0
- package/tests/fixtures/import-meta/a.js +16 -0
- package/tests/fixtures/import-meta/build/runner.html +15 -0
- package/tests/fixtures/import-meta/entry.js +14 -0
- package/tests/fixtures/import-meta-worker/a.js +12 -0
- package/tests/fixtures/import-meta-worker/build/runner.html +15 -0
- package/tests/fixtures/import-meta-worker/entry.js +22 -0
- package/tests/fixtures/import-worker-url/a.js +16 -0
- package/tests/fixtures/import-worker-url/b.js +16 -0
- package/tests/fixtures/import-worker-url/build/runner.html +15 -0
- package/tests/fixtures/import-worker-url/entry.js +21 -0
- package/tests/fixtures/import-worker-url/worker.js +17 -0
- package/tests/fixtures/import-worker-url-custom-scheme/a.js +16 -0
- package/tests/fixtures/import-worker-url-custom-scheme/b.js +16 -0
- package/tests/fixtures/import-worker-url-custom-scheme/build/runner.html +15 -0
- package/tests/fixtures/import-worker-url-custom-scheme/config.json +3 -0
- package/tests/fixtures/import-worker-url-custom-scheme/entry.js +21 -0
- package/tests/fixtures/import-worker-url-custom-scheme/worker.js +17 -0
- package/tests/fixtures/module-worker/a.js +20 -0
- package/tests/fixtures/module-worker/b.js +20 -0
- package/tests/fixtures/module-worker/build/runner.html +15 -0
- package/tests/fixtures/module-worker/entry.js +17 -0
- package/tests/fixtures/module-worker/rollup.config.js +4 -0
- package/tests/fixtures/module-worker/worker.js +17 -0
- package/tests/fixtures/more-workers/a.js +16 -0
- package/tests/fixtures/more-workers/b.js +16 -0
- package/tests/fixtures/more-workers/build/runner.html +15 -0
- package/tests/fixtures/more-workers/entry.js +34 -0
- package/tests/fixtures/more-workers/worker_a.js +16 -0
- package/tests/fixtures/more-workers/worker_b.js +18 -0
- package/tests/fixtures/public-path/a.js +16 -0
- package/tests/fixtures/public-path/build/runner.html +15 -0
- package/tests/fixtures/public-path/config.json +3 -0
- package/tests/fixtures/public-path/entry.js +14 -0
- package/tests/fixtures/simple-bundle/a.js +16 -0
- package/tests/fixtures/simple-bundle/build/runner.html +15 -0
- package/tests/fixtures/simple-bundle/entry.js +16 -0
- package/tests/fixtures/single-default/a.js +14 -0
- package/tests/fixtures/single-default/build/runner.html +15 -0
- package/tests/fixtures/single-default/entry.js +16 -0
- package/tests/fixtures/url-import-meta-worker/a.js +17 -0
- package/tests/fixtures/url-import-meta-worker/b.js +16 -0
- package/tests/fixtures/url-import-meta-worker/build/runner.html +15 -0
- package/tests/fixtures/url-import-meta-worker/entry.js +20 -0
- package/tests/fixtures/url-import-meta-worker/worker.js +16 -0
- package/tests/fixtures/worker/a.js +17 -0
- package/tests/fixtures/worker/b.js +16 -0
- package/tests/fixtures/worker/build/runner.html +15 -0
- package/tests/fixtures/worker/entry.js +18 -0
- package/tests/fixtures/worker/worker.js +16 -0
- package/tests/import-meta-worker.test.js +37 -0
- package/tests/import-meta.test.js +33 -0
- package/tests/import-worker-url-custom-scheme.test.js +42 -0
- package/tests/import-worker-url.test.js +41 -0
- package/tests/module-worker.test.js +47 -0
- package/tests/more-workers.test.js +33 -0
- package/tests/public-path.test.js +33 -0
- package/tests/simple-bundle.test.js +33 -0
- package/tests/single-default.test.js +33 -0
- package/tests/url-import-meta-worker.test.js +34 -0
- package/tests/worker.test.js +33 -0
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
async function run() {
|
|
15
|
+
await new Promise(resolve => {
|
|
16
|
+
const w = new Worker("./worker_a.js");
|
|
17
|
+
w.addEventListener("message", ev => {
|
|
18
|
+
if (ev.data === "a") {
|
|
19
|
+
resolve();
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
await new Promise(resolve => {
|
|
24
|
+
const w = new Worker("./worker_b.js");
|
|
25
|
+
w.addEventListener("message", ev => {
|
|
26
|
+
if (ev.data === "b") {
|
|
27
|
+
resolve();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
window.parent.postMessage("a", "*");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
run();
|
|
@@ -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
|
+
import a from "./a.js";
|
|
15
|
+
|
|
16
|
+
a();
|
|
@@ -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
|
+
async function run() {
|
|
15
|
+
const { default: b } = await import("./b.js");
|
|
16
|
+
b();
|
|
17
|
+
}
|
|
18
|
+
run();
|
|
@@ -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());
|
|
@@ -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,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
|
+
import A from "./a.js";
|
|
15
|
+
|
|
16
|
+
A();
|
|
@@ -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
|
+
export default 4;
|
|
@@ -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,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
|
+
import A from "./a.js";
|
|
15
|
+
|
|
16
|
+
window.parent.postMessage(A, "*");
|
|
@@ -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
|
+
export default async function() {
|
|
15
|
+
const { default: f } = await import("./b.js");
|
|
16
|
+
self.postMessage(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
|
+
return "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,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
|
+
// The type module should get removed for AMD format!
|
|
15
|
+
const w = new Worker(new URL("worker.js", import.meta.url), {
|
|
16
|
+
type: "module"
|
|
17
|
+
});
|
|
18
|
+
w.addEventListener("message", ev => {
|
|
19
|
+
window.parent.postMessage(ev.data, "*");
|
|
20
|
+
});
|
|
@@ -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
|
+
import a from "./a.js";
|
|
15
|
+
|
|
16
|
+
a();
|
|
@@ -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
|
+
export default async function() {
|
|
15
|
+
const { default: f } = await import("./b.js");
|
|
16
|
+
self.postMessage(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
|
+
return "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,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
|
+
// The type module should get removed for AMD format!
|
|
15
|
+
const w = new Worker("./worker.js", { type: "module" });
|
|
16
|
+
w.addEventListener("message", ev => {
|
|
17
|
+
window.parent.postMessage(ev.data, "*");
|
|
18
|
+
});
|
|
@@ -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
|
+
import a from "./a.js";
|
|
15
|
+
|
|
16
|
+
a();
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
describe("omt: use import.meta.url in Worker constructor", function() {
|
|
15
|
+
const runner = "/base/tests/fixtures/import-meta-worker/build/runner.html";
|
|
16
|
+
|
|
17
|
+
beforeEach(function() {
|
|
18
|
+
this.ifr = document.createElement("iframe");
|
|
19
|
+
document.body.append(this.ifr);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
afterEach(function() {
|
|
23
|
+
this.ifr.remove();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("loads itself as a module", function(done) {
|
|
27
|
+
window.addEventListener("message", function l(ev) {
|
|
28
|
+
if (ev.data === "a") {
|
|
29
|
+
window.removeEventListener("message", l);
|
|
30
|
+
done();
|
|
31
|
+
} else {
|
|
32
|
+
done(`Unexpected message! ${ev.data}`);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
this.ifr.src = runner;
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +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("import.meta", 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 (/^https?:\/\/.+\.js$/.test(ev.data)) {
|
|
27
|
+
window.removeEventListener("message", l);
|
|
28
|
+
done();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
this.ifr.src = "/base/tests/fixtures/import-meta/build/runner.html";
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
describe("omt: URL import with custom scheme", function() {
|
|
15
|
+
const runner =
|
|
16
|
+
"/base/tests/fixtures/import-worker-url-custom-scheme/build/runner.html";
|
|
17
|
+
|
|
18
|
+
beforeEach(function() {
|
|
19
|
+
this.ifr = document.createElement("iframe");
|
|
20
|
+
document.body.append(this.ifr);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
afterEach(function() {
|
|
24
|
+
this.ifr.remove();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("imports as string", async function() {
|
|
28
|
+
this.ifr.src = runner;
|
|
29
|
+
await new Promise(resolve => this.ifr.addEventListener("load", resolve));
|
|
30
|
+
assert.typeOf(this.ifr.contentWindow.workerURL, "string");
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("loads transpiled modules", function(done) {
|
|
34
|
+
window.addEventListener("message", function l(ev) {
|
|
35
|
+
if (ev.data === "a") {
|
|
36
|
+
window.removeEventListener("message", l);
|
|
37
|
+
done();
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
this.ifr.src = runner;
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
describe("omt: URL import", function() {
|
|
15
|
+
const runner = "/base/tests/fixtures/import-worker-url/build/runner.html";
|
|
16
|
+
|
|
17
|
+
beforeEach(function() {
|
|
18
|
+
this.ifr = document.createElement("iframe");
|
|
19
|
+
document.body.append(this.ifr);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
afterEach(function() {
|
|
23
|
+
this.ifr.remove();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("imports as string", async function() {
|
|
27
|
+
this.ifr.src = runner;
|
|
28
|
+
await new Promise(resolve => this.ifr.addEventListener("load", resolve));
|
|
29
|
+
assert.typeOf(this.ifr.contentWindow.workerURL, "string");
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("loads transpiled modules", function(done) {
|
|
33
|
+
window.addEventListener("message", function l(ev) {
|
|
34
|
+
if (ev.data === "a") {
|
|
35
|
+
window.removeEventListener("message", l);
|
|
36
|
+
done();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
this.ifr.src = runner;
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
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("Module Worker", function() {
|
|
15
|
+
const blob = new Blob([""], { type: "text/javascript" });
|
|
16
|
+
const url = URL.createObjectURL(blob);
|
|
17
|
+
let supportsModuleWorker = false;
|
|
18
|
+
const options = {
|
|
19
|
+
get type() {
|
|
20
|
+
supportsModuleWorker = true;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
new Worker(url, options).terminate();
|
|
24
|
+
URL.revokeObjectURL(url);
|
|
25
|
+
|
|
26
|
+
beforeEach(function() {
|
|
27
|
+
if (!supportsModuleWorker) {
|
|
28
|
+
return this.skip();
|
|
29
|
+
}
|
|
30
|
+
this.ifr = document.createElement("iframe");
|
|
31
|
+
document.body.append(this.ifr);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
afterEach(function() {
|
|
35
|
+
this.ifr.remove();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("work", function(done) {
|
|
39
|
+
window.addEventListener("message", function l(ev) {
|
|
40
|
+
if (ev.data === "a") {
|
|
41
|
+
window.removeEventListener("message", l);
|
|
42
|
+
done();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
this.ifr.src = "/base/tests/fixtures/module-worker/build/runner.html";
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +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("Worker", 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 load multiple workers", 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/more-workers/build/runner.html";
|
|
32
|
+
});
|
|
33
|
+
});
|