/** * 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 `