Add progressive web app companion for cross-platform access
Vite + TypeScript PWA that mirrors the Android app's core features: - Pre-processed shelter data (build-time UTM33N→WGS84 conversion) - Leaflet map with shelter markers, user location, and offline tiles - Canvas compass arrow (ported from DirectionArrowView.kt) - IndexedDB shelter cache with 7-day staleness check - Service worker with CacheFirst tiles and precached app shell - i18n for en, nb, nn (ported from Android strings.xml) - iOS/Android compass handling with low-pass filter - Respects user map interaction (no auto-snap on pan/zoom) - Build revision cache-breaker for reliable SW updates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
46365b713b
commit
e8428de775
12051 changed files with 1799735 additions and 0 deletions
8
pwa/node_modules/@surma/rollup-plugin-off-main-thread/.travis.yml
generated
vendored
Normal file
8
pwa/node_modules/@surma/rollup-plugin-off-main-thread/.travis.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
script:
|
||||
- docker build -t omt .
|
||||
- docker run --rm -v `pwd`:/usr/src omt
|
||||
1
pwa/node_modules/@surma/rollup-plugin-off-main-thread/CODEOWNERS
generated
vendored
Normal file
1
pwa/node_modules/@surma/rollup-plugin-off-main-thread/CODEOWNERS
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
* @surma
|
||||
27
pwa/node_modules/@surma/rollup-plugin-off-main-thread/CONTRIBUTING
generated
vendored
Normal file
27
pwa/node_modules/@surma/rollup-plugin-off-main-thread/CONTRIBUTING
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
Want to contribute? Great! First, read this page (including the small print at the end).
|
||||
|
||||
### Before you contribute
|
||||
Before we can use your code, you must sign the
|
||||
[Google Individual Contributor License Agreement]
|
||||
(https://cla.developers.google.com/about/google-individual)
|
||||
(CLA), which you can do online. The CLA is necessary mainly because you own the
|
||||
copyright to your changes, even after your contribution becomes part of our
|
||||
codebase, so we need your permission to use and distribute your code. We also
|
||||
need to be sure of various other things—for instance that you'll tell us if you
|
||||
know that your code infringes on other people's patents. You don't have to sign
|
||||
the CLA until after you've submitted your code for review and a member has
|
||||
approved it, but you must do it before we can put your code into our codebase.
|
||||
Before you start working on a larger contribution, you should get in touch with
|
||||
us first through the issue tracker with your idea so that we can help out and
|
||||
possibly guide you. Coordinating up front makes it much easier to avoid
|
||||
frustration later on.
|
||||
|
||||
### Code reviews
|
||||
All submissions, including submissions by project members, require review. We
|
||||
use Github pull requests for this purpose.
|
||||
|
||||
### The small print
|
||||
Contributions made by corporations are covered by a different agreement than
|
||||
the one above, the
|
||||
[Software Grant and Corporate Contributor License Agreement]
|
||||
(https://cla.developers.google.com/about/google-corporate).
|
||||
11
pwa/node_modules/@surma/rollup-plugin-off-main-thread/CONTRIBUTORS
generated
vendored
Normal file
11
pwa/node_modules/@surma/rollup-plugin-off-main-thread/CONTRIBUTORS
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# People who have agreed to one of the CLAs and can contribute patches.
|
||||
# The AUTHORS file lists the copyright holders; this file
|
||||
# lists people. For example, Google employees are listed here
|
||||
# but not in AUTHORS, because Google holds the copyright.
|
||||
#
|
||||
# https://developers.google.com/open-source/cla/individual
|
||||
# https://developers.google.com/open-source/cla/corporate
|
||||
#
|
||||
# Names should be added to this file as:
|
||||
# Name <email address>
|
||||
Surma <surma@google.com>
|
||||
20
pwa/node_modules/@surma/rollup-plugin-off-main-thread/Dockerfile
generated
vendored
Normal file
20
pwa/node_modules/@surma/rollup-plugin-off-main-thread/Dockerfile
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
FROM selenium/node-chrome:latest
|
||||
|
||||
USER root
|
||||
|
||||
RUN apt-get update -qqy \
|
||||
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
|
||||
&& rm /bin/sh && ln -s /bin/bash /bin/sh \
|
||||
&& chown seluser /usr/local
|
||||
|
||||
ENV NVM_DIR /usr/local/nvm
|
||||
RUN mkdir -p $NVM_DIR \
|
||||
&& wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.35.2/install.sh | bash \
|
||||
&& source $NVM_DIR/nvm.sh \
|
||||
&& nvm install v12
|
||||
|
||||
ENV CHROME_BIN /opt/google/chrome/chrome
|
||||
ENV INSIDE_DOCKER=1
|
||||
|
||||
WORKDIR /usr/src
|
||||
ENTRYPOINT source $NVM_DIR/nvm.sh && npm i && npm test
|
||||
202
pwa/node_modules/@surma/rollup-plugin-off-main-thread/LICENSE
generated
vendored
Normal file
202
pwa/node_modules/@surma/rollup-plugin-off-main-thread/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2018 Google Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
97
pwa/node_modules/@surma/rollup-plugin-off-main-thread/README.md
generated
vendored
Normal file
97
pwa/node_modules/@surma/rollup-plugin-off-main-thread/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
# rollup-plugin-off-main-thread
|
||||
|
||||
Use Rollup with workers and ES6 modules _today_.
|
||||
|
||||
```
|
||||
$ npm install --save @surma/rollup-plugin-off-main-thread
|
||||
```
|
||||
|
||||
Workers are JavaScript’s version of threads. [Workers are important to use][when workers] as the main thread is already overloaded, especially on slower or older devices.
|
||||
|
||||
This plugin takes care of shimming module support in workers and allows you to use `new Worker()`.
|
||||
|
||||
OMT is the result of merging loadz0r and workz0r.
|
||||
|
||||
## Usage
|
||||
|
||||
I set up [a gist] to show a full setup with OMT.
|
||||
|
||||
### Config
|
||||
|
||||
```js
|
||||
// rollup.config.js
|
||||
import OMT from "@surma/rollup-plugin-off-main-thread";
|
||||
|
||||
export default {
|
||||
input: ["src/main.js"],
|
||||
output: {
|
||||
dir: "dist",
|
||||
// You _must_ use either “amd” or “esm” as your format.
|
||||
// But note that only very few browsers have native support for
|
||||
// modules in workers.
|
||||
format: "amd"
|
||||
},
|
||||
plugins: [OMT()]
|
||||
};
|
||||
```
|
||||
|
||||
### Auto bundling
|
||||
|
||||
In your project's code use a module-relative path via `new URL` to include a Worker:
|
||||
|
||||
```js
|
||||
const worker = new Worker(new URL("worker.js", import.meta.url), {
|
||||
type: "module"
|
||||
});
|
||||
```
|
||||
|
||||
This will just work.
|
||||
|
||||
If required, the plugin also supports plain literal paths:
|
||||
|
||||
```js
|
||||
const worker = new Worker("./worker.js", { type: "module" });
|
||||
```
|
||||
|
||||
However, those are less portable: in Rollup they would result in module-relative
|
||||
path, but if used directly in the browser, they'll be relative to the document
|
||||
URL instead.
|
||||
|
||||
Hence, they're deprecated and `new URL` pattern is encouraged instead for portability.
|
||||
|
||||
### Importing workers as URLs
|
||||
|
||||
If your worker constructor doesn't match `workerRegexp` (see options below), you might find it easier to import the worker as a URL. In your project's code:
|
||||
|
||||
```js
|
||||
import workerURL from "omt:./worker.js";
|
||||
import paintWorkletURL from "omt:./paint-worklet.js";
|
||||
|
||||
const worker = new Worker(workerURL, { name: "main-worker" });
|
||||
CSS.paintWorklet.addModule(paintWorkletURL);
|
||||
```
|
||||
|
||||
`./worker.js` and `./paint-worklet.js` will be added to the output as chunks.
|
||||
|
||||
## Options
|
||||
|
||||
```js
|
||||
{
|
||||
// ...
|
||||
plugins: [OMT(options)];
|
||||
}
|
||||
```
|
||||
|
||||
- `loader`: A string containing the EJS template for the amd loader. If `undefined`, OMT will use `loader.ejs`.
|
||||
- `useEval`: Use `fetch()` + `eval()` to load dependencies instead of `<script>` tags and `importScripts()`. _This is not CSP compliant, but is required if you want to use dynamic imports in ServiceWorker_.
|
||||
- `workerRegexp`: A RegExp to find `new Workers()` calls. The second capture group _must_ capture the provided file name without the quotes.
|
||||
- `amdFunctionName`: Function name to use instead of AMD’s `define`.
|
||||
- `prependLoader`: A function that determines whether the loader code should be prepended to a certain chunk. Should return true if the load is suppsoed to be prepended.
|
||||
- `urlLoaderScheme`: Scheme to use when importing workers as URLs. If `undefined`, OMT will use `"omt"`.
|
||||
|
||||
[when workers]: https://dassur.ma/things/when-workers
|
||||
[a gist]: https://gist.github.com/surma/a02db7b53eb3e7870bf539b906ff6ff6
|
||||
|
||||
---
|
||||
|
||||
License Apache-2.0
|
||||
318
pwa/node_modules/@surma/rollup-plugin-off-main-thread/index.js
generated
vendored
Normal file
318
pwa/node_modules/@surma/rollup-plugin-off-main-thread/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,318 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const { readFileSync } = require("fs");
|
||||
const { join } = require("path");
|
||||
const ejs = require("ejs");
|
||||
const MagicString = require("magic-string");
|
||||
const json5 = require("json5");
|
||||
// See https://github.com/surma/rollup-plugin-off-main-thread/issues/49
|
||||
const matchAll = require("string.prototype.matchall");
|
||||
|
||||
const defaultOpts = {
|
||||
// A string containing the EJS template for the amd loader. If `undefined`,
|
||||
// OMT will use `loader.ejs`.
|
||||
loader: readFileSync(join(__dirname, "/loader.ejs"), "utf8"),
|
||||
// Use `fetch()` + `eval()` to load dependencies instead of `<script>` tags
|
||||
// and `importScripts()`. _This is not CSP compliant, but is required if you
|
||||
// want to use dynamic imports in ServiceWorker_.
|
||||
useEval: false,
|
||||
// Function name to use instead of AMD’s `define`.
|
||||
amdFunctionName: "define",
|
||||
// A function that determines whether the loader code should be prepended to a
|
||||
// certain chunk. Should return true if the load is supposed to be prepended.
|
||||
prependLoader: (chunk, workerFiles) =>
|
||||
chunk.isEntry || workerFiles.includes(chunk.facadeModuleId),
|
||||
// The scheme used when importing workers as a URL.
|
||||
urlLoaderScheme: "omt",
|
||||
// Silence the warning about ESM being badly supported in workers.
|
||||
silenceESMWorkerWarning: false
|
||||
};
|
||||
|
||||
// A regexp to find static `new Worker` invocations.
|
||||
// Matches `new Worker(...file part...`
|
||||
// File part matches one of:
|
||||
// - '...'
|
||||
// - "..."
|
||||
// - `import.meta.url`
|
||||
// - new URL('...', import.meta.url)
|
||||
// - new URL("...", import.meta.url)
|
||||
const workerRegexpForTransform = /(new\s+Worker\()\s*(('.*?'|".*?")|import\.meta\.url|new\s+URL\(('.*?'|".*?"),\s*import\.meta\.url\))/gs;
|
||||
|
||||
// A regexp to find static `new Worker` invocations we've rewritten during the transform phase.
|
||||
// Matches `new Worker(...file part..., ...options...`.
|
||||
// File part matches one of:
|
||||
// - new URL('...', module.uri)
|
||||
// - new URL("...", module.uri)
|
||||
const workerRegexpForOutput = /new\s+Worker\(new\s+URL\((?:'.*?'|".*?"),\s*module\.uri\)\s*(,([^)]+))/gs;
|
||||
|
||||
let longWarningAlreadyShown = false;
|
||||
|
||||
module.exports = function(opts = {}) {
|
||||
opts = Object.assign({}, defaultOpts, opts);
|
||||
|
||||
opts.loader = ejs.render(opts.loader, opts);
|
||||
|
||||
const urlLoaderPrefix = opts.urlLoaderScheme + ":";
|
||||
|
||||
let workerFiles;
|
||||
let isEsmOutput = () => { throw new Error("outputOptions hasn't been called yet") };
|
||||
return {
|
||||
name: "off-main-thread",
|
||||
|
||||
async buildStart(options) {
|
||||
workerFiles = [];
|
||||
},
|
||||
|
||||
async resolveId(id, importer) {
|
||||
if (!id.startsWith(urlLoaderPrefix)) return;
|
||||
|
||||
const path = id.slice(urlLoaderPrefix.length);
|
||||
const resolved = await this.resolve(path, importer);
|
||||
if (!resolved)
|
||||
throw Error(`Cannot find module '${path}' from '${importer}'`);
|
||||
const newId = resolved.id;
|
||||
|
||||
return urlLoaderPrefix + newId;
|
||||
},
|
||||
|
||||
load(id) {
|
||||
if (!id.startsWith(urlLoaderPrefix)) return;
|
||||
|
||||
const realId = id.slice(urlLoaderPrefix.length);
|
||||
const chunkRef = this.emitFile({ id: realId, type: "chunk" });
|
||||
return `export default import.meta.ROLLUP_FILE_URL_${chunkRef};`;
|
||||
},
|
||||
|
||||
async transform(code, id) {
|
||||
const ms = new MagicString(code);
|
||||
|
||||
const replacementPromises = [];
|
||||
|
||||
for (const match of matchAll(code, workerRegexpForTransform)) {
|
||||
let [
|
||||
fullMatch,
|
||||
partBeforeArgs,
|
||||
workerSource,
|
||||
directWorkerFile,
|
||||
workerFile,
|
||||
] = match;
|
||||
|
||||
const workerParametersEndIndex = match.index + fullMatch.length;
|
||||
const matchIndex = match.index;
|
||||
const workerParametersStartIndex = matchIndex + partBeforeArgs.length;
|
||||
|
||||
let workerIdPromise;
|
||||
if (workerSource === "import.meta.url") {
|
||||
// Turn the current file into a chunk
|
||||
workerIdPromise = Promise.resolve(id);
|
||||
} else {
|
||||
// Otherwise it's a string literal either directly or in the `new URL(...)`.
|
||||
if (directWorkerFile) {
|
||||
const fullMatchWithOpts = `${fullMatch}, …)`;
|
||||
const fullReplacement = `new Worker(new URL(${directWorkerFile}, import.meta.url), …)`;
|
||||
|
||||
if (!longWarningAlreadyShown) {
|
||||
this.warn(
|
||||
`rollup-plugin-off-main-thread:
|
||||
\`${fullMatchWithOpts}\` suggests that the Worker should be relative to the document, not the script.
|
||||
In the bundler, we don't know what the final document's URL will be, and instead assume it's a URL relative to the current module.
|
||||
This might lead to incorrect behaviour during runtime.
|
||||
If you did mean to use a URL relative to the current module, please change your code to the following form:
|
||||
\`${fullReplacement}\`
|
||||
This will become a hard error in the future.`,
|
||||
matchIndex
|
||||
);
|
||||
longWarningAlreadyShown = true;
|
||||
} else {
|
||||
this.warn(
|
||||
`rollup-plugin-off-main-thread: Treating \`${fullMatchWithOpts}\` as \`${fullReplacement}\``,
|
||||
matchIndex
|
||||
);
|
||||
}
|
||||
workerFile = directWorkerFile;
|
||||
}
|
||||
|
||||
// Cut off surrounding quotes.
|
||||
workerFile = workerFile.slice(1, -1);
|
||||
|
||||
if (!/^\.{1,2}\//.test(workerFile)) {
|
||||
let isError = false;
|
||||
if (directWorkerFile) {
|
||||
// If direct worker file, it must be in `./something` form.
|
||||
isError = true;
|
||||
} else {
|
||||
// If `new URL(...)` it can be in `new URL('something', import.meta.url)` form too,
|
||||
// so just check it's not absolute.
|
||||
if (/^(\/|https?:)/.test(workerFile)) {
|
||||
isError = true;
|
||||
} else {
|
||||
// If it does turn out to be `new URL('something', import.meta.url)` form,
|
||||
// prepend `./` so that it becomes valid module specifier.
|
||||
workerFile = `./${workerFile}`;
|
||||
}
|
||||
}
|
||||
if (isError) {
|
||||
this.warn(
|
||||
`Paths passed to the Worker constructor must be relative to the current file, i.e. start with ./ or ../ (just like dynamic import!). Ignoring "${workerFile}".`,
|
||||
matchIndex
|
||||
);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
workerIdPromise = this.resolve(workerFile, id).then(res => res.id);
|
||||
}
|
||||
|
||||
replacementPromises.push(
|
||||
(async () => {
|
||||
const resolvedWorkerFile = await workerIdPromise;
|
||||
workerFiles.push(resolvedWorkerFile);
|
||||
const chunkRefId = this.emitFile({
|
||||
id: resolvedWorkerFile,
|
||||
type: "chunk"
|
||||
});
|
||||
|
||||
ms.overwrite(
|
||||
workerParametersStartIndex,
|
||||
workerParametersEndIndex,
|
||||
`new URL(import.meta.ROLLUP_FILE_URL_${chunkRefId}, import.meta.url)`
|
||||
);
|
||||
})()
|
||||
);
|
||||
}
|
||||
|
||||
// No matches found.
|
||||
if (!replacementPromises.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Wait for all the scheduled replacements to finish.
|
||||
await Promise.all(replacementPromises);
|
||||
|
||||
return {
|
||||
code: ms.toString(),
|
||||
map: ms.generateMap({ hires: true })
|
||||
};
|
||||
},
|
||||
|
||||
resolveFileUrl(chunk) {
|
||||
return JSON.stringify(chunk.relativePath);
|
||||
},
|
||||
|
||||
outputOptions({ format }) {
|
||||
if (format === "esm" || format === "es") {
|
||||
if (!opts.silenceESMWorkerWarning) {
|
||||
this.warn(
|
||||
'Very few browsers support ES modules in Workers. If you want to your code to run in all browsers, set `output.format = "amd";`'
|
||||
);
|
||||
}
|
||||
// In ESM, we never prepend a loader.
|
||||
isEsmOutput = () => true;
|
||||
} else if (format !== "amd") {
|
||||
this.error(
|
||||
`\`output.format\` must either be "amd" or "esm", got "${format}"`
|
||||
);
|
||||
} else {
|
||||
isEsmOutput = () => false;
|
||||
}
|
||||
},
|
||||
|
||||
renderDynamicImport() {
|
||||
if (isEsmOutput()) return;
|
||||
|
||||
// In our loader, `require` simply return a promise directly.
|
||||
// This is tinier and simpler output than the Rollup's default.
|
||||
return {
|
||||
left: 'require(',
|
||||
right: ')'
|
||||
};
|
||||
},
|
||||
|
||||
resolveImportMeta(property) {
|
||||
if (isEsmOutput()) return;
|
||||
|
||||
if (property === 'url') {
|
||||
// In our loader, `module.uri` is already fully resolved
|
||||
// so we can emit something shorter than the Rollup's default.
|
||||
return `module.uri`;
|
||||
}
|
||||
},
|
||||
|
||||
renderChunk(code, chunk, outputOptions) {
|
||||
// We don’t need to do any loader processing when targeting ESM format.
|
||||
if (isEsmOutput()) return;
|
||||
|
||||
if (outputOptions.banner && outputOptions.banner.length > 0) {
|
||||
this.error(
|
||||
"OMT currently doesn’t work with `banner`. Feel free to submit a PR at https://github.com/surma/rollup-plugin-off-main-thread"
|
||||
);
|
||||
return;
|
||||
}
|
||||
const ms = new MagicString(code);
|
||||
|
||||
for (const match of matchAll(code, workerRegexpForOutput)) {
|
||||
let [fullMatch, optionsWithCommaStr, optionsStr] = match;
|
||||
let options;
|
||||
try {
|
||||
options = json5.parse(optionsStr);
|
||||
} catch (e) {
|
||||
// If we couldn't parse the options object, maybe it's something dynamic or has nested
|
||||
// parentheses or something like that. In that case, treat it as a warning
|
||||
// and not a hard error, just like we wouldn't break on unmatched regex.
|
||||
console.warn("Couldn't match options object", fullMatch, ": ", e);
|
||||
continue;
|
||||
}
|
||||
if (!("type" in options)) {
|
||||
// Nothing to do.
|
||||
continue;
|
||||
}
|
||||
delete options.type;
|
||||
const replacementEnd = match.index + fullMatch.length;
|
||||
const replacementStart = replacementEnd - optionsWithCommaStr.length;
|
||||
optionsStr = json5.stringify(options);
|
||||
optionsWithCommaStr = optionsStr === "{}" ? "" : `, ${optionsStr}`;
|
||||
ms.overwrite(
|
||||
replacementStart,
|
||||
replacementEnd,
|
||||
optionsWithCommaStr
|
||||
);
|
||||
}
|
||||
|
||||
// Mangle define() call
|
||||
ms.remove(0, "define(".length);
|
||||
// If the module does not have any dependencies, it’s technically okay
|
||||
// to skip the dependency array. But our minimal loader expects it, so
|
||||
// we add it back in.
|
||||
if (!code.startsWith("define([")) {
|
||||
ms.prepend("[],");
|
||||
}
|
||||
ms.prepend(`${opts.amdFunctionName}(`);
|
||||
|
||||
// Prepend loader if it’s an entry point or a worker file
|
||||
if (opts.prependLoader(chunk, workerFiles)) {
|
||||
ms.prepend(opts.loader);
|
||||
}
|
||||
|
||||
const newCode = ms.toString();
|
||||
const hasCodeChanged = code !== newCode;
|
||||
return {
|
||||
code: newCode,
|
||||
// Avoid generating sourcemaps if possible as it can be a very expensive operation
|
||||
map: hasCodeChanged ? ms.generateMap({ hires: true }) : null
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
46
pwa/node_modules/@surma/rollup-plugin-off-main-thread/karma.conf.js
generated
vendored
Normal file
46
pwa/node_modules/@surma/rollup-plugin-off-main-thread/karma.conf.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
module.exports = function(config) {
|
||||
const configuration = {
|
||||
basePath: "",
|
||||
frameworks: ["mocha", "chai"],
|
||||
files: [
|
||||
{
|
||||
pattern: "tests/fixtures/**",
|
||||
included: false
|
||||
},
|
||||
{
|
||||
pattern: "tests/*.test.js"
|
||||
}
|
||||
],
|
||||
reporters: ["progress"],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
singleRun: true,
|
||||
concurrency: 1,
|
||||
browsers: ["Chrome", "Firefox", "Safari"],
|
||||
customLaunchers: {
|
||||
DockerChrome: {
|
||||
base: "ChromeHeadless",
|
||||
flags: ["--no-sandbox"]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (process.env.INSIDE_DOCKER) configuration.browsers = ["DockerChrome"];
|
||||
|
||||
config.set(configuration);
|
||||
};
|
||||
76
pwa/node_modules/@surma/rollup-plugin-off-main-thread/loader.ejs
generated
vendored
Normal file
76
pwa/node_modules/@surma/rollup-plugin-off-main-thread/loader.ejs
generated
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// If the loader is already loaded, just stop.
|
||||
if (!self.<%- amdFunctionName %>) {
|
||||
let registry = {};
|
||||
|
||||
// Used for `eval` and `importScripts` where we can't get script URL by other means.
|
||||
// In both cases, it's safe to use a global var because those functions are synchronous.
|
||||
let nextDefineUri;
|
||||
|
||||
const singleRequire = (uri, parentUri) => {
|
||||
uri = new URL(uri + ".js", parentUri).href;
|
||||
return registry[uri] || (
|
||||
<% if (useEval) { %>
|
||||
fetch(uri)
|
||||
.then(resp => resp.text())
|
||||
.then(code => {
|
||||
nextDefineUri = uri;
|
||||
eval(code);
|
||||
})
|
||||
<% } else { %>
|
||||
new Promise(resolve => {
|
||||
if ("document" in self) {
|
||||
const script = document.createElement("script");
|
||||
script.src = uri;
|
||||
script.onload = resolve;
|
||||
document.head.appendChild(script);
|
||||
} else {
|
||||
nextDefineUri = uri;
|
||||
importScripts(uri);
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
<% } %>
|
||||
.then(() => {
|
||||
let promise = registry[uri];
|
||||
if (!promise) {
|
||||
throw new Error(`Module ${uri} didn’t register its module`);
|
||||
}
|
||||
return promise;
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
self.<%- amdFunctionName %> = (depsNames, factory) => {
|
||||
const uri = nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href;
|
||||
if (registry[uri]) {
|
||||
// Module is already loading or loaded.
|
||||
return;
|
||||
}
|
||||
let exports = {};
|
||||
const require = depUri => singleRequire(depUri, uri);
|
||||
const specialDeps = {
|
||||
module: { uri },
|
||||
exports,
|
||||
require
|
||||
};
|
||||
registry[uri] = Promise.all(depsNames.map(
|
||||
depName => specialDeps[depName] || require(depName)
|
||||
)).then(deps => {
|
||||
factory(...deps);
|
||||
return exports;
|
||||
});
|
||||
};
|
||||
}
|
||||
7
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/LICENSE
generated
vendored
Normal file
7
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Copyright 2018 Rich Harris
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
252
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/README.md
generated
vendored
Normal file
252
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,252 @@
|
|||
# magic-string
|
||||
|
||||
<a href="https://travis-ci.org/Rich-Harris/magic-string">
|
||||
<img src="http://img.shields.io/travis/Rich-Harris/magic-string.svg"
|
||||
alt="build status">
|
||||
</a>
|
||||
<a href="https://npmjs.org/package/magic-string">
|
||||
<img src="https://img.shields.io/npm/v/magic-string.svg"
|
||||
alt="npm version">
|
||||
</a>
|
||||
<a href="https://github.com/Rich-Harris/magic-string/blob/master/LICENSE.md">
|
||||
<img src="https://img.shields.io/npm/l/magic-string.svg"
|
||||
alt="license">
|
||||
</a>
|
||||
|
||||
Suppose you have some source code. You want to make some light modifications to it - replacing a few characters here and there, wrapping it with a header and footer, etc - and ideally you'd like to generate a source map at the end of it. You've thought about using something like [recast](https://github.com/benjamn/recast) (which allows you to generate an AST from some JavaScript, manipulate it, and reprint it with a sourcemap without losing your comments and formatting), but it seems like overkill for your needs (or maybe the source code isn't JavaScript).
|
||||
|
||||
Your requirements are, frankly, rather niche. But they're requirements that I also have, and for which I made magic-string. It's a small, fast utility for manipulating strings and generating sourcemaps.
|
||||
|
||||
## Installation
|
||||
|
||||
magic-string works in both node.js and browser environments. For node, install with npm:
|
||||
|
||||
```bash
|
||||
npm i magic-string
|
||||
```
|
||||
|
||||
To use in browser, grab the [magic-string.umd.js](https://unpkg.com/magic-string/dist/magic-string.umd.js) file and add it to your page:
|
||||
|
||||
```html
|
||||
<script src='magic-string.umd.js'></script>
|
||||
```
|
||||
|
||||
(It also works with various module systems, if you prefer that sort of thing - it has a dependency on [vlq](https://github.com/Rich-Harris/vlq).)
|
||||
|
||||
## Usage
|
||||
|
||||
These examples assume you're in node.js, or something similar:
|
||||
|
||||
```js
|
||||
import MagicString from 'magic-string';
|
||||
import fs from 'fs'
|
||||
|
||||
const s = new MagicString('problems = 99');
|
||||
|
||||
s.overwrite(0, 8, 'answer');
|
||||
s.toString(); // 'answer = 99'
|
||||
|
||||
s.overwrite(11, 13, '42'); // character indices always refer to the original string
|
||||
s.toString(); // 'answer = 42'
|
||||
|
||||
s.prepend('var ').append(';'); // most methods are chainable
|
||||
s.toString(); // 'var answer = 42;'
|
||||
|
||||
const map = s.generateMap({
|
||||
source: 'source.js',
|
||||
file: 'converted.js.map',
|
||||
includeContent: true
|
||||
}); // generates a v3 sourcemap
|
||||
|
||||
fs.writeFileSync('converted.js', s.toString());
|
||||
fs.writeFileSync('converted.js.map', map.toString());
|
||||
```
|
||||
|
||||
You can pass an options argument:
|
||||
|
||||
```js
|
||||
const s = new MagicString(someCode, {
|
||||
// both these options will be used if you later
|
||||
// call `bundle.addSource( s )` - see below
|
||||
filename: 'foo.js',
|
||||
indentExclusionRanges: [/*...*/]
|
||||
});
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
### s.addSourcemapLocation( index )
|
||||
|
||||
Adds the specified character index (with respect to the original string) to sourcemap mappings, if `hires` is `false` (see below).
|
||||
|
||||
### s.append( content )
|
||||
|
||||
Appends the specified content to the end of the string. Returns `this`.
|
||||
|
||||
### s.appendLeft( index, content )
|
||||
|
||||
Appends the specified `content` at the `index` in the original string. If a range *ending* with `index` is subsequently moved, the insert will be moved with it. Returns `this`. See also `s.prependLeft(...)`.
|
||||
|
||||
### s.appendRight( index, content )
|
||||
|
||||
Appends the specified `content` at the `index` in the original string. If a range *starting* with `index` is subsequently moved, the insert will be moved with it. Returns `this`. See also `s.prependRight(...)`.
|
||||
|
||||
### s.clone()
|
||||
|
||||
Does what you'd expect.
|
||||
|
||||
### s.generateDecodedMap( options )
|
||||
|
||||
Generates a sourcemap object with raw mappings in array form, rather than encoded as a string. See `generateMap` documentation below for options details. Useful if you need to manipulate the sourcemap further, but most of the time you will use `generateMap` instead.
|
||||
|
||||
### s.generateMap( options )
|
||||
|
||||
Generates a [version 3 sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit). All options are, well, optional:
|
||||
|
||||
* `file` - the filename where you plan to write the sourcemap
|
||||
* `source` - the filename of the file containing the original source
|
||||
* `includeContent` - whether to include the original content in the map's `sourcesContent` array
|
||||
* `hires` - whether the mapping should be high-resolution. Hi-res mappings map every single character, meaning (for example) your devtools will always be able to pinpoint the exact location of function calls and so on. With lo-res mappings, devtools may only be able to identify the correct line - but they're quicker to generate and less bulky. If sourcemap locations have been specified with `s.addSourceMapLocation()`, they will be used here.
|
||||
|
||||
The returned sourcemap has two (non-enumerable) methods attached for convenience:
|
||||
|
||||
* `toString` - returns the equivalent of `JSON.stringify(map)`
|
||||
* `toUrl` - returns a DataURI containing the sourcemap. Useful for doing this sort of thing:
|
||||
|
||||
```js
|
||||
code += '\n//# sourceMappingURL=' + map.toUrl();
|
||||
```
|
||||
|
||||
### s.indent( prefix[, options] )
|
||||
|
||||
Prefixes each line of the string with `prefix`. If `prefix` is not supplied, the indentation will be guessed from the original content, falling back to a single tab character. Returns `this`.
|
||||
|
||||
The `options` argument can have an `exclude` property, which is an array of `[start, end]` character ranges. These ranges will be excluded from the indentation - useful for (e.g.) multiline strings.
|
||||
|
||||
### s.insertLeft( index, content )
|
||||
|
||||
**DEPRECATED** since 0.17 – use `s.appendLeft(...)` instead
|
||||
|
||||
### s.insertRight( index, content )
|
||||
|
||||
**DEPRECATED** since 0.17 – use `s.prependRight(...)` instead
|
||||
|
||||
### s.locate( index )
|
||||
|
||||
**DEPRECATED** since 0.10 – see [#30](https://github.com/Rich-Harris/magic-string/pull/30)
|
||||
|
||||
### s.locateOrigin( index )
|
||||
|
||||
**DEPRECATED** since 0.10 – see [#30](https://github.com/Rich-Harris/magic-string/pull/30)
|
||||
|
||||
### s.move( start, end, newIndex )
|
||||
|
||||
Moves the characters from `start` and `end` to `index`. Returns `this`.
|
||||
|
||||
### s.overwrite( start, end, content[, options] )
|
||||
|
||||
Replaces the characters from `start` to `end` with `content`. The same restrictions as `s.remove()` apply. Returns `this`.
|
||||
|
||||
The fourth argument is optional. It can have a `storeName` property — if `true`, the original name will be stored for later inclusion in a sourcemap's `names` array — and a `contentOnly` property which determines whether only the content is overwritten, or anything that was appended/prepended to the range as well.
|
||||
|
||||
### s.prepend( content )
|
||||
|
||||
Prepends the string with the specified content. Returns `this`.
|
||||
|
||||
### s.prependLeft ( index, content )
|
||||
|
||||
Same as `s.appendLeft(...)`, except that the inserted content will go *before* any previous appends or prepends at `index`
|
||||
|
||||
### s.prependRight ( index, content )
|
||||
|
||||
Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index`
|
||||
|
||||
### s.remove( start, end )
|
||||
|
||||
Removes the characters from `start` to `end` (of the original string, **not** the generated string). Removing the same content twice, or making removals that partially overlap, will cause an error. Returns `this`.
|
||||
|
||||
### s.slice( start, end )
|
||||
|
||||
Returns the content of the generated string that corresponds to the slice between `start` and `end` of the original string. Throws error if the indices are for characters that were already removed.
|
||||
|
||||
### s.snip( start, end )
|
||||
|
||||
Returns a clone of `s`, with all content before the `start` and `end` characters of the original string removed.
|
||||
|
||||
### s.toString()
|
||||
|
||||
Returns the generated string.
|
||||
|
||||
### s.trim([ charType ])
|
||||
|
||||
Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start and end. Returns `this`.
|
||||
|
||||
### s.trimStart([ charType ])
|
||||
|
||||
Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start. Returns `this`.
|
||||
|
||||
### s.trimEnd([ charType ])
|
||||
|
||||
Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the end. Returns `this`.
|
||||
|
||||
### s.trimLines()
|
||||
|
||||
Removes empty lines from the start and end. Returns `this`.
|
||||
|
||||
### s.isEmpty()
|
||||
|
||||
Returns true if the resulting source is empty (disregarding white space).
|
||||
|
||||
## Bundling
|
||||
|
||||
To concatenate several sources, use `MagicString.Bundle`:
|
||||
|
||||
```js
|
||||
const bundle = new MagicString.Bundle();
|
||||
|
||||
bundle.addSource({
|
||||
filename: 'foo.js',
|
||||
content: new MagicString('var answer = 42;')
|
||||
});
|
||||
|
||||
bundle.addSource({
|
||||
filename: 'bar.js',
|
||||
content: new MagicString('console.log( answer )')
|
||||
});
|
||||
|
||||
// Advanced: a source can include an `indentExclusionRanges` property
|
||||
// alongside `filename` and `content`. This will be passed to `s.indent()`
|
||||
// - see documentation above
|
||||
|
||||
bundle.indent() // optionally, pass an indent string, otherwise it will be guessed
|
||||
.prepend('(function () {\n')
|
||||
.append('}());');
|
||||
|
||||
bundle.toString();
|
||||
// (function () {
|
||||
// var answer = 42;
|
||||
// console.log( answer );
|
||||
// }());
|
||||
|
||||
// options are as per `s.generateMap()` above
|
||||
const map = bundle.generateMap({
|
||||
file: 'bundle.js',
|
||||
includeContent: true,
|
||||
hires: true
|
||||
});
|
||||
```
|
||||
|
||||
As an alternative syntax, if you a) don't have `filename` or `indentExclusionRanges` options, or b) passed those in when you used `new MagicString(...)`, you can simply pass the `MagicString` instance itself:
|
||||
|
||||
```js
|
||||
const bundle = new MagicString.Bundle();
|
||||
const source = new MagicString(someCode, {
|
||||
filename: 'foo.js'
|
||||
});
|
||||
|
||||
bundle.addSource(source);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
1311
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/dist/magic-string.cjs.js
generated
vendored
Normal file
1311
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/dist/magic-string.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/dist/magic-string.cjs.js.map
generated
vendored
Normal file
1
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/dist/magic-string.cjs.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1305
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/dist/magic-string.es.js
generated
vendored
Normal file
1305
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/dist/magic-string.es.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/dist/magic-string.es.js.map
generated
vendored
Normal file
1
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/dist/magic-string.es.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1371
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/dist/magic-string.umd.js
generated
vendored
Normal file
1371
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/dist/magic-string.umd.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/dist/magic-string.umd.js.map
generated
vendored
Normal file
1
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/dist/magic-string.umd.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
221
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/index.d.ts
generated
vendored
Normal file
221
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
export interface BundleOptions {
|
||||
intro?: string;
|
||||
separator?: string;
|
||||
}
|
||||
|
||||
export interface SourceMapOptions {
|
||||
/**
|
||||
* Whether the mapping should be high-resolution.
|
||||
* Hi-res mappings map every single character, meaning (for example) your devtools will always
|
||||
* be able to pinpoint the exact location of function calls and so on.
|
||||
* With lo-res mappings, devtools may only be able to identify the correct
|
||||
* line - but they're quicker to generate and less bulky.
|
||||
* If sourcemap locations have been specified with s.addSourceMapLocation(), they will be used here.
|
||||
*/
|
||||
hires?: boolean;
|
||||
/**
|
||||
* The filename where you plan to write the sourcemap.
|
||||
*/
|
||||
file?: string;
|
||||
/**
|
||||
* The filename of the file containing the original source.
|
||||
*/
|
||||
source?: string;
|
||||
/**
|
||||
* Whether to include the original content in the map's sourcesContent array.
|
||||
*/
|
||||
includeContent?: boolean;
|
||||
}
|
||||
|
||||
export type SourceMapSegment =
|
||||
| [number]
|
||||
| [number, number, number, number]
|
||||
| [number, number, number, number, number];
|
||||
|
||||
export interface DecodedSourceMap {
|
||||
file: string;
|
||||
sources: string[];
|
||||
sourcesContent: string[];
|
||||
names: string[];
|
||||
mappings: SourceMapSegment[][];
|
||||
}
|
||||
|
||||
export class SourceMap {
|
||||
constructor(properties: DecodedSourceMap);
|
||||
|
||||
version: number;
|
||||
file: string;
|
||||
sources: string[];
|
||||
sourcesContent: string[];
|
||||
names: string[];
|
||||
mappings: string;
|
||||
|
||||
/**
|
||||
* Returns the equivalent of `JSON.stringify(map)`
|
||||
*/
|
||||
toString(): string;
|
||||
/**
|
||||
* Returns a DataURI containing the sourcemap. Useful for doing this sort of thing:
|
||||
* `generateMap(options?: SourceMapOptions): SourceMap;`
|
||||
*/
|
||||
toUrl(): string;
|
||||
}
|
||||
|
||||
export class Bundle {
|
||||
constructor(options?: BundleOptions);
|
||||
addSource(source: MagicString | { filename?: string, content: MagicString }): Bundle;
|
||||
append(str: string, options?: BundleOptions): Bundle;
|
||||
clone(): Bundle;
|
||||
generateMap(options?: SourceMapOptions): SourceMap;
|
||||
generateDecodedMap(options?: SourceMapOptions): DecodedSourceMap;
|
||||
getIndentString(): string;
|
||||
indent(indentStr?: string): Bundle;
|
||||
indentExclusionRanges: ExclusionRange | Array<ExclusionRange>;
|
||||
prepend(str: string): Bundle;
|
||||
toString(): string;
|
||||
trimLines(): Bundle;
|
||||
trim(charType?: string): Bundle;
|
||||
trimStart(charType?: string): Bundle;
|
||||
trimEnd(charType?: string): Bundle;
|
||||
isEmpty(): boolean;
|
||||
length(): number;
|
||||
}
|
||||
|
||||
export type ExclusionRange = [ number, number ];
|
||||
|
||||
export interface MagicStringOptions {
|
||||
filename?: string,
|
||||
indentExclusionRanges?: ExclusionRange | Array<ExclusionRange>;
|
||||
}
|
||||
|
||||
export interface IndentOptions {
|
||||
exclude?: ExclusionRange | Array<ExclusionRange>;
|
||||
indentStart?: boolean;
|
||||
}
|
||||
|
||||
export interface OverwriteOptions {
|
||||
storeName?: boolean;
|
||||
contentOnly?: boolean;
|
||||
}
|
||||
|
||||
export default class MagicString {
|
||||
constructor(str: string, options?: MagicStringOptions);
|
||||
/**
|
||||
* Adds the specified character index (with respect to the original string) to sourcemap mappings, if `hires` is false.
|
||||
*/
|
||||
addSourcemapLocation(char: number): void;
|
||||
/**
|
||||
* Appends the specified content to the end of the string.
|
||||
*/
|
||||
append(content: string): MagicString;
|
||||
/**
|
||||
* Appends the specified content at the index in the original string.
|
||||
* If a range *ending* with index is subsequently moved, the insert will be moved with it.
|
||||
* See also `s.prependLeft(...)`.
|
||||
*/
|
||||
appendLeft(index: number, content: string): MagicString;
|
||||
/**
|
||||
* Appends the specified content at the index in the original string.
|
||||
* If a range *starting* with index is subsequently moved, the insert will be moved with it.
|
||||
* See also `s.prependRight(...)`.
|
||||
*/
|
||||
appendRight(index: number, content: string): MagicString;
|
||||
/**
|
||||
* Does what you'd expect.
|
||||
*/
|
||||
clone(): MagicString;
|
||||
/**
|
||||
* Generates a version 3 sourcemap.
|
||||
*/
|
||||
generateMap(options?: SourceMapOptions): SourceMap;
|
||||
/**
|
||||
* Generates a sourcemap object with raw mappings in array form, rather than encoded as a string.
|
||||
* Useful if you need to manipulate the sourcemap further, but most of the time you will use `generateMap` instead.
|
||||
*/
|
||||
generateDecodedMap(options?: SourceMapOptions): DecodedSourceMap;
|
||||
getIndentString(): string;
|
||||
|
||||
/**
|
||||
* Prefixes each line of the string with prefix.
|
||||
* If prefix is not supplied, the indentation will be guessed from the original content, falling back to a single tab character.
|
||||
*/
|
||||
indent(options?: IndentOptions): MagicString;
|
||||
/**
|
||||
* Prefixes each line of the string with prefix.
|
||||
* If prefix is not supplied, the indentation will be guessed from the original content, falling back to a single tab character.
|
||||
*
|
||||
* The options argument can have an exclude property, which is an array of [start, end] character ranges.
|
||||
* These ranges will be excluded from the indentation - useful for (e.g.) multiline strings.
|
||||
*/
|
||||
indent(indentStr?: string, options?: IndentOptions): MagicString;
|
||||
indentExclusionRanges: ExclusionRange | Array<ExclusionRange>;
|
||||
|
||||
/**
|
||||
* Moves the characters from `start and `end` to `index`.
|
||||
*/
|
||||
move(start: number, end: number, index: number): MagicString;
|
||||
/**
|
||||
* Replaces the characters from `start` to `end` with `content`. The same restrictions as `s.remove()` apply.
|
||||
*
|
||||
* The fourth argument is optional. It can have a storeName property — if true, the original name will be stored
|
||||
* for later inclusion in a sourcemap's names array — and a contentOnly property which determines whether only
|
||||
* the content is overwritten, or anything that was appended/prepended to the range as well.
|
||||
*/
|
||||
overwrite(start: number, end: number, content: string, options?: boolean | OverwriteOptions): MagicString;
|
||||
/**
|
||||
* Prepends the string with the specified content.
|
||||
*/
|
||||
prepend(content: string): MagicString;
|
||||
/**
|
||||
* Same as `s.appendLeft(...)`, except that the inserted content will go *before* any previous appends or prepends at index
|
||||
*/
|
||||
prependLeft(index: number, content: string): MagicString;
|
||||
/**
|
||||
* Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index`
|
||||
*/
|
||||
prependRight(index: number, content: string): MagicString;
|
||||
/**
|
||||
* Removes the characters from `start` to `end` (of the original string, **not** the generated string).
|
||||
* Removing the same content twice, or making removals that partially overlap, will cause an error.
|
||||
*/
|
||||
remove(start: number, end: number): MagicString;
|
||||
/**
|
||||
* Returns the content of the generated string that corresponds to the slice between `start` and `end` of the original string.
|
||||
* Throws error if the indices are for characters that were already removed.
|
||||
*/
|
||||
slice(start: number, end: number): string;
|
||||
/**
|
||||
* Returns a clone of `s`, with all content before the `start` and `end` characters of the original string removed.
|
||||
*/
|
||||
snip(start: number, end: number): MagicString;
|
||||
/**
|
||||
* Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start and end.
|
||||
*/
|
||||
trim(charType?: string): MagicString;
|
||||
/**
|
||||
* Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start.
|
||||
*/
|
||||
trimStart(charType?: string): MagicString;
|
||||
/**
|
||||
* Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the end.
|
||||
*/
|
||||
trimEnd(charType?: string): MagicString;
|
||||
/**
|
||||
* Removes empty lines from the start and end.
|
||||
*/
|
||||
trimLines(): MagicString;
|
||||
|
||||
lastChar(): string;
|
||||
lastLine(): string;
|
||||
/**
|
||||
* Returns true if the resulting source is empty (disregarding white space).
|
||||
*/
|
||||
isEmpty(): boolean;
|
||||
length(): number;
|
||||
|
||||
original: string;
|
||||
/**
|
||||
* Returns the generated string.
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
52
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/package.json
generated
vendored
Normal file
52
pwa/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/magic-string/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"name": "magic-string",
|
||||
"version": "0.25.9",
|
||||
"description": "Modify strings, generate sourcemaps",
|
||||
"keywords": [
|
||||
"string",
|
||||
"string manipulation",
|
||||
"sourcemap",
|
||||
"templating",
|
||||
"transpilation"
|
||||
],
|
||||
"repository": "https://github.com/rich-harris/magic-string",
|
||||
"license": "MIT",
|
||||
"author": "Rich Harris",
|
||||
"main": "dist/magic-string.cjs.js",
|
||||
"module": "dist/magic-string.es.js",
|
||||
"jsnext:main": "dist/magic-string.es.js",
|
||||
"typings": "index.d.ts",
|
||||
"files": [
|
||||
"dist/*",
|
||||
"index.d.ts",
|
||||
"README.md"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
||||
"format": "prettier --single-quote --print-width 100 --use-tabs --write src/*.js src/**/*.js",
|
||||
"lint": "eslint src test",
|
||||
"prepare": "npm run build",
|
||||
"prepublishOnly": "rm -rf dist && npm test",
|
||||
"release": "bumpp -x \"npm run changelog\" --all --commit --tag --push && npm publish",
|
||||
"pretest": "npm run lint && npm run build",
|
||||
"test": "mocha",
|
||||
"watch": "rollup -cw"
|
||||
},
|
||||
"dependencies": {
|
||||
"sourcemap-codec": "^1.4.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-buble": "^0.21.3",
|
||||
"@rollup/plugin-node-resolve": "^13.1.3",
|
||||
"@rollup/plugin-replace": "^4.0.0",
|
||||
"bumpp": "^7.1.1",
|
||||
"conventional-changelog-cli": "^2.2.2",
|
||||
"eslint": "^7.32.0",
|
||||
"mocha": "^9.2.1",
|
||||
"prettier": "^2.5.1",
|
||||
"rollup": "^2.69.0",
|
||||
"source-map": "^0.6.1",
|
||||
"source-map-support": "^0.5.21"
|
||||
}
|
||||
}
|
||||
36
pwa/node_modules/@surma/rollup-plugin-off-main-thread/package.json
generated
vendored
Normal file
36
pwa/node_modules/@surma/rollup-plugin-off-main-thread/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"name": "@surma/rollup-plugin-off-main-thread",
|
||||
"version": "2.2.3",
|
||||
"description": "Use Rollup with workers and ES6 modules today.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"fmt": "prettier --write 'tests/**/*.js' *.js *.md *.json",
|
||||
"test": "node ./run_tests.js"
|
||||
},
|
||||
"author": "Surma <surma@google.com>",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"chai": "4.2.0",
|
||||
"chalk": "^2.4.2",
|
||||
"karma": "4.2.0",
|
||||
"karma-chai": "0.1.0",
|
||||
"karma-chrome-launcher": "3.0.0",
|
||||
"karma-firefox-launcher": "1.1.0",
|
||||
"karma-mocha": "1.3.0",
|
||||
"karma-safari-launcher": "1.0.0",
|
||||
"karma-safaritechpreview-launcher": "2.0.2",
|
||||
"mocha": "6.1.4",
|
||||
"prettier": "1.18.2",
|
||||
"rollup": "2.2.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/surma/rollup-plugin-off-main-thread"
|
||||
},
|
||||
"dependencies": {
|
||||
"ejs": "^3.1.6",
|
||||
"json5": "^2.2.0",
|
||||
"magic-string": "^0.25.0",
|
||||
"string.prototype.matchall": "^4.0.6"
|
||||
}
|
||||
}
|
||||
3
pwa/node_modules/@surma/rollup-plugin-off-main-thread/renovate.json
generated
vendored
Normal file
3
pwa/node_modules/@surma/rollup-plugin-off-main-thread/renovate.json
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": ["config:base"]
|
||||
}
|
||||
105
pwa/node_modules/@surma/rollup-plugin-off-main-thread/run_tests.js
generated
vendored
Normal file
105
pwa/node_modules/@surma/rollup-plugin-off-main-thread/run_tests.js
generated
vendored
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const rollup = require("rollup");
|
||||
const path = require("path");
|
||||
const omt = require(".");
|
||||
const fs = require("fs");
|
||||
const chalk = require("chalk");
|
||||
|
||||
const karma = require("karma");
|
||||
const myKarmaConfig = require("./karma.conf.js");
|
||||
|
||||
async function fileExists(file) {
|
||||
try {
|
||||
const stat = await fs.promises.stat(file);
|
||||
return stat.isFile();
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function init() {
|
||||
await Promise.all(
|
||||
[
|
||||
"./tests/fixtures/simple-bundle/entry.js",
|
||||
"./tests/fixtures/import-meta/entry.js",
|
||||
"./tests/fixtures/dynamic-import/entry.js",
|
||||
"./tests/fixtures/public-path/entry.js",
|
||||
"./tests/fixtures/worker/entry.js",
|
||||
"./tests/fixtures/module-worker/entry.js",
|
||||
"./tests/fixtures/more-workers/entry.js",
|
||||
"./tests/fixtures/amd-function-name/entry.js",
|
||||
"./tests/fixtures/single-default/entry.js",
|
||||
"./tests/fixtures/import-worker-url/entry.js",
|
||||
"./tests/fixtures/import-meta-worker/entry.js",
|
||||
"./tests/fixtures/import-worker-url-custom-scheme/entry.js",
|
||||
"./tests/fixtures/assets-in-worker/entry.js",
|
||||
"./tests/fixtures/url-import-meta-worker/entry.js"
|
||||
].map(async input => {
|
||||
const pathName = path.dirname(input);
|
||||
const outputOptions = {
|
||||
dir: path.join(pathName, "build"),
|
||||
format: "amd"
|
||||
};
|
||||
let rollupConfig = {
|
||||
input,
|
||||
strictDeprecations: true,
|
||||
// Copied / adapted from default `onwarn` in Rollup CLI.
|
||||
onwarn: warning => {
|
||||
console.warn(`⚠️ ${chalk.bold(warning.message)}`);
|
||||
|
||||
if (warning.url) {
|
||||
console.warn(chalk.cyan(warning.url));
|
||||
}
|
||||
|
||||
if (warning.loc) {
|
||||
console.warn(
|
||||
`${warning.loc.file} (${warning.loc.line}:${warning.loc.column})`
|
||||
);
|
||||
}
|
||||
|
||||
if (warning.frame) {
|
||||
console.warn(chalk.dim(warning.frame));
|
||||
}
|
||||
|
||||
console.warn("");
|
||||
}
|
||||
};
|
||||
const rollupConfigPath = "./" + path.join(pathName, "rollup.config.js");
|
||||
const configPath = "./" + path.join(pathName, "config.json");
|
||||
if (await fileExists(rollupConfigPath)) {
|
||||
require(rollupConfigPath)(rollupConfig, outputOptions, omt);
|
||||
} else if (await fileExists(configPath)) {
|
||||
rollupConfig.plugins = [omt(require(configPath))];
|
||||
} else {
|
||||
rollupConfig.plugins = [omt()];
|
||||
}
|
||||
const bundle = await rollup.rollup(rollupConfig);
|
||||
await bundle.write(outputOptions);
|
||||
})
|
||||
);
|
||||
|
||||
const karmaConfig = { port: 9876 };
|
||||
myKarmaConfig({
|
||||
set(config) {
|
||||
Object.assign(karmaConfig, config);
|
||||
}
|
||||
});
|
||||
const server = new karma.Server(karmaConfig, code => {
|
||||
console.log(`Karma exited with code ${code}`);
|
||||
process.exit(code);
|
||||
});
|
||||
server.start();
|
||||
}
|
||||
init();
|
||||
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/amd-function-name.test.js
generated
vendored
Normal file
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/amd-function-name.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
describe("AMD Function Name", function() {
|
||||
beforeEach(function() {
|
||||
this.ifr = document.createElement("iframe");
|
||||
document.body.append(this.ifr);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.ifr.remove();
|
||||
});
|
||||
|
||||
it("loads with a different AMD function name", function(done) {
|
||||
window.addEventListener("message", function l(ev) {
|
||||
if (ev.data === "a") {
|
||||
window.removeEventListener("message", l);
|
||||
done();
|
||||
}
|
||||
});
|
||||
this.ifr.src = "/base/tests/fixtures/amd-function-name/build/runner.html";
|
||||
});
|
||||
});
|
||||
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/asset-in-worker.test.js
generated
vendored
Normal file
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/asset-in-worker.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
describe("Assets in workers", function() {
|
||||
beforeEach(function() {
|
||||
this.ifr = document.createElement("iframe");
|
||||
document.body.append(this.ifr);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.ifr.remove();
|
||||
});
|
||||
|
||||
it("can be fetched", function(done) {
|
||||
window.addEventListener("message", function l(ev) {
|
||||
if (ev.data === "assetcontent") {
|
||||
window.removeEventListener("message", l);
|
||||
done();
|
||||
}
|
||||
});
|
||||
this.ifr.src = "/base/tests/fixtures/assets-in-worker/build/runner.html";
|
||||
});
|
||||
});
|
||||
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/dynamic-import.test.js
generated
vendored
Normal file
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/dynamic-import.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
describe("Dynamic import", function() {
|
||||
beforeEach(function() {
|
||||
this.ifr = document.createElement("iframe");
|
||||
document.body.append(this.ifr);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.ifr.remove();
|
||||
});
|
||||
|
||||
it("loads transpiled modules", function(done) {
|
||||
window.addEventListener("message", function l(ev) {
|
||||
if (ev.data === "a") {
|
||||
window.removeEventListener("message", l);
|
||||
done();
|
||||
}
|
||||
});
|
||||
this.ifr.src = "/base/tests/fixtures/dynamic-import/build/runner.html";
|
||||
});
|
||||
});
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/amd-function-name/a.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/amd-function-name/a.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default function() {
|
||||
return 4;
|
||||
}
|
||||
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/amd-function-name/build/runner.html
generated
vendored
Normal file
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/amd-function-name/build/runner.html
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!--
|
||||
Copyright 2018 Google Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!doctype html>
|
||||
<script src="entry.js"></script>
|
||||
3
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/amd-function-name/config.json
generated
vendored
Normal file
3
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/amd-function-name/config.json
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"amdFunctionName": "foo"
|
||||
}
|
||||
22
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/amd-function-name/entry.js
generated
vendored
Normal file
22
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/amd-function-name/entry.js
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import("./a.js").then(m => {
|
||||
if (m.default() != 4) {
|
||||
return;
|
||||
}
|
||||
if (!self.foo) {
|
||||
return;
|
||||
}
|
||||
window.parent.postMessage("a", "*");
|
||||
});
|
||||
1
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/assets-in-worker/build/assets/my-asset-620b911b.bin
generated
vendored
Normal file
1
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/assets-in-worker/build/assets/my-asset-620b911b.bin
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
assetcontent
|
||||
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/assets-in-worker/build/runner.html
generated
vendored
Normal file
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/assets-in-worker/build/runner.html
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!--
|
||||
Copyright 2018 Google Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!doctype html>
|
||||
<script src="entry.js"></script>
|
||||
17
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/assets-in-worker/entry.js
generated
vendored
Normal file
17
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/assets-in-worker/entry.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const w = new Worker("./worker.js");
|
||||
w.addEventListener("message", ev => {
|
||||
window.parent.postMessage(ev.data, "*");
|
||||
});
|
||||
25
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/assets-in-worker/rollup.config.js
generated
vendored
Normal file
25
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/assets-in-worker/rollup.config.js
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
const MARKER = "my-special-import";
|
||||
module.exports = (config, outputOptions, omt) => {
|
||||
config.plugins = [
|
||||
omt(),
|
||||
{
|
||||
resolveId(id) {
|
||||
if (id !== MARKER) {
|
||||
return;
|
||||
}
|
||||
return id;
|
||||
},
|
||||
load(id) {
|
||||
if (id !== MARKER) {
|
||||
return;
|
||||
}
|
||||
const referenceId = this.emitFile({
|
||||
type: "asset",
|
||||
name: "my-asset.bin",
|
||||
source: "assetcontent"
|
||||
});
|
||||
return `export default import.meta.ROLLUP_FILE_URL_${referenceId}`;
|
||||
}
|
||||
}
|
||||
];
|
||||
};
|
||||
18
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/assets-in-worker/worker.js
generated
vendored
Normal file
18
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/assets-in-worker/worker.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import url from "my-special-import";
|
||||
|
||||
fetch(url)
|
||||
.then(resp => resp.text())
|
||||
.then(text => postMessage(text));
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/dynamic-import/a.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/dynamic-import/a.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default function() {
|
||||
window.parent.postMessage("a", "*");
|
||||
}
|
||||
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/dynamic-import/build/runner.html
generated
vendored
Normal file
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/dynamic-import/build/runner.html
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!--
|
||||
Copyright 2018 Google Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!doctype html>
|
||||
<script src="entry.js"></script>
|
||||
14
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/dynamic-import/entry.js
generated
vendored
Normal file
14
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/dynamic-import/entry.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import("./a.js").then(m => m.default());
|
||||
0
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/empty.js
generated
vendored
Normal file
0
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/empty.js
generated
vendored
Normal file
12
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-meta-worker/a.js
generated
vendored
Normal file
12
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-meta-worker/a.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
let worker;
|
||||
|
||||
if (self.document) {
|
||||
worker = new Worker(import.meta.url);
|
||||
}
|
||||
if (self.postMessage) {
|
||||
setTimeout(() => {
|
||||
postMessage("a");
|
||||
}, 500);
|
||||
}
|
||||
|
||||
export { worker };
|
||||
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-meta-worker/build/runner.html
generated
vendored
Normal file
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-meta-worker/build/runner.html
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!--
|
||||
Copyright 2020 Google Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!doctype html>
|
||||
<script src="entry.js"></script>
|
||||
22
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-meta-worker/entry.js
generated
vendored
Normal file
22
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-meta-worker/entry.js
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* Copyright 2020 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { worker } from "./a.js";
|
||||
if (worker) {
|
||||
worker.addEventListener("message", ev => {
|
||||
window.parent.postMessage(ev.data, "*");
|
||||
});
|
||||
}
|
||||
// This should not get bundled into the worker module
|
||||
if (self.postMessage) {
|
||||
postMessage("xxx");
|
||||
}
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-meta/a.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-meta/a.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default function() {
|
||||
window.parent.postMessage(import.meta.url, "*");
|
||||
}
|
||||
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-meta/build/runner.html
generated
vendored
Normal file
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-meta/build/runner.html
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!--
|
||||
Copyright 2018 Google Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!doctype html>
|
||||
<script src="entry.js"></script>
|
||||
14
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-meta/entry.js
generated
vendored
Normal file
14
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-meta/entry.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import("./a.js").then(m => m.default());
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url-custom-scheme/a.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url-custom-scheme/a.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2020 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default function() {
|
||||
self.postMessage("a");
|
||||
}
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url-custom-scheme/b.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url-custom-scheme/b.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2020 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default function() {
|
||||
return 1;
|
||||
}
|
||||
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url-custom-scheme/build/runner.html
generated
vendored
Normal file
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url-custom-scheme/build/runner.html
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!--
|
||||
Copyright 2020 Google Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!doctype html>
|
||||
<script src="entry.js"></script>
|
||||
3
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url-custom-scheme/config.json
generated
vendored
Normal file
3
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url-custom-scheme/config.json
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"urlLoaderScheme": "fancy-custom-scheme"
|
||||
}
|
||||
21
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url-custom-scheme/entry.js
generated
vendored
Normal file
21
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url-custom-scheme/entry.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* Copyright 2020 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import workerURL from "fancy-custom-scheme:./worker.js";
|
||||
|
||||
// Set this, so it can be picked up in the test.
|
||||
self.workerURL = workerURL;
|
||||
|
||||
const w = new Worker(workerURL);
|
||||
w.addEventListener("message", ev => {
|
||||
window.parent.postMessage(ev.data, "*");
|
||||
});
|
||||
17
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url-custom-scheme/worker.js
generated
vendored
Normal file
17
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url-custom-scheme/worker.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Copyright 2020 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import a from "./a.js";
|
||||
|
||||
a();
|
||||
import("./b.js");
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url/a.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url/a.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2020 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default function() {
|
||||
self.postMessage("a");
|
||||
}
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url/b.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url/b.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2020 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default function() {
|
||||
return 1;
|
||||
}
|
||||
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url/build/runner.html
generated
vendored
Normal file
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url/build/runner.html
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!--
|
||||
Copyright 2020 Google Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!doctype html>
|
||||
<script src="entry.js"></script>
|
||||
21
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url/entry.js
generated
vendored
Normal file
21
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url/entry.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* Copyright 2020 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import workerURL from "omt:./worker.js";
|
||||
|
||||
// Set this, so it can be picked up in the test.
|
||||
self.workerURL = workerURL;
|
||||
|
||||
const w = new Worker(workerURL);
|
||||
w.addEventListener("message", ev => {
|
||||
window.parent.postMessage(ev.data, "*");
|
||||
});
|
||||
17
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url/worker.js
generated
vendored
Normal file
17
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/import-worker-url/worker.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Copyright 2020 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import a from "./a.js";
|
||||
|
||||
a();
|
||||
import("./b.js");
|
||||
20
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/module-worker/a.js
generated
vendored
Normal file
20
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/module-worker/a.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default async function(f) {
|
||||
self.postMessage(f());
|
||||
}
|
||||
|
||||
export function someValue() {
|
||||
return self.String("a");
|
||||
}
|
||||
20
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/module-worker/b.js
generated
vendored
Normal file
20
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/module-worker/b.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Import for side-effects (of which there are none)
|
||||
// to make sure that a.js gets its own chunk.
|
||||
import {someValue} from "./a.js";
|
||||
|
||||
export default function() {
|
||||
return someValue();
|
||||
}
|
||||
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/module-worker/build/runner.html
generated
vendored
Normal file
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/module-worker/build/runner.html
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!--
|
||||
Copyright 2018 Google Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!doctype html>
|
||||
<script src="entry.js" type="module"></script>
|
||||
17
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/module-worker/entry.js
generated
vendored
Normal file
17
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/module-worker/entry.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const w = new Worker("./worker.js", { type: "module" });
|
||||
w.addEventListener("message", ev => {
|
||||
window.parent.postMessage(ev.data, "*");
|
||||
});
|
||||
4
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/module-worker/rollup.config.js
generated
vendored
Normal file
4
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/module-worker/rollup.config.js
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = (config, outputOptions, omt) => {
|
||||
outputOptions.format = "esm";
|
||||
config.plugins = [omt()];
|
||||
};
|
||||
17
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/module-worker/worker.js
generated
vendored
Normal file
17
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/module-worker/worker.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import a from "./a.js";
|
||||
import("./b.js").then(({default: f}) => {
|
||||
a(f);
|
||||
})
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/more-workers/a.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/more-workers/a.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default function() {
|
||||
self.postMessage("a");
|
||||
}
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/more-workers/b.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/more-workers/b.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default function() {
|
||||
self.postMessage("b");
|
||||
}
|
||||
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/more-workers/build/runner.html
generated
vendored
Normal file
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/more-workers/build/runner.html
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!--
|
||||
Copyright 2018 Google Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!doctype html>
|
||||
<script src="entry.js"></script>
|
||||
34
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/more-workers/entry.js
generated
vendored
Normal file
34
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/more-workers/entry.js
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
async function run() {
|
||||
await new Promise(resolve => {
|
||||
const w = new Worker("./worker_a.js");
|
||||
w.addEventListener("message", ev => {
|
||||
if (ev.data === "a") {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
await new Promise(resolve => {
|
||||
const w = new Worker("./worker_b.js");
|
||||
w.addEventListener("message", ev => {
|
||||
if (ev.data === "b") {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
window.parent.postMessage("a", "*");
|
||||
}
|
||||
|
||||
run();
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/more-workers/worker_a.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/more-workers/worker_a.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import a from "./a.js";
|
||||
|
||||
a();
|
||||
18
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/more-workers/worker_b.js
generated
vendored
Normal file
18
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/more-workers/worker_b.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
async function run() {
|
||||
const { default: b } = await import("./b.js");
|
||||
b();
|
||||
}
|
||||
run();
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/public-path/a.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/public-path/a.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default function() {
|
||||
window.parent.postMessage("a", "*");
|
||||
}
|
||||
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/public-path/build/runner.html
generated
vendored
Normal file
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/public-path/build/runner.html
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!--
|
||||
Copyright 2018 Google Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!doctype html>
|
||||
<script src="entry.js"></script>
|
||||
3
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/public-path/config.json
generated
vendored
Normal file
3
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/public-path/config.json
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"publicPath": "/base/tests/fixtures/public-path/build"
|
||||
}
|
||||
14
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/public-path/entry.js
generated
vendored
Normal file
14
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/public-path/entry.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import("./a.js").then(m => m.default());
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/simple-bundle/a.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/simple-bundle/a.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default function() {
|
||||
window.parent.postMessage("a", "*");
|
||||
}
|
||||
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/simple-bundle/build/runner.html
generated
vendored
Normal file
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/simple-bundle/build/runner.html
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!--
|
||||
Copyright 2018 Google Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!doctype html>
|
||||
<script src="entry.js"></script>
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/simple-bundle/entry.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/simple-bundle/entry.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import A from "./a.js";
|
||||
|
||||
A();
|
||||
14
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/single-default/a.js
generated
vendored
Normal file
14
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/single-default/a.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default 4;
|
||||
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/single-default/build/runner.html
generated
vendored
Normal file
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/single-default/build/runner.html
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!--
|
||||
Copyright 2018 Google Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!doctype html>
|
||||
<script src="entry.js"></script>
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/single-default/entry.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/single-default/entry.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import A from "./a.js";
|
||||
|
||||
window.parent.postMessage(A, "*");
|
||||
17
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/url-import-meta-worker/a.js
generated
vendored
Normal file
17
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/url-import-meta-worker/a.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default async function() {
|
||||
const { default: f } = await import("./b.js");
|
||||
self.postMessage(f());
|
||||
}
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/url-import-meta-worker/b.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/url-import-meta-worker/b.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default function() {
|
||||
return "a";
|
||||
}
|
||||
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/url-import-meta-worker/build/runner.html
generated
vendored
Normal file
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/url-import-meta-worker/build/runner.html
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!--
|
||||
Copyright 2018 Google Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!doctype html>
|
||||
<script src="entry.js"></script>
|
||||
20
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/url-import-meta-worker/entry.js
generated
vendored
Normal file
20
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/url-import-meta-worker/entry.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// The type module should get removed for AMD format!
|
||||
const w = new Worker(new URL("worker.js", import.meta.url), {
|
||||
type: "module"
|
||||
});
|
||||
w.addEventListener("message", ev => {
|
||||
window.parent.postMessage(ev.data, "*");
|
||||
});
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/url-import-meta-worker/worker.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/url-import-meta-worker/worker.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import a from "./a.js";
|
||||
|
||||
a();
|
||||
17
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/worker/a.js
generated
vendored
Normal file
17
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/worker/a.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default async function() {
|
||||
const { default: f } = await import("./b.js");
|
||||
self.postMessage(f());
|
||||
}
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/worker/b.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/worker/b.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default function() {
|
||||
return "a";
|
||||
}
|
||||
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/worker/build/runner.html
generated
vendored
Normal file
15
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/worker/build/runner.html
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!--
|
||||
Copyright 2018 Google Inc. All Rights Reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!doctype html>
|
||||
<script src="entry.js"></script>
|
||||
18
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/worker/entry.js
generated
vendored
Normal file
18
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/worker/entry.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// The type module should get removed for AMD format!
|
||||
const w = new Worker("./worker.js", { type: "module" });
|
||||
w.addEventListener("message", ev => {
|
||||
window.parent.postMessage(ev.data, "*");
|
||||
});
|
||||
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/worker/worker.js
generated
vendored
Normal file
16
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/fixtures/worker/worker.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import a from "./a.js";
|
||||
|
||||
a();
|
||||
37
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/import-meta-worker.test.js
generated
vendored
Normal file
37
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/import-meta-worker.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* Copyright 2020 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
describe("omt: use import.meta.url in Worker constructor", function() {
|
||||
const runner = "/base/tests/fixtures/import-meta-worker/build/runner.html";
|
||||
|
||||
beforeEach(function() {
|
||||
this.ifr = document.createElement("iframe");
|
||||
document.body.append(this.ifr);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.ifr.remove();
|
||||
});
|
||||
|
||||
it("loads itself as a module", function(done) {
|
||||
window.addEventListener("message", function l(ev) {
|
||||
if (ev.data === "a") {
|
||||
window.removeEventListener("message", l);
|
||||
done();
|
||||
} else {
|
||||
done(`Unexpected message! ${ev.data}`);
|
||||
}
|
||||
});
|
||||
this.ifr.src = runner;
|
||||
});
|
||||
});
|
||||
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/import-meta.test.js
generated
vendored
Normal file
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/import-meta.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
describe("import.meta", function() {
|
||||
beforeEach(function() {
|
||||
this.ifr = document.createElement("iframe");
|
||||
document.body.append(this.ifr);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.ifr.remove();
|
||||
});
|
||||
|
||||
it("loads transpiled modules", function(done) {
|
||||
window.addEventListener("message", function l(ev) {
|
||||
if (/^https?:\/\/.+\.js$/.test(ev.data)) {
|
||||
window.removeEventListener("message", l);
|
||||
done();
|
||||
}
|
||||
});
|
||||
this.ifr.src = "/base/tests/fixtures/import-meta/build/runner.html";
|
||||
});
|
||||
});
|
||||
42
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/import-worker-url-custom-scheme.test.js
generated
vendored
Normal file
42
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/import-worker-url-custom-scheme.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* Copyright 2020 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
describe("omt: URL import with custom scheme", function() {
|
||||
const runner =
|
||||
"/base/tests/fixtures/import-worker-url-custom-scheme/build/runner.html";
|
||||
|
||||
beforeEach(function() {
|
||||
this.ifr = document.createElement("iframe");
|
||||
document.body.append(this.ifr);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.ifr.remove();
|
||||
});
|
||||
|
||||
it("imports as string", async function() {
|
||||
this.ifr.src = runner;
|
||||
await new Promise(resolve => this.ifr.addEventListener("load", resolve));
|
||||
assert.typeOf(this.ifr.contentWindow.workerURL, "string");
|
||||
});
|
||||
|
||||
it("loads transpiled modules", function(done) {
|
||||
window.addEventListener("message", function l(ev) {
|
||||
if (ev.data === "a") {
|
||||
window.removeEventListener("message", l);
|
||||
done();
|
||||
}
|
||||
});
|
||||
this.ifr.src = runner;
|
||||
});
|
||||
});
|
||||
41
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/import-worker-url.test.js
generated
vendored
Normal file
41
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/import-worker-url.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* Copyright 2020 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
describe("omt: URL import", function() {
|
||||
const runner = "/base/tests/fixtures/import-worker-url/build/runner.html";
|
||||
|
||||
beforeEach(function() {
|
||||
this.ifr = document.createElement("iframe");
|
||||
document.body.append(this.ifr);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.ifr.remove();
|
||||
});
|
||||
|
||||
it("imports as string", async function() {
|
||||
this.ifr.src = runner;
|
||||
await new Promise(resolve => this.ifr.addEventListener("load", resolve));
|
||||
assert.typeOf(this.ifr.contentWindow.workerURL, "string");
|
||||
});
|
||||
|
||||
it("loads transpiled modules", function(done) {
|
||||
window.addEventListener("message", function l(ev) {
|
||||
if (ev.data === "a") {
|
||||
window.removeEventListener("message", l);
|
||||
done();
|
||||
}
|
||||
});
|
||||
this.ifr.src = runner;
|
||||
});
|
||||
});
|
||||
47
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/module-worker.test.js
generated
vendored
Normal file
47
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/module-worker.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
describe("Module Worker", function() {
|
||||
const blob = new Blob([""], { type: "text/javascript" });
|
||||
const url = URL.createObjectURL(blob);
|
||||
let supportsModuleWorker = false;
|
||||
const options = {
|
||||
get type() {
|
||||
supportsModuleWorker = true;
|
||||
}
|
||||
};
|
||||
new Worker(url, options).terminate();
|
||||
URL.revokeObjectURL(url);
|
||||
|
||||
beforeEach(function() {
|
||||
if (!supportsModuleWorker) {
|
||||
return this.skip();
|
||||
}
|
||||
this.ifr = document.createElement("iframe");
|
||||
document.body.append(this.ifr);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.ifr.remove();
|
||||
});
|
||||
|
||||
it("work", function(done) {
|
||||
window.addEventListener("message", function l(ev) {
|
||||
if (ev.data === "a") {
|
||||
window.removeEventListener("message", l);
|
||||
done();
|
||||
}
|
||||
});
|
||||
this.ifr.src = "/base/tests/fixtures/module-worker/build/runner.html";
|
||||
});
|
||||
});
|
||||
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/more-workers.test.js
generated
vendored
Normal file
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/more-workers.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
describe("Worker", function() {
|
||||
beforeEach(function() {
|
||||
this.ifr = document.createElement("iframe");
|
||||
document.body.append(this.ifr);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.ifr.remove();
|
||||
});
|
||||
|
||||
it("can load multiple workers", function(done) {
|
||||
window.addEventListener("message", function l(ev) {
|
||||
if (ev.data === "a") {
|
||||
window.removeEventListener("message", l);
|
||||
done();
|
||||
}
|
||||
});
|
||||
this.ifr.src = "/base/tests/fixtures/more-workers/build/runner.html";
|
||||
});
|
||||
});
|
||||
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/public-path.test.js
generated
vendored
Normal file
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/public-path.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
describe("Public Path", function() {
|
||||
beforeEach(function() {
|
||||
this.ifr = document.createElement("iframe");
|
||||
document.body.append(this.ifr);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.ifr.remove();
|
||||
});
|
||||
|
||||
it("loads transpiled modules", function(done) {
|
||||
window.addEventListener("message", function l(ev) {
|
||||
if (ev.data === "a") {
|
||||
window.removeEventListener("message", l);
|
||||
done();
|
||||
}
|
||||
});
|
||||
this.ifr.src = "/base/tests/fixtures/public-path/build/runner.html";
|
||||
});
|
||||
});
|
||||
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/simple-bundle.test.js
generated
vendored
Normal file
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/simple-bundle.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
describe("Simple bundle", function() {
|
||||
beforeEach(function() {
|
||||
this.ifr = document.createElement("iframe");
|
||||
document.body.append(this.ifr);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.ifr.remove();
|
||||
});
|
||||
|
||||
it("loads transpiled modules", function(done) {
|
||||
window.addEventListener("message", function l(ev) {
|
||||
if (ev.data === "a") {
|
||||
window.removeEventListener("message", l);
|
||||
done();
|
||||
}
|
||||
});
|
||||
this.ifr.src = "/base/tests/fixtures/simple-bundle/build/runner.html";
|
||||
});
|
||||
});
|
||||
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/single-default.test.js
generated
vendored
Normal file
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/single-default.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
describe("Single default const export", function() {
|
||||
beforeEach(function() {
|
||||
this.ifr = document.createElement("iframe");
|
||||
document.body.append(this.ifr);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.ifr.remove();
|
||||
});
|
||||
|
||||
it("loads transpiled modules", function(done) {
|
||||
window.addEventListener("message", function l(ev) {
|
||||
if (ev.data === 4) {
|
||||
window.removeEventListener("message", l);
|
||||
done();
|
||||
}
|
||||
});
|
||||
this.ifr.src = "/base/tests/fixtures/single-default/build/runner.html";
|
||||
});
|
||||
});
|
||||
34
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/url-import-meta-worker.test.js
generated
vendored
Normal file
34
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/url-import-meta-worker.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
describe("Worker", function() {
|
||||
beforeEach(function() {
|
||||
this.ifr = document.createElement("iframe");
|
||||
document.body.append(this.ifr);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.ifr.remove();
|
||||
});
|
||||
|
||||
it("loads module-relative worker paths", function(done) {
|
||||
window.addEventListener("message", function l(ev) {
|
||||
if (ev.data === "a") {
|
||||
window.removeEventListener("message", l);
|
||||
done();
|
||||
}
|
||||
});
|
||||
this.ifr.src =
|
||||
"/base/tests/fixtures/url-import-meta-worker/build/runner.html";
|
||||
});
|
||||
});
|
||||
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/worker.test.js
generated
vendored
Normal file
33
pwa/node_modules/@surma/rollup-plugin-off-main-thread/tests/worker.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
describe("Worker", function() {
|
||||
beforeEach(function() {
|
||||
this.ifr = document.createElement("iframe");
|
||||
document.body.append(this.ifr);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.ifr.remove();
|
||||
});
|
||||
|
||||
it("loads transpiled modules", function(done) {
|
||||
window.addEventListener("message", function l(ev) {
|
||||
if (ev.data === "a") {
|
||||
window.removeEventListener("message", l);
|
||||
done();
|
||||
}
|
||||
});
|
||||
this.ifr.src = "/base/tests/fixtures/worker/build/runner.html";
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue