@trickfilm400/rollup-plugin-off-main-thread 3.0.0-pre1 → 3.1.0-pre2
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/package.json +2 -2
- package/.travis.yml +0 -8
- package/CONTRIBUTING +0 -27
- package/karma.conf.js +0 -46
- package/run_tests.js +0 -105
- package/tests/amd-function-name.test.js +0 -33
- package/tests/asset-in-worker.test.js +0 -33
- package/tests/dynamic-import.test.js +0 -33
- package/tests/fixtures/amd-function-name/a.js +0 -16
- package/tests/fixtures/amd-function-name/build/a-29701bae.js +0 -22
- package/tests/fixtures/amd-function-name/build/a-REsyh-LW.js +0 -22
- package/tests/fixtures/amd-function-name/build/a-bd62e735.js +0 -22
- package/tests/fixtures/amd-function-name/build/entry.js +0 -95
- package/tests/fixtures/amd-function-name/build/runner.html +0 -15
- package/tests/fixtures/amd-function-name/config.json +0 -3
- package/tests/fixtures/amd-function-name/entry.js +0 -22
- package/tests/fixtures/assets-in-worker/build/assets/my-asset-620b911b.bin +0 -1
- package/tests/fixtures/assets-in-worker/build/assets/my-asset-8db90352.bin +0 -1
- package/tests/fixtures/assets-in-worker/build/assets/my-asset-C4yNwep_.bin +0 -1
- package/tests/fixtures/assets-in-worker/build/entry.js +0 -90
- package/tests/fixtures/assets-in-worker/build/runner.html +0 -15
- package/tests/fixtures/assets-in-worker/build/worker-2a7f7c23.js +0 -91
- package/tests/fixtures/assets-in-worker/build/worker-5cc2068a.js +0 -92
- package/tests/fixtures/assets-in-worker/build/worker-CtBAebZB.js +0 -92
- package/tests/fixtures/assets-in-worker/entry.js +0 -17
- package/tests/fixtures/assets-in-worker/rollup.config.js +0 -25
- package/tests/fixtures/assets-in-worker/worker.js +0 -18
- package/tests/fixtures/dynamic-import/a.js +0 -16
- package/tests/fixtures/dynamic-import/build/a-Dqjf2iqw.js +0 -22
- package/tests/fixtures/dynamic-import/build/a-b9a1bf8d.js +0 -22
- package/tests/fixtures/dynamic-import/build/a-f1483003.js +0 -22
- package/tests/fixtures/dynamic-import/build/entry.js +0 -87
- package/tests/fixtures/dynamic-import/build/runner.html +0 -15
- package/tests/fixtures/dynamic-import/entry.js +0 -14
- package/tests/fixtures/empty.js +0 -0
- package/tests/fixtures/import-meta/a.js +0 -16
- package/tests/fixtures/import-meta/build/a-115d949a.js +0 -22
- package/tests/fixtures/import-meta/build/a-550898d2.js +0 -22
- package/tests/fixtures/import-meta/build/a-BFYklafB.js +0 -22
- package/tests/fixtures/import-meta/build/entry.js +0 -87
- package/tests/fixtures/import-meta/build/runner.html +0 -15
- package/tests/fixtures/import-meta/entry.js +0 -14
- package/tests/fixtures/import-meta-worker/a.js +0 -12
- package/tests/fixtures/import-meta-worker/build/a-23c670a1.js +0 -83
- package/tests/fixtures/import-meta-worker/build/a-9c89b629.js +0 -85
- package/tests/fixtures/import-meta-worker/build/a-CrtsJ3Po.js +0 -83
- package/tests/fixtures/import-meta-worker/build/a-e0498c05.js +0 -83
- package/tests/fixtures/import-meta-worker/build/entry.js +0 -94
- package/tests/fixtures/import-meta-worker/build/runner.html +0 -15
- package/tests/fixtures/import-meta-worker/entry.js +0 -22
- package/tests/fixtures/import-worker-url/a.js +0 -16
- package/tests/fixtures/import-worker-url/b.js +0 -16
- package/tests/fixtures/import-worker-url/build/b-64a9d830.js +0 -22
- package/tests/fixtures/import-worker-url/build/b-725e92c1.js +0 -5
- package/tests/fixtures/import-worker-url/build/entry.js +0 -95
- package/tests/fixtures/import-worker-url/build/runner.html +0 -15
- package/tests/fixtures/import-worker-url/build/worker-Bq6uP7t8.js +0 -123
- package/tests/fixtures/import-worker-url/build/worker-ef1d7c89.js +0 -106
- package/tests/fixtures/import-worker-url/build/worker-f5690442.js +0 -105
- package/tests/fixtures/import-worker-url/entry.js +0 -21
- package/tests/fixtures/import-worker-url/worker.js +0 -17
- package/tests/fixtures/import-worker-url-custom-scheme/a.js +0 -16
- package/tests/fixtures/import-worker-url-custom-scheme/b.js +0 -16
- package/tests/fixtures/import-worker-url-custom-scheme/build/b-725e92c1.js +0 -5
- package/tests/fixtures/import-worker-url-custom-scheme/build/b-74a80c25.js +0 -22
- package/tests/fixtures/import-worker-url-custom-scheme/build/entry.js +0 -95
- package/tests/fixtures/import-worker-url-custom-scheme/build/runner.html +0 -15
- package/tests/fixtures/import-worker-url-custom-scheme/build/worker-Bq6uP7t8.js +0 -123
- package/tests/fixtures/import-worker-url-custom-scheme/build/worker-e37d535c.js +0 -105
- package/tests/fixtures/import-worker-url-custom-scheme/build/worker-ef1d7c89.js +0 -106
- package/tests/fixtures/import-worker-url-custom-scheme/config.json +0 -3
- package/tests/fixtures/import-worker-url-custom-scheme/entry.js +0 -21
- package/tests/fixtures/import-worker-url-custom-scheme/worker.js +0 -17
- package/tests/fixtures/module-worker/a.js +0 -20
- package/tests/fixtures/module-worker/b.js +0 -20
- package/tests/fixtures/module-worker/build/b-8d8ba280.js +0 -20
- package/tests/fixtures/module-worker/build/b-ZxqdL95j.js +0 -21
- package/tests/fixtures/module-worker/build/b-f6cfc895.js +0 -21
- package/tests/fixtures/module-worker/build/entry.js +0 -17
- package/tests/fixtures/module-worker/build/runner.html +0 -15
- package/tests/fixtures/module-worker/build/worker-41a1c649.js +0 -1
- package/tests/fixtures/module-worker/build/worker-50885fe8.js +0 -38
- package/tests/fixtures/module-worker/build/worker-9fb0618d.js +0 -39
- package/tests/fixtures/module-worker/build/worker-DWbjHYfx.js +0 -39
- package/tests/fixtures/module-worker/entry.js +0 -17
- package/tests/fixtures/module-worker/rollup.config.js +0 -4
- package/tests/fixtures/module-worker/worker.js +0 -17
- package/tests/fixtures/more-workers/a.js +0 -16
- package/tests/fixtures/more-workers/b.js +0 -16
- package/tests/fixtures/more-workers/build/b-Dok_VKGN.js +0 -22
- package/tests/fixtures/more-workers/build/b-e9bb9f94.js +0 -22
- package/tests/fixtures/more-workers/build/b-f31d0f9f.js +0 -22
- package/tests/fixtures/more-workers/build/entry.js +0 -107
- package/tests/fixtures/more-workers/build/runner.html +0 -15
- package/tests/fixtures/more-workers/build/worker_a-25924b0d.js +0 -105
- package/tests/fixtures/more-workers/build/worker_a-DtsyxKtN.js +0 -105
- package/tests/fixtures/more-workers/build/worker_a-b8e0ca8d.js +0 -104
- package/tests/fixtures/more-workers/build/worker_b-477edb2c.js +0 -91
- package/tests/fixtures/more-workers/build/worker_b-60981e1f.js +0 -91
- package/tests/fixtures/more-workers/build/worker_b-CG60Lcld.js +0 -91
- package/tests/fixtures/more-workers/entry.js +0 -34
- package/tests/fixtures/more-workers/worker_a.js +0 -16
- package/tests/fixtures/more-workers/worker_b.js +0 -18
- package/tests/fixtures/public-path/a.js +0 -16
- package/tests/fixtures/public-path/build/a-1fb502b9.js +0 -22
- package/tests/fixtures/public-path/build/a-Dqjf2iqw.js +0 -22
- package/tests/fixtures/public-path/build/a-b9a1bf8d.js +0 -22
- package/tests/fixtures/public-path/build/entry.js +0 -87
- package/tests/fixtures/public-path/build/runner.html +0 -15
- package/tests/fixtures/public-path/config.json +0 -3
- package/tests/fixtures/public-path/entry.js +0 -14
- package/tests/fixtures/simple-bundle/a.js +0 -16
- package/tests/fixtures/simple-bundle/build/entry.js +0 -105
- package/tests/fixtures/simple-bundle/build/runner.html +0 -15
- package/tests/fixtures/simple-bundle/entry.js +0 -16
- package/tests/fixtures/single-default/a.js +0 -14
- package/tests/fixtures/single-default/build/entry.js +0 -103
- package/tests/fixtures/single-default/build/runner.html +0 -15
- package/tests/fixtures/single-default/entry.js +0 -16
- package/tests/fixtures/url-import-meta-worker/a.js +0 -17
- package/tests/fixtures/url-import-meta-worker/b.js +0 -16
- package/tests/fixtures/url-import-meta-worker/build/b-258f8a6b.js +0 -22
- package/tests/fixtures/url-import-meta-worker/build/b-8c5ed926.js +0 -22
- package/tests/fixtures/url-import-meta-worker/build/b-CNJP1XvI.js +0 -22
- package/tests/fixtures/url-import-meta-worker/build/entry.js +0 -91
- package/tests/fixtures/url-import-meta-worker/build/runner.html +0 -15
- package/tests/fixtures/url-import-meta-worker/build/worker-9a661671.js +0 -105
- package/tests/fixtures/url-import-meta-worker/build/worker-S2Vh56Q-.js +0 -106
- package/tests/fixtures/url-import-meta-worker/build/worker-e833ae5d.js +0 -106
- package/tests/fixtures/url-import-meta-worker/entry.js +0 -20
- package/tests/fixtures/url-import-meta-worker/worker.js +0 -16
- package/tests/fixtures/worker/a.js +0 -17
- package/tests/fixtures/worker/b.js +0 -16
- package/tests/fixtures/worker/build/b-258f8a6b.js +0 -22
- package/tests/fixtures/worker/build/b-CNJP1XvI.js +0 -22
- package/tests/fixtures/worker/build/b-a9f43d76.js +0 -22
- package/tests/fixtures/worker/build/entry.js +0 -91
- package/tests/fixtures/worker/build/runner.html +0 -15
- package/tests/fixtures/worker/build/worker-S2Vh56Q-.js +0 -106
- package/tests/fixtures/worker/build/worker-b4897a54.js +0 -105
- package/tests/fixtures/worker/build/worker-e833ae5d.js +0 -106
- package/tests/fixtures/worker/entry.js +0 -18
- package/tests/fixtures/worker/worker.js +0 -16
- package/tests/import-meta-worker.test.js +0 -37
- package/tests/import-meta.test.js +0 -33
- package/tests/import-worker-url-custom-scheme.test.js +0 -42
- package/tests/import-worker-url.test.js +0 -41
- package/tests/module-worker.test.js +0 -47
- package/tests/more-workers.test.js +0 -33
- package/tests/public-path.test.js +0 -33
- package/tests/simple-bundle.test.js +0 -33
- package/tests/single-default.test.js +0 -33
- package/tests/url-import-meta-worker.test.js +0 -34
- package/tests/worker.test.js +0 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trickfilm400/rollup-plugin-off-main-thread",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0-pre2",
|
|
4
4
|
"description": "Use Rollup with workers and ES6 modules today.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
31
|
-
"url": "https://github.com/Trickfilm400/rollup-plugin-off-main-thread"
|
|
31
|
+
"url": "git+https://github.com/Trickfilm400/rollup-plugin-off-main-thread.git"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"ejs": "^3.1.10",
|
package/.travis.yml
DELETED
package/CONTRIBUTING
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
Want to contribute? Great! First, read this page (including the small print at the end).
|
|
2
|
-
|
|
3
|
-
### Before you contribute
|
|
4
|
-
Before we can use your code, you must sign the
|
|
5
|
-
[Google Individual Contributor License Agreement]
|
|
6
|
-
(https://cla.developers.google.com/about/google-individual)
|
|
7
|
-
(CLA), which you can do online. The CLA is necessary mainly because you own the
|
|
8
|
-
copyright to your changes, even after your contribution becomes part of our
|
|
9
|
-
codebase, so we need your permission to use and distribute your code. We also
|
|
10
|
-
need to be sure of various other things—for instance that you'll tell us if you
|
|
11
|
-
know that your code infringes on other people's patents. You don't have to sign
|
|
12
|
-
the CLA until after you've submitted your code for review and a member has
|
|
13
|
-
approved it, but you must do it before we can put your code into our codebase.
|
|
14
|
-
Before you start working on a larger contribution, you should get in touch with
|
|
15
|
-
us first through the issue tracker with your idea so that we can help out and
|
|
16
|
-
possibly guide you. Coordinating up front makes it much easier to avoid
|
|
17
|
-
frustration later on.
|
|
18
|
-
|
|
19
|
-
### Code reviews
|
|
20
|
-
All submissions, including submissions by project members, require review. We
|
|
21
|
-
use Github pull requests for this purpose.
|
|
22
|
-
|
|
23
|
-
### The small print
|
|
24
|
-
Contributions made by corporations are covered by a different agreement than
|
|
25
|
-
the one above, the
|
|
26
|
-
[Software Grant and Corporate Contributor License Agreement]
|
|
27
|
-
(https://cla.developers.google.com/about/google-corporate).
|
package/karma.conf.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
module.exports = function(config) {
|
|
15
|
-
const configuration = {
|
|
16
|
-
basePath: "",
|
|
17
|
-
frameworks: ["mocha", "chai"],
|
|
18
|
-
files: [
|
|
19
|
-
{
|
|
20
|
-
pattern: "tests/fixtures/**",
|
|
21
|
-
included: false
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
pattern: "tests/*.test.js"
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
reporters: ["progress"],
|
|
28
|
-
port: 9876,
|
|
29
|
-
colors: true,
|
|
30
|
-
logLevel: config.LOG_INFO,
|
|
31
|
-
autoWatch: true,
|
|
32
|
-
singleRun: true,
|
|
33
|
-
concurrency: 1,
|
|
34
|
-
browsers: ["Chrome", "Firefox", "Safari"],
|
|
35
|
-
customLaunchers: {
|
|
36
|
-
DockerChrome: {
|
|
37
|
-
base: "ChromeHeadless",
|
|
38
|
-
flags: ["--no-sandbox"]
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
if (process.env.INSIDE_DOCKER) configuration.browsers = ["DockerChrome"];
|
|
44
|
-
|
|
45
|
-
config.set(configuration);
|
|
46
|
-
};
|
package/run_tests.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
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 rollup = require("rollup");
|
|
15
|
-
const path = require("path");
|
|
16
|
-
const omt = require(".");
|
|
17
|
-
const fs = require("fs");
|
|
18
|
-
const chalk = require("chalk");
|
|
19
|
-
|
|
20
|
-
const karma = require("karma");
|
|
21
|
-
const myKarmaConfig = require("./karma.conf.js");
|
|
22
|
-
|
|
23
|
-
async function fileExists(file) {
|
|
24
|
-
try {
|
|
25
|
-
const stat = await fs.promises.stat(file);
|
|
26
|
-
return stat.isFile();
|
|
27
|
-
} catch (e) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async function init() {
|
|
33
|
-
await Promise.all(
|
|
34
|
-
[
|
|
35
|
-
"./tests/fixtures/simple-bundle/entry.js",
|
|
36
|
-
"./tests/fixtures/import-meta/entry.js",
|
|
37
|
-
"./tests/fixtures/dynamic-import/entry.js",
|
|
38
|
-
"./tests/fixtures/public-path/entry.js",
|
|
39
|
-
"./tests/fixtures/worker/entry.js",
|
|
40
|
-
"./tests/fixtures/module-worker/entry.js",
|
|
41
|
-
"./tests/fixtures/more-workers/entry.js",
|
|
42
|
-
"./tests/fixtures/amd-function-name/entry.js",
|
|
43
|
-
"./tests/fixtures/single-default/entry.js",
|
|
44
|
-
"./tests/fixtures/import-worker-url/entry.js",
|
|
45
|
-
"./tests/fixtures/import-meta-worker/entry.js",
|
|
46
|
-
"./tests/fixtures/import-worker-url-custom-scheme/entry.js",
|
|
47
|
-
"./tests/fixtures/assets-in-worker/entry.js",
|
|
48
|
-
"./tests/fixtures/url-import-meta-worker/entry.js"
|
|
49
|
-
].map(async input => {
|
|
50
|
-
const pathName = path.dirname(input);
|
|
51
|
-
const outputOptions = {
|
|
52
|
-
dir: path.join(pathName, "build"),
|
|
53
|
-
format: "amd"
|
|
54
|
-
};
|
|
55
|
-
let rollupConfig = {
|
|
56
|
-
input,
|
|
57
|
-
strictDeprecations: true,
|
|
58
|
-
// Copied / adapted from default `onwarn` in Rollup CLI.
|
|
59
|
-
onwarn: warning => {
|
|
60
|
-
console.warn(`⚠️ ${chalk.bold(warning.message)}`);
|
|
61
|
-
|
|
62
|
-
if (warning.url) {
|
|
63
|
-
console.warn(chalk.cyan(warning.url));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (warning.loc) {
|
|
67
|
-
console.warn(
|
|
68
|
-
`${warning.loc.file} (${warning.loc.line}:${warning.loc.column})`
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (warning.frame) {
|
|
73
|
-
console.warn(chalk.dim(warning.frame));
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
console.warn("");
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
const rollupConfigPath = "./" + path.join(pathName, "rollup.config.js");
|
|
80
|
-
const configPath = "./" + path.join(pathName, "config.json");
|
|
81
|
-
if (await fileExists(rollupConfigPath)) {
|
|
82
|
-
require(rollupConfigPath)(rollupConfig, outputOptions, omt);
|
|
83
|
-
} else if (await fileExists(configPath)) {
|
|
84
|
-
rollupConfig.plugins = [omt(require(configPath))];
|
|
85
|
-
} else {
|
|
86
|
-
rollupConfig.plugins = [omt()];
|
|
87
|
-
}
|
|
88
|
-
const bundle = await rollup.rollup(rollupConfig);
|
|
89
|
-
await bundle.write(outputOptions);
|
|
90
|
-
})
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
const karmaConfig = { port: 9876 };
|
|
94
|
-
myKarmaConfig({
|
|
95
|
-
set(config) {
|
|
96
|
-
Object.assign(karmaConfig, config);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
const server = new karma.Server(karmaConfig, code => {
|
|
100
|
-
console.log(`Karma exited with code ${code}`);
|
|
101
|
-
process.exit(code);
|
|
102
|
-
});
|
|
103
|
-
server.start();
|
|
104
|
-
}
|
|
105
|
-
init();
|
|
@@ -1,33 +0,0 @@
|
|
|
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("AMD Function Name", 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 with a different AMD function name", 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/amd-function-name/build/runner.html";
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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,22 +0,0 @@
|
|
|
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
|
-
}));
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
}));
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
}));
|
|
@@ -1,95 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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,22 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
assetcontent
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
assetcontent
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
assetcontent
|
|
@@ -1,90 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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>
|