Skip to content

Commit

Permalink
Merge pull request #50 from jeffposnick/node-v10-compat
Browse files Browse the repository at this point in the history
  • Loading branch information
surma authored Nov 2, 2021
2 parents c967772 + 73b30cd commit 20365ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ 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`,
Expand Down Expand Up @@ -99,7 +101,7 @@ module.exports = function(opts = {}) {

const replacementPromises = [];

for (const match of code.matchAll(workerRegexpForTransform)) {
for (const match of matchAll(code, workerRegexpForTransform)) {
let [
fullMatch,
partBeforeArgs,
Expand Down Expand Up @@ -261,7 +263,7 @@ This will become a hard error in the future.`,
}
const ms = new MagicString(code);

for (const match of code.matchAll(workerRegexpForOutput)) {
for (const match of matchAll(code, workerRegexpForOutput)) {
let [fullMatch, optionsWithCommaStr, optionsStr] = match;
let options;
try {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"dependencies": {
"ejs": "^3.1.6",
"json5": "^2.2.0",
"magic-string": "^0.25.0"
"magic-string": "^0.25.0",
"string.prototype.matchall": "^4.0.6"
}
}

0 comments on commit 20365ed

Please sign in to comment.