From 7f555711104ed4efd69ac112012a86e1a41d8aed Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Thu, 30 Dec 2021 07:43:27 +0100 Subject: [PATCH 01/30] Stabilize watch tests (#4318) * Use atomic file writes * Use atomic file writes for regular watch tests * Increase timeout --- .../wait-for-bundle-input-object/_config.js | 5 +- .../samples/wait-for-bundle-input/_config.js | 3 +- .../cli/samples/watch/bundle-error/_config.js | 3 +- .../watch-config-early-update/_config.js | 3 +- .../watch/watch-config-error/_config.js | 5 +- .../watch-config-initial-error/_config.js | 3 +- .../watch/watch-config-no-update/_config.js | 3 +- test/utils.js | 11 ++ test/watch/index.js | 105 +++++++++--------- 9 files changed, 80 insertions(+), 61 deletions(-) diff --git a/test/cli/samples/wait-for-bundle-input-object/_config.js b/test/cli/samples/wait-for-bundle-input-object/_config.js index 981f3ba47a9..4bda6e35d5c 100644 --- a/test/cli/samples/wait-for-bundle-input-object/_config.js +++ b/test/cli/samples/wait-for-bundle-input-object/_config.js @@ -1,5 +1,6 @@ const fs = require('fs'); const path = require('path'); +const { atomicWriteFileSync } = require('../../../utils'); let second; let third; @@ -17,9 +18,9 @@ module.exports = { }, abortOnStderr(data) { if (data.includes('waiting for input second')) { - fs.writeFileSync(second, "export default 'second'"); + atomicWriteFileSync(second, "export default 'second'"); } else if (data.includes('waiting for input third')) { - fs.writeFileSync(third, "export default 'third'"); + atomicWriteFileSync(third, "export default 'third'"); } } }; diff --git a/test/cli/samples/wait-for-bundle-input/_config.js b/test/cli/samples/wait-for-bundle-input/_config.js index 045097c443b..64f197395b4 100644 --- a/test/cli/samples/wait-for-bundle-input/_config.js +++ b/test/cli/samples/wait-for-bundle-input/_config.js @@ -1,5 +1,6 @@ const fs = require('fs'); const path = require('path'); +const { atomicWriteFileSync } = require('../../../utils'); let mainFile; @@ -15,7 +16,7 @@ module.exports = { abortOnStderr(data) { if (data.includes('waiting for input main.js')) { // wait longer than one polling interval - setTimeout(() => fs.writeFileSync(mainFile, 'export default 42;'), 600); + setTimeout(() => atomicWriteFileSync(mainFile, 'export default 42;'), 600); } } }; diff --git a/test/cli/samples/watch/bundle-error/_config.js b/test/cli/samples/watch/bundle-error/_config.js index 7b101a1bc14..2f38a2e2407 100644 --- a/test/cli/samples/watch/bundle-error/_config.js +++ b/test/cli/samples/watch/bundle-error/_config.js @@ -1,5 +1,6 @@ const fs = require('fs'); const path = require('path'); +const { atomicWriteFileSync } = require('../../../../utils'); let mainFile; @@ -16,7 +17,7 @@ module.exports = { }, abortOnStderr(data) { if (data.includes('Error: Unexpected token')) { - setTimeout(() => fs.writeFileSync(mainFile, 'export default 42;'), 500); + setTimeout(() => atomicWriteFileSync(mainFile, 'export default 42;'), 500); return false; } if (data.includes('created _actual')) { diff --git a/test/cli/samples/watch/watch-config-early-update/_config.js b/test/cli/samples/watch/watch-config-early-update/_config.js index c13c2690ab6..d7b769c9058 100644 --- a/test/cli/samples/watch/watch-config-early-update/_config.js +++ b/test/cli/samples/watch/watch-config-early-update/_config.js @@ -1,5 +1,6 @@ const fs = require('fs'); const path = require('path'); +const { atomicWriteFileSync } = require('../../../../utils'); let configFile; @@ -34,7 +35,7 @@ module.exports = { }, abortOnStderr(data) { if (data === 'initial\n') { - fs.writeFileSync( + atomicWriteFileSync( configFile, ` console.error('updated'); diff --git a/test/cli/samples/watch/watch-config-error/_config.js b/test/cli/samples/watch/watch-config-error/_config.js index caa161f4052..149901b3e4e 100644 --- a/test/cli/samples/watch/watch-config-error/_config.js +++ b/test/cli/samples/watch/watch-config-error/_config.js @@ -1,5 +1,6 @@ const fs = require('fs'); const path = require('path'); +const { atomicWriteFileSync } = require('../../../../utils'); let configFile; @@ -25,12 +26,12 @@ module.exports = { }, abortOnStderr(data) { if (data.includes(`created _actual${path.sep}main1.js`)) { - fs.writeFileSync(configFile, 'throw new Error("Config contains errors");'); + atomicWriteFileSync(configFile, 'throw new Error("Config contains errors");'); return false; } if (data.includes('Config contains errors')) { setTimeout(() => { - fs.writeFileSync( + atomicWriteFileSync( configFile, 'export default {\n' + '\tinput: "main.js",\n' + diff --git a/test/cli/samples/watch/watch-config-initial-error/_config.js b/test/cli/samples/watch/watch-config-initial-error/_config.js index 9fd2eb4def9..d2ecd6532ec 100644 --- a/test/cli/samples/watch/watch-config-initial-error/_config.js +++ b/test/cli/samples/watch/watch-config-initial-error/_config.js @@ -1,5 +1,6 @@ const fs = require('fs'); const path = require('path'); +const { atomicWriteFileSync } = require('../../../../utils'); let configFile; @@ -16,7 +17,7 @@ module.exports = { async abortOnStderr(data) { if (data.includes('Config contains initial errors')) { await new Promise(resolve => setTimeout(resolve, 100)); - fs.writeFileSync( + atomicWriteFileSync( configFile, 'export default {\n' + '\tinput: "main.js",\n' + diff --git a/test/cli/samples/watch/watch-config-no-update/_config.js b/test/cli/samples/watch/watch-config-no-update/_config.js index 635d77d42d9..7bc29a79ab1 100644 --- a/test/cli/samples/watch/watch-config-no-update/_config.js +++ b/test/cli/samples/watch/watch-config-no-update/_config.js @@ -1,5 +1,6 @@ const fs = require('fs'); const path = require('path'); +const { atomicWriteFileSync } = require('../../../../utils'); let configFile; const configContent = @@ -23,7 +24,7 @@ module.exports = { }, abortOnStderr(data) { if (data.includes('created _actual/main.js')) { - fs.writeFileSync(configFile, configContent); + atomicWriteFileSync(configFile, configContent); return new Promise(resolve => setTimeout(() => resolve(true), 500)); } }, diff --git a/test/utils.js b/test/utils.js index beb2c60d97b..23aecff9d3a 100644 --- a/test/utils.js +++ b/test/utils.js @@ -1,4 +1,5 @@ const assert = require('assert'); +const fs = require('fs'); const path = require('path'); const fixturify = require('fixturify'); const sander = require('sander'); @@ -14,6 +15,7 @@ exports.runTestSuiteWithSamples = runTestSuiteWithSamples; exports.assertDirectoriesAreEqual = assertDirectoriesAreEqual; exports.assertFilesAreEqual = assertFilesAreEqual; exports.assertIncludes = assertIncludes; +exports.atomicWriteFileSync = atomicWriteFileSync; function normaliseError(error) { delete error.stack; @@ -220,3 +222,12 @@ function assertIncludes(actual, expected) { throw err; } } + +// Workaround a race condition in fs.writeFileSync that temporarily creates +// an empty file for a brief moment which may be read by rollup watch - even +// if the content being overwritten is identical. +function atomicWriteFileSync(filePath, contents) { + const stagingPath = filePath + '_'; + fs.writeFileSync(stagingPath, contents); + fs.renameSync(stagingPath, filePath); +} diff --git a/test/watch/index.js b/test/watch/index.js index f7d9124fb52..76a957fb634 100644 --- a/test/watch/index.js +++ b/test/watch/index.js @@ -2,6 +2,7 @@ const assert = require('assert'); const path = require('path'); const sander = require('sander'); const rollup = require('../../dist/rollup'); +const { atomicWriteFileSync } = require('../utils'); const cwd = process.cwd(); @@ -89,7 +90,7 @@ describe('rollup.watch', () => { if (triggerRestart) { triggerRestart = false; return wait(100) - .then(() => sander.writeFileSync('test/_tmp/input/main.js', 'export default 44;')) + .then(() => atomicWriteFileSync('test/_tmp/input/main.js', 'export default 44;')) .then(() => wait(100)) .then(() => code); } @@ -110,7 +111,7 @@ describe('rollup.watch', () => { () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 42); triggerRestart = true; - sander.writeFileSync('test/_tmp/input/main.js', 'export default 43;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 43;'); }, 'START', 'BUNDLE_START', @@ -160,7 +161,7 @@ describe('rollup.watch', () => { 'END', () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 42); - sander.writeFileSync( + atomicWriteFileSync( 'test/_tmp/input/main.js', "import {value} from 'virtual';\nexport default value + 1;" ); @@ -203,7 +204,7 @@ describe('rollup.watch', () => { () => { watchChangeCnt = 0; assert.strictEqual(run('../_tmp/output/bundle.js'), 42); - sander.writeFileSync('test/_tmp/input/main.js', 'export default 43;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 43;'); }, 'START', 'BUNDLE_START', @@ -212,7 +213,7 @@ describe('rollup.watch', () => { () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 43); assert.strictEqual(watchChangeCnt, 1); - sander.writeFileSync('test/_tmp/input/main.js', 'export default 43;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 43;'); }, 'START', 'BUNDLE_START', @@ -221,7 +222,7 @@ describe('rollup.watch', () => { () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 43); assert.strictEqual(watchChangeCnt, 2); - sander.writeFileSync('test/_tmp/input/main.js', 'export default 43;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 43;'); }, 'START', 'BUNDLE_START', @@ -272,7 +273,7 @@ describe('rollup.watch', () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 42); assert.deepStrictEqual(events, []); assert.deepStrictEqual(ids, expectedIds); - sander.writeFileSync(WATCHED_ID, 'first'); + atomicWriteFileSync(WATCHED_ID, 'first'); }, 'START', 'BUNDLE_START', @@ -282,7 +283,7 @@ describe('rollup.watch', () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 42); assert.deepStrictEqual(events, ['create']); assert.deepStrictEqual(ids, expectedIds); - sander.writeFileSync(WATCHED_ID, 'first'); + atomicWriteFileSync(WATCHED_ID, 'first'); }, 'START', 'BUNDLE_START', @@ -320,7 +321,7 @@ describe('rollup.watch', () => { exports: 'auto' }, watch: { - buildDelay: 300, + buildDelay: 600, chokidar: { atomic: false } @@ -345,7 +346,7 @@ describe('rollup.watch', () => { 'END', async () => { assert.strictEqual(lastEvent, null); - sander.writeFileSync(WATCHED_ID, 'another'); + atomicWriteFileSync(WATCHED_ID, 'another'); await wait(100); sander.unlinkSync(WATCHED_ID); }, @@ -356,11 +357,11 @@ describe('rollup.watch', () => { async () => { assert.strictEqual(lastEvent, 'delete'); lastEvent = null; - sander.writeFileSync(WATCHED_ID, '123'); + atomicWriteFileSync(WATCHED_ID, '123'); await wait(100); sander.unlinkSync(WATCHED_ID); // To ensure there is always another change to trigger a rebuild - sander.writeFileSync(MAIN_ID, 'export default 43;'); + atomicWriteFileSync(MAIN_ID, 'export default 43;'); }, 'START', 'BUNDLE_START', @@ -368,9 +369,9 @@ describe('rollup.watch', () => { 'END', async () => { assert.strictEqual(lastEvent, null); - sander.writeFileSync(WATCHED_ID, '123'); + atomicWriteFileSync(WATCHED_ID, '123'); await wait(100); - sander.writeFileSync(WATCHED_ID, 'asd'); + atomicWriteFileSync(WATCHED_ID, 'asd'); }, 'START', 'BUNDLE_START', @@ -459,7 +460,7 @@ describe('rollup.watch', () => { () => { assert.strictEqual(run('../_tmp/output/main1.js'), 21); assert.strictEqual(run('../_tmp/output/main2.js'), 42); - sander.writeFileSync('test/_tmp/input/shared.js', 'export const value = 22;'); + atomicWriteFileSync('test/_tmp/input/shared.js', 'export const value = 22;'); }, 'START', 'BUNDLE_START', @@ -498,7 +499,7 @@ describe('rollup.watch', () => { () => { assert.strictEqual(run('../_tmp/output/_main_1.js'), 21); assert.strictEqual(run('../_tmp/output/subfolder/_main_2.js'), 42); - sander.writeFileSync('test/_tmp/input/shared.js', 'export const value = 22;'); + atomicWriteFileSync('test/_tmp/input/shared.js', 'export const value = 22;'); }, 'START', 'BUNDLE_START', @@ -533,13 +534,13 @@ describe('rollup.watch', () => { 'END', () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 42); - sander.writeFileSync('test/_tmp/input/main.js', 'export nope;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export nope;'); }, 'START', 'BUNDLE_START', 'ERROR', () => { - sander.writeFileSync('test/_tmp/input/main.js', 'export default 43;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 43;'); }, 'START', 'BUNDLE_START', @@ -572,7 +573,7 @@ describe('rollup.watch', () => { 'ERROR', () => { assert.strictEqual(sander.existsSync('../_tmp/output/bundle.js'), false); - sander.writeFileSync('test/_tmp/input/main.js', 'export default 43;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 43;'); }, 'START', 'BUNDLE_START', @@ -613,7 +614,7 @@ describe('rollup.watch', () => { 'ERROR', () => { assert.strictEqual(sander.existsSync('../_tmp/output/bundle.js'), false); - sander.writeFileSync('test/_tmp/input/main.js', 'export default 43;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 43;'); }, 'START', 'BUNDLE_START', @@ -648,14 +649,14 @@ describe('rollup.watch', () => { () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 42); sander.unlinkSync('test/_tmp/input/main.js'); - sander.writeFileSync('test/_tmp/input/main.js', 'export nope;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export nope;'); }, 'START', 'BUNDLE_START', 'ERROR', () => { sander.unlinkSync('test/_tmp/input/main.js'); - sander.writeFileSync('test/_tmp/input/main.js', 'export default 43;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 43;'); }, 'START', 'BUNDLE_START', @@ -690,14 +691,14 @@ describe('rollup.watch', () => { () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 43); sander.unlinkSync('test/_tmp/input/dep.js'); - sander.writeFileSync('test/_tmp/input/dep.js', 'export nope;'); + atomicWriteFileSync('test/_tmp/input/dep.js', 'export nope;'); }, 'START', 'BUNDLE_START', 'ERROR', () => { sander.unlinkSync('test/_tmp/input/dep.js'); - sander.writeFileSync('test/_tmp/input/dep.js', 'export const value = 43;'); + atomicWriteFileSync('test/_tmp/input/dep.js', 'export const value = 43;'); }, 'START', 'BUNDLE_START', @@ -735,7 +736,7 @@ describe('rollup.watch', () => { 'START', 'BUNDLE_START', () => { - sander.writeFileSync('test/_tmp/input/main.js', 'export default 44;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 44;'); return wait(400).then(() => assert.deepStrictEqual(events, ['START', 'BUNDLE_START'])); } ]); @@ -767,7 +768,7 @@ describe('rollup.watch', () => { 'START', 'BUNDLE_START', () => { - sander.writeFileSync('test/_tmp/input/main.js', 'export default 44;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 44;'); return wait(400).then(() => assert.deepStrictEqual(events, ['START', 'BUNDLE_START'])); } ]); @@ -795,7 +796,7 @@ describe('rollup.watch', () => { 'END', () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 43); - sander.writeFileSync('test/_tmp/input/main.js', 'export default 42;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 42;'); }, 'START', 'BUNDLE_START', @@ -807,7 +808,7 @@ describe('rollup.watch', () => { watcher.once('event', event => { unexpectedEvent = event; }); - sander.writeFileSync('test/_tmp/input/dep.js', '= invalid'); + atomicWriteFileSync('test/_tmp/input/dep.js', '= invalid'); return wait(400).then(() => assert.strictEqual(unexpectedEvent, false)); } ]); @@ -835,14 +836,14 @@ describe('rollup.watch', () => { 'END', () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 42); - sander.writeFileSync('test/_tmp/input/main.js', `import '../output/bundle.js'`); + atomicWriteFileSync('test/_tmp/input/main.js', `import '../output/bundle.js'`); }, 'START', 'BUNDLE_START', 'ERROR', event => { assert.strictEqual(event.error.message, 'Cannot import the generated bundle'); - sander.writeFileSync('test/_tmp/input/main.js', 'export default 43;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 43;'); }, 'START', 'BUNDLE_START', @@ -882,7 +883,7 @@ describe('rollup.watch', () => { foo: 'foo-1', bar: 'bar-1' }); - sander.writeFileSync('test/_tmp/input/foo.js', `export default 'foo-2';`); + atomicWriteFileSync('test/_tmp/input/foo.js', `export default 'foo-2';`); }, 'START', 'BUNDLE_START', @@ -897,7 +898,7 @@ describe('rollup.watch', () => { watcher.once('event', event => { unexpectedEvent = event; }); - sander.writeFileSync('test/_tmp/input/bar.js', "export default 'bar-2';"); + atomicWriteFileSync('test/_tmp/input/bar.js', "export default 'bar-2';"); return wait(400).then(() => { assert.deepStrictEqual(run('../_tmp/output/bundle.js'), { foo: 'foo-2', @@ -937,7 +938,7 @@ describe('rollup.watch', () => { foo: 'foo-1', bar: 'bar-1' }); - sander.writeFileSync('test/_tmp/input/foo.js', `export default 'foo-2';`); + atomicWriteFileSync('test/_tmp/input/foo.js', `export default 'foo-2';`); }, 'START', 'BUNDLE_START', @@ -952,7 +953,7 @@ describe('rollup.watch', () => { watcher.once('event', event => { unexpectedEvent = event; }); - sander.writeFileSync('test/_tmp/input/bar.js', "export default 'bar-2';"); + atomicWriteFileSync('test/_tmp/input/bar.js', "export default 'bar-2';"); return wait(400).then(() => { assert.deepStrictEqual(run('../_tmp/output/bundle.js'), { foo: 'foo-2', @@ -1000,7 +1001,7 @@ describe('rollup.watch', () => { () => { assert.deepStrictEqual(run('../_tmp/output/bundle1.js'), 42); assert.deepStrictEqual(run('../_tmp/output/bundle2.js'), 43); - sander.writeFileSync('test/_tmp/input/main2.js', 'export default 44'); + atomicWriteFileSync('test/_tmp/input/main2.js', 'export default 44'); }, 'START', 'BUNDLE_START', @@ -1113,7 +1114,7 @@ describe('rollup.watch', () => { 'END', () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 42); - sander.writeFileSync('test/_tmp/input/[foo]/bar.js', `export const bar = 43;`); + atomicWriteFileSync('test/_tmp/input/[foo]/bar.js', `export const bar = 43;`); }, 'START', 'BUNDLE_START', @@ -1155,7 +1156,7 @@ describe('rollup.watch', () => { sander.rimrafSync('test/_tmp/output'); // this should only update the hash of that particular entry point - sander.writeFileSync( + atomicWriteFileSync( 'test/_tmp/input/main-static.js', "import {value} from './shared';\nexport default 2 * value;" ); @@ -1175,7 +1176,7 @@ describe('rollup.watch', () => { staticName = newStaticName; // this should update all hashes - sander.writeFileSync('test/_tmp/input/shared.js', 'export const value = 42;'); + atomicWriteFileSync('test/_tmp/input/shared.js', 'export const value = 42;'); }, 'START', 'BUNDLE_START', @@ -1227,13 +1228,13 @@ describe('rollup.watch', () => { 'END', () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 42); - sander.writeFileSync('test/_tmp/input/main.js', 'export default "broken";'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default "broken";'); }, 'START', 'BUNDLE_START', 'ERROR', () => { - sander.writeFileSync('test/_tmp/input/main.js', INITIAL_CONTENT); + atomicWriteFileSync('test/_tmp/input/main.js', INITIAL_CONTENT); }, 'START', 'BUNDLE_START', @@ -1277,7 +1278,7 @@ describe('rollup.watch', () => { () => { watchChangeCnt = 0; assert.strictEqual(sander.existsSync('../_tmp/output/bundle.js'), false); - sander.writeFileSync('test/_tmp/input/main.js', 'export default 43;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 43;'); }, 'START', 'BUNDLE_START', @@ -1286,7 +1287,7 @@ describe('rollup.watch', () => { () => { assert.strictEqual(sander.existsSync('../_tmp/output/bundle.js'), false); assert.strictEqual(watchChangeCnt, 1); - sander.writeFileSync('test/_tmp/input/main.js', 'export default 43;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 43;'); }, 'START', 'BUNDLE_START', @@ -1295,7 +1296,7 @@ describe('rollup.watch', () => { () => { assert.strictEqual(sander.existsSync('../_tmp/output/bundle.js'), false); assert.strictEqual(watchChangeCnt, 2); - sander.writeFileSync('test/_tmp/input/main.js', 'export default 43;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 43;'); }, 'START', 'BUNDLE_START', @@ -1332,7 +1333,7 @@ describe('rollup.watch', () => { 'END', () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 42); - sander.writeFileSync('test/_tmp/input/main.js', 'export default 43;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 43;'); startTime = process.hrtime(); }, 'START', @@ -1406,7 +1407,7 @@ describe('rollup.watch', () => { 'END', () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 42); - sander.writeFileSync('test/_tmp/input/main.js', 'export default 43;'); + atomicWriteFileSync('test/_tmp/input/main.js', 'export default 43;'); startTime = process.hrtime(); }, 'START', @@ -1517,7 +1518,7 @@ describe('rollup.watch', () => { 'END', () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 'initial'); - sander.writeFileSync(WATCHED_ID, 'next'); + atomicWriteFileSync(WATCHED_ID, 'next'); }, 'START', 'BUNDLE_START', @@ -1581,7 +1582,7 @@ describe('rollup.watch', () => { () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 'initial'); addWatchFile = false; - sander.writeFileSync(WATCHED_ID, 'next'); + atomicWriteFileSync(WATCHED_ID, 'next'); }, 'START', 'BUNDLE_START', @@ -1589,7 +1590,7 @@ describe('rollup.watch', () => { 'END', () => { assert.strictEqual(run('../_tmp/output/bundle.js'), 'next'); - sander.writeFileSync(WATCHED_ID, 'other'); + atomicWriteFileSync(WATCHED_ID, 'other'); events.length = 0; return wait(400).then(() => assert.deepStrictEqual(events, [])); } @@ -1630,7 +1631,7 @@ describe('rollup.watch', () => { run('../_tmp/output/bundle.js'), `dep1: "export default 'dep2';", dep2: "dep2"` ); - sander.writeFileSync('test/_tmp/input/dep2.js', 'export default "next";'); + atomicWriteFileSync('test/_tmp/input/dep2.js', 'export default "next";'); }, 'START', 'BUNDLE_START', @@ -1715,7 +1716,7 @@ describe('rollup.watch', () => { 'END', () => { assert.strictEqual(run('../_tmp/output/bundle.js'), false); - sander.writeFileSync('test/_tmp/input/dep', ''); + atomicWriteFileSync('test/_tmp/input/dep', ''); }, 'START', 'BUNDLE_START', @@ -1764,7 +1765,7 @@ describe('rollup.watch', () => { 'END', () => { assert.strictEqual(run('../_tmp/output/bundle.js'), false); - sander.writeFileSync('test/_tmp/input/dep', ''); + atomicWriteFileSync('test/_tmp/input/dep', ''); }, 'START', 'BUNDLE_START', @@ -1812,7 +1813,7 @@ describe('rollup.watch', () => { 'END', () => { assert.strictEqual(transformRuns, 1); - sander.writeFileSync('test/_tmp/input/alsoWatched', 'next'); + atomicWriteFileSync('test/_tmp/input/alsoWatched', 'next'); }, 'START', 'BUNDLE_START', From ba7fc533ee7ce1d31f2b7800e2402a958f8ae9c9 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Tue, 4 Jan 2022 07:05:55 +0100 Subject: [PATCH 02/30] Do not watch unless --watch is specified explicitly (#4335) --- cli/run/index.ts | 3 ++- src/utils/options/mergeOptions.ts | 20 ++++++++++++++----- src/utils/options/options.ts | 5 ++++- .../watch/no-watch-by-default/_config.js | 12 +++++++++++ .../samples/watch/no-watch-by-default/main.js | 1 + .../no-watch-by-default/rollup.config.js | 9 +++++++++ .../watch/no-watch-by-default/wrapper.js | 5 +++++ 7 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 test/cli/samples/watch/no-watch-by-default/_config.js create mode 100644 test/cli/samples/watch/no-watch-by-default/main.js create mode 100644 test/cli/samples/watch/no-watch-by-default/rollup.config.js create mode 100755 test/cli/samples/watch/no-watch-by-default/wrapper.js diff --git a/cli/run/index.ts b/cli/run/index.ts index 6ff743c79f8..ed4478fa6d4 100644 --- a/cli/run/index.ts +++ b/cli/run/index.ts @@ -1,4 +1,5 @@ import { MergedRollupOptions } from '../../src/rollup/types'; +import { isWatchEnabled } from '../../src/utils/options/mergeOptions'; import { getAliasName } from '../../src/utils/relativeId'; import { loadFsEvents } from '../../src/watch/fsevents-importer'; import { handleError } from '../logging'; @@ -56,7 +57,7 @@ export default async function runRollup(command: Record): Promise Record | undefined = value => - (typeof value === 'object' ? value : {}) as Record | undefined + objectifyValue = objectifyOption ) => { const commandOption = normalizeObjectOptionValue(overrides[name], objectifyValue); const configOption = normalizeObjectOptionValue(config[name], objectifyValue); @@ -182,8 +182,18 @@ const getObjectOption = ( return configOption; }; -const getWatch = (config: GenericConfigObject, overrides: GenericConfigObject, name: string) => - config.watch !== false && getObjectOption(config, overrides, name); +export const getWatch = (config: GenericConfigObject, overrides: GenericConfigObject) => + config.watch !== false && getObjectOption(config, overrides, 'watch'); + +export const isWatchEnabled = (optionValue: unknown): boolean => { + if (Array.isArray(optionValue)) { + return optionValue.reduce( + (result, value) => (typeof value === 'boolean' ? value : result), + false + ); + } + return optionValue === true; +}; export const normalizeObjectOptionValue = ( optionValue: unknown, diff --git a/src/utils/options/options.ts b/src/utils/options/options.ts index d6555064c63..cfcf75b9306 100644 --- a/src/utils/options/options.ts +++ b/src/utils/options/options.ts @@ -94,6 +94,9 @@ type ObjectOptionWithPresets = | Partial | Partial; +export const objectifyOption = (value: unknown): Record => + value && typeof value === 'object' ? (value as Record) : {}; + export const objectifyOptionWithPresets = ( presets: Record, @@ -117,7 +120,7 @@ export const objectifyOptionWithPresets = ) ); } - return value && typeof value === 'object' ? (value as Record) : {}; + return objectifyOption(value); }; export const getOptionWithPreset = ( diff --git a/test/cli/samples/watch/no-watch-by-default/_config.js b/test/cli/samples/watch/no-watch-by-default/_config.js new file mode 100644 index 00000000000..b43ee5fbb19 --- /dev/null +++ b/test/cli/samples/watch/no-watch-by-default/_config.js @@ -0,0 +1,12 @@ +const { assertIncludes } = require('../../../../utils'); + +module.exports = { + description: 'does not watch if --watch is missing', + command: 'node wrapper.js -c --no-watch.clearScreen', + stderr: stderr => assertIncludes(stderr, 'main.js → _actual.js...\ncreated _actual.js in'), + abortOnStderr(data) { + if (data.includes('waiting for changes')) { + throw new Error('Watch initiated'); + } + } +}; diff --git a/test/cli/samples/watch/no-watch-by-default/main.js b/test/cli/samples/watch/no-watch-by-default/main.js new file mode 100644 index 00000000000..7a4e8a723a4 --- /dev/null +++ b/test/cli/samples/watch/no-watch-by-default/main.js @@ -0,0 +1 @@ +export default 42; diff --git a/test/cli/samples/watch/no-watch-by-default/rollup.config.js b/test/cli/samples/watch/no-watch-by-default/rollup.config.js new file mode 100644 index 00000000000..161653a6b43 --- /dev/null +++ b/test/cli/samples/watch/no-watch-by-default/rollup.config.js @@ -0,0 +1,9 @@ +export default [ + { + input: 'main.js', + output: { + file: '_actual.js', + format: 'es', + }, + } +]; diff --git a/test/cli/samples/watch/no-watch-by-default/wrapper.js b/test/cli/samples/watch/no-watch-by-default/wrapper.js new file mode 100755 index 00000000000..8f733cc8815 --- /dev/null +++ b/test/cli/samples/watch/no-watch-by-default/wrapper.js @@ -0,0 +1,5 @@ +#!/usr/bin/env node + +process.stdout.isTTY = true; +process.stderr.isTTY = true; +require('../../../../../dist/bin/rollup'); From 3943111a6c8173b3e047ea213f508274c67a41d9 Mon Sep 17 00:00:00 2001 From: dnalborczyk Date: Tue, 4 Jan 2022 01:14:07 -0500 Subject: [PATCH 03/30] refactor: convert utils.transform to async function (#4333) * refactor: convert utils.transform to async function * initialize plugin name --- src/utils/transform.ts | 49 ++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/utils/transform.ts b/src/utils/transform.ts index 5821d636a07..16ea7de1319 100644 --- a/src/utils/transform.ts +++ b/src/utils/transform.ts @@ -21,7 +21,7 @@ import { decodedSourcemap } from './decodedSourcemap'; import { augmentCodeLocation, errNoTransformMapOrAstWithoutCode } from './error'; import { throwPluginError } from './pluginUtils'; -export default function transform( +export default async function transform( source: SourceDescription, module: Module, pluginDriver: PluginDriver, @@ -37,7 +37,7 @@ export default function transform( const emittedFiles: EmittedFile[] = []; let customTransformCache = false; const useCustomTransformCache = () => (customTransformCache = true); - let curPlugin: Plugin; + let pluginName = ''; const curSource: string = source.code; function transformReducer( @@ -77,13 +77,15 @@ export default function transform( return code; } - return pluginDriver - .hookReduceArg0( + let code: string; + + try { + code = await pluginDriver.hookReduceArg0( 'transform', [curSource, id], transformReducer, (pluginContext, plugin): TransformPluginContext => { - curPlugin = plugin; + pluginName = plugin.name; return { ...pluginContext, addWatchFile(id: string) { @@ -149,23 +151,24 @@ export default function transform( } }; } - ) - .catch(err => throwPluginError(err, curPlugin.name, { hook: 'transform', id })) - .then(code => { - if (!customTransformCache) { - // files emitted by a transform hook need to be emitted again if the hook is skipped - if (emittedFiles.length) module.transformFiles = emittedFiles; - } + ); + } catch (err: any) { + throwPluginError(err, pluginName, { hook: 'transform', id }); + } + + if (!customTransformCache) { + // files emitted by a transform hook need to be emitted again if the hook is skipped + if (emittedFiles.length) module.transformFiles = emittedFiles; + } - return { - ast, - code, - customTransformCache, - meta: module.info.meta, - originalCode, - originalSourcemap, - sourcemapChain, - transformDependencies - }; - }); + return { + ast, + code, + customTransformCache, + meta: module.info.meta, + originalCode, + originalSourcemap, + sourcemapChain, + transformDependencies + }; } From 342ba2c17bb47642d52a0ae0beda46822128a218 Mon Sep 17 00:00:00 2001 From: dnalborczyk Date: Tue, 4 Jan 2022 01:17:55 -0500 Subject: [PATCH 04/30] feat: add support for Array.prototype.findLast,findLastIndex (#4332) --- src/ast/nodes/shared/ArrayPrototype.ts | 2 ++ .../builtin-prototypes/array-expression/_expected.js | 8 ++++++++ .../builtin-prototypes/array-expression/main.js | 12 ++++++++++++ 3 files changed, 22 insertions(+) diff --git a/src/ast/nodes/shared/ArrayPrototype.ts b/src/ast/nodes/shared/ArrayPrototype.ts index 65efb82ea17..a1a1d3d6912 100644 --- a/src/ast/nodes/shared/ArrayPrototype.ts +++ b/src/ast/nodes/shared/ArrayPrototype.ts @@ -128,6 +128,8 @@ export const ARRAY_PROTOTYPE = new ObjectEntity( filter: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY, find: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN, findIndex: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NUMBER, + findLast: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN, + findLastIndex: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NUMBER, flat: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY, flatMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY, forEach: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN, diff --git a/test/form/samples/builtin-prototypes/array-expression/_expected.js b/test/form/samples/builtin-prototypes/array-expression/_expected.js index f6f62d2d5fe..4fea44f0ad9 100644 --- a/test/form/samples/builtin-prototypes/array-expression/_expected.js +++ b/test/form/samples/builtin-prototypes/array-expression/_expected.js @@ -35,10 +35,18 @@ _filterArray[0].effect(); const _findArray = [{ effect() {} }]; _findArray.find(element => (element.effect = () => console.log(1))); _findArray[0].effect(); +[1].findLast(() => console.log(1) || true); +const _findLastArray = [{ effect() {} }]; +_findLastArray.findLast(element => (element.effect = () => console.log(1))); +_findLastArray[0].effect(); [1].findIndex(() => console.log(1) || true); const _findIndexArray = [{ effect() {} }]; _findIndexArray.findIndex(element => (element.effect = () => console.log(1))); _findIndexArray[0].effect(); +[1].findLastIndex(() => console.log(1) || true); +const _findLastIndexArray = [{ effect() {} }]; +_findLastIndexArray.findLastIndex(element => (element.effect = () => console.log(1))); +_findLastIndexArray[0].effect(); [1].flatMap(() => console.log(1) || 1); const _flatMapArray = [{ effect() {} }]; _flatMapArray.flatMap(element => (element.effect = () => console.log(1))); diff --git a/test/form/samples/builtin-prototypes/array-expression/main.js b/test/form/samples/builtin-prototypes/array-expression/main.js index ae082e12d64..3cf1b47ca43 100644 --- a/test/form/samples/builtin-prototypes/array-expression/main.js +++ b/test/form/samples/builtin-prototypes/array-expression/main.js @@ -74,12 +74,24 @@ const _findArray = [{ effect() {} }]; _findArray.find(element => (element.effect = () => console.log(1))); _findArray[0].effect(); +const _findLast = [1].findLast(() => true); +const _findLastEffect = [1].findLast(() => console.log(1) || true); +const _findLastArray = [{ effect() {} }]; +_findLastArray.findLast(element => (element.effect = () => console.log(1))); +_findLastArray[0].effect(); + const _findIndex = [1].findIndex(() => true).toPrecision(1); const _findIndexEffect = [1].findIndex(() => console.log(1) || true); const _findIndexArray = [{ effect() {} }]; _findIndexArray.findIndex(element => (element.effect = () => console.log(1))); _findIndexArray[0].effect(); +const _findLastIndex = [1].findLastIndex(() => true).toPrecision(1); +const _findLastIndexEffect = [1].findLastIndex(() => console.log(1) || true); +const _findLastIndexArray = [{ effect() {} }]; +_findLastIndexArray.findLastIndex(element => (element.effect = () => console.log(1))); +_findLastIndexArray[0].effect(); + const _flatMap = [1].flatMap(() => 1).join(','); const _flatMapEffect = [1].flatMap(() => console.log(1) || 1); const _flatMapArray = [{ effect() {} }]; From a54b798db5cc10c2bd519f830e39ce6348f65c96 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Tue, 4 Jan 2022 07:18:27 +0100 Subject: [PATCH 05/30] Improve JS docs example (#4331) --- docs/02-javascript-api.md | 134 +++++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 58 deletions(-) diff --git a/docs/02-javascript-api.md b/docs/02-javascript-api.md index bd1542a6368..59cf967ebbd 100755 --- a/docs/02-javascript-api.md +++ b/docs/02-javascript-api.md @@ -13,71 +13,89 @@ On a `bundle` object, you can call `bundle.generate` multiple times with differe Once you're finished with the `bundle` object, you should call `bundle.close()`, which will let plugins clean up their external processes or services via the [`closeBundle`](guide/en/#closebundle) hook. ```javascript -const rollup = require('rollup'); +import { rollup } from 'rollup'; -// see below for details on the options +// see below for details on these options const inputOptions = {...}; -const outputOptions = {...}; -async function build() { - // create a bundle - const bundle = await rollup.rollup(inputOptions); - - console.log(bundle.watchFiles); // an array of file names this bundle depends on - - // generate output specific code in-memory - // you can call this function multiple times on the same bundle object - const { output } = await bundle.generate(outputOptions); - - for (const chunkOrAsset of output) { - if (chunkOrAsset.type === 'asset') { - // For assets, this contains - // { - // fileName: string, // the asset file name - // source: string | Uint8Array // the asset source - // type: 'asset' // signifies that this is an asset - // } - console.log('Asset', chunkOrAsset); - } else { - // For chunks, this contains - // { - // code: string, // the generated JS code - // dynamicImports: string[], // external modules imported dynamically by the chunk - // exports: string[], // exported variable names - // facadeModuleId: string | null, // the id of a module that this chunk corresponds to - // fileName: string, // the chunk file name - // implicitlyLoadedBefore: string[]; // entries that should only be loaded after this chunk - // imports: string[], // external modules imported statically by the chunk - // importedBindings: {[imported: string]: string[]} // imported bindings per dependency - // isDynamicEntry: boolean, // is this chunk a dynamic entry point - // isEntry: boolean, // is this chunk a static entry point - // isImplicitEntry: boolean, // should this chunk only be loaded after other chunks - // map: string | null, // sourcemaps if present - // modules: { // information about the modules in this chunk - // [id: string]: { - // renderedExports: string[]; // exported variable names that were included - // removedExports: string[]; // exported variable names that were removed - // renderedLength: number; // the length of the remaining code in this module - // originalLength: number; // the original length of the code in this module - // code: string | null; // remaining code in this module - // }; - // }, - // name: string // the name of this chunk as used in naming patterns - // referencedFiles: string[] // files referenced via import.meta.ROLLUP_FILE_URL_ - // type: 'chunk', // signifies that this is a chunk - // } - console.log('Chunk', chunkOrAsset.modules); - } - } +// you can create multiple outputs from the same input to generate e.g. +// different formats like CommonJS and ESM +const outputOptionsList = [{...}, {...}]; - // or write the bundle to disk - await bundle.write(outputOptions); +build(); - // closes the bundle - await bundle.close(); +async function build() { + let bundle; + let buildFailed = false; + try { + // create a bundle + const bundle = await rollup(inputOptions); + + // an array of file names this bundle depends on + console.log(bundle.watchFiles); + + await generateOutputs(bundle); + } catch (error) { + buildFailed = true; + // do some error reporting + console.error(error); + } + if (bundle) { + // closes the bundle + await bundle.close(); + } + process.exit(buildFailed ? 1 : 0); } -build(); +async function generateOutputs(bundle) { + for (const outputOptions of outputOptionsList) { + // generate output specific code in-memory + // you can call this function multiple times on the same bundle object + // replace bundle.generate with bundle.write to directly write to disk + const { output } = await bundle.generate(outputOptions); + + for (const chunkOrAsset of output) { + if (chunkOrAsset.type === 'asset') { + // For assets, this contains + // { + // fileName: string, // the asset file name + // source: string | Uint8Array // the asset source + // type: 'asset' // signifies that this is an asset + // } + console.log('Asset', chunkOrAsset); + } else { + // For chunks, this contains + // { + // code: string, // the generated JS code + // dynamicImports: string[], // external modules imported dynamically by the chunk + // exports: string[], // exported variable names + // facadeModuleId: string | null, // the id of a module that this chunk corresponds to + // fileName: string, // the chunk file name + // implicitlyLoadedBefore: string[]; // entries that should only be loaded after this chunk + // imports: string[], // external modules imported statically by the chunk + // importedBindings: {[imported: string]: string[]} // imported bindings per dependency + // isDynamicEntry: boolean, // is this chunk a dynamic entry point + // isEntry: boolean, // is this chunk a static entry point + // isImplicitEntry: boolean, // should this chunk only be loaded after other chunks + // map: string | null, // sourcemaps if present + // modules: { // information about the modules in this chunk + // [id: string]: { + // renderedExports: string[]; // exported variable names that were included + // removedExports: string[]; // exported variable names that were removed + // renderedLength: number; // the length of the remaining code in this module + // originalLength: number; // the original length of the code in this module + // code: string | null; // remaining code in this module + // }; + // }, + // name: string // the name of this chunk as used in naming patterns + // referencedFiles: string[] // files referenced via import.meta.ROLLUP_FILE_URL_ + // type: 'chunk', // signifies that this is a chunk + // } + console.log('Chunk', chunkOrAsset.modules); + } + } + } +} ``` #### inputOptions object From 2fea0d7ca1482dd8f585c1839a2727aeed677ecb Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Tue, 4 Jan 2022 07:35:28 +0100 Subject: [PATCH 06/30] Make initial ModuleInfo.meta mutable and maintain object identity (#4328) --- docs/05-plugin-development.md | 22 ++++++- src/Module.ts | 2 +- src/ModuleLoader.ts | 4 +- test/function/samples/modify-meta/_config.js | 66 ++++++++++++++++++++ test/function/samples/modify-meta/main.js | 1 + test/incremental/index.js | 8 +-- 6 files changed, 95 insertions(+), 8 deletions(-) create mode 100644 test/function/samples/modify-meta/_config.js create mode 100644 test/function/samples/modify-meta/main.js diff --git a/docs/05-plugin-development.md b/docs/05-plugin-development.md index d67b216587b..ef2def09112 100644 --- a/docs/05-plugin-development.md +++ b/docs/05-plugin-development.md @@ -1055,7 +1055,7 @@ Note the convention that custom options should be added using a property corresp #### Custom module meta-data -Plugins can annotate modules with custom meta-data which can be accessed by themselves and other plugins via the [`resolveId`](guide/en/#resolveid), [`load`](guide/en/#load), and [`transform`](guide/en/#transform) hooks. This meta-data should always be JSON.stringifyable and will be persisted in the cache e.g. in watch mode. +Plugins can annotate modules with custom meta-data which can be set by themselves and other plugins via the [`resolveId`](guide/en/#resolveid), [`load`](guide/en/#load), and [`transform`](guide/en/#transform) hooks and accessed via [`this.getModuleInfo`](guide/en/#thisgetmoduleinfo), [`this.load`](guide/en/#thisload) and the [`moduleParsed`](guide/en/#moduleparsed) hook. This meta-data should always be JSON.stringifyable and will be persisted in the cache e.g. in watch mode. ```js function annotatingPlugin() { @@ -1087,6 +1087,26 @@ Note the convention that plugins that add or modify data should use a property c If several plugins add meta-data or meta-data is added in different hooks, then these `meta` objects will be merged shallowly. That means if plugin `first` adds `{meta: {first: {resolved: "first"}}}` in the resolveId hook and `{meta: {first: {loaded: "first"}}}` in the load hook while plugin `second` adds `{meta: {second: {transformed: "second"}}}` in the `transform` hook, then the resulting `meta` object will be `{first: {loaded: "first"}, second: {transformed: "second"}}`. Here the result of the `resolveId` hook will be overwritten by the result of the `load` hook as the plugin was both storing them under its `first` top-level property. The `transform` data of the other plugin on the other hand will be placed next to it. +The `meta` object of a module is created as soon as Rollup starts loading a module and is updated for each lifecycle hook of the module. If you store a reference to this object, you can also update it manually. To access the meta object of a module that has not been loaded yet, you can trigger its creation and loading the module via [`this.load`](guide/en/#thisload): + +```js +function plugin() { + return { + name: 'test', + buildStart() { + // trigger loading a module. We could also pass an initial "meta" object + // here, but it would be ignored if the module was already loaded via + // other means + this.load({ id: 'my-id' }); + // the module info is now available, we do not need to await this.load + const meta = this.getModuleInfo('my-id').meta; + // we can also modify meta manually now + meta.test = { some: 'data' }; + } + }; +} +``` + #### Direct plugin communication For any other kind of inter-plugin communication, we recommend the pattern below. Note that `api` will never conflict with any upcoming plugin hooks. diff --git a/src/Module.ts b/src/Module.ts index 9af5446b1e7..361b9300f51 100644 --- a/src/Module.ts +++ b/src/Module.ts @@ -840,7 +840,7 @@ export default class Module { this.info.syntheticNamedExports = syntheticNamedExports; } if (meta != null) { - this.info.meta = { ...this.info.meta, ...meta }; + Object.assign(this.info.meta, meta); } } diff --git a/src/ModuleLoader.ts b/src/ModuleLoader.ts index 0d774a8bad6..515ebf233ad 100644 --- a/src/ModuleLoader.ts +++ b/src/ModuleLoader.ts @@ -204,7 +204,7 @@ export class ModuleLoader { return { external, id: resolvedId.id, - meta: resolvedId.meta || EMPTY_OBJECT, + meta: resolvedId.meta || {}, moduleSideEffects: resolvedId.moduleSideEffects ?? this.hasModuleSideEffects(resolvedId.id, !!external), syntheticNamedExports: resolvedId.syntheticNamedExports ?? false @@ -555,7 +555,7 @@ export class ModuleLoader { return { external: true, id: source, - meta: EMPTY_OBJECT, + meta: {}, moduleSideEffects: this.hasModuleSideEffects(source, true), syntheticNamedExports: false }; diff --git a/test/function/samples/modify-meta/_config.js b/test/function/samples/modify-meta/_config.js new file mode 100644 index 00000000000..daf0ff85d0f --- /dev/null +++ b/test/function/samples/modify-meta/_config.js @@ -0,0 +1,66 @@ +const assert = require('assert'); +const path = require('path'); +const ID_MAIN = path.join(__dirname, 'main.js'); + +let initialMeta; + +module.exports = { + description: 'allows to freely modify moduleInfo.meta and maintain object identity', + options: { + plugins: [ + { + name: 'first', + buildStart() { + this.load({ id: ID_MAIN }); + initialMeta = this.getModuleInfo(ID_MAIN).meta; + initialMeta.buildStart = true; + }, + load(id) { + assert.strictEqual(id, ID_MAIN); + const meta = this.getModuleInfo(ID_MAIN).meta; + assert.deepStrictEqual(meta, { buildStart: true }, 'load'); + assert.strictEqual(meta, initialMeta); + meta.load1a = true; + return { code: `assert.ok(true);`, meta: { load1b: true } }; + }, + transform(code, id) { + assert.strictEqual(id, ID_MAIN); + const meta = this.getModuleInfo(ID_MAIN).meta; + assert.deepStrictEqual( + meta, + { buildStart: true, load1a: true, load1b: true }, + 'transform' + ); + assert.strictEqual(meta, initialMeta); + meta.transform1a = true; + return { code: `assert.ok(true);`, meta: { transform1b: true } }; + }, + buildEnd(error) { + if (error) { + throw error; + } + const meta = this.getModuleInfo(ID_MAIN).meta; + assert.deepStrictEqual( + meta, + { + buildStart: true, + load1a: true, + load1b: true, + transform1a: true, + transform1b: true, + transform2: true + }, + 'buildEnd' + ); + } + }, + { + name: 'second', + transform(code, id) { + assert.strictEqual(id, ID_MAIN); + return { code: `assert.ok(true);`, meta: { transform2: true } }; + } + } + ] + } +}; diff --git a/test/function/samples/modify-meta/main.js b/test/function/samples/modify-meta/main.js new file mode 100644 index 00000000000..cc1d88a24fa --- /dev/null +++ b/test/function/samples/modify-meta/main.js @@ -0,0 +1 @@ +assert.ok(true); diff --git a/test/incremental/index.js b/test/incremental/index.js index ad84de892da..1595ca248d7 100644 --- a/test/incremental/index.js +++ b/test/incremental/index.js @@ -293,18 +293,17 @@ describe('incremental', () => { }, load(id) { - assert.deepStrictEqual(this.getModuleInfo(id).meta, { test: { resolved: id } }); return { code: modules[id], meta: { test: { loaded: id } } }; }, transform(code, id) { transformCalls++; - assert.deepStrictEqual(this.getModuleInfo(id).meta, { test: { loaded: id } }); + assert.deepStrictEqual(this.getModuleInfo(id).meta, { test: { loaded: id } }, 'transform'); return { code, meta: { test: { transformed: id } } }; }, moduleParsed({ id, meta }) { - assert.deepStrictEqual(meta, { test: { transformed: id } }); + assert.deepStrictEqual(meta, { test: { transformed: id } }, 'moduleParsed'); moduleParsedCalls++; }, @@ -314,7 +313,8 @@ describe('incremental', () => { [ { id: 'entry', meta: { test: { transformed: 'entry' } } }, { id: 'foo', meta: { test: { transformed: 'foo' } } } - ] + ], + 'buildEnd' ); } }; From 0ceee1df3e1ffaf1698554abfe682250eb94ff0d Mon Sep 17 00:00:00 2001 From: kzc Date: Tue, 4 Jan 2022 02:16:02 -0500 Subject: [PATCH 07/30] Detect unfulfilled async hook actions and report error on exit (#4320) * Better user experience with buggy plugins that previously caused rollup to exit abruptly without any output, error or warning, and a zero process exit code incorrectly indicating success. Co-authored-by: Lukas Taegert-Atkinson --- browser/hookActions.ts | 3 ++ build-plugins/replace-browser-modules.ts | 3 ++ src/utils/PluginDriver.ts | 35 +++++++++++++++++- src/utils/hookActions.ts | 37 +++++++++++++++++++ test/cli/index.js | 2 +- .../unfulfilled-hook-actions/_config.js | 24 ++++++++++++ .../unfulfilled-hook-actions/_expected.js | 0 .../cli/samples/unfulfilled-hook-actions/a.js | 1 + .../cli/samples/unfulfilled-hook-actions/b.js | 1 + .../unfulfilled-hook-actions/buggy-plugin.js | 33 +++++++++++++++++ .../cli/samples/unfulfilled-hook-actions/c.js | 1 + .../cli/samples/unfulfilled-hook-actions/d.js | 1 + .../samples/unfulfilled-hook-actions/main.js | 5 +++ 13 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 browser/hookActions.ts create mode 100644 src/utils/hookActions.ts create mode 100644 test/cli/samples/unfulfilled-hook-actions/_config.js create mode 100644 test/cli/samples/unfulfilled-hook-actions/_expected.js create mode 100644 test/cli/samples/unfulfilled-hook-actions/a.js create mode 100644 test/cli/samples/unfulfilled-hook-actions/b.js create mode 100644 test/cli/samples/unfulfilled-hook-actions/buggy-plugin.js create mode 100644 test/cli/samples/unfulfilled-hook-actions/c.js create mode 100644 test/cli/samples/unfulfilled-hook-actions/d.js create mode 100644 test/cli/samples/unfulfilled-hook-actions/main.js diff --git a/browser/hookActions.ts b/browser/hookActions.ts new file mode 100644 index 00000000000..015f6ccb405 --- /dev/null +++ b/browser/hookActions.ts @@ -0,0 +1,3 @@ +export function addUnresolvedAction(_actionTuple: [string, string, Parameters]): void {} + +export function resolveAction(_actionTuple: [string, string, Parameters]): void {} diff --git a/build-plugins/replace-browser-modules.ts b/build-plugins/replace-browser-modules.ts index 9ffb7a8cc07..39c9acafe2a 100644 --- a/build-plugins/replace-browser-modules.ts +++ b/build-plugins/replace-browser-modules.ts @@ -3,6 +3,7 @@ import { Plugin } from 'rollup'; const ID_CRYPTO = path.resolve('src/utils/crypto'); const ID_FS = path.resolve('src/utils/fs'); +const ID_HOOKACTIONS = path.resolve('src/utils/hookActions'); const ID_PATH = path.resolve('src/utils/path'); const ID_RESOLVEID = path.resolve('src/utils/resolveId'); @@ -17,6 +18,8 @@ export default function replaceBrowserModules(): Plugin { return path.resolve('browser/crypto.ts'); case ID_FS: return path.resolve('browser/fs.ts'); + case ID_HOOKACTIONS: + return path.resolve('browser/hookActions.ts'); case ID_PATH: return path.resolve('browser/path.ts'); case ID_RESOLVEID: diff --git a/src/utils/PluginDriver.ts b/src/utils/PluginDriver.ts index 0035a40949a..5913fbeed04 100644 --- a/src/utils/PluginDriver.ts +++ b/src/utils/PluginDriver.ts @@ -22,6 +22,7 @@ import { import { FileEmitter } from './FileEmitter'; import { getPluginContext } from './PluginContext'; import { errInputHookInOutputPlugin, error } from './error'; +import { addUnresolvedAction, resolveAction } from './hookActions'; import { throwPluginError, warnDeprecatedHooks } from './pluginUtils'; /** @@ -314,6 +315,7 @@ export class PluginDriver { context = hookContext(context, plugin); } + let action: [string, string, Parameters] | null = null; return Promise.resolve() .then(() => { // permit values allows values to be returned instead of a functional hook @@ -322,9 +324,38 @@ export class PluginDriver { return throwInvalidHookError(hookName, plugin.name); } // eslint-disable-next-line @typescript-eslint/ban-types - return (hook as Function).apply(context, args); + const hookResult = (hook as Function).apply(context, args); + + if (!hookResult || !hookResult.then) { + // short circuit for non-thenables and non-Promises + return hookResult; + } + + // Track pending hook actions to properly error out when + // unfulfilled promises cause rollup to abruptly and confusingly + // exit with a successful 0 return code but without producing any + // output, errors or warnings. + action = [plugin.name, hookName, args]; + addUnresolvedAction(action); + + // Although it would be more elegant to just return hookResult here + // and put the .then() handler just above the .catch() handler below, + // doing so would subtly change the defacto async event dispatch order + // which at least one test and some plugins in the wild may depend on. + const promise = Promise.resolve(hookResult); + return promise.then(() => { + // action was fulfilled + resolveAction(action as [string, string, Parameters]); + return promise; + }); }) - .catch(err => throwPluginError(err, plugin.name, { hook: hookName })); + .catch(err => { + if (action !== null) { + // action considered to be fulfilled since error being handled + resolveAction(action); + } + return throwPluginError(err, plugin.name, { hook: hookName }); + }); } /** diff --git a/src/utils/hookActions.ts b/src/utils/hookActions.ts new file mode 100644 index 00000000000..eca7b630545 --- /dev/null +++ b/src/utils/hookActions.ts @@ -0,0 +1,37 @@ +const unfulfilledActions: Set<[string, string, Parameters]> = new Set(); + +export function addUnresolvedAction(actionTuple: [string, string, Parameters]): void { + unfulfilledActions.add(actionTuple); +} + +export function resolveAction(actionTuple: [string, string, Parameters]): void { + unfulfilledActions.delete(actionTuple); +} + +function formatAction([pluginName, hookName, args]: [string, string, Parameters]): string { + let action = `(${pluginName}) ${hookName}`; + const s = JSON.stringify; + switch (hookName) { + case 'resolveId': + action += ` ${s(args[0])} ${s(args[1])}`; + break; + case 'load': + action += ` ${s(args[0])}`; + break; + case 'transform': + action += ` ${s(args[1])}`; + break; + } + return action; +} + +process.on('exit', () => { + if (unfulfilledActions.size) { + let err = '[!] Error: unfinished hook action(s) on exit:\n'; + for (const action of unfulfilledActions) { + err += formatAction(action) + '\n'; + } + console.error('%s', err); + process.exit(1); + } +}); diff --git a/test/cli/index.js b/test/cli/index.js index 5401bf699a0..4bbd525a431 100644 --- a/test/cli/index.js +++ b/test/cli/index.js @@ -35,7 +35,7 @@ runTestSuiteWithSamples( env: { ...process.env, FORCE_COLOR: '0', ...config.env } }, (err, code, stderr) => { - if (config.after) config.after(); + if (config.after) config.after(err, code, stderr); if (err && !err.killed) { if (config.error) { const shouldContinue = config.error(err); diff --git a/test/cli/samples/unfulfilled-hook-actions/_config.js b/test/cli/samples/unfulfilled-hook-actions/_config.js new file mode 100644 index 00000000000..7336c290a29 --- /dev/null +++ b/test/cli/samples/unfulfilled-hook-actions/_config.js @@ -0,0 +1,24 @@ +const assert = require('assert'); +const { assertIncludes } = require('../../../utils.js'); + +module.exports = { + description: 'show errors with non-zero exit code for unfulfilled async plugin actions on exit', + command: 'rollup main.js -p ./buggy-plugin.js --silent', + after(err) { + // exit code check has to be here as error(err) is only called upon failure + assert.strictEqual(err && err.code, 1); + }, + error(err) { + // do not abort test upon error + return true; + }, + stderr(stderr) { + assertIncludes(stderr, '[!] Error: unfinished hook action(s) on exit'); + + // these unfulfilled async hook actions may occur in random order + assertIncludes(stderr, '(buggy-plugin) resolveId "./c.js" "main.js"'); + assertIncludes(stderr, '(buggy-plugin) load "./b.js"'); + assertIncludes(stderr, '(buggy-plugin) transform "./a.js"'); + assertIncludes(stderr, '(buggy-plugin) moduleParsed'); + } +}; diff --git a/test/cli/samples/unfulfilled-hook-actions/_expected.js b/test/cli/samples/unfulfilled-hook-actions/_expected.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/cli/samples/unfulfilled-hook-actions/a.js b/test/cli/samples/unfulfilled-hook-actions/a.js new file mode 100644 index 00000000000..8609d075540 --- /dev/null +++ b/test/cli/samples/unfulfilled-hook-actions/a.js @@ -0,0 +1 @@ +console.log('a'); diff --git a/test/cli/samples/unfulfilled-hook-actions/b.js b/test/cli/samples/unfulfilled-hook-actions/b.js new file mode 100644 index 00000000000..eeb313a0347 --- /dev/null +++ b/test/cli/samples/unfulfilled-hook-actions/b.js @@ -0,0 +1 @@ +console.log('b'); diff --git a/test/cli/samples/unfulfilled-hook-actions/buggy-plugin.js b/test/cli/samples/unfulfilled-hook-actions/buggy-plugin.js new file mode 100644 index 00000000000..4666e3d1e6e --- /dev/null +++ b/test/cli/samples/unfulfilled-hook-actions/buggy-plugin.js @@ -0,0 +1,33 @@ +var path = require('path'); + +function relative(id) { + if (id[0] != '/') return id; + if (id[0] != '\\') return id; + return './' + path.relative(process.cwd(), id); +} + +module.exports = function() { + return { + name: 'buggy-plugin', + resolveId(id) { + if (id.includes('\0')) return; + + // this action will never resolve or reject + if (id.endsWith('c.js')) return new Promise(() => {}); + + return relative(id); + }, + load(id) { + // this action will never resolve or reject + if (id.endsWith('b.js')) return new Promise(() => {}); + }, + transform(code, id) { + // this action will never resolve or reject + if (id.endsWith('a.js')) return new Promise(() => {}); + }, + moduleParsed(mod) { + // this action will never resolve or reject + if (mod.id.endsWith('d.js')) return new Promise(() => {}); + } + }; +} diff --git a/test/cli/samples/unfulfilled-hook-actions/c.js b/test/cli/samples/unfulfilled-hook-actions/c.js new file mode 100644 index 00000000000..c7857d5f484 --- /dev/null +++ b/test/cli/samples/unfulfilled-hook-actions/c.js @@ -0,0 +1 @@ +console.log('c'); diff --git a/test/cli/samples/unfulfilled-hook-actions/d.js b/test/cli/samples/unfulfilled-hook-actions/d.js new file mode 100644 index 00000000000..3c130f85474 --- /dev/null +++ b/test/cli/samples/unfulfilled-hook-actions/d.js @@ -0,0 +1 @@ +console.log('d'); diff --git a/test/cli/samples/unfulfilled-hook-actions/main.js b/test/cli/samples/unfulfilled-hook-actions/main.js new file mode 100644 index 00000000000..f0d40cba75c --- /dev/null +++ b/test/cli/samples/unfulfilled-hook-actions/main.js @@ -0,0 +1,5 @@ +import './a.js'; +import './b.js'; +import './c.js'; +import './d.js'; +console.log('main'); From cf537338325ad710f1bf7dd3b45020aff9e41d56 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Tue, 4 Jan 2022 08:27:44 +0100 Subject: [PATCH 08/30] Add build delay for plugin event test (#4338) --- test/watch/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/watch/index.js b/test/watch/index.js index 76a957fb634..64b66b5cb97 100644 --- a/test/watch/index.js +++ b/test/watch/index.js @@ -250,6 +250,9 @@ describe('rollup.watch', () => { format: 'cjs', exports: 'auto' }, + watch: { + buildDelay: 300 + }, plugins: { buildStart() { this.addWatchFile(WATCHED_ID); From 27196a09a0c368ac83f18a204d787620689ca946 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Tue, 4 Jan 2022 08:28:18 +0100 Subject: [PATCH 09/30] Update changelog --- CHANGELOG.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2419ee77b16..7204f446512 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # rollup changelog +## 2.63.0 + +_2022-01-04_ + +### Features + +- Report a helpful error if rollup exits due to an empty event loop when using `this.load` (#4320) +- Allow directly mutating ModuleInfo.meta for modules and never replace this object (#4328) +- Detect additional side effect free array prototype methods (#4332) + +### Bug Fixes + +- Do not watch if CLI watch options are specified but `--watch` is missing (#4335) + +### Pull Requests + +- [#4320](https://github.com/rollup/rollup/pull/4320): Detect unfulfilled async hook actions and report error on exit (@kzc) +- [#4328](https://github.com/rollup/rollup/pull/4328): Make initial ModuleInfo.meta mutable and maintain object identity (@lukastaegert) +- [#4318](https://github.com/rollup/rollup/pull/4318): Stabilize watch tests (@lukastaegert) +- [#4331](https://github.com/rollup/rollup/pull/4331): Improve JS docs example (@lukastaegert) +- [#4332](https://github.com/rollup/rollup/pull/4332): add support for Array.prototype.findLast,findLastIndex (@dnalborczyk) +- [#4333](https://github.com/rollup/rollup/pull/4333): convert utils.transform to async function (@dnalborczyk) +- [#4335](https://github.com/rollup/rollup/pull/4335): Do not watch unless --watch is specified explicitly (@lukastaegert) +- [#4338](https://github.com/rollup/rollup/pull/4338): Add build delay for plugin event test (@lukastaegert) + ## 2.62.0 _2021-12-24_ From ae674c9edde5efb8ce6d8ef845598a805938178c Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Tue, 4 Jan 2022 08:28:35 +0100 Subject: [PATCH 10/30] 2.63.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1c33476fea8..69121aa2049 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "2.62.0", + "version": "2.63.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 857e8ee89c2..17e64ca3bd5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "2.62.0", + "version": "2.63.0", "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js", From 205e8611ba3f25f66678d4458e88f8db08869032 Mon Sep 17 00:00:00 2001 From: dnalborczyk Date: Wed, 5 Jan 2022 01:20:02 -0500 Subject: [PATCH 11/30] refactor: type fixes (#4326) * make queue readonly * extract QueueItem type, use array literal, add function return type * make readqueue readonly, make maxparallel private and pass via constructor * extract and re-use task type, fix load result return type * fix source description condition * make props readonly * remove unknown from generic parameter * convert to async function, make types readonly * fix more queue types * remove test config file * remove unneeded type assertion * add more return types * re-use getexports method * remove type import * more type fixes * more type fixes * fix: use generic constraint * more readonly * simplify type declaration * remove truthy check * clone imports set * remove type assertion * remove type declaration * Improve coverage Co-authored-by: Lukas Taegert-Atkinson Co-authored-by: Lukas Taegert-Atkinson --- browser/resolveId.ts | 4 +- build-plugins/generate-license-file.ts | 8 +-- cli/run/batchWarnings.ts | 19 ++++-- cli/run/commandPlugins.ts | 5 +- cli/run/getConfigPath.ts | 6 +- cli/run/loadConfigFile.ts | 18 +++--- cli/run/resetScreen.ts | 2 +- cli/run/watch-cli.ts | 14 ++-- src/Bundle.ts | 16 ++--- src/Chunk.ts | 60 ++++++++++-------- src/ExternalModule.ts | 14 ++-- src/Graph.ts | 32 +++++----- src/Module.ts | 88 +++++++++++++------------- src/ModuleLoader.ts | 65 +++++++++++-------- src/ast/scopes/ChildScope.ts | 8 +-- src/ast/scopes/ModuleScope.ts | 4 +- src/utils/PluginDriver.ts | 16 ++--- src/utils/collapseSourcemaps.ts | 18 +++--- src/utils/commondir.ts | 6 +- src/utils/deconflictChunk.ts | 18 +++--- src/utils/executionOrder.ts | 4 +- src/utils/exportNames.ts | 4 +- src/utils/getCodeFrame.ts | 4 +- src/utils/getExportMode.ts | 2 +- src/utils/getIndentString.ts | 4 +- src/utils/getOriginalLocation.ts | 2 +- src/utils/getStaticDependencies.ts | 6 +- src/utils/identifierHelpers.ts | 2 +- src/utils/pluginUtils.ts | 5 +- src/utils/printStringList.ts | 5 +- src/utils/pureComments.ts | 8 +-- src/utils/queue.ts | 26 +++++--- src/utils/reassignedExportsMember.ts | 2 +- src/utils/renderHelpers.ts | 4 +- src/utils/resolveId.ts | 4 +- src/utils/resolveIdViaPlugins.ts | 4 +- src/utils/systemJsRendering.ts | 4 +- src/utils/timers.ts | 10 +-- src/watch/fileWatcher.ts | 16 ++--- src/watch/watch.ts | 24 +++---- 40 files changed, 296 insertions(+), 265 deletions(-) diff --git a/browser/resolveId.ts b/browser/resolveId.ts index 945768fb94f..6eccc297b11 100644 --- a/browser/resolveId.ts +++ b/browser/resolveId.ts @@ -13,9 +13,9 @@ export async function resolveId( importer: string | undefined, customOptions: CustomPluginOptions | undefined, isEntry: boolean | undefined, - skip: { importer: string | undefined; plugin: Plugin; source: string }[] | null + skip: readonly { importer: string | undefined; plugin: Plugin; source: string }[] | null ) => Promise, - skip: { importer: string | undefined; plugin: Plugin; source: string }[] | null, + skip: readonly { importer: string | undefined; plugin: Plugin; source: string }[] | null, customOptions: CustomPluginOptions | undefined, isEntry: boolean ): Promise { diff --git a/build-plugins/generate-license-file.ts b/build-plugins/generate-license-file.ts index e64391c9617..42f1e363c38 100644 --- a/build-plugins/generate-license-file.ts +++ b/build-plugins/generate-license-file.ts @@ -1,9 +1,9 @@ -import fs from 'fs'; +import { readFileSync, writeFileSync } from 'fs'; import { PluginImpl } from 'rollup'; import license, { Dependency, Person } from 'rollup-plugin-license'; function generateLicenseFile(dependencies: Dependency[]) { - const coreLicense = fs.readFileSync('LICENSE-CORE.md'); + const coreLicense = readFileSync('LICENSE-CORE.md'); const licenses = new Set(); const dependencyLicenseTexts = dependencies .sort(({ name: nameA }, { name: nameB }) => (nameA! > nameB! ? 1 : -1)) @@ -52,9 +52,9 @@ function generateLicenseFile(dependencies: Dependency[]) { `${Array.from(licenses).join(', ')}\n\n` + `# Bundled dependencies:\n` + dependencyLicenseTexts; - const existingLicenseText = fs.readFileSync('LICENSE.md', 'utf8'); + const existingLicenseText = readFileSync('LICENSE.md', 'utf8'); if (existingLicenseText !== licenseText) { - fs.writeFileSync('LICENSE.md', licenseText); + writeFileSync('LICENSE.md', licenseText); console.warn('LICENSE.md updated. You should commit the updated file.'); } } diff --git a/cli/run/batchWarnings.ts b/cli/run/batchWarnings.ts index a6beab9daa8..d311035fa37 100644 --- a/cli/run/batchWarnings.ts +++ b/cli/run/batchWarnings.ts @@ -248,20 +248,25 @@ const deferredHandlers: { } }; -function title(str: string) { +function title(str: string): void { stderr(bold(yellow(`(!) ${str}`))); } -function info(url: string) { +function info(url: string): void { stderr(gray(url)); } -function nest(array: T[], prop: string) { - const nested: { items: T[]; key: string }[] = []; - const lookup = new Map(); +interface Nested { + items: T[]; + key: string; +} + +function nest>(array: readonly T[], prop: string): Nested[] { + const nested: Nested[] = []; + const lookup = new Map>(); for (const item of array) { - const key = (item as any)[prop]; + const key = item[prop]; getOrCreate(lookup, key, () => { const items = { items: [], @@ -275,7 +280,7 @@ function nest(array: T[], prop: string) { return nested; } -function showTruncatedWarnings(warnings: RollupWarning[]) { +function showTruncatedWarnings(warnings: readonly RollupWarning[]): void { const nestedByModule = nest(warnings, 'id'); const displayedByModule = nestedByModule.length > 5 ? nestedByModule.slice(0, 3) : nestedByModule; diff --git a/cli/run/commandPlugins.ts b/cli/run/commandPlugins.ts index df4bb31d662..67fce28a866 100644 --- a/cli/run/commandPlugins.ts +++ b/cli/run/commandPlugins.ts @@ -38,7 +38,10 @@ export async function addPluginsFromCommandOption( } } -async function loadAndRegisterPlugin(inputOptions: InputOptions, pluginText: string) { +async function loadAndRegisterPlugin( + inputOptions: InputOptions, + pluginText: string +): Promise { let plugin: any = null; let pluginArg: any = undefined; if (pluginText[0] === '{') { diff --git a/cli/run/getConfigPath.ts b/cli/run/getConfigPath.ts index 10623faf256..e47039008fe 100644 --- a/cli/run/getConfigPath.ts +++ b/cli/run/getConfigPath.ts @@ -1,5 +1,5 @@ import { readdirSync } from 'fs'; -import * as path from 'path'; +import { resolve } from 'path'; import relative from 'require-relative'; import { handleError } from '../logging'; @@ -8,7 +8,7 @@ const DEFAULT_CONFIG_BASE = 'rollup.config'; export function getConfigPath(commandConfig: string | true): string { const cwd = process.cwd(); if (commandConfig === true) { - return path.resolve(findConfigFileNameInCwd()); + return resolve(findConfigFileNameInCwd()); } if (commandConfig.slice(0, 5) === 'node:') { const pkgName = commandConfig.slice(5); @@ -28,7 +28,7 @@ export function getConfigPath(commandConfig: string | true): string { } } } - return path.resolve(commandConfig); + return resolve(commandConfig); } function findConfigFileNameInCwd(): string { diff --git a/cli/run/loadConfigFile.ts b/cli/run/loadConfigFile.ts index 1ddba4d142e..3b07543aa6d 100644 --- a/cli/run/loadConfigFile.ts +++ b/cli/run/loadConfigFile.ts @@ -1,5 +1,5 @@ -import * as fs from 'fs'; -import * as path from 'path'; +import { realpathSync } from 'fs'; +import { extname, isAbsolute } from 'path'; import { pathToFileURL } from 'url'; import * as rollup from '../../src/node-entry'; import { MergedRollupOptions } from '../../src/rollup/types'; @@ -12,7 +12,7 @@ import { stderr } from '../logging'; import batchWarnings, { BatchWarnings } from './batchWarnings'; import { addCommandPluginsToInputOptions, addPluginsFromCommandOption } from './commandPlugins'; -function supportsNativeESM() { +function supportsNativeESM(): boolean { return Number(/^v(\d+)/.exec(process.version)![1]) >= 13; } @@ -44,7 +44,7 @@ async function loadConfigFile( fileName: string, commandOptions: Record ): Promise { - const extension = path.extname(fileName); + const extension = extname(fileName); const configFileExport = commandOptions.configPlugin || @@ -68,7 +68,7 @@ async function getDefaultFromTranspiledConfigFile( const warnings = batchWarnings(); const inputOptions = { external: (id: string) => - (id[0] !== '.' && !path.isAbsolute(id)) || id.slice(-5, id.length) === '.json', + (id[0] !== '.' && !isAbsolute(id)) || id.slice(-5, id.length) === '.json', input: fileName, onwarn: warnings.add, plugins: [], @@ -102,9 +102,9 @@ async function getDefaultFromTranspiledConfigFile( return loadConfigFromBundledFile(fileName, code); } -async function loadConfigFromBundledFile(fileName: string, bundledCode: string) { - const resolvedFileName = fs.realpathSync(fileName); - const extension = path.extname(resolvedFileName); +async function loadConfigFromBundledFile(fileName: string, bundledCode: string): Promise { + const resolvedFileName = realpathSync(fileName); + const extension = extname(resolvedFileName); const defaultLoader = require.extensions[extension]; require.extensions[extension] = (module: NodeModule, requiredFileName: string) => { if (requiredFileName === resolvedFileName) { @@ -132,7 +132,7 @@ async function loadConfigFromBundledFile(fileName: string, bundledCode: string) } } -async function getConfigList(configFileExport: any, commandOptions: any) { +async function getConfigList(configFileExport: any, commandOptions: any): Promise { const config = await (typeof configFileExport === 'function' ? configFileExport(commandOptions) : configFileExport); diff --git a/cli/run/resetScreen.ts b/cli/run/resetScreen.ts index 39fc53c70b3..3cf34ee8657 100644 --- a/cli/run/resetScreen.ts +++ b/cli/run/resetScreen.ts @@ -4,7 +4,7 @@ import { stderr } from '../logging'; const CLEAR_SCREEN = '\u001Bc'; export function getResetScreen( - configs: MergedRollupOptions[], + configs: readonly MergedRollupOptions[], allowClearScreen: boolean | undefined ): (heading: string) => void { let clearScreen = allowClearScreen; diff --git a/cli/run/watch-cli.ts b/cli/run/watch-cli.ts index 7baa555d876..9c83fc8265e 100644 --- a/cli/run/watch-cli.ts +++ b/cli/run/watch-cli.ts @@ -1,4 +1,4 @@ -import fs from 'fs'; +import { type FSWatcher, readFileSync } from 'fs'; import chokidar from 'chokidar'; import dateTime from 'date-time'; import ms from 'pretty-ms'; @@ -22,17 +22,17 @@ export async function watch(command: Record): Promise { let configs: MergedRollupOptions[]; let warnings: BatchWarnings; let watcher: RollupWatcher; - let configWatcher: fs.FSWatcher; + let configWatcher: FSWatcher; const configFile = command.config ? getConfigPath(command.config) : null; onExit(close); - process.on('uncaughtException' as any, close); + process.on('uncaughtException', close); if (!process.stdin.isTTY) { process.stdin.on('end', close); process.stdin.resume(); } - async function loadConfigFromFileAndTrack(configFile: string) { + async function loadConfigFromFileAndTrack(configFile: string): Promise { let reloadingConfig = false; let aborted = false; let configFileData: string | null = null; @@ -42,7 +42,7 @@ export async function watch(command: Record): Promise { async function reloadConfigFile() { try { - const newConfigFileData = fs.readFileSync(configFile, 'utf-8'); + const newConfigFileData = readFileSync(configFile, 'utf-8'); if (newConfigFileData === configFileData) { return; } @@ -83,7 +83,7 @@ export async function watch(command: Record): Promise { const resetScreen = getResetScreen(configs!, isTTY); - function start(configs: MergedRollupOptions[]) { + function start(configs: MergedRollupOptions[]): void { try { watcher = rollup.watch(configs as any); } catch (err: any) { @@ -144,7 +144,7 @@ export async function watch(command: Record): Promise { }); } - function close(code: number | null) { + function close(code: number | null): void { process.removeListener('uncaughtException', close); // removing a non-existent listener is a no-op process.stdin.removeListener('end', close); diff --git a/src/Bundle.ts b/src/Bundle.ts index ce26dc85bca..6c23f85d34e 100644 --- a/src/Bundle.ts +++ b/src/Bundle.ts @@ -30,8 +30,8 @@ import { basename, isAbsolute } from './utils/path'; import { timeEnd, timeStart } from './utils/timers'; export default class Bundle { - private facadeChunkByModule = new Map(); - private includedNamespaces = new Set(); + private readonly facadeChunkByModule = new Map(); + private readonly includedNamespaces = new Set(); constructor( private readonly outputOptions: NormalizedOutputOptions, @@ -82,7 +82,7 @@ export default class Bundle { } private async addFinalizedChunksToBundle( - chunks: Chunk[], + chunks: readonly Chunk[], inputBase: string, addons: Addons, outputBundle: OutputBundleWithPlaceholders, @@ -122,11 +122,11 @@ export default class Bundle { } private assignChunkIds( - chunks: Chunk[], + chunks: readonly Chunk[], inputBase: string, addons: Addons, bundle: OutputBundleWithPlaceholders - ) { + ): void { const entryChunks: Chunk[] = []; const otherChunks: Chunk[] = []; for (const chunk of chunks) { @@ -137,7 +137,7 @@ export default class Bundle { } // make sure entry chunk names take precedence with regard to deconflicting - const chunksForNaming: Chunk[] = entryChunks.concat(otherChunks); + const chunksForNaming = entryChunks.concat(otherChunks); for (const chunk of chunksForNaming) { if (this.outputOptions.file) { chunk.id = basename(this.outputOptions.file); @@ -241,7 +241,7 @@ export default class Bundle { } private prerenderChunks( - chunks: Chunk[], + chunks: readonly Chunk[], inputBase: string, snippets: GenerateCodeSnippets ): void { @@ -254,7 +254,7 @@ export default class Bundle { } } -function getAbsoluteEntryModulePaths(chunks: Chunk[]): string[] { +function getAbsoluteEntryModulePaths(chunks: readonly Chunk[]): string[] { const absoluteEntryModulePaths: string[] = []; for (const chunk of chunks) { for (const entryModule of chunk.entryModules) { diff --git a/src/Chunk.ts b/src/Chunk.ts index d72b3fede59..437c7400145 100644 --- a/src/Chunk.ts +++ b/src/Chunk.ts @@ -108,7 +108,7 @@ function getGlobalName( globals: GlobalsOption, hasExports: boolean, warn: WarningHandler -) { +): string | undefined { const globalName = typeof globals === 'function' ? globals(module.id) : globals[module.id]; if (globalName) { return globalName; @@ -126,7 +126,7 @@ function getGlobalName( } export default class Chunk { - entryModules: Module[] = []; + readonly entryModules: Module[] = []; execIndex: number; exportMode: 'none' | 'named' | 'default' = 'named'; facadeModule: Module | null = null; @@ -136,27 +136,28 @@ export default class Chunk { suggestedVariableName: string; variableName = ''; - private accessedGlobalsByScope = new Map>(); + private readonly accessedGlobalsByScope = new Map>(); private dependencies = new Set(); - private dynamicDependencies = new Set(); - private dynamicEntryModules: Module[] = []; + private readonly dynamicDependencies = new Set(); + private readonly dynamicEntryModules: Module[] = []; private dynamicName: string | null = null; - private exportNamesByVariable = new Map(); - private exports = new Set(); - private exportsByName: Record = Object.create(null); + private readonly exportNamesByVariable = new Map(); + private readonly exports = new Set(); + private readonly exportsByName: Record = Object.create(null); private fileName: string | null = null; private implicitEntryModules: Module[] = []; - private implicitlyLoadedBefore = new Set(); - private imports = new Set(); + private readonly implicitlyLoadedBefore = new Set(); + private readonly imports = new Set(); private indentString: string = undefined as never; + // This may only be updated in the constructor private readonly isEmpty: boolean = true; private name: string | null = null; private renderedDependencies: Map | null = null; private renderedExports: ChunkExports | null = null; - private renderedHash: string = undefined as never; - private renderedModuleSources = new Map(); - private renderedModules: { + private renderedHash: string | undefined = undefined; + private readonly renderedModuleSources = new Map(); + private readonly renderedModules: { [moduleId: string]: RenderedModule; } = Object.create(null); private renderedSource: MagicStringBundle | null = null; @@ -251,7 +252,7 @@ export default class Chunk { return chunk; } - canModuleBeFacade(module: Module, exposedVariables: Set): boolean { + canModuleBeFacade(module: Module, exposedVariables: ReadonlySet): boolean { const moduleExportNamesByVariable = module.getExportNamesByVariable(); for (const exposedVariable of this.exports) { if (!moduleExportNamesByVariable.has(exposedVariable)) { @@ -429,9 +430,9 @@ export default class Chunk { preserveModulesRelativeDir: string, options: NormalizedOutputOptions, existingNames: Record, - unsetOptions: Set + unsetOptions: ReadonlySet ): string { - const id = this.orderedModules[0].id; + const [{ id }] = this.orderedModules; const sanitizedId = this.outputOptions.sanitizeFileName(id); let path: string; @@ -641,7 +642,7 @@ export default class Chunk { this.renderedSource = magicString.trim(); } - this.renderedHash = undefined as never; + this.renderedHash = undefined; if (this.isEmpty && this.getExportNames().length === 0 && this.dependencies.size === 0) { const chunkName = this.getChunkName(); @@ -811,9 +812,9 @@ export default class Chunk { } private addDependenciesToChunk( - moduleDependencies: Set, + moduleDependencies: ReadonlySet, chunkDependencies: Set - ) { + ): void { for (const module of moduleDependencies) { if (module instanceof Module) { const chunk = this.chunkByModule.get(module); @@ -826,7 +827,7 @@ export default class Chunk { } } - private assignFacadeName({ fileName, name }: FacadeName, facadedModule: Module) { + private assignFacadeName({ fileName, name }: FacadeName, facadedModule: Module): void { if (fileName) { this.fileName = fileName; } else { @@ -870,7 +871,7 @@ export default class Chunk { hash.update( [addons.intro, addons.outro, addons.banner, addons.footer].map(addon => addon || '').join(':') ); - hash.update(options.format as string); + hash.update(options.format); const dependenciesForHashing = new Set([this]); for (const current of dependenciesForHashing) { if (current instanceof ExternalModule) { @@ -887,7 +888,7 @@ export default class Chunk { return hash.digest('hex').substr(0, 8); } - private ensureReexportsAreAvailableForModule(module: Module) { + private ensureReexportsAreAvailableForModule(module: Module): void { const map = module.getExportNamesByVariable(); for (const exportedVariable of map.keys()) { const isSynthetic = exportedVariable instanceof SyntheticNamedExportVariable; @@ -910,7 +911,10 @@ export default class Chunk { } } - private finaliseDynamicImports(options: NormalizedOutputOptions, snippets: GenerateCodeSnippets) { + private finaliseDynamicImports( + options: NormalizedOutputOptions, + snippets: GenerateCodeSnippets + ): void { const stripKnownJsExtensions = options.format === 'amd'; for (const [module, code] of this.renderedModuleSources) { for (const { node, resolution } of module.dynamicImports) { @@ -1218,7 +1222,7 @@ export default class Chunk { return relativePath.startsWith('../') ? relativePath : './' + relativePath; } - private inlineChunkDependencies(chunk: Chunk) { + private inlineChunkDependencies(chunk: Chunk): void { for (const dep of chunk.dependencies) { if (this.dependencies.has(dep)) continue; this.dependencies.add(dep); @@ -1228,7 +1232,7 @@ export default class Chunk { } } - private prepareModulesForRendering(snippets: GenerateCodeSnippets) { + private prepareModulesForRendering(snippets: GenerateCodeSnippets): void { const accessedGlobalsByScope = this.accessedGlobalsByScope; for (const module of this.orderedModules) { for (const { node, resolution } of module.dynamicImports) { @@ -1268,7 +1272,7 @@ export default class Chunk { } } - private setExternalRenderPaths(options: NormalizedOutputOptions, inputBase: string) { + private setExternalRenderPaths(options: NormalizedOutputOptions, inputBase: string): void { for (const dependency of [...this.dependencies, ...this.dynamicDependencies]) { if (dependency instanceof ExternalModule) { dependency.setRenderPath(options, inputBase); @@ -1303,7 +1307,7 @@ export default class Chunk { break; } } - const usedNames = new Set(['Object', 'Promise']); + const usedNames = new Set(['Object', 'Promise']); if (this.needsExportsShim) { usedNames.add(MISSING_EXPORT_SHIM_VARIABLE); } @@ -1347,7 +1351,7 @@ export default class Chunk { ); } - private setUpChunkImportsAndExportsForModule(module: Module) { + private setUpChunkImportsAndExportsForModule(module: Module): void { const moduleImports = new Set(module.imports); // when we are not preserving modules, we need to make all namespace variables available for // rendering the namespace object diff --git a/src/ExternalModule.ts b/src/ExternalModule.ts index 8a395b827df..97a66c36e67 100644 --- a/src/ExternalModule.ts +++ b/src/ExternalModule.ts @@ -12,15 +12,15 @@ import { printQuotedStringList } from './utils/printStringList'; import relativeId from './utils/relativeId'; export default class ExternalModule { - declarations: { [name: string]: ExternalVariable } = Object.create(null); + readonly declarations: { [name: string]: ExternalVariable } = Object.create(null); defaultVariableName = ''; - dynamicImporters: string[] = []; + readonly dynamicImporters: string[] = []; execIndex = Infinity; - exportedVariables = new Map(); - importers: string[] = []; - info: ModuleInfo; + readonly exportedVariables = new Map(); + readonly importers: string[] = []; + readonly info: ModuleInfo; mostCommonSuggestion = 0; - nameSuggestions: { [name: string]: number } = Object.create(null); + readonly nameSuggestions: { [name: string]: number } = Object.create(null); namespaceVariableName = ''; reexported = false; renderPath: string = undefined as never; @@ -33,7 +33,7 @@ export default class ExternalModule { public readonly id: string, hasModuleSideEffects: boolean | 'no-treeshake', meta: CustomPluginOptions, - public renormalizeRenderPath: boolean + public readonly renormalizeRenderPath: boolean ) { this.suggestedVariableName = makeLegal(id.split(/[\\/]/).pop()!); diff --git a/src/Graph.ts b/src/Graph.ts index 9ed4bbdb4d9..38fc7a0d7cc 100644 --- a/src/Graph.ts +++ b/src/Graph.ts @@ -23,7 +23,7 @@ import { timeEnd, timeStart } from './utils/timers'; import { markModuleAndImpureDependenciesAsExecuted } from './utils/traverseStaticDependencies'; function normalizeEntryModules( - entryModules: string[] | Record + entryModules: readonly string[] | Record ): UnresolvedModule[] { if (Array.isArray(entryModules)) { return entryModules.map(id => ({ @@ -44,20 +44,20 @@ function normalizeEntryModules( } export default class Graph { - acornParser: typeof acorn.Parser; - cachedModules = new Map(); - deoptimizationTracker = new PathTracker(); + readonly acornParser: typeof acorn.Parser; + readonly cachedModules = new Map(); + readonly deoptimizationTracker = new PathTracker(); entryModules: Module[] = []; - moduleLoader: ModuleLoader; - modulesById = new Map(); + readonly moduleLoader: ModuleLoader; + readonly modulesById = new Map(); needsTreeshakingPass = false; phase: BuildPhase = BuildPhase.LOAD_AND_PARSE; - pluginDriver: PluginDriver; - scope = new GlobalScope(); - watchFiles: Record = Object.create(null); + readonly pluginDriver: PluginDriver; + readonly scope = new GlobalScope(); + readonly watchFiles: Record = Object.create(null); watchMode = false; - private externalModules: ExternalModule[] = []; + private readonly externalModules: ExternalModule[] = []; private implicitEntryModules: Module[] = []; private modules: Module[] = []; private declare pluginCache?: Record; @@ -178,7 +178,7 @@ export default class Graph { } } - private includeStatements() { + private includeStatements(): void { for (const module of [...this.entryModules, ...this.implicitEntryModules]) { markModuleAndImpureDependenciesAsExecuted(module); } @@ -221,7 +221,7 @@ export default class Graph { } } - private sortModules() { + private sortModules(): void { const { orderedModules, cyclePaths } = analyseModuleExecution(this.entryModules); for (const cyclePath of cyclePaths) { this.options.onwarn({ @@ -238,21 +238,21 @@ export default class Graph { this.warnForMissingExports(); } - private warnForMissingExports() { + private warnForMissingExports(): void { for (const module of this.modules) { for (const importDescription of Object.values(module.importDescriptions)) { if ( importDescription.name !== '*' && - !(importDescription.module as Module).getVariableForExportName(importDescription.name) + !importDescription.module.getVariableForExportName(importDescription.name) ) { module.warn( { code: 'NON_EXISTENT_EXPORT', message: `Non-existent export '${ importDescription.name - }' is imported from ${relativeId((importDescription.module as Module).id)}`, + }' is imported from ${relativeId(importDescription.module.id)}`, name: importDescription.name, - source: (importDescription.module as Module).id + source: importDescription.module.id }, importDescription.start ); diff --git a/src/Module.ts b/src/Module.ts index 361b9300f51..dc9094bef55 100644 --- a/src/Module.ts +++ b/src/Module.ts @@ -11,7 +11,6 @@ import ExportNamedDeclaration from './ast/nodes/ExportNamedDeclaration'; import Identifier from './ast/nodes/Identifier'; import ImportDeclaration from './ast/nodes/ImportDeclaration'; import ImportExpression from './ast/nodes/ImportExpression'; -import ImportSpecifier from './ast/nodes/ImportSpecifier'; import Literal from './ast/nodes/Literal'; import MetaProperty from './ast/nodes/MetaProperty'; import * as NodeType from './ast/nodes/NodeType'; @@ -187,29 +186,29 @@ function getAndExtendSideEffectModules(variable: Variable, module: Module): Set< } export default class Module { - alternativeReexportModules = new Map(); + readonly alternativeReexportModules = new Map(); ast: Program | null = null; - chunkFileNames = new Set(); + readonly chunkFileNames = new Set(); chunkName: string | null = null; - cycles = new Set(); - dependencies = new Set(); - dynamicDependencies = new Set(); - dynamicImporters: string[] = []; - dynamicImports: DynamicImport[] = []; + readonly cycles = new Set(); + readonly dependencies = new Set(); + readonly dynamicDependencies = new Set(); + readonly dynamicImporters: string[] = []; + readonly dynamicImports: DynamicImport[] = []; excludeFromSourcemap: boolean; execIndex = Infinity; - exportAllSources = new Set(); - exports: { [name: string]: ExportDescription } = Object.create(null); - exportsAll: { [name: string]: string } = Object.create(null); - implicitlyLoadedAfter = new Set(); - implicitlyLoadedBefore = new Set(); - importDescriptions: { [name: string]: ImportDescription } = Object.create(null); - importMetas: MetaProperty[] = []; + readonly exportAllSources = new Set(); + readonly exports: { [name: string]: ExportDescription } = Object.create(null); + readonly exportsAll: { [name: string]: string } = Object.create(null); + readonly implicitlyLoadedAfter = new Set(); + readonly implicitlyLoadedBefore = new Set(); + readonly importDescriptions: { [name: string]: ImportDescription } = Object.create(null); + readonly importMetas: MetaProperty[] = []; importedFromNotTreeshaken = false; - importers: string[] = []; - imports = new Set(); - includedDynamicImporters: Module[] = []; - info: ModuleInfo; + readonly importers: string[] = []; + readonly imports = new Set(); + readonly includedDynamicImporters: Module[] = []; + readonly info: ModuleInfo; isExecuted = false; isUserDefinedEntryPoint = false; declare namespace: NamespaceVariable; @@ -217,27 +216,27 @@ export default class Module { declare originalCode: string; declare originalSourcemap: ExistingDecodedSourceMap | null; preserveSignature: PreserveEntrySignaturesOption; - reexportDescriptions: { [name: string]: ReexportDescription } = Object.create(null); + readonly reexportDescriptions: { [name: string]: ReexportDescription } = Object.create(null); declare resolvedIds: ResolvedIdMap; declare scope: ModuleScope; - sideEffectDependenciesByVariable = new Map>(); + readonly sideEffectDependenciesByVariable = new Map>(); declare sourcemapChain: DecodedSourceMapOrMissing[]; - sources = new Set(); + readonly sources = new Set(); declare transformFiles?: EmittedFile[]; - userChunkNames = new Set(); + readonly userChunkNames = new Set(); usesTopLevelAwait = false; private allExportNames: Set | null = null; private declare astContext: AstContext; private readonly context: string; private declare customTransformCache: boolean; - private exportAllModules: (Module | ExternalModule)[] = []; + private readonly exportAllModules: (Module | ExternalModule)[] = []; private exportNamesByVariable: Map | null = null; - private exportShimVariable: ExportShimVariable = new ExportShimVariable(this); + private readonly exportShimVariable: ExportShimVariable = new ExportShimVariable(this); private declare magicString: MagicString; private namespaceReexportsByName: Record = Object.create(null); private relevantDependencies: Set | null = null; - private syntheticExports = new Map(); + private readonly syntheticExports = new Map(); private syntheticNamespace: Variable | null | undefined = null; private transformDependencies: string[] = []; private transitiveReexports: string[] | null = null; @@ -320,7 +319,7 @@ export default class Module { return this.allExportNames; } const allExportNames = (this.allExportNames = new Set()); - for (const name of Object.keys(this.exports)) { + for (const name of this.getExports()) { allExportNames.add(name); } for (const name of Object.keys(this.reexportDescriptions)) { @@ -345,15 +344,14 @@ export default class Module { const relevantDependencies = new Set(); const necessaryDependencies = new Set(); const alwaysCheckedDependencies = new Set(); + const dependencyVariables = new Set(this.imports); - let dependencyVariables: Set | IterableIterator = this.imports.keys(); if ( this.info.isEntry || this.includedDynamicImporters.length > 0 || this.namespace.included || this.implicitlyLoadedAfter.size > 0 ) { - dependencyVariables = new Set(dependencyVariables); for (const exportName of [...this.getReexports(), ...this.getExports()]) { const exportedVariable = this.getVariableForExportName(exportName); if (exportedVariable) { @@ -396,7 +394,7 @@ export default class Module { if (this.exportNamesByVariable) { return this.exportNamesByVariable; } - const exportNamesByVariable: Map = new Map(); + const exportNamesByVariable = new Map(); for (const exportName of this.getAllExportNames()) { if (exportName === this.info.syntheticNamedExports) continue; let tracedVariable = this.getVariableForExportName(exportName); @@ -863,7 +861,7 @@ export default class Module { private addExport( node: ExportAllDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration - ) { + ): void { if (node instanceof ExportDefaultDeclaration) { // export default foo; @@ -931,18 +929,14 @@ export default class Module { } } - private addImport(node: ImportDeclaration) { + private addImport(node: ImportDeclaration): void { const source = node.source.value; this.sources.add(source); for (const specifier of node.specifiers) { const isDefault = specifier.type === NodeType.ImportDefaultSpecifier; const isNamespace = specifier.type === NodeType.ImportNamespaceSpecifier; - const name = isDefault - ? 'default' - : isNamespace - ? '*' - : (specifier as ImportSpecifier).imported.name; + const name = isDefault ? 'default' : isNamespace ? '*' : specifier.imported.name; this.importDescriptions[specifier.local.name] = { module: null as never, // filled in later name, @@ -952,7 +946,7 @@ export default class Module { } } - private addImportMeta(node: MetaProperty) { + private addImportMeta(node: MetaProperty): void { this.importMetas.push(node); } @@ -985,7 +979,7 @@ export default class Module { private addModulesToImportDescriptions(importDescription: { [name: string]: ImportDescription | ReexportDescription; - }) { + }): void { for (const specifier of Object.values(importDescription)) { const id = this.resolvedIds[specifier.source].id; specifier.module = this.graph.modulesById.get(id)!; @@ -996,7 +990,7 @@ export default class Module { relevantDependencies: Set, necessaryDependencies: Set, alwaysCheckedDependencies: Set - ) { + ): void { const handledDependencies = new Set(); const addSideEffectDependencies = (possibleDependencies: Set) => { @@ -1109,7 +1103,7 @@ export default class Module { return [...syntheticNamespaces, ...externalNamespaces]; } - private includeDynamicImport(node: ImportExpression) { + private includeDynamicImport(node: ImportExpression): void { const resolution = ( this.dynamicImports.find(dynamicImport => dynamicImport.node === node) as { resolution: string | Module | ExternalModule | undefined; @@ -1121,12 +1115,12 @@ export default class Module { } } - private includeVariable(variable: Variable) { + private includeVariable(variable: Variable): void { if (!variable.included) { variable.include(); this.graph.needsTreeshakingPass = true; const variableModule = variable.module; - if (variableModule && variableModule instanceof Module) { + if (variableModule instanceof Module) { if (!variableModule.isExecuted) { markModuleAndImpureDependenciesAsExecuted(variableModule); } @@ -1142,7 +1136,7 @@ export default class Module { } } - private includeVariableInModule(variable: Variable) { + private includeVariableInModule(variable: Variable): void { this.includeVariable(variable); const variableModule = variable.module; if (variableModule && variableModule !== this) { @@ -1164,7 +1158,11 @@ export default class Module { // if there is a cyclic import in the reexport chain, we should not // import from the original module but from the cyclic module to not // mess up execution order. -function setAlternativeExporterIfCyclic(variable: Variable, importer: Module, reexporter: Module) { +function setAlternativeExporterIfCyclic( + variable: Variable, + importer: Module, + reexporter: Module +): void { if (variable.module instanceof Module && variable.module !== reexporter) { const exporterCycles = variable.module.cycles; if (exporterCycles.size > 0) { diff --git a/src/ModuleLoader.ts b/src/ModuleLoader.ts index 515ebf233ad..ede3546b14f 100644 --- a/src/ModuleLoader.ts +++ b/src/ModuleLoader.ts @@ -2,18 +2,18 @@ import * as acorn from 'acorn'; import ExternalModule from './ExternalModule'; import Graph from './Graph'; import Module, { DynamicImport } from './Module'; -import { +import type { CustomPluginOptions, EmittedChunk, HasModuleSideEffects, + LoadResult, ModuleInfo, ModuleOptions, NormalizedInputOptions, PartialNull, Plugin, ResolvedId, - ResolveIdResult, - SourceDescription + ResolveIdResult } from './rollup/types'; import { PluginDriver } from './utils/PluginDriver'; import { EMPTY_OBJECT } from './utils/blank'; @@ -66,10 +66,10 @@ export class ModuleLoader { private readonly implicitEntryModules = new Set(); private readonly indexedEntryModules: { index: number; module: Module }[] = []; private latestLoadModulesPromise: Promise = Promise.resolve(); - private moduleLoadPromises = new Map(); - private modulesWithLoadedDependencies = new Set(); + private readonly moduleLoadPromises = new Map(); + private readonly modulesWithLoadedDependencies = new Set(); private nextEntryModuleIndex = 0; - private readQueue = new Queue(); + private readonly readQueue: Queue; constructor( private readonly graph: Graph, @@ -80,10 +80,11 @@ export class ModuleLoader { this.hasModuleSideEffects = options.treeshake ? options.treeshake.moduleSideEffects : () => true; - this.readQueue.maxParallel = options.maxParallelFileReads; + + this.readQueue = new Queue(options.maxParallelFileReads); } - async addAdditionalModules(unresolvedModules: string[]): Promise { + async addAdditionalModules(unresolvedModules: readonly string[]): Promise { const result = this.extendLoadModulesPromise( Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))) ); @@ -92,7 +93,7 @@ export class ModuleLoader { } async addEntryModules( - unresolvedEntryModules: UnresolvedModule[], + unresolvedEntryModules: readonly UnresolvedModule[], isUserDefined: boolean ): Promise<{ entryModules: Module[]; @@ -103,8 +104,8 @@ export class ModuleLoader { this.nextEntryModuleIndex += unresolvedEntryModules.length; const newEntryModules = await this.extendLoadModulesPromise( Promise.all( - unresolvedEntryModules.map( - ({ id, importer }): Promise => this.loadEntryModule(id, true, importer, null) + unresolvedEntryModules.map(({ id, importer }) => + this.loadEntryModule(id, true, importer, null) ) ).then(entryModules => { let moduleIndex = firstEntryModuleIndex; @@ -160,10 +161,14 @@ export class ModuleLoader { return module; } - public preloadModule(resolvedId: NormalizedResolveIdWithoutDefaults): Promise { - return this.fetchModule(this.addDefaultsToResolvedId(resolvedId)!, undefined, false, true).then( - module => module.info + public async preloadModule(resolvedId: NormalizedResolveIdWithoutDefaults): Promise { + const module = await this.fetchModule( + this.addDefaultsToResolvedId(resolvedId)!, + undefined, + false, + true ); + return module.info; } resolveId = async ( @@ -171,7 +176,7 @@ export class ModuleLoader { importer: string | undefined, customOptions: CustomPluginOptions | undefined, isEntry: boolean | undefined, - skip: { importer: string | undefined; plugin: Plugin; source: string }[] | null = null + skip: readonly { importer: string | undefined; plugin: Plugin; source: string }[] | null = null ): Promise => { return this.addDefaultsToResolvedId( this.getNormalizedResolvedIdWithoutDefaults( @@ -213,7 +218,7 @@ export class ModuleLoader { private addEntryWithImplicitDependants( unresolvedModule: UnresolvedModule, - implicitlyLoadedAfter: string[] + implicitlyLoadedAfter: readonly string[] ): Promise { return this.extendLoadModulesPromise( this.loadEntryModule(unresolvedModule.id, false, unresolvedModule.importer, null).then( @@ -239,9 +244,13 @@ export class ModuleLoader { ); } - private async addModuleSource(id: string, importer: string | undefined, module: Module) { + private async addModuleSource( + id: string, + importer: string | undefined, + module: Module + ): Promise { timeStart('load modules', 3); - let source: string | SourceDescription; + let source: LoadResult; try { source = await this.readQueue.run( async () => (await this.pluginDriver.hookFirst('load', [id])) ?? (await readFile(id)) @@ -258,7 +267,7 @@ export class ModuleLoader { const sourceDescription = typeof source === 'string' ? { code: source } - : typeof source === 'object' && typeof source.code === 'string' + : source != null && typeof source === 'object' && typeof source.code === 'string' ? source : error(errBadLoader(id)); const cachedModule = this.graph.cachedModules.get(id); @@ -301,7 +310,7 @@ export class ModuleLoader { private async fetchDynamicDependencies( module: Module, - resolveDynamicImportPromises: ResolveDynamicDependencyPromise[] + resolveDynamicImportPromises: readonly ResolveDynamicDependencyPromise[] ): Promise { const dependencies = await Promise.all( resolveDynamicImportPromises.map(resolveDynamicImportPromise => @@ -342,7 +351,7 @@ export class ModuleLoader { return existingModule; } - const module: Module = new Module( + const module = new Module( this.graph, id, this.options, @@ -360,7 +369,7 @@ export class ModuleLoader { ]); const loadAndResolveDependenciesPromise = loadPromise .then(([resolveStaticDependencyPromises, resolveDynamicImportPromises]) => - Promise.all([...resolveStaticDependencyPromises, ...resolveDynamicImportPromises]) + Promise.all([...resolveStaticDependencyPromises, ...resolveDynamicImportPromises]) ) .then(() => this.pluginDriver.hookParallel('moduleParsed', [module.info])); loadAndResolveDependenciesPromise.catch(() => { @@ -376,10 +385,10 @@ export class ModuleLoader { private async fetchModuleDependencies( module: Module, - resolveStaticDependencyPromises: ResolveStaticDependencyPromise[], - resolveDynamicDependencyPromises: ResolveDynamicDependencyPromise[], + resolveStaticDependencyPromises: readonly ResolveStaticDependencyPromise[], + resolveDynamicDependencyPromises: readonly ResolveDynamicDependencyPromise[], loadAndResolveDependenciesPromise: Promise - ) { + ): Promise { if (this.modulesWithLoadedDependencies.has(module)) { return; } @@ -425,7 +434,7 @@ export class ModuleLoader { private async fetchStaticDependencies( module: Module, - resolveStaticDependencyPromises: ResolveStaticDependencyPromise[] + resolveStaticDependencyPromises: readonly ResolveStaticDependencyPromise[] ): Promise { for (const dependency of await Promise.all( resolveStaticDependencyPromises.map(resolveStaticDependencyPromise => @@ -665,7 +674,7 @@ function addChunkNamesToModule( module: Module, { fileName, name }: UnresolvedModule, isUserDefined: boolean -) { +): void { if (fileName !== null) { module.chunkFileNames.add(fileName); } else if (name !== null) { @@ -682,7 +691,7 @@ function isNotAbsoluteExternal( id: string, source: string, makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource' -) { +): boolean { return ( makeAbsoluteExternalsRelative === true || (makeAbsoluteExternalsRelative === 'ifRelativeSource' && isRelative(source)) || diff --git a/src/ast/scopes/ChildScope.ts b/src/ast/scopes/ChildScope.ts index 6b7acfbbf08..96ca9d95c67 100644 --- a/src/ast/scopes/ChildScope.ts +++ b/src/ast/scopes/ChildScope.ts @@ -51,8 +51,8 @@ export default class ChildScope extends Scope { addUsedOutsideNames( usedNames: Set, format: InternalModuleFormat, - exportNamesByVariable: Map, - accessedGlobalsByScope: Map> + exportNamesByVariable: ReadonlyMap, + accessedGlobalsByScope: ReadonlyMap> ): void { for (const variable of this.accessedOutsideVariables.values()) { if (variable.included) { @@ -76,8 +76,8 @@ export default class ChildScope extends Scope { deconflict( format: InternalModuleFormat, - exportNamesByVariable: Map, - accessedGlobalsByScope: Map> + exportNamesByVariable: ReadonlyMap, + accessedGlobalsByScope: ReadonlyMap> ): void { const usedNames = new Set(); this.addUsedOutsideNames(usedNames, format, exportNamesByVariable, accessedGlobalsByScope); diff --git a/src/ast/scopes/ModuleScope.ts b/src/ast/scopes/ModuleScope.ts index ab0c5696211..e6e328a7b89 100644 --- a/src/ast/scopes/ModuleScope.ts +++ b/src/ast/scopes/ModuleScope.ts @@ -33,8 +33,8 @@ export default class ModuleScope extends ChildScope { deconflict( format: InternalModuleFormat, - exportNamesByVariable: Map, - accessedGlobalsByScope: Map> + exportNamesByVariable: ReadonlyMap, + accessedGlobalsByScope: ReadonlyMap> ): void { // all module level variables are already deconflicted when deconflicting the chunk for (const scope of this.children) diff --git a/src/utils/PluginDriver.ts b/src/utils/PluginDriver.ts index 5913fbeed04..1a77fe57851 100644 --- a/src/utils/PluginDriver.ts +++ b/src/utils/PluginDriver.ts @@ -70,24 +70,24 @@ function throwInvalidHookError(hookName: string, pluginName: string) { } export class PluginDriver { - public emitFile: EmitFile; + public readonly emitFile: EmitFile; public finaliseAssets: () => void; public getFileName: (fileReferenceId: string) => string; - public setOutputBundle: ( + public readonly setOutputBundle: ( outputBundle: OutputBundleWithPlaceholders, outputOptions: NormalizedOutputOptions, facadeChunkByModule: Map ) => void; - private fileEmitter: FileEmitter; - private pluginCache: Record | undefined; - private pluginContexts = new Map(); - private plugins: Plugin[]; + private readonly fileEmitter: FileEmitter; + private readonly pluginCache: Record | undefined; + private readonly pluginContexts = new Map(); + private readonly plugins: Plugin[]; constructor( private readonly graph: Graph, private readonly options: NormalizedInputOptions, - userPlugins: Plugin[], + userPlugins: readonly Plugin[], pluginCache: Record | undefined, basePluginDriver?: PluginDriver ) { @@ -121,7 +121,7 @@ export class PluginDriver { } } - public createOutputPluginDriver(plugins: Plugin[]): PluginDriver { + public createOutputPluginDriver(plugins: readonly Plugin[]): PluginDriver { return new PluginDriver(this.graph, this.options, plugins, this.pluginCache, this); } diff --git a/src/utils/collapseSourcemaps.ts b/src/utils/collapseSourcemaps.ts index 784eadf6696..5842126e0e8 100644 --- a/src/utils/collapseSourcemaps.ts +++ b/src/utils/collapseSourcemaps.ts @@ -10,8 +10,8 @@ import { error } from './error'; import { basename, dirname, relative, resolve } from './path'; class Source { - content: string; - filename: string; + readonly content: string; + readonly filename: string; isOriginal = true; constructor(filename: string, content: string) { @@ -32,9 +32,9 @@ interface SourceMapSegmentObject { } class Link { - mappings: SourceMapSegment[][]; - names: string[]; - sources: (Source | Link)[]; + readonly mappings: SourceMapSegment[][]; + readonly names: string[]; + readonly sources: (Source | Link)[]; constructor( map: { mappings: SourceMapSegment[][]; names: string[] }, @@ -176,7 +176,7 @@ function getCollapsedSourcemap( id: string, originalCode: string, originalSourcemap: ExistingDecodedSourceMap | null, - sourcemapChain: DecodedSourceMapOrMissing[], + sourcemapChain: readonly DecodedSourceMapOrMissing[], linkMap: (source: Source | Link, map: DecodedSourceMapOrMissing) => Link ): Source | Link { let source: Source | Link; @@ -200,8 +200,8 @@ function getCollapsedSourcemap( export function collapseSourcemaps( file: string, map: DecodedSourceMap, - modules: Module[], - bundleSourcemapChain: DecodedSourceMapOrMissing[], + modules: readonly Module[], + bundleSourcemapChain: readonly DecodedSourceMapOrMissing[], excludeContent: boolean | undefined, warn: WarningHandler ): SourceMap { @@ -241,7 +241,7 @@ export function collapseSourcemap( id: string, originalCode: string, originalSourcemap: ExistingDecodedSourceMap | null, - sourcemapChain: DecodedSourceMapOrMissing[], + sourcemapChain: readonly DecodedSourceMapOrMissing[], warn: WarningHandler ): ExistingDecodedSourceMap | null { if (!sourcemapChain.length) { diff --git a/src/utils/commondir.ts b/src/utils/commondir.ts index fa3bb0a29e9..95a705d2e4f 100644 --- a/src/utils/commondir.ts +++ b/src/utils/commondir.ts @@ -1,9 +1,9 @@ -import * as path from './path'; +import { dirname } from './path'; // ported from https://github.com/substack/node-commondir -export default function commondir(files: string[]): string { +export default function commondir(files: readonly string[]): string { if (files.length === 0) return '/'; - if (files.length === 1) return path.dirname(files[0]); + if (files.length === 1) return dirname(files[0]); const commonSegments = files.slice(1).reduce((commonSegments, file) => { const pathSegements = file.split(/\/+|\\+/); let i; diff --git a/src/utils/deconflictChunk.ts b/src/utils/deconflictChunk.ts index a344d0ca9f8..d19c41dc2a3 100644 --- a/src/utils/deconflictChunk.ts +++ b/src/utils/deconflictChunk.ts @@ -41,7 +41,7 @@ const DECONFLICT_IMPORTED_VARIABLES_BY_FORMAT: { }; export function deconflictChunk( - modules: Module[], + modules: readonly Module[], dependenciesToBeDeconflicted: DependenciesToBeDeconflicted, imports: Set, usedNames: Set, @@ -51,9 +51,9 @@ export function deconflictChunk( externalLiveBindings: boolean, chunkByModule: Map, syntheticExports: Set, - exportNamesByVariable: Map, - accessedGlobalsByScope: Map>, - includedNamespaces: Set + exportNamesByVariable: ReadonlyMap, + accessedGlobalsByScope: ReadonlyMap>, + includedNamespaces: ReadonlySet ): void { const reversedModules = modules.slice().reverse(); for (const module of reversedModules) { @@ -83,7 +83,7 @@ export function deconflictChunk( function deconflictImportsEsmOrSystem( usedNames: Set, - imports: Set, + imports: ReadonlySet, dependenciesToBeDeconflicted: DependenciesToBeDeconflicted, _interop: GetInterop, preserveModules: boolean, @@ -134,7 +134,7 @@ function deconflictImportsOther( preserveModules: boolean, externalLiveBindings: boolean, chunkByModule: Map -) { +): void { for (const chunkOrExternalModule of dependencies) { chunkOrExternalModule.variableName = getSafeName( chunkOrExternalModule.suggestedVariableName, @@ -206,9 +206,9 @@ function deconflictImportsOther( function deconflictTopLevelVariables( usedNames: Set, - modules: Module[], - includedNamespaces: Set -) { + modules: readonly Module[], + includedNamespaces: ReadonlySet +): void { for (const module of modules) { for (const variable of module.scope.variables.values()) { if ( diff --git a/src/utils/executionOrder.ts b/src/utils/executionOrder.ts index 6d8430dec4f..d966f993ba7 100644 --- a/src/utils/executionOrder.ts +++ b/src/utils/executionOrder.ts @@ -13,7 +13,7 @@ export function sortByExecutionOrder(units: OrderedExecutionUnit[]): void { units.sort(compareExecIndex); } -export function analyseModuleExecution(entryModules: Module[]): { +export function analyseModuleExecution(entryModules: readonly Module[]): { cyclePaths: string[][]; orderedModules: Module[]; } { @@ -72,7 +72,7 @@ function getCyclePath( module: Module, parent: Module, parents: Map -) { +): string[] { const cycleSymbol = Symbol(module.id); const path = [relativeId(module.id)]; let nextModule = parent; diff --git a/src/utils/exportNames.ts b/src/utils/exportNames.ts index 33a59384689..dcb297edc63 100644 --- a/src/utils/exportNames.ts +++ b/src/utils/exportNames.ts @@ -3,7 +3,7 @@ import RESERVED_NAMES from './RESERVED_NAMES'; import { toBase64 } from './base64'; export function assignExportsToMangledNames( - exports: Set, + exports: ReadonlySet, exportsByName: Record, exportNamesByVariable: Map ): void { @@ -26,7 +26,7 @@ export function assignExportsToMangledNames( } export function assignExportsToNames( - exports: Set, + exports: ReadonlySet, exportsByName: Record, exportNamesByVariable: Map ): void { diff --git a/src/utils/getCodeFrame.ts b/src/utils/getCodeFrame.ts index 612f2530fdf..0b1858e8b47 100644 --- a/src/utils/getCodeFrame.ts +++ b/src/utils/getCodeFrame.ts @@ -1,10 +1,10 @@ -function spaces(i: number) { +function spaces(i: number): string { let result = ''; while (i--) result += ' '; return result; } -function tabsToSpaces(str: string) { +function tabsToSpaces(str: string): string { return str.replace(/^\t+/, match => match.split('\t').join(' ')); } diff --git a/src/utils/getExportMode.ts b/src/utils/getExportMode.ts index f5f3a060911..d0854ef9959 100644 --- a/src/utils/getExportMode.ts +++ b/src/utils/getExportMode.ts @@ -10,7 +10,7 @@ import { export default function getExportMode( chunk: Chunk, { exports: exportMode, name, format }: NormalizedOutputOptions, - unsetOptions: Set, + unsetOptions: ReadonlySet, facadeModuleId: string, warn: WarningHandler ): 'default' | 'named' | 'none' { diff --git a/src/utils/getIndentString.ts b/src/utils/getIndentString.ts index 183d708c030..b7cd960ba44 100644 --- a/src/utils/getIndentString.ts +++ b/src/utils/getIndentString.ts @@ -1,6 +1,6 @@ import Module from '../Module'; -function guessIndentString(code: string) { +function guessIndentString(code: string): string | null { const lines = code.split('\n'); const tabbed = lines.filter(line => /^\t+/.test(line)); @@ -27,7 +27,7 @@ function guessIndentString(code: string) { } export default function getIndentString( - modules: Module[], + modules: readonly Module[], options: { indent: true | string } ): string { if (options.indent !== true) return options.indent; diff --git a/src/utils/getOriginalLocation.ts b/src/utils/getOriginalLocation.ts index 692888dd472..fb615b0a397 100644 --- a/src/utils/getOriginalLocation.ts +++ b/src/utils/getOriginalLocation.ts @@ -1,7 +1,7 @@ import { DecodedSourceMapOrMissing, ExistingDecodedSourceMap } from '../rollup/types'; export function getOriginalLocation( - sourcemapChain: DecodedSourceMapOrMissing[], + sourcemapChain: readonly DecodedSourceMapOrMissing[], location: { column: number; line: number; name?: string; source?: string } ): { column: number; line: number } { const filteredSourcemapChain = sourcemapChain.filter( diff --git a/src/utils/getStaticDependencies.ts b/src/utils/getStaticDependencies.ts index 5d3a447c9f5..173206e1a78 100644 --- a/src/utils/getStaticDependencies.ts +++ b/src/utils/getStaticDependencies.ts @@ -4,8 +4,8 @@ import Module from '../Module'; export function getStaticDependencies( chunk: Chunk, - orderedModules: Module[], - chunkByModule: Map + orderedModules: readonly Module[], + chunkByModule: ReadonlyMap ): Set { const staticDependencyBlocks: (Chunk | ExternalModule)[][] = []; const handledDependencies = new Set(); @@ -31,7 +31,7 @@ function addStaticDependencies( staticDependencies: (Chunk | ExternalModule)[], handledModules: Set, chunk: Chunk, - chunkByModule: Map + chunkByModule: ReadonlyMap ): void { const dependencies = module.getDependenciesToBeIncluded(); for (const dependency of dependencies) { diff --git a/src/utils/identifierHelpers.ts b/src/utils/identifierHelpers.ts index b67952d14c7..0dbbde65c74 100644 --- a/src/utils/identifierHelpers.ts +++ b/src/utils/identifierHelpers.ts @@ -2,7 +2,7 @@ import RESERVED_NAMES from './RESERVED_NAMES'; const illegalCharacters = /[^$_a-zA-Z0-9]/g; -const startsWithDigit = (str: string) => /\d/.test(str[0]); +const startsWithDigit = (str: string): boolean => /\d/.test(str[0]); export function isLegal(str: string): boolean { if (startsWithDigit(str) || RESERVED_NAMES.has(str)) { diff --git a/src/utils/pluginUtils.ts b/src/utils/pluginUtils.ts index af027c59f01..1bac7a304c5 100644 --- a/src/utils/pluginUtils.ts +++ b/src/utils/pluginUtils.ts @@ -28,7 +28,10 @@ export const deprecatedHooks: { active: boolean; deprecated: string; replacement { active: true, deprecated: 'resolveAssetUrl', replacement: 'resolveFileUrl' } ]; -export function warnDeprecatedHooks(plugins: Plugin[], options: NormalizedInputOptions): void { +export function warnDeprecatedHooks( + plugins: readonly Plugin[], + options: NormalizedInputOptions +): void { for (const { active, deprecated, replacement } of deprecatedHooks) { for (const plugin of plugins) { if (deprecated in plugin) { diff --git a/src/utils/printStringList.ts b/src/utils/printStringList.ts index 19c80ce5e60..80445ebb8fa 100644 --- a/src/utils/printStringList.ts +++ b/src/utils/printStringList.ts @@ -1,4 +1,7 @@ -export function printQuotedStringList(list: string[], verbs?: [string, string]): string { +export function printQuotedStringList( + list: readonly string[], + verbs?: readonly [string, string] +): string { const isSingleItem = list.length <= 1; const quotedList = list.map(item => `"${item}"`); let output = isSingleItem diff --git a/src/utils/pureComments.ts b/src/utils/pureComments.ts index 29cefc6faaa..2177df22e4e 100644 --- a/src/utils/pureComments.ts +++ b/src/utils/pureComments.ts @@ -13,7 +13,7 @@ import { import { SOURCEMAPPING_URL_RE } from './sourceMappingURL'; // patch up acorn-walk until class-fields are officially supported -basicWalker.PropertyDefinition = function (node: any, st: any, c: any) { +basicWalker.PropertyDefinition = function (node: any, st: any, c: any): void { if (node.computed) { c(node.key, st, 'Expression'); } @@ -40,7 +40,7 @@ function handlePureAnnotationsOfNode( node: acorn.Node, state: CommentState, type: string = node.type -) { +): void { const { annotations } = state; let comment = annotations[state.annotationIndex]; while (comment && node.start >= comment.end) { @@ -59,7 +59,7 @@ function handlePureAnnotationsOfNode( const neitherWithespaceNorBrackets = /[^\s(]/g; const noWhitespace = /\S/g; -function markPureNode(node: NodeWithComments, comment: acorn.Comment, code: string) { +function markPureNode(node: NodeWithComments, comment: acorn.Comment, code: string): void { const annotatedNodes = []; let invalidAnnotation: boolean | undefined; const codeInBetween = code.slice(comment.end, node.start); @@ -162,7 +162,7 @@ export function addAnnotations( }); } -function annotateNode(node: NodeWithComments, comment: acorn.Comment, valid: boolean) { +function annotateNode(node: NodeWithComments, comment: acorn.Comment, valid: boolean): void { const key = valid ? ANNOTATION_KEY : INVALID_COMMENT_KEY; const property = node[key]; if (property) { diff --git a/src/utils/queue.ts b/src/utils/queue.ts index 8be2d4826d8..18e056ee72d 100644 --- a/src/utils/queue.ts +++ b/src/utils/queue.ts @@ -1,25 +1,31 @@ -export class Queue { - private queue = new Array<{ - reject: (reason?: any) => void; - resolve: (value: any) => void; - task: () => any; - }>(); +interface Task { + (): T | Promise; +} + +interface QueueItem { + reject: (reason?: unknown) => void; + resolve: (value: T) => void; + task: Task; +} + +export class Queue { + private readonly queue: QueueItem[] = []; private workerCount = 0; - constructor(public maxParallel = 1) {} + constructor(private maxParallel: number) {} - run(task: () => T | Promise): Promise { + run(task: Task): Promise { return new Promise((resolve, reject) => { this.queue.push({ reject, resolve, task }); this.work(); }); } - private async work() { + private async work(): Promise { if (this.workerCount >= this.maxParallel) return; this.workerCount++; - let entry; + let entry: QueueItem | undefined; while ((entry = this.queue.shift())) { const { reject, resolve, task } = entry; diff --git a/src/utils/reassignedExportsMember.ts b/src/utils/reassignedExportsMember.ts index c51081a5bc4..c7ac51146f1 100644 --- a/src/utils/reassignedExportsMember.ts +++ b/src/utils/reassignedExportsMember.ts @@ -2,7 +2,7 @@ import Variable from '../ast/variables/Variable'; export function isReassignedExportsMember( variable: Variable, - exportNamesByVariable: Map + exportNamesByVariable: ReadonlyMap ): boolean { return ( variable.renderBaseName !== null && exportNamesByVariable.has(variable) && variable.isReassigned diff --git a/src/utils/renderHelpers.ts b/src/utils/renderHelpers.ts index 14ed47f8f90..6e9c6c2d209 100644 --- a/src/utils/renderHelpers.ts +++ b/src/utils/renderHelpers.ts @@ -89,7 +89,7 @@ function findFirstLineBreakOutsideComment(code: string): [number, number] { } export function renderStatementList( - statements: StatementNode[], + statements: readonly StatementNode[], code: MagicString, start: number, end: number, @@ -134,7 +134,7 @@ export function renderStatementList( // This assumes that the first character is not part of the first node export function getCommaSeparatedNodesWithBoundaries( - nodes: N[], + nodes: readonly N[], code: MagicString, start: number, end: number diff --git a/src/utils/resolveId.ts b/src/utils/resolveId.ts index c6a908f926f..221cab3f79b 100644 --- a/src/utils/resolveId.ts +++ b/src/utils/resolveId.ts @@ -14,9 +14,9 @@ export async function resolveId( importer: string | undefined, customOptions: CustomPluginOptions | undefined, isEntry: boolean | undefined, - skip: { importer: string | undefined; plugin: Plugin; source: string }[] | null + skip: readonly { importer: string | undefined; plugin: Plugin; source: string }[] | null ) => Promise, - skip: { importer: string | undefined; plugin: Plugin; source: string }[] | null, + skip: readonly { importer: string | undefined; plugin: Plugin; source: string }[] | null, customOptions: CustomPluginOptions | undefined, isEntry: boolean ): Promise { diff --git a/src/utils/resolveIdViaPlugins.ts b/src/utils/resolveIdViaPlugins.ts index 23a14a332d6..20d177e6bc2 100644 --- a/src/utils/resolveIdViaPlugins.ts +++ b/src/utils/resolveIdViaPlugins.ts @@ -17,9 +17,9 @@ export function resolveIdViaPlugins( importer: string | undefined, customOptions: CustomPluginOptions | undefined, isEntry: boolean | undefined, - skip: { importer: string | undefined; plugin: Plugin; source: string }[] | null + skip: readonly { importer: string | undefined; plugin: Plugin; source: string }[] | null ) => Promise, - skip: { importer: string | undefined; plugin: Plugin; source: string }[] | null, + skip: readonly { importer: string | undefined; plugin: Plugin; source: string }[] | null, customOptions: CustomPluginOptions | undefined, isEntry: boolean ): Promise { diff --git a/src/utils/systemJsRendering.ts b/src/utils/systemJsRendering.ts index e5e29f479c6..6d8e9fed0a9 100644 --- a/src/utils/systemJsRendering.ts +++ b/src/utils/systemJsRendering.ts @@ -3,7 +3,7 @@ import Variable from '../ast/variables/Variable'; import { RenderOptions } from './renderHelpers'; export function getSystemExportStatement( - exportedVariables: Variable[], + exportedVariables: readonly Variable[], { exportNamesByVariable, snippets: { _, getObject, getPropertyAccess } }: RenderOptions, modifier = '' ): string { @@ -41,7 +41,7 @@ export function renderSystemExportExpression( } export function renderSystemExportFunction( - exportedVariables: Variable[], + exportedVariables: readonly Variable[], expressionStart: number, expressionEnd: number, needsParens: boolean | undefined, diff --git a/src/utils/timers.ts b/src/utils/timers.ts index cc5c02bb128..6ecb47e94bb 100644 --- a/src/utils/timers.ts +++ b/src/utils/timers.ts @@ -20,9 +20,9 @@ let getElapsedTime: (previous: StartTime) => number = () => 0; let getMemory: () => number = () => 0; let timers: Timers = {}; -const normalizeHrTime = (time: [number, number]) => time[0] * 1e3 + time[1] / 1e6; +const normalizeHrTime = (time: [number, number]): number => time[0] * 1e3 + time[1] / 1e6; -function setTimeHelpers() { +function setTimeHelpers(): void { if (typeof process !== 'undefined' && typeof process.hrtime === 'function') { getStartTime = process.hrtime.bind(process); getElapsedTime = previous => normalizeHrTime(process.hrtime(previous)); @@ -35,7 +35,7 @@ function setTimeHelpers() { } } -function getPersistedLabel(label: string, level: number) { +function getPersistedLabel(label: string, level: number): string { switch (level) { case 1: return `# ${label}`; @@ -48,7 +48,7 @@ function getPersistedLabel(label: string, level: number) { } } -function timeStartImpl(label: string, level = 3) { +function timeStartImpl(label: string, level = 3): void { label = getPersistedLabel(label, level); if (!timers.hasOwnProperty(label)) { timers[label] = { @@ -64,7 +64,7 @@ function timeStartImpl(label: string, level = 3) { timers[label].startMemory = currentMemory; } -function timeEndImpl(label: string, level = 3) { +function timeEndImpl(label: string, level = 3): void { label = getPersistedLabel(label, level); if (timers.hasOwnProperty(label)) { const currentMemory = getMemory(); diff --git a/src/watch/fileWatcher.ts b/src/watch/fileWatcher.ts index d774b74b04d..f586ae7f1f5 100644 --- a/src/watch/fileWatcher.ts +++ b/src/watch/fileWatcher.ts @@ -1,13 +1,13 @@ import { platform } from 'os'; -import chokidar, { FSWatcher } from 'chokidar'; -import { ChangeEvent, ChokidarOptions } from '../rollup/types'; -import { Task } from './watch'; +import chokidar, { type FSWatcher } from 'chokidar'; +import type { ChangeEvent, ChokidarOptions } from '../rollup/types'; +import type { Task } from './watch'; export class FileWatcher { - private chokidarOptions: ChokidarOptions; - private task: Task; - private transformWatchers = new Map(); - private watcher: FSWatcher; + private readonly chokidarOptions: ChokidarOptions; + private readonly task: Task; + private readonly transformWatchers = new Map(); + private readonly watcher: FSWatcher; constructor(task: Task, chokidarOptions: ChokidarOptions) { this.chokidarOptions = chokidarOptions; @@ -33,7 +33,7 @@ export class FileWatcher { watch(id: string, isTransformDependency: boolean): void { if (isTransformDependency) { - const watcher = this.transformWatchers.get(id) || this.createWatcher(id); + const watcher = this.transformWatchers.get(id) ?? this.createWatcher(id); watcher.add(id); this.transformWatchers.set(id, watcher); } else { diff --git a/src/watch/watch.ts b/src/watch/watch.ts index 9ed301f729e..134124cc7b1 100644 --- a/src/watch/watch.ts +++ b/src/watch/watch.ts @@ -1,4 +1,4 @@ -import * as path from 'path'; +import { resolve } from 'path'; import { createFilter } from '@rollup/pluginutils'; import { rollupInternal } from '../rollup/rollup'; import { @@ -33,16 +33,16 @@ const eventsRewrites: Record(); + private readonly invalidatedIds = new Map(); private rerun = false; private running = true; - private tasks: Task[]; + private readonly tasks: Task[]; - constructor(configs: GenericConfigObject[], emitter: RollupWatcher) { + constructor(configs: readonly GenericConfigObject[], emitter: RollupWatcher) { this.emitter = emitter; emitter.close = this.close.bind(this); this.tasks = configs.map(config => new Task(this, config)); @@ -97,7 +97,7 @@ export class Watcher { }, this.buildDelay); } - private async run() { + private async run(): Promise { this.running = true; this.emitter.emit('event', { code: 'START' @@ -123,15 +123,15 @@ export class Task { watchFiles: string[] = []; private closed = false; - private fileWatcher: FileWatcher; + private readonly fileWatcher: FileWatcher; private filter: (id: string) => boolean; private invalidated = true; - private options: MergedRollupOptions; - private outputFiles: string[]; - private outputs: OutputOptions[]; + private readonly options: MergedRollupOptions; + private readonly outputFiles: string[]; + private readonly outputs: OutputOptions[]; private skipWrite: boolean; private watched = new Set(); - private watcher: Watcher; + private readonly watcher: Watcher; constructor(watcher: Watcher, config: GenericConfigObject) { this.watcher = watcher; @@ -140,7 +140,7 @@ export class Task { this.options = mergeOptions(config); this.outputs = this.options.output; this.outputFiles = this.outputs.map(output => { - if (output.file || output.dir) return path.resolve(output.file || output.dir!); + if (output.file || output.dir) return resolve(output.file || output.dir!); return undefined as never; }); From da3bb43003e48fbb9815d9bd5aefee55d776b386 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Wed, 5 Jan 2022 08:23:50 +0100 Subject: [PATCH 12/30] More watch test stabilization (#4339) * Make CLI tests repeatable * Add watcher to test * Make it more lightweight by using fs.watch * More logging * Use timeouts again * Remove repetitions --- test/cli/index.js | 211 +++++++++--------- .../watch-config-early-update/_config.js | 21 +- .../watch/watch-config-error/_config.js | 27 ++- test/utils.js | 1 + 4 files changed, 137 insertions(+), 123 deletions(-) diff --git a/test/cli/index.js b/test/cli/index.js index 4bbd525a431..7f747a34024 100644 --- a/test/cli/index.js +++ b/test/cli/index.js @@ -5,7 +5,8 @@ const sander = require('sander'); const { normaliseOutput, runTestSuiteWithSamples, - assertDirectoriesAreEqual + assertDirectoriesAreEqual, + getFileNamesAndRemoveOutput } = require('../utils.js'); const cwd = process.cwd(); @@ -17,123 +18,131 @@ runTestSuiteWithSamples( 'cli', path.resolve(__dirname, 'samples'), (dir, config) => { - (config.skip ? it.skip : config.solo ? it.only : it)( - path.basename(dir) + ': ' + config.description, - done => { - process.chdir(config.cwd || dir); - if (config.before) config.before(); + // allow to repeat flaky tests for debugging on CLI + for (let pass = 0; pass < (config.repeat || 1); pass++) { + runTest(dir, config, pass); + } + }, + () => process.chdir(cwd) +); - const command = config.command.replace( - /(^| )rollup($| )/g, - `node ${path.resolve(__dirname, '../../dist/bin')}${path.sep}rollup ` - ); +function runTest(dir, config, pass) { + const name = path.basename(dir) + ': ' + config.description; + (config.skip ? it.skip : config.solo ? it.only : it)( + pass > 0 ? `${name} (pass ${pass + 1})` : name, + done => { + process.chdir(config.cwd || dir); + if (pass > 0) { + getFileNamesAndRemoveOutput(dir); + } + if (config.before) config.before(); - const childProcess = exec( - command, - { - timeout: 40000, - env: { ...process.env, FORCE_COLOR: '0', ...config.env } - }, - (err, code, stderr) => { - if (config.after) config.after(err, code, stderr); - if (err && !err.killed) { - if (config.error) { - const shouldContinue = config.error(err); - if (!shouldContinue) return done(); - } else { - throw err; - } - } + const command = config.command.replace( + /(^| )rollup($| )/g, + `node ${path.resolve(__dirname, '../../dist/bin')}${path.sep}rollup ` + ); - if ('stderr' in config) { - const shouldContinue = config.stderr(stderr); + const childProcess = exec( + command, + { + timeout: 40000, + env: { ...process.env, FORCE_COLOR: '0', ...config.env } + }, + (err, code, stderr) => { + if (config.after) config.after(err, code, stderr); + if (err && !err.killed) { + if (config.error) { + const shouldContinue = config.error(err); if (!shouldContinue) return done(); - } else if (stderr) { - console.error(stderr); + } else { + throw err; } + } - let unintendedError; - - if (config.execute) { - try { - const fn = new Function('require', 'module', 'exports', 'assert', code); - const module = { - exports: {} - }; - fn(require, module, module.exports, assert); + if ('stderr' in config) { + const shouldContinue = config.stderr(stderr); + if (!shouldContinue) return done(); + } else if (stderr) { + console.error(stderr); + } - if (config.error) { - unintendedError = new Error('Expected an error while executing output'); - } + let unintendedError; - if (config.exports) { - config.exports(module.exports); - } - } catch (err) { - if (config.error) { - config.error(err); - } else { - unintendedError = err; - } - } + if (config.execute) { + try { + const fn = new Function('require', 'module', 'exports', 'assert', code); + const module = { + exports: {} + }; + fn(require, module, module.exports, assert); - if (config.show || unintendedError) { - console.log(code + '\n\n\n'); + if (config.error) { + unintendedError = new Error('Expected an error while executing output'); } - if (config.solo) console.groupEnd(); - - unintendedError ? done(unintendedError) : done(); - } else if (config.result) { - try { - config.result(code); - done(); - } catch (err) { - done(err); - } - } else if (config.test) { - try { - config.test(); - done(); - } catch (err) { - done(err); - } - } else if ( - sander.existsSync('_expected') && - sander.statSync('_expected').isDirectory() - ) { - try { - assertDirectoriesAreEqual('_actual', '_expected'); - done(); - } catch (err) { - done(err); + if (config.exports) { + config.exports(module.exports); } - } else { - const expected = sander.readFileSync('_expected.js').toString(); - try { - assert.equal(normaliseOutput(code), normaliseOutput(expected)); - done(); - } catch (err) { - done(err); + } catch (err) { + if (config.error) { + config.error(err); + } else { + unintendedError = err; } } - } - ); - childProcess.stderr.on('data', async data => { - if (config.abortOnStderr) { + if (config.show || unintendedError) { + console.log(code + '\n\n\n'); + } + + if (config.solo) console.groupEnd(); + + unintendedError ? done(unintendedError) : done(); + } else if (config.result) { try { - if (await config.abortOnStderr(data)) { - childProcess.kill('SIGTERM'); - } + config.result(code); + done(); + } catch (err) { + done(err); + } + } else if (config.test) { + try { + config.test(); + done(); + } catch (err) { + done(err); + } + } else if (sander.existsSync('_expected') && sander.statSync('_expected').isDirectory()) { + try { + assertDirectoriesAreEqual('_actual', '_expected'); + done(); + } catch (err) { + done(err); + } + } else { + const expected = sander.readFileSync('_expected.js').toString(); + try { + assert.equal(normaliseOutput(code), normaliseOutput(expected)); + done(); } catch (err) { - childProcess.kill('SIGTERM'); done(err); } } - }); - } - ).timeout(50000); - }, - () => process.chdir(cwd) -); + } + ); + + childProcess.stderr.on('data', async data => { + if (config.abortOnStderr) { + try { + if (await config.abortOnStderr(data)) { + childProcess.kill('SIGTERM'); + } + } catch (err) { + childProcess.kill('SIGTERM'); + done(err); + } + } + }); + } + ).timeout(50000); +} diff --git a/test/cli/samples/watch/watch-config-early-update/_config.js b/test/cli/samples/watch/watch-config-early-update/_config.js index d7b769c9058..65197b87546 100644 --- a/test/cli/samples/watch/watch-config-early-update/_config.js +++ b/test/cli/samples/watch/watch-config-early-update/_config.js @@ -8,7 +8,9 @@ module.exports = { description: 'immediately reloads the config file if a change happens while it is parsed', command: 'rollup -cw', before() { - fs.mkdirSync(path.resolve(__dirname, '_actual')); + // This test writes a config file that prints a message to stderr but delays resolving to a + // config. The stderr message is observed by the parent process and triggers overwriting the + // config file. That way, we simulate a complicated config file being changed while it is parsed. configFile = path.resolve(__dirname, 'rollup.config.js'); fs.writeFileSync( configFile, @@ -18,16 +20,15 @@ module.exports = { setTimeout( () => resolve({ - input: { output1: 'main.js' }, + input: 'main.js', output: { - dir: '_actual', + file: '_actual/output1.js', format: 'es' } }), - 1000 + 3000 ); - }); - ` + });` ); }, after() { @@ -40,9 +41,9 @@ module.exports = { ` console.error('updated'); export default { - input: {output2: "main.js"}, + input: 'main.js', output: { - dir: "_actual", + file: '_actual/output2.js', format: "es" } }; @@ -50,8 +51,8 @@ module.exports = { ); return false; } - if (data === 'updated\n') { - return new Promise(resolve => setTimeout(() => resolve(true), 500)); + if (data.includes(`created _actual${path.sep}output2.js`)) { + return new Promise(resolve => setTimeout(() => resolve(true), 600)); } } }; diff --git a/test/cli/samples/watch/watch-config-error/_config.js b/test/cli/samples/watch/watch-config-error/_config.js index 149901b3e4e..400b1953b88 100644 --- a/test/cli/samples/watch/watch-config-error/_config.js +++ b/test/cli/samples/watch/watch-config-error/_config.js @@ -11,22 +11,25 @@ module.exports = { configFile = path.resolve(__dirname, 'rollup.config.js'); fs.writeFileSync( configFile, - 'export default {\n' + - '\tinput: "main.js",\n' + - '\toutput: {\n' + - '\t\tfile: "_actual/main1.js",\n' + - '\t\tformat: "es"\n' + - '\t}\n' + - '};' + ` + export default { + input: "main.js", + output: { + file: "_actual/main1.js", + format: "es" + } + };` ); }, after() { - // synchronous sometimes does not seem to work, probably because the watch is not yet removed properly - setTimeout(() => fs.unlinkSync(configFile), 300); + fs.unlinkSync(configFile); }, abortOnStderr(data) { if (data.includes(`created _actual${path.sep}main1.js`)) { - atomicWriteFileSync(configFile, 'throw new Error("Config contains errors");'); + setTimeout( + () => atomicWriteFileSync(configFile, 'throw new Error("Config contains errors");'), + 600 + ); return false; } if (data.includes('Config contains errors')) { @@ -41,11 +44,11 @@ module.exports = { '\t}\n' + '};' ); - }, 400); + }, 600); return false; } if (data.includes(`created _actual${path.sep}main2.js`)) { - return true; + return new Promise(resolve => setTimeout(() => resolve(true), 600)); } } }; diff --git a/test/utils.js b/test/utils.js index 23aecff9d3a..d8896c1d306 100644 --- a/test/utils.js +++ b/test/utils.js @@ -16,6 +16,7 @@ exports.assertDirectoriesAreEqual = assertDirectoriesAreEqual; exports.assertFilesAreEqual = assertFilesAreEqual; exports.assertIncludes = assertIncludes; exports.atomicWriteFileSync = atomicWriteFileSync; +exports.getFileNamesAndRemoveOutput = getFileNamesAndRemoveOutput; function normaliseError(error) { delete error.stack; From 1d2ea22b9889e4593f25c7142a58ffef71974d13 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 14 Jan 2022 06:15:54 +0100 Subject: [PATCH 13/30] Implement shouldTransformCachedModule hook (#4341) * Create docs * Implement shouldTransformCachedModule * Flush atomic file writes * Fix formatting * Improve test reliability --- docs/05-plugin-development.md | 16 ++++-- docs/build-hooks.mmd | 12 ++++- src/ModuleLoader.ts | 12 ++++- src/rollup/types.d.ts | 21 ++++++-- src/utils/PluginDriver.ts | 1 + src/utils/transform.ts | 1 - .../watch-config-early-update/_config.js | 6 +-- test/incremental/index.js | 50 +++++++++++++++++++ test/utils.js | 9 ++++ 9 files changed, 116 insertions(+), 12 deletions(-) diff --git a/docs/05-plugin-development.md b/docs/05-plugin-development.md index ef2def09112..ab5ead9f000 100644 --- a/docs/05-plugin-development.md +++ b/docs/05-plugin-development.md @@ -102,7 +102,7 @@ Notifies a plugin when watcher process closes and all open resources should be c #### `load` -**Type:** `(id: string) => string | null | {code: string, map?: string | SourceMap, ast? : ESTree.Program, moduleSideEffects?: boolean | "no-treeshake" | null, syntheticNamedExports?: boolean | string | null, meta?: {[plugin: string]: any} | null}`
**Kind:** `async, first`
**Previous Hook:** [`resolveId`](guide/en/#resolveid) or [`resolveDynamicImport`](guide/en/#resolvedynamicimport) where the loaded id was resolved. Additionally, this hook can be triggered at any time from plugin hooks by calling [`this.load`](guide/en/#thisload) to preload the module corresponding to an id.
**Next Hook:** [`transform`](guide/en/#transform) to transform the loaded file. +**Type:** `(id: string) => string | null | {code: string, map?: string | SourceMap, ast? : ESTree.Program, moduleSideEffects?: boolean | "no-treeshake" | null, syntheticNamedExports?: boolean | string | null, meta?: {[plugin: string]: any} | null}`
**Kind:** `async, first`
**Previous Hook:** [`resolveId`](guide/en/#resolveid) or [`resolveDynamicImport`](guide/en/#resolvedynamicimport) where the loaded id was resolved. Additionally, this hook can be triggered at any time from plugin hooks by calling [`this.load`](guide/en/#thisload) to preload the module corresponding to an id.
**Next Hook:** [`transform`](guide/en/#transform) to transform the loaded file if no cache was used, or there was no cached copy with the same `code`, otherwise [`shouldTransformCachedModule`](guide/en/#shouldtransformcachedmodule). Defines a custom loader. Returning `null` defers to other `load` functions (and eventually the default behavior of loading from the file system). To prevent additional parsing overhead in case e.g. this hook already used `this.parse` to generate an AST for some reason, this hook can optionally return a `{ code, ast, map }` object. The `ast` must be a standard ESTree AST with `start` and `end` properties for each node. If the transformation does not move code, you can preserve existing sourcemaps by setting `map` to `null`. Otherwise you might need to generate the source map. See [the section on source code transformations](#source-code-transformations). @@ -116,7 +116,7 @@ You can use [`this.getModuleInfo`](guide/en/#thisgetmoduleinfo) to find out the #### `moduleParsed` -**Type:** `(moduleInfo: ModuleInfo) => void`
**Kind:** `async, parallel`
**Previous Hook:** [`transform`](guide/en/#transform) where the currently handled file was transformed.
NextHook: [`resolveId`](guide/en/#resolveid) and [`resolveDynamicImport`](guide/en/#resolvedynamicimport) to resolve all discovered static and dynamic imports in parallel if present, otherwise [`buildEnd`](guide/en/#buildend). +**Type:** `(moduleInfo: ModuleInfo) => void`
**Kind:** `async, parallel`
**Previous Hook:** [`transform`](guide/en/#transform) where the currently handled file was transformed.
**Next Hook:** [`resolveId`](guide/en/#resolveid) and [`resolveDynamicImport`](guide/en/#resolvedynamicimport) to resolve all discovered static and dynamic imports in parallel if present, otherwise [`buildEnd`](guide/en/#buildend). This hook is called each time a module has been fully parsed by Rollup. See [`this.getModuleInfo`](guide/en/#thisgetmoduleinfo) for what information is passed to this hook. @@ -222,9 +222,19 @@ Note that while `resolveId` will be called for each import of a module and can t When triggering this hook from a plugin via [`this.resolve`](guide/en/#thisresolve), it is possible to pass a custom options object to this hook. While this object will be passed unmodified, plugins should follow the convention of adding a `custom` property with an object where the keys correspond to the names of the plugins that the options are intended for. For details see [custom resolver options](guide/en/#custom-resolver-options). +#### `shouldTransformCachedModule` + +**Type:** `({id: string, code: string, ast: ESTree.Program, meta: {[plugin: string]: any}, moduleSideEffects: boolean | "no-treeshake", syntheticNamedExports: string | boolean}) => boolean`
**Kind:** `async, first`
**Previous Hook:** [`load`](guide/en/#load) where the cached file was loaded to compare its code with the cached version.
**Next Hook:** [`moduleParsed`](guide/en/#moduleparsed) if no plugin returns `true`, otherwise [`transform`](guide/en/#transform). + +If the Rollup cache is used (e.g. in watch mode or explicitly via the JavaScript API), Rollup will skip the [`transform`](guide/en/#transform) hook of a module if after the [`load`](guide/en/#transform) hook, the loaded `code` is identical to the code of the cached copy. To prevent this, discard the cached copy and instead transform a module, plugins can implement this hook and return `true`. + +This hook can also be used to find out which modules were cached and access their cached meta information. + +If a plugin does not return `true`, Rollup will trigger this hook for other plugins, otherwise all remaining plugins will be skipped. + #### `transform` -**Type:** `(code: string, id: string) => string | null | {code?: string, map?: string | SourceMap, ast? : ESTree.Program, moduleSideEffects?: boolean | "no-treeshake" | null, syntheticNamedExports?: boolean | string | null, meta?: {[plugin: string]: any} | null}`
**Kind:** `async, sequential`
**Previous Hook:** [`load`](guide/en/#load) where the currently handled file was loaded.
NextHook: [`moduleParsed`](guide/en/#moduleparsed) once the file has been processed and parsed. +**Type:** `(code: string, id: string) => string | null | {code?: string, map?: string | SourceMap, ast? : ESTree.Program, moduleSideEffects?: boolean | "no-treeshake" | null, syntheticNamedExports?: boolean | string | null, meta?: {[plugin: string]: any} | null}`
**Kind:** `async, sequential`
**Previous Hook:** [`load`](guide/en/#load) where the currently handled file was loaded. If caching is used and there was a cached copy of that module, [`shouldTransformCachedModule`](guide/en/#shouldtransformcachedmodule) if a plugin returned `true` for that hook.
**Next Hook:** [`moduleParsed`](guide/en/#moduleparsed) once the file has been processed and parsed. Can be used to transform individual modules. To prevent additional parsing overhead in case e.g. this hook already used `this.parse` to generate an AST for some reason, this hook can optionally return a `{ code, ast, map }` object. The `ast` must be a standard ESTree AST with `start` and `end` properties for each node. If the transformation does not move code, you can preserve existing sourcemaps by setting `map` to `null`. Otherwise you might need to generate the source map. See [the section on source code transformations](#source-code-transformations). diff --git a/docs/build-hooks.mmd b/docs/build-hooks.mmd index bdb2695fcda..512dc5916b0 100644 --- a/docs/build-hooks.mmd +++ b/docs/build-hooks.mmd @@ -25,6 +25,9 @@ flowchart TB resolveid("resolveId"):::hook-first click resolveid "/guide/en/#resolveid" _parent + shouldtransformcachedmodule("shouldTransformCachedModule"):::hook-first + click shouldtransformcachedmodule "/guide/en/#shouldtransformcachedmodule" _parent + transform("transform"):::hook-sequential click transform "/guide/en/#transform" _parent @@ -41,10 +44,17 @@ flowchart TB resolveid --> |non-external|load - --> transform + --> |not cached|transform --> moduleparsed .-> |no imports|buildend + load + --> |cached|shouldtransformcachedmodule + --> |false|moduleparsed + + shouldtransformcachedmodule + --> |true|transform + moduleparsed --> |"each import()"|resolvedynamicimport --> |non-external|load diff --git a/src/ModuleLoader.ts b/src/ModuleLoader.ts index ede3546b14f..648d9aba78b 100644 --- a/src/ModuleLoader.ts +++ b/src/ModuleLoader.ts @@ -274,7 +274,17 @@ export class ModuleLoader { if ( cachedModule && !cachedModule.customTransformCache && - cachedModule.originalCode === sourceDescription.code + cachedModule.originalCode === sourceDescription.code && + !(await this.pluginDriver.hookFirst('shouldTransformCachedModule', [ + { + ast: cachedModule.ast, + code: cachedModule.code, + id: cachedModule.id, + meta: cachedModule.meta, + moduleSideEffects: cachedModule.moduleSideEffects, + syntheticNamedExports: cachedModule.syntheticNamedExports + } + ])) ) { if (cachedModule.transformFiles) { for (const emittedFile of cachedModule.transformFiles) diff --git a/src/rollup/types.d.ts b/src/rollup/types.d.ts index 1197dc41e8a..45cabb78c10 100644 --- a/src/rollup/types.d.ts +++ b/src/rollup/types.d.ts @@ -101,7 +101,7 @@ export interface SourceDescription extends Partial> { map?: SourceMapInput; } -export interface TransformModuleJSON extends Partial> { +export interface TransformModuleJSON { ast?: AcornNode; code: string; // note if plugins use new this.cache to opt-out auto transform cache @@ -113,7 +113,7 @@ export interface TransformModuleJSON extends Partial> transformDependencies: string[]; } -export interface ModuleJSON extends TransformModuleJSON { +export interface ModuleJSON extends TransformModuleJSON, ModuleOptions { ast: AcornNode; dependencies: string[]; id: string; @@ -242,6 +242,18 @@ export type ResolveIdHook = ( options: { custom?: CustomPluginOptions; isEntry: boolean } ) => Promise | ResolveIdResult; +export type ShouldTransformCachedModuleHook = ( + this: PluginContext, + options: { + ast: AcornNode; + code: string; + id: string; + meta: CustomPluginOptions; + moduleSideEffects: boolean | 'no-treeshake'; + syntheticNamedExports: boolean | string; + } +) => Promise | boolean; + export type IsExternal = ( source: string, importer: string | undefined, @@ -367,6 +379,7 @@ export interface PluginHooks extends OutputPluginHooks { ) => Promise | InputOptions | null | undefined; resolveDynamicImport: ResolveDynamicImportHook; resolveId: ResolveIdHook; + shouldTransformCachedModule: ShouldTransformCachedModuleHook; transform: TransformHook; watchChange: WatchChangeHook; } @@ -419,6 +432,7 @@ export type AsyncPluginHooks = | 'renderStart' | 'resolveDynamicImport' | 'resolveId' + | 'shouldTransformCachedModule' | 'transform' | 'writeBundle' | 'closeBundle'; @@ -434,7 +448,8 @@ export type FirstPluginHooks = | 'resolveDynamicImport' | 'resolveFileUrl' | 'resolveId' - | 'resolveImportMeta'; + | 'resolveImportMeta' + | 'shouldTransformCachedModule'; export type SequentialPluginHooks = | 'augmentChunkHash' diff --git a/src/utils/PluginDriver.ts b/src/utils/PluginDriver.ts index 1a77fe57851..b96b54880b1 100644 --- a/src/utils/PluginDriver.ts +++ b/src/utils/PluginDriver.ts @@ -55,6 +55,7 @@ const inputHookNames: { options: 1, resolveDynamicImport: 1, resolveId: 1, + shouldTransformCachedModule: 1, transform: 1, watchChange: 1 }; diff --git a/src/utils/transform.ts b/src/utils/transform.ts index 16ea7de1319..67cc23a3e20 100644 --- a/src/utils/transform.ts +++ b/src/utils/transform.ts @@ -165,7 +165,6 @@ export default async function transform( ast, code, customTransformCache, - meta: module.info.meta, originalCode, originalSourcemap, sourcemapChain, diff --git a/test/cli/samples/watch/watch-config-early-update/_config.js b/test/cli/samples/watch/watch-config-early-update/_config.js index 65197b87546..02e3884aa4d 100644 --- a/test/cli/samples/watch/watch-config-early-update/_config.js +++ b/test/cli/samples/watch/watch-config-early-update/_config.js @@ -1,6 +1,6 @@ const fs = require('fs'); const path = require('path'); -const { atomicWriteFileSync } = require('../../../../utils'); +const { writeAndSync } = require('../../../../utils'); let configFile; @@ -26,7 +26,7 @@ module.exports = { format: 'es' } }), - 3000 + 2000 ); });` ); @@ -36,7 +36,7 @@ module.exports = { }, abortOnStderr(data) { if (data === 'initial\n') { - atomicWriteFileSync( + writeAndSync( configFile, ` console.error('updated'); diff --git a/test/incremental/index.js b/test/incremental/index.js index 1595ca248d7..794fcc6a17f 100644 --- a/test/incremental/index.js +++ b/test/incremental/index.js @@ -336,4 +336,54 @@ describe('incremental', () => { assert.strictEqual(transformCalls, 2); assert.strictEqual(moduleParsedCalls, 4); // should not be cached }); + + it('runs shouldTransformCachedModule when using a cached module', async () => { + let shouldTransformCachedModuleCalls = 0; + + const transformPlugin = { + async shouldTransformCachedModule({ ast, id, meta, ...other }) { + shouldTransformCachedModuleCalls++; + assert.strictEqual(ast.type, 'Program'); + assert.deepStrictEqual(other, { + code: modules[id], + moduleSideEffects: true, + syntheticNamedExports: false + }); + switch (id) { + case 'foo': + assert.deepStrictEqual(meta, { transform: { calls: 1, id } }); + // we return promises to ensure they are awaited + return Promise.resolve(false); + case 'entry': + assert.deepStrictEqual(meta, { transform: { calls: 0, id } }); + return Promise.resolve(true); + default: + throw new Error(`Unexpected id ${id}.`); + } + }, + transform: (code, id) => { + return { meta: { transform: { calls: transformCalls, id } } }; + } + }; + const cache = await rollup.rollup({ + input: 'entry', + plugins: [transformPlugin, plugin] + }); + assert.strictEqual(shouldTransformCachedModuleCalls, 0); + assert.strictEqual(transformCalls, 2); + + const { + cache: { modules: cachedModules } + } = await rollup.rollup({ + input: 'entry', + plugins: [transformPlugin, plugin], + cache + }); + assert.strictEqual(shouldTransformCachedModuleCalls, 2); + assert.strictEqual(transformCalls, 3); + assert.strictEqual(cachedModules[0].id, 'foo'); + assert.deepStrictEqual(cachedModules[0].meta, { transform: { calls: 1, id: 'foo' } }); + assert.strictEqual(cachedModules[1].id, 'entry'); + assert.deepStrictEqual(cachedModules[1].meta, { transform: { calls: 2, id: 'entry' } }); + }); }); diff --git a/test/utils.js b/test/utils.js index d8896c1d306..7bd767d5751 100644 --- a/test/utils.js +++ b/test/utils.js @@ -16,6 +16,7 @@ exports.assertDirectoriesAreEqual = assertDirectoriesAreEqual; exports.assertFilesAreEqual = assertFilesAreEqual; exports.assertIncludes = assertIncludes; exports.atomicWriteFileSync = atomicWriteFileSync; +exports.writeAndSync = writeAndSync; exports.getFileNamesAndRemoveOutput = getFileNamesAndRemoveOutput; function normaliseError(error) { @@ -232,3 +233,11 @@ function atomicWriteFileSync(filePath, contents) { fs.writeFileSync(stagingPath, contents); fs.renameSync(stagingPath, filePath); } + +// It appears that on MacOS, it sometimes takes long for the file system to update +function writeAndSync(filePath, contents) { + const file = fs.openSync(filePath, 'w'); + fs.writeSync(file, contents); + fs.fsyncSync(file); + fs.closeSync(file); +} From 9e947fcdb366bdfe69568f5940f43e43c4f3b796 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 14 Jan 2022 06:26:48 +0100 Subject: [PATCH 14/30] Create a shallow copy when returning meta from resolveId (#4347) --- src/Module.ts | 2 +- .../samples/reuse-resolve-meta/_config.js | 29 +++++++++++++++++++ .../samples/reuse-resolve-meta/main.js | 1 + 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 test/function/samples/reuse-resolve-meta/_config.js create mode 100644 test/function/samples/reuse-resolve-meta/main.js diff --git a/src/Module.ts b/src/Module.ts index dc9094bef55..12fe9b7c245 100644 --- a/src/Module.ts +++ b/src/Module.ts @@ -293,7 +293,7 @@ export default class Module { } return module.isIncluded(); }, - meta, + meta: { ...meta }, syntheticNamedExports }; } diff --git a/test/function/samples/reuse-resolve-meta/_config.js b/test/function/samples/reuse-resolve-meta/_config.js new file mode 100644 index 00000000000..7d4a9a88789 --- /dev/null +++ b/test/function/samples/reuse-resolve-meta/_config.js @@ -0,0 +1,29 @@ +const assert = require('assert'); +const path = require('path'); +const meta = { plugin: { initial: true } }; + +const ID_MAIN = path.join(__dirname, 'main.js'); + +module.exports = { + description: 'does not modify meta objects passed in resolveId', + options: { + plugins: [ + { + async resolveId(source, importer) { + const { id } = await this.resolve(source, importer, { skipSelf: true }); + return { id, meta }; + }, + transform(code) { + return { code, meta: { otherPlugin: { ignored: true }, plugin: { replaced: true } } }; + }, + buildEnd() { + assert.deepStrictEqual(meta, { plugin: { initial: true } }); + assert.deepStrictEqual(this.getModuleInfo(ID_MAIN).meta, { + otherPlugin: { ignored: true }, + plugin: { replaced: true } + }); + } + } + ] + } +}; diff --git a/test/function/samples/reuse-resolve-meta/main.js b/test/function/samples/reuse-resolve-meta/main.js new file mode 100644 index 00000000000..cc1d88a24fa --- /dev/null +++ b/test/function/samples/reuse-resolve-meta/main.js @@ -0,0 +1 @@ +assert.ok(true); From edca64e2aa09c4728d848888b72d00577a37e7a1 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 14 Jan 2022 14:08:11 +0100 Subject: [PATCH 15/30] Directly restart Rollup when config file change is detected in watch mode (#4344) * Improve test reliability * Increase timeout and repeat * Try again with a watcher * Try using fs.watchfile in the config * Wait a little after initial config write * Limit how long we wait at most * Immediately restart Rollup upon config file changes and change test to look for a message from the second config * See if we can trigger a stuck watcher by writing again * Extract retry helper * Clean up --- cli/logging.ts | 2 +- cli/run/watch-cli.ts | 45 ++--- test/cli/index.js | 173 +++++++++--------- .../samples/wait-for-bundle-input/_config.js | 2 + .../samples/watch/no-config-file/_config.js | 4 +- .../samples/watch/node-config-file/_config.js | 4 +- .../watch-config-early-update/_config.js | 58 +++--- .../watch/watch-config-error/_config.js | 2 +- .../watch/watch-config-no-update/_config.js | 5 +- test/utils.js | 21 +++ 10 files changed, 175 insertions(+), 141 deletions(-) diff --git a/cli/logging.ts b/cli/logging.ts index 959eae94071..59b4ec94630 100644 --- a/cli/logging.ts +++ b/cli/logging.ts @@ -3,7 +3,7 @@ import { bold, cyan, dim, red } from '../src/utils/colors'; import relativeId from '../src/utils/relativeId'; // log to stderr to keep `rollup main.js > bundle.js` from breaking -export const stderr = console.error.bind(console); +export const stderr = (...args: unknown[]) => process.stderr.write(`${args.join('')}\n`); export function handleError(err: RollupError, recover = false): void { let description = err.message || err; diff --git a/cli/run/watch-cli.ts b/cli/run/watch-cli.ts index 9c83fc8265e..3e8e619a961 100644 --- a/cli/run/watch-cli.ts +++ b/cli/run/watch-cli.ts @@ -19,10 +19,9 @@ export async function watch(command: Record): Promise { process.env.ROLLUP_WATCH = 'true'; const isTTY = process.stderr.isTTY; const silent = command.silent; - let configs: MergedRollupOptions[]; - let warnings: BatchWarnings; let watcher: RollupWatcher; let configWatcher: FSWatcher; + let resetScreen: (heading: string) => void; const configFile = command.config ? getConfigPath(command.config) : null; onExit(close); @@ -33,11 +32,10 @@ export async function watch(command: Record): Promise { } async function loadConfigFromFileAndTrack(configFile: string): Promise { - let reloadingConfig = false; - let aborted = false; let configFileData: string | null = null; + let configFileRevision = 0; - configWatcher = chokidar.watch(configFile).on('change', () => reloadConfigFile()); + configWatcher = chokidar.watch(configFile).on('change', reloadConfigFile); await reloadConfigFile(); async function reloadConfigFile() { @@ -46,29 +44,21 @@ export async function watch(command: Record): Promise { if (newConfigFileData === configFileData) { return; } - if (reloadingConfig) { - aborted = true; - return; - } + configFileRevision++; + const currentConfigFileRevision = configFileRevision; if (configFileData) { stderr(`\nReloading updated config...`); } configFileData = newConfigFileData; - reloadingConfig = true; - ({ options: configs, warnings } = await loadAndParseConfigFile(configFile, command)); - reloadingConfig = false; - if (aborted) { - aborted = false; - reloadConfigFile(); - } else { - if (watcher) { - watcher.close(); - } - start(configs); + const { options, warnings } = await loadAndParseConfigFile(configFile, command); + if (currentConfigFileRevision !== configFileRevision) { + return; } + if (watcher) { + watcher.close(); + } + start(options, warnings); } catch (err: any) { - configs = []; - reloadingConfig = false; handleError(err, true); } } @@ -77,13 +67,11 @@ export async function watch(command: Record): Promise { if (configFile) { await loadConfigFromFileAndTrack(configFile); } else { - ({ options: configs, warnings } = await loadConfigFromCommand(command)); - start(configs); + const { options, warnings } = await loadConfigFromCommand(command); + start(options, warnings); } - const resetScreen = getResetScreen(configs!, isTTY); - - function start(configs: MergedRollupOptions[]): void { + function start(configs: MergedRollupOptions[], warnings: BatchWarnings): void { try { watcher = rollup.watch(configs as any); } catch (err: any) { @@ -99,6 +87,9 @@ export async function watch(command: Record): Promise { case 'START': if (!silent) { + if (!resetScreen) { + resetScreen = getResetScreen(configs, isTTY); + } resetScreen(underline(`rollup v${rollup.VERSION}`)); } break; diff --git a/test/cli/index.js b/test/cli/index.js index 7f747a34024..267b0b27e2d 100644 --- a/test/cli/index.js +++ b/test/cli/index.js @@ -35,113 +35,116 @@ function runTest(dir, config, pass) { if (pass > 0) { getFileNamesAndRemoveOutput(dir); } - if (config.before) config.before(); - const command = config.command.replace( /(^| )rollup($| )/g, `node ${path.resolve(__dirname, '../../dist/bin')}${path.sep}rollup ` ); - const childProcess = exec( - command, - { - timeout: 40000, - env: { ...process.env, FORCE_COLOR: '0', ...config.env } - }, - (err, code, stderr) => { - if (config.after) config.after(err, code, stderr); - if (err && !err.killed) { - if (config.error) { - const shouldContinue = config.error(err); + Promise.resolve(config.before && config.before()).then(() => { + const childProcess = exec( + command, + { + timeout: 40000, + env: { ...process.env, FORCE_COLOR: '0', ...config.env } + }, + (err, code, stderr) => { + if (config.after) config.after(err, code, stderr); + if (err && !err.killed) { + if (config.error) { + const shouldContinue = config.error(err); + if (!shouldContinue) return done(); + } else { + throw err; + } + } + + if ('stderr' in config) { + const shouldContinue = config.stderr(stderr); if (!shouldContinue) return done(); - } else { - throw err; + } else if (stderr) { + console.error(stderr); } - } - if ('stderr' in config) { - const shouldContinue = config.stderr(stderr); - if (!shouldContinue) return done(); - } else if (stderr) { - console.error(stderr); - } + let unintendedError; - let unintendedError; + if (config.execute) { + try { + const fn = new Function('require', 'module', 'exports', 'assert', code); + const module = { + exports: {} + }; + fn(require, module, module.exports, assert); - if (config.execute) { - try { - const fn = new Function('require', 'module', 'exports', 'assert', code); - const module = { - exports: {} - }; - fn(require, module, module.exports, assert); + if (config.error) { + unintendedError = new Error('Expected an error while executing output'); + } - if (config.error) { - unintendedError = new Error('Expected an error while executing output'); + if (config.exports) { + config.exports(module.exports); + } + } catch (err) { + if (config.error) { + config.error(err); + } else { + unintendedError = err; + } } - if (config.exports) { - config.exports(module.exports); + if (config.show || unintendedError) { + console.log(code + '\n\n\n'); } - } catch (err) { - if (config.error) { - config.error(err); - } else { - unintendedError = err; - } - } - if (config.show || unintendedError) { - console.log(code + '\n\n\n'); - } + if (config.solo) console.groupEnd(); - if (config.solo) console.groupEnd(); - - unintendedError ? done(unintendedError) : done(); - } else if (config.result) { - try { - config.result(code); - done(); - } catch (err) { - done(err); - } - } else if (config.test) { - try { - config.test(); - done(); - } catch (err) { - done(err); - } - } else if (sander.existsSync('_expected') && sander.statSync('_expected').isDirectory()) { - try { - assertDirectoriesAreEqual('_actual', '_expected'); - done(); - } catch (err) { - done(err); - } - } else { - const expected = sander.readFileSync('_expected.js').toString(); - try { - assert.equal(normaliseOutput(code), normaliseOutput(expected)); - done(); - } catch (err) { - done(err); + unintendedError ? done(unintendedError) : done(); + } else if (config.result) { + try { + config.result(code); + done(); + } catch (err) { + done(err); + } + } else if (config.test) { + try { + config.test(); + done(); + } catch (err) { + done(err); + } + } else if ( + sander.existsSync('_expected') && + sander.statSync('_expected').isDirectory() + ) { + try { + assertDirectoriesAreEqual('_actual', '_expected'); + done(); + } catch (err) { + done(err); + } + } else { + const expected = sander.readFileSync('_expected.js').toString(); + try { + assert.equal(normaliseOutput(code), normaliseOutput(expected)); + done(); + } catch (err) { + done(err); + } } } - } - ); + ); - childProcess.stderr.on('data', async data => { - if (config.abortOnStderr) { - try { - if (await config.abortOnStderr(data)) { + childProcess.stderr.on('data', async data => { + if (config.abortOnStderr) { + try { + if (await config.abortOnStderr(data)) { + childProcess.kill('SIGTERM'); + } + } catch (err) { childProcess.kill('SIGTERM'); + done(err); } - } catch (err) { - childProcess.kill('SIGTERM'); - done(err); } - } + }); }); } ).timeout(50000); diff --git a/test/cli/samples/wait-for-bundle-input/_config.js b/test/cli/samples/wait-for-bundle-input/_config.js index 64f197395b4..e27820f5bb6 100644 --- a/test/cli/samples/wait-for-bundle-input/_config.js +++ b/test/cli/samples/wait-for-bundle-input/_config.js @@ -18,5 +18,7 @@ module.exports = { // wait longer than one polling interval setTimeout(() => atomicWriteFileSync(mainFile, 'export default 42;'), 600); } + // We wait for a regular abort as we do not watch + return false; } }; diff --git a/test/cli/samples/watch/no-config-file/_config.js b/test/cli/samples/watch/no-config-file/_config.js index 7c7bb86caa3..af24c566137 100644 --- a/test/cli/samples/watch/no-config-file/_config.js +++ b/test/cli/samples/watch/no-config-file/_config.js @@ -1,8 +1,10 @@ +const path = require('path'); + module.exports = { description: 'watches without a config file', command: 'rollup main.js --watch --format es --file _actual/main.js', abortOnStderr(data) { - if (data.includes('created _actual/main.js')) { + if (data.includes(`created _actual${path.sep}main.js`)) { return true; } } diff --git a/test/cli/samples/watch/node-config-file/_config.js b/test/cli/samples/watch/node-config-file/_config.js index 10957e1893b..1181c599571 100644 --- a/test/cli/samples/watch/node-config-file/_config.js +++ b/test/cli/samples/watch/node-config-file/_config.js @@ -1,8 +1,10 @@ +const path = require('path'); + module.exports = { description: 'watches using a node_modules config files', command: 'rollup --watch --config node:custom', abortOnStderr(data) { - if (data.includes('created _actual/main.js')) { + if (data.includes(`created _actual${path.sep}main.js`)) { return true; } } diff --git a/test/cli/samples/watch/watch-config-early-update/_config.js b/test/cli/samples/watch/watch-config-early-update/_config.js index 02e3884aa4d..031d5d38d14 100644 --- a/test/cli/samples/watch/watch-config-early-update/_config.js +++ b/test/cli/samples/watch/watch-config-early-update/_config.js @@ -1,33 +1,45 @@ const fs = require('fs'); const path = require('path'); -const { writeAndSync } = require('../../../../utils'); +const { writeAndSync, writeAndRetry } = require('../../../../utils'); -let configFile; +const configFile = path.join(__dirname, 'rollup.config.js'); +let stopUpdate; module.exports = { description: 'immediately reloads the config file if a change happens while it is parsed', command: 'rollup -cw', before() { - // This test writes a config file that prints a message to stderr but delays resolving to a - // config. The stderr message is observed by the parent process and triggers overwriting the - // config file. That way, we simulate a complicated config file being changed while it is parsed. - configFile = path.resolve(__dirname, 'rollup.config.js'); - fs.writeFileSync( + // This test writes a config file that prints a message to stderr which signals to the test that + // the config files has been parsed, at which point the test replaces the config file. The + // initial file returns a Promise that only resolves once the second config file has been + // parsed. To do that, the first config hooks into process.stderr and looks for a log from the + // second config. + // That way, we simulate a complicated config file being changed while it is parsed. + fs.mkdirSync(path.join(__dirname, '_actual')); + writeAndSync( configFile, ` - console.error('initial'); + import { Writable } from 'stream'; + process.stderr.write('initial\\n'); + const processStderr = process.stderr; export default new Promise(resolve => { - setTimeout( - () => - resolve({ - input: 'main.js', - output: { - file: '_actual/output1.js', - format: 'es' - } - }), - 2000 - ); + delete process.stderr; + process.stderr = new Writable({ + write(chunk, encoding, next) { + processStderr.write(chunk, encoding, next); + if (chunk.toString() === 'updated\\n') { + process.stderr.end(); + process.stderr = processStderr; + resolve({ + input: 'main.js', + output: { + file: '_actual/output1.js', + format: 'es' + } + }) + } + }, + }); });` ); }, @@ -36,7 +48,7 @@ module.exports = { }, abortOnStderr(data) { if (data === 'initial\n') { - writeAndSync( + stopUpdate = writeAndRetry( configFile, ` console.error('updated'); @@ -46,13 +58,13 @@ module.exports = { file: '_actual/output2.js', format: "es" } - }; - ` + };` ); return false; } if (data.includes(`created _actual${path.sep}output2.js`)) { - return new Promise(resolve => setTimeout(() => resolve(true), 600)); + stopUpdate(); + return true; } } }; diff --git a/test/cli/samples/watch/watch-config-error/_config.js b/test/cli/samples/watch/watch-config-error/_config.js index 400b1953b88..b313c17851f 100644 --- a/test/cli/samples/watch/watch-config-error/_config.js +++ b/test/cli/samples/watch/watch-config-error/_config.js @@ -48,7 +48,7 @@ module.exports = { return false; } if (data.includes(`created _actual${path.sep}main2.js`)) { - return new Promise(resolve => setTimeout(() => resolve(true), 600)); + return true; } } }; diff --git a/test/cli/samples/watch/watch-config-no-update/_config.js b/test/cli/samples/watch/watch-config-no-update/_config.js index 7bc29a79ab1..a90cb10e14a 100644 --- a/test/cli/samples/watch/watch-config-no-update/_config.js +++ b/test/cli/samples/watch/watch-config-no-update/_config.js @@ -23,9 +23,10 @@ module.exports = { fs.unlinkSync(configFile); }, abortOnStderr(data) { - if (data.includes('created _actual/main.js')) { + if (data.includes(`created _actual${path.sep}main.js`)) { atomicWriteFileSync(configFile, configContent); - return new Promise(resolve => setTimeout(() => resolve(true), 500)); + // wait some time for the watcher to trigger + return new Promise(resolve => setTimeout(() => resolve(true), 600)); } }, stderr(stderr) { diff --git a/test/utils.js b/test/utils.js index 7bd767d5751..7d391538477 100644 --- a/test/utils.js +++ b/test/utils.js @@ -18,6 +18,7 @@ exports.assertIncludes = assertIncludes; exports.atomicWriteFileSync = atomicWriteFileSync; exports.writeAndSync = writeAndSync; exports.getFileNamesAndRemoveOutput = getFileNamesAndRemoveOutput; +exports.writeAndRetry = writeAndRetry; function normaliseError(error) { delete error.stack; @@ -241,3 +242,23 @@ function writeAndSync(filePath, contents) { fs.fsyncSync(file); fs.closeSync(file); } + +// Sometimes, watchers on MacOS do not seem to fire. In those cases, it helps +// to write the same content again. This function returns a callback to stop +// further updates. +function writeAndRetry(filePath, contents) { + let retries = 0; + let updateRetryTimeout; + + const writeFile = () => { + if (retries > 0) { + console.error(`RETRIED writeFile (${retries})`); + } + retries++; + atomicWriteFileSync(filePath, contents); + updateRetryTimeout = setTimeout(writeFile, 1000); + }; + + writeFile(); + return () => clearTimeout(updateRetryTimeout); +} From 7c4728377fce727338b835d0dba3425319ec5626 Mon Sep 17 00:00:00 2001 From: dnalborczyk Date: Fri, 14 Jan 2022 08:19:35 -0500 Subject: [PATCH 16/30] refactor: performance timers for node.js and browser (#4340) * refactor: performance timers for node.js and browser * simplify, add return types * refactor: replace object with array * refactor: replace fn.apply with spread * refactor: use map * nit * export performance object * type fixes * fix browser perf test, add comment * export entire process object * remove type assertion in rollup.config * remove comment * extract interface * check for performance object in alternative environments Co-authored-by: Lukas Taegert-Atkinson --- browser/performance.ts | 10 +++ browser/process.ts | 11 +++ build-plugins/replace-browser-modules.ts | 34 ++++---- rollup.config.ts | 11 +-- src/utils/collapseSourcemaps.ts | 4 +- src/utils/crypto.ts | 2 +- src/utils/performance.ts | 1 + src/utils/process.ts | 1 + src/utils/timers.ts | 100 ++++++++++------------- test/browser/index.js | 5 ++ 10 files changed, 99 insertions(+), 80 deletions(-) create mode 100644 browser/performance.ts create mode 100644 browser/process.ts create mode 100644 src/utils/performance.ts create mode 100644 src/utils/process.ts diff --git a/browser/performance.ts b/browser/performance.ts new file mode 100644 index 00000000000..aec23b86950 --- /dev/null +++ b/browser/performance.ts @@ -0,0 +1,10 @@ +const global = + typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : {}; + +export default 'performance' in global + ? performance + : { + now(): 0 { + return 0; + } + }; diff --git a/browser/process.ts b/browser/process.ts new file mode 100644 index 00000000000..a526f24c035 --- /dev/null +++ b/browser/process.ts @@ -0,0 +1,11 @@ +interface MemoryUsage { + heapUsed: 0; +} + +export default { + memoryUsage(): MemoryUsage { + return { + heapUsed: 0 + }; + } +}; diff --git a/build-plugins/replace-browser-modules.ts b/build-plugins/replace-browser-modules.ts index 39c9acafe2a..25ac4b77abb 100644 --- a/build-plugins/replace-browser-modules.ts +++ b/build-plugins/replace-browser-modules.ts @@ -1,29 +1,35 @@ -import path from 'path'; -import { Plugin } from 'rollup'; +import { dirname, join, resolve } from 'path'; +import type { Plugin } from 'rollup'; -const ID_CRYPTO = path.resolve('src/utils/crypto'); -const ID_FS = path.resolve('src/utils/fs'); -const ID_HOOKACTIONS = path.resolve('src/utils/hookActions'); -const ID_PATH = path.resolve('src/utils/path'); -const ID_RESOLVEID = path.resolve('src/utils/resolveId'); +const ID_CRYPTO = resolve('src/utils/crypto'); +const ID_FS = resolve('src/utils/fs'); +const ID_HOOKACTIONS = resolve('src/utils/hookActions'); +const ID_PATH = resolve('src/utils/path'); +const ID_PERFORMANCE = resolve('src/utils/performance'); +const ID_PROCESS = resolve('src/utils/process'); +const ID_RESOLVEID = resolve('src/utils/resolveId'); export default function replaceBrowserModules(): Plugin { return { name: 'replace-browser-modules', - resolveId: (source, importee) => { + resolveId(source, importee) { if (importee && source[0] === '.') { - const resolved = path.join(path.dirname(importee), source); + const resolved = join(dirname(importee), source); switch (resolved) { case ID_CRYPTO: - return path.resolve('browser/crypto.ts'); + return resolve('browser/crypto.ts'); case ID_FS: - return path.resolve('browser/fs.ts'); + return resolve('browser/fs.ts'); case ID_HOOKACTIONS: - return path.resolve('browser/hookActions.ts'); + return resolve('browser/hookActions.ts'); case ID_PATH: - return path.resolve('browser/path.ts'); + return resolve('browser/path.ts'); + case ID_PERFORMANCE: + return resolve('browser/performance.ts'); + case ID_PROCESS: + return resolve('browser/process.ts'); case ID_RESOLVEID: - return path.resolve('browser/resolveId.ts'); + return resolve('browser/resolveId.ts'); } } } diff --git a/rollup.config.ts b/rollup.config.ts index 3273078b6bf..51ce7f40ace 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -1,4 +1,4 @@ -import fs from 'fs'; +import { readFileSync } from 'fs'; import path from 'path'; import alias from '@rollup/plugin-alias'; import commonjs from '@rollup/plugin-commonjs'; @@ -18,7 +18,7 @@ import pkg from './package.json'; const commitHash = (function () { try { - return fs.readFileSync('.commithash', 'utf-8'); + return readFileSync('.commithash', 'utf-8'); } catch { return 'unknown'; } @@ -90,8 +90,10 @@ export default (command: Record): RollupOptions | RollupOptions 'fs', 'fsevents', 'module', - 'path', 'os', + 'path', + 'perf_hooks', + 'process', 'stream', 'url', 'util' @@ -125,8 +127,7 @@ export default (command: Record): RollupOptions | RollupOptions ...nodePlugins, addCliEntry(), esmDynamicImport(), - // TODO this relied on an unpublished type update - (!command.configTest && collectLicenses()) as Plugin + !command.configTest && collectLicenses() ], strictDeprecations: true, treeshake diff --git a/src/utils/collapseSourcemaps.ts b/src/utils/collapseSourcemaps.ts index 5842126e0e8..2d188baaa03 100644 --- a/src/utils/collapseSourcemaps.ts +++ b/src/utils/collapseSourcemaps.ts @@ -49,7 +49,7 @@ class Link { const sources: string[] = []; const sourcesContent: string[] = []; const names: string[] = []; - const nameIndexMap: Map = new Map(); + const nameIndexMap = new Map(); const mappings = []; @@ -147,7 +147,7 @@ class Link { } function getLinkMap(warn: WarningHandler) { - return function linkMap(source: Source | Link, map: DecodedSourceMapOrMissing) { + return function linkMap(source: Source | Link, map: DecodedSourceMapOrMissing): Link { if (map.mappings) { return new Link(map, [source]); } diff --git a/src/utils/crypto.ts b/src/utils/crypto.ts index 7489b3383ea..56752850646 100644 --- a/src/utils/crypto.ts +++ b/src/utils/crypto.ts @@ -1,3 +1,3 @@ -import { createHash as cryptoCreateHash, Hash } from 'crypto'; +import { createHash as cryptoCreateHash, type Hash } from 'crypto'; export const createHash = (): Hash => cryptoCreateHash('sha256'); diff --git a/src/utils/performance.ts b/src/utils/performance.ts new file mode 100644 index 00000000000..ba7aa092b4c --- /dev/null +++ b/src/utils/performance.ts @@ -0,0 +1 @@ +export { performance as default } from 'perf_hooks'; diff --git a/src/utils/process.ts b/src/utils/process.ts new file mode 100644 index 00000000000..768ba7d74fb --- /dev/null +++ b/src/utils/process.ts @@ -0,0 +1 @@ +export { default } from 'process'; diff --git a/src/utils/timers.ts b/src/utils/timers.ts index 6ecb47e94bb..d097f15131f 100644 --- a/src/utils/timers.ts +++ b/src/utils/timers.ts @@ -1,39 +1,18 @@ import { InputOptions, Plugin, SerializedTimings } from '../rollup/types'; - -type StartTime = [number, number]; +import performance from './performance'; +import process from './process'; interface Timer { memory: number; startMemory: number; - startTime: StartTime; + startTime: number; time: number; totalMemory: number; } -interface Timers { - [label: string]: Timer; -} - const NOOP = (): void => {}; -let getStartTime = (): StartTime => [0, 0]; -let getElapsedTime: (previous: StartTime) => number = () => 0; -let getMemory: () => number = () => 0; -let timers: Timers = {}; - -const normalizeHrTime = (time: [number, number]): number => time[0] * 1e3 + time[1] / 1e6; - -function setTimeHelpers(): void { - if (typeof process !== 'undefined' && typeof process.hrtime === 'function') { - getStartTime = process.hrtime.bind(process); - getElapsedTime = previous => normalizeHrTime(process.hrtime(previous)); - } else if (typeof performance !== 'undefined' && typeof performance.now === 'function') { - getStartTime = () => [performance.now(), 0]; - getElapsedTime = previous => performance.now() - previous[0]; - } - if (typeof process !== 'undefined' && typeof process.memoryUsage === 'function') { - getMemory = () => process.memoryUsage().heapUsed; - } -} + +let timers = new Map(); function getPersistedLabel(label: string, level: number): string { switch (level) { @@ -50,53 +29,58 @@ function getPersistedLabel(label: string, level: number): string { function timeStartImpl(label: string, level = 3): void { label = getPersistedLabel(label, level); - if (!timers.hasOwnProperty(label)) { - timers[label] = { + + const startMemory = process.memoryUsage().heapUsed; + const startTime = performance.now(); + + const timer = timers.get(label); + + if (timer === undefined) { + timers.set(label, { memory: 0, - startMemory: undefined as never, - startTime: undefined as never, + startMemory, + startTime, time: 0, totalMemory: 0 - }; + }); + } else { + timer.startMemory = startMemory; + timer.startTime = startTime; } - const currentMemory = getMemory(); - timers[label].startTime = getStartTime(); - timers[label].startMemory = currentMemory; } function timeEndImpl(label: string, level = 3): void { label = getPersistedLabel(label, level); - if (timers.hasOwnProperty(label)) { - const currentMemory = getMemory(); - timers[label].time += getElapsedTime(timers[label].startTime); - timers[label].totalMemory = Math.max(timers[label].totalMemory, currentMemory); - timers[label].memory += currentMemory - timers[label].startMemory; + + const timer = timers.get(label); + + if (timer !== undefined) { + const currentMemory = process.memoryUsage().heapUsed; + timer.memory += currentMemory - timer.startMemory; + timer.time += performance.now() - timer.startTime; + timer.totalMemory = Math.max(timer.totalMemory, currentMemory); } } export function getTimings(): SerializedTimings { const newTimings: SerializedTimings = {}; - for (const [label, { time, memory, totalMemory }] of Object.entries(timers)) { + + for (const [label, { memory, time, totalMemory }] of timers) { newTimings[label] = [time, memory, totalMemory]; } return newTimings; } -export let timeStart: (label: string, level?: number) => void = NOOP, - timeEnd: (label: string, level?: number) => void = NOOP; +export let timeStart: (label: string, level?: number) => void = NOOP; +export let timeEnd: (label: string, level?: number) => void = NOOP; -const TIMED_PLUGIN_HOOKS: { [hook: string]: boolean } = { - load: true, - resolveDynamicImport: true, - resolveId: true, - transform: true -}; +const TIMED_PLUGIN_HOOKS = ['load', 'resolveDynamicImport', 'resolveId', 'transform'] as const; function getPluginWithTimers(plugin: any, index: number): Plugin { - const timedPlugin: { [hook: string]: any } = {}; + const timedPlugin: Pick = {}; - for (const hook of Object.keys(plugin)) { - if (TIMED_PLUGIN_HOOKS[hook] === true) { + for (const hook of TIMED_PLUGIN_HOOKS) { + if (hook in plugin) { let timerLabel = `plugin ${index}`; if (plugin.name) { timerLabel += ` (${plugin.name})`; @@ -104,28 +88,28 @@ function getPluginWithTimers(plugin: any, index: number): Plugin { timerLabel += ` - ${hook}`; timedPlugin[hook] = function (...args: unknown[]) { timeStart(timerLabel, 4); - let result = plugin[hook].apply(this === timedPlugin ? plugin : this, args); + const result = plugin[hook](...args); timeEnd(timerLabel, 4); if (result && typeof result.then === 'function') { timeStart(`${timerLabel} (async)`, 4); - result = result.then((hookResult: unknown) => { + return result.then((hookResult: unknown) => { timeEnd(`${timerLabel} (async)`, 4); return hookResult; }); } return result; }; - } else { - timedPlugin[hook] = plugin[hook]; } } - return timedPlugin as Plugin; + return { + ...plugin, + ...timedPlugin + }; } export function initialiseTimers(inputOptions: InputOptions): void { if (inputOptions.perf) { - timers = {}; - setTimeHelpers(); + timers = new Map(); timeStart = timeStartImpl; timeEnd = timeEndImpl; inputOptions.plugins = inputOptions.plugins!.map(getPluginWithTimers); diff --git a/test/browser/index.js b/test/browser/index.js index e3f05d0620d..a084f320744 100644 --- a/test/browser/index.js +++ b/test/browser/index.js @@ -1,3 +1,8 @@ +// since we don't run the browser tests in an actual browser, we need to make `performance` +// globally accessible same as in the browser. this can be removed once `performance` is +// available globally in all supported platforms. [currently global for node.js v16+]. +global.performance = require('perf_hooks').performance; + const { basename, resolve } = require('path'); const fixturify = require('fixturify'); const { rollup } = require('../../dist/rollup.browser.js'); From b1205b826418fb22e2f06ec2fd28db23ac028e79 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 14 Jan 2022 14:40:17 +0100 Subject: [PATCH 17/30] Update changelog --- CHANGELOG.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7204f446512..37a66c5b6ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # rollup changelog +## 2.64.0 + +_2022-01-14_ + +### Features + +- Allow inspecting cached modules and forcing them to be transformed again via shouldTransformCachedModule (#4320) +- Do not wait for the config file to be parsed in watch mode if it is updated before that (#4344) + +### Bug Fixes + +- Do not mutate objects returned as `meta` from the resolveId hook (#4347) + +### Pull Requests + +- [#4326](https://github.com/rollup/rollup/pull/4326): refactor: type fixes (@dnalborczyk) +- [#4339](https://github.com/rollup/rollup/pull/4339): More watch test stabilization (@lukastaegert) +- [#4340](https://github.com/rollup/rollup/pull/4340): refactor: performance timers for node.js and browser (@dnalborczyk) +- [#4341](https://github.com/rollup/rollup/pull/4341): Implement shouldTransformCachedModule hook (@lukastaegert) +- [#4344](https://github.com/rollup/rollup/pull/4344): Directly restart Rollup when config file change is detected in watch mode (@lukastaegert) +- [#4347](https://github.com/rollup/rollup/pull/4347): Create a shallow copy when returning meta from resolveId (@lukastaegert) + ## 2.63.0 _2022-01-04_ From 82a3e2634a9d51b5040752e4fb2fd264651d504e Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 14 Jan 2022 14:40:37 +0100 Subject: [PATCH 18/30] 2.64.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 69121aa2049..1730bf12d57 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "2.63.0", + "version": "2.64.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 17e64ca3bd5..91bb6ad1d95 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "2.63.0", + "version": "2.64.0", "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js", From 7c2823e4b6ad27e169833db537c5ff244515e542 Mon Sep 17 00:00:00 2001 From: dnalborczyk Date: Tue, 18 Jan 2022 00:34:31 -0500 Subject: [PATCH 19/30] chore: bump deps (#4353) --- package-lock.json | 688 ++++--- package.json | 28 +- .../samples/supports-core-js/_expected.js | 1781 +++++++++-------- .../samples/supports-es5-shim/_expected.js | 43 +- 4 files changed, 1337 insertions(+), 1203 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1730bf12d57..cc8115d17cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,35 +5,35 @@ "requires": true, "dependencies": { "@babel/code-frame": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", - "integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, "requires": { - "@babel/highlight": "^7.16.0" + "@babel/highlight": "^7.16.7" } }, "@babel/compat-data": { - "version": "7.16.4", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.4.tgz", - "integrity": "sha512-1o/jo7D+kC9ZjHX5v+EHrdjl3PhxMrLSOTGsOdHJ+KL8HCaEK6ehrVL2RS6oHDZp+L7xLirLrPmQtEng769J/Q==", + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.8.tgz", + "integrity": "sha512-m7OkX0IdKLKPpBlJtF561YJal5y/jyI5fNfWbPxh2D/nbzzGI4qRyrD8xO2jB24u7l+5I2a43scCG2IrfjC50Q==", "dev": true }, "@babel/core": { - "version": "7.16.5", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.5.tgz", - "integrity": "sha512-wUcenlLzuWMZ9Zt8S0KmFwGlH6QKRh3vsm/dhDA3CHkiTA45YuG1XkHRcNRl73EFPXDp/d5kVOU0/y7x2w6OaQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.16.0", - "@babel/generator": "^7.16.5", - "@babel/helper-compilation-targets": "^7.16.3", - "@babel/helper-module-transforms": "^7.16.5", - "@babel/helpers": "^7.16.5", - "@babel/parser": "^7.16.5", - "@babel/template": "^7.16.0", - "@babel/traverse": "^7.16.5", - "@babel/types": "^7.16.0", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.7.tgz", + "integrity": "sha512-aeLaqcqThRNZYmbMqtulsetOQZ/5gbR/dWruUCJcpas4Qoyy+QeagfDsPdMrqwsPRDNxJvBlRiZxxX7THO7qtA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.7", + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helpers": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -66,12 +66,12 @@ } }, "@babel/generator": { - "version": "7.16.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.5.tgz", - "integrity": "sha512-kIvCdjZqcdKqoDbVVdt5R99icaRtrtYhYK/xux5qiWCBmfdvEYMFZ68QCrpE5cbFM1JsuArUNs1ZkuKtTtUcZA==", + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.8.tgz", + "integrity": "sha512-1ojZwE9+lOXzcWdWmO6TbUzDfqLD39CmEhN8+2cX9XkDo5yW1OpgfejfliysR2AWLpMamTiOiAp/mtroaymhpw==", "dev": true, "requires": { - "@babel/types": "^7.16.0", + "@babel/types": "^7.16.8", "jsesc": "^2.5.1", "source-map": "^0.5.0" }, @@ -91,13 +91,13 @@ } }, "@babel/helper-compilation-targets": { - "version": "7.16.3", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.3.tgz", - "integrity": "sha512-vKsoSQAyBmxS35JUOOt+07cLc6Nk/2ljLIHwmq2/NM6hdioUaqEXq/S+nXvbvXbZkNDlWOymPanJGOc4CBjSJA==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz", + "integrity": "sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA==", "dev": true, "requires": { - "@babel/compat-data": "^7.16.0", - "@babel/helper-validator-option": "^7.14.5", + "@babel/compat-data": "^7.16.4", + "@babel/helper-validator-option": "^7.16.7", "browserslist": "^4.17.5", "semver": "^6.3.0" }, @@ -111,151 +111,151 @@ } }, "@babel/helper-environment-visitor": { - "version": "7.16.5", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.5.tgz", - "integrity": "sha512-ODQyc5AnxmZWm/R2W7fzhamOk1ey8gSguo5SGvF0zcB3uUzRpTRmM/jmLSm9bDMyPlvbyJ+PwPEK0BWIoZ9wjg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", + "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", "dev": true, "requires": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" } }, "@babel/helper-function-name": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.0.tgz", - "integrity": "sha512-BZh4mEk1xi2h4HFjWUXRQX5AEx4rvaZxHgax9gcjdLWdkjsY7MKt5p0otjsg5noXw+pB+clMCjw+aEVYADMjog==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz", + "integrity": "sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA==", "dev": true, "requires": { - "@babel/helper-get-function-arity": "^7.16.0", - "@babel/template": "^7.16.0", - "@babel/types": "^7.16.0" + "@babel/helper-get-function-arity": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/types": "^7.16.7" } }, "@babel/helper-get-function-arity": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.0.tgz", - "integrity": "sha512-ASCquNcywC1NkYh/z7Cgp3w31YW8aojjYIlNg4VeJiHkqyP4AzIvr4qx7pYDb4/s8YcsZWqqOSxgkvjUz1kpDQ==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz", + "integrity": "sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw==", "dev": true, "requires": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" } }, "@babel/helper-hoist-variables": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.0.tgz", - "integrity": "sha512-1AZlpazjUR0EQZQv3sgRNfM9mEVWPK3M6vlalczA+EECcPz3XPh6VplbErL5UoMpChhSck5wAJHthlj1bYpcmg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", + "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", "dev": true, "requires": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" } }, "@babel/helper-module-imports": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.0.tgz", - "integrity": "sha512-kkH7sWzKPq0xt3H1n+ghb4xEMP8k0U7XV3kkB+ZGy69kDk2ySFW1qPi06sjKzFY3t1j6XbJSqr4mF9L7CYVyhg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", + "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", "dev": true, "requires": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" } }, "@babel/helper-module-transforms": { - "version": "7.16.5", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.5.tgz", - "integrity": "sha512-CkvMxgV4ZyyioElFwcuWnDCcNIeyqTkCm9BxXZi73RR1ozqlpboqsbGUNvRTflgZtFbbJ1v5Emvm+lkjMYY/LQ==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz", + "integrity": "sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng==", "dev": true, "requires": { - "@babel/helper-environment-visitor": "^7.16.5", - "@babel/helper-module-imports": "^7.16.0", - "@babel/helper-simple-access": "^7.16.0", - "@babel/helper-split-export-declaration": "^7.16.0", - "@babel/helper-validator-identifier": "^7.15.7", - "@babel/template": "^7.16.0", - "@babel/traverse": "^7.16.5", - "@babel/types": "^7.16.0" + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-simple-access": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" } }, "@babel/helper-simple-access": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.0.tgz", - "integrity": "sha512-o1rjBT/gppAqKsYfUdfHq5Rk03lMQrkPHG1OWzHWpLgVXRH4HnMM9Et9CVdIqwkCQlobnGHEJMsgWP/jE1zUiw==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz", + "integrity": "sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g==", "dev": true, "requires": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" } }, "@babel/helper-split-export-declaration": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.0.tgz", - "integrity": "sha512-0YMMRpuDFNGTHNRiiqJX19GjNXA4H0E8jZ2ibccfSxaCogbm3am5WN/2nQNj0YnQwGWM1J06GOcQ2qnh3+0paw==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", + "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", "dev": true, "requires": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" } }, "@babel/helper-validator-identifier": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", - "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", "dev": true }, "@babel/helper-validator-option": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz", - "integrity": "sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", + "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", "dev": true }, "@babel/helpers": { - "version": "7.16.5", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.5.tgz", - "integrity": "sha512-TLgi6Lh71vvMZGEkFuIxzaPsyeYCHQ5jJOOX1f0xXn0uciFuE8cEk0wyBquMcCxBXZ5BJhE2aUB7pnWTD150Tw==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.7.tgz", + "integrity": "sha512-9ZDoqtfY7AuEOt3cxchfii6C7GDyyMBffktR5B2jvWv8u2+efwvpnVKXMWzNehqy68tKgAfSwfdw/lWpthS2bw==", "dev": true, "requires": { - "@babel/template": "^7.16.0", - "@babel/traverse": "^7.16.5", - "@babel/types": "^7.16.0" + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" } }, "@babel/highlight": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz", - "integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.7.tgz", + "integrity": "sha512-aKpPMfLvGO3Q97V0qhw/V2SWNWlwfJknuwAunU7wZLSfrM4xTBvg7E5opUVi1kJTBKihE38CPg4nBiqX83PWYw==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.15.7", + "@babel/helper-validator-identifier": "^7.16.7", "chalk": "^2.0.0", "js-tokens": "^4.0.0" } }, "@babel/parser": { - "version": "7.16.6", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.6.tgz", - "integrity": "sha512-Gr86ujcNuPDnNOY8mi383Hvi8IYrJVJYuf3XcuBM/Dgd+bINn/7tHqsj+tKkoreMbmGsFLsltI/JJd8fOFWGDQ==", + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.8.tgz", + "integrity": "sha512-i7jDUfrVBWc+7OKcBzEe5n7fbv3i2fWtxKzzCvOjnzSxMfWMigAhtfJ7qzZNGFNMsCCd67+uz553dYKWXPvCKw==", "dev": true }, "@babel/template": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.0.tgz", - "integrity": "sha512-MnZdpFD/ZdYhXwiunMqqgyZyucaYsbL0IrjoGjaVhGilz+x8YB++kRfygSOIj1yOtWKPlx7NBp+9I1RQSgsd5A==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", + "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", "dev": true, "requires": { - "@babel/code-frame": "^7.16.0", - "@babel/parser": "^7.16.0", - "@babel/types": "^7.16.0" + "@babel/code-frame": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/types": "^7.16.7" } }, "@babel/traverse": { - "version": "7.16.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.5.tgz", - "integrity": "sha512-FOCODAzqUMROikDYLYxl4nmwiLlu85rNqBML/A5hKRVXG2LV8d0iMqgPzdYTcIpjZEBB7D6UDU9vxRZiriASdQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.16.0", - "@babel/generator": "^7.16.5", - "@babel/helper-environment-visitor": "^7.16.5", - "@babel/helper-function-name": "^7.16.0", - "@babel/helper-hoist-variables": "^7.16.0", - "@babel/helper-split-export-declaration": "^7.16.0", - "@babel/parser": "^7.16.5", - "@babel/types": "^7.16.0", + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.8.tgz", + "integrity": "sha512-xe+H7JlvKsDQwXRsBhSnq1/+9c+LlQcCK3Tn/l5sbx02HYns/cn7ibp9+RV1sIUqu7hKg91NWsgHurO9dowITQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.8", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.16.8", + "@babel/types": "^7.16.8", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -269,12 +269,12 @@ } }, "@babel/types": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.0.tgz", - "integrity": "sha512-PJgg/k3SdLsGb3hhisFvtLOw5ts113klrpLuIPtCJIU+BB24fqq6lf8RWqKJEjzqXR9AEH1rIb5XTqwBHB+kQg==", + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.8.tgz", + "integrity": "sha512-smN2DQc5s4M7fntyjGtyIPbRJv6wW4rU/94fmYJ7PKQuZkC0qGMHXJbg6sNGt12JmVr4k5YaptI/XtiLJBnmIg==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.15.7", + "@babel/helper-validator-identifier": "^7.16.7", "to-fast-properties": "^2.0.0" } }, @@ -448,9 +448,9 @@ } }, "@rollup/plugin-alias": { - "version": "3.1.8", - "resolved": "https://registry.npmjs.org/@rollup/plugin-alias/-/plugin-alias-3.1.8.tgz", - "integrity": "sha512-tf7HeSs/06wO2LPqKNY3Ckbvy0JRe7Jyn98bXnt/gfrxbe+AJucoNJlsEVi9sdgbQtXemjbakCpO/76JVgnHpA==", + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/@rollup/plugin-alias/-/plugin-alias-3.1.9.tgz", + "integrity": "sha512-QI5fsEvm9bDzt32k39wpOwZhVzRcL5ydcffUHMyLVaVaLeC70I8TJZ17F1z1eMoLu4E/UOcH9BWVkKpIKdrfiw==", "dev": true, "requires": { "slash": "^3.0.0" @@ -554,9 +554,9 @@ } }, "@rollup/plugin-node-resolve": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.1.1.tgz", - "integrity": "sha512-6QKtRevXLrmEig9UiMYt2fSvee9TyltGRfw+qSs6xjUnxwjOzTOqy+/Lpxsgjb8mJn1EQNbCDAvt89O4uzL5kw==", + "version": "13.1.3", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.1.3.tgz", + "integrity": "sha512-BdxNk+LtmElRo5d06MGY4zoepyrXX1tkzX2hrnPEZ53k78GuOMWLqmJDGIIOPwVRIFZrLQOo+Yr6KtCuLIA0AQ==", "dev": true, "requires": { "@rollup/pluginutils": "^3.1.0", @@ -581,9 +581,9 @@ } }, "@rollup/plugin-replace": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-3.0.0.tgz", - "integrity": "sha512-3c7JCbMuYXM4PbPWT4+m/4Y6U60SgsnDT/cCyAyUKwFHg7pTSfsSQzIpETha3a3ig6OdOKzZz87D9ZXIK3qsDg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-3.0.1.tgz", + "integrity": "sha512-989J5oRzf3mm0pO/0djTijdfEh9U3n63BIXN5X7T4U9BP+fN4oxQ6DvDuBvFaHA6scaHQRclqmKQEkBhB7k7Hg==", "dev": true, "requires": { "@rollup/pluginutils": "^3.1.0", @@ -746,13 +746,14 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.7.0.tgz", - "integrity": "sha512-8RTGBpNn5a9M628wBPrCbJ+v3YTEOE2qeZb7TDkGKTDXSj36KGRg92SpFFaR/0S3rSXQxM0Og/kV9EyadsYSBg==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.0.tgz", + "integrity": "sha512-XXVKnMsq2fuu9K2KsIxPUGqb6xAImz8MEChClbXmE3VbveFtBUU5bzM6IPVWqzyADIgdkS2Ws/6Xo7W2TeZWjQ==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "5.7.0", - "@typescript-eslint/scope-manager": "5.7.0", + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/type-utils": "5.10.0", + "@typescript-eslint/utils": "5.10.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -761,56 +762,53 @@ "tsutils": "^3.21.0" } }, - "@typescript-eslint/experimental-utils": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.7.0.tgz", - "integrity": "sha512-u57eZ5FbEpzN5kSjmVrSesovWslH2ZyNPnaXQMXWgH57d5+EVHEt76W75vVuI9qKZ5BMDKNfRN+pxcPEjQjb2A==", + "@typescript-eslint/parser": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.10.0.tgz", + "integrity": "sha512-pJB2CCeHWtwOAeIxv8CHVGJhI5FNyJAIpx5Pt72YkK3QfEzt6qAlXZuyaBmyfOdM62qU0rbxJzNToPTVeJGrQw==", "dev": true, "requires": { - "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.7.0", - "@typescript-eslint/types": "5.7.0", - "@typescript-eslint/typescript-estree": "5.7.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/typescript-estree": "5.10.0", + "debug": "^4.3.2" } }, - "@typescript-eslint/parser": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.7.0.tgz", - "integrity": "sha512-m/gWCCcS4jXw6vkrPQ1BjZ1vomP01PArgzvauBqzsoZ3urLbsRChexB8/YV8z9HwE3qlJM35FxfKZ1nfP/4x8g==", + "@typescript-eslint/scope-manager": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.0.tgz", + "integrity": "sha512-tgNgUgb4MhqK6DoKn3RBhyZ9aJga7EQrw+2/OiDk5hKf3pTVZWyqBi7ukP+Z0iEEDMF5FDa64LqODzlfE4O/Dg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.7.0", - "@typescript-eslint/types": "5.7.0", - "@typescript-eslint/typescript-estree": "5.7.0", - "debug": "^4.3.2" + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/visitor-keys": "5.10.0" } }, - "@typescript-eslint/scope-manager": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.7.0.tgz", - "integrity": "sha512-7mxR520DGq5F7sSSgM0HSSMJ+TFUymOeFRMfUfGFAVBv8BR+Jv1vHgAouYUvWRZeszVBJlLcc9fDdktxb5kmxA==", + "@typescript-eslint/type-utils": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.10.0.tgz", + "integrity": "sha512-TzlyTmufJO5V886N+hTJBGIfnjQDQ32rJYxPaeiyWKdjsv2Ld5l8cbS7pxim4DeNs62fKzRSt8Q14Evs4JnZyQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.7.0", - "@typescript-eslint/visitor-keys": "5.7.0" + "@typescript-eslint/utils": "5.10.0", + "debug": "^4.3.2", + "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.7.0.tgz", - "integrity": "sha512-5AeYIF5p2kAneIpnLFve8g50VyAjq7udM7ApZZ9JYjdPjkz0LvODfuSHIDUVnIuUoxafoWzpFyU7Sqbxgi79mA==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.0.tgz", + "integrity": "sha512-wUljCgkqHsMZbw60IbOqT/puLfyqqD5PquGiBo1u1IS3PLxdi3RDGlyf032IJyh+eQoGhz9kzhtZa+VC4eWTlQ==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.7.0.tgz", - "integrity": "sha512-aO1Ql+izMrTnPj5aFFlEJkpD4jRqC4Gwhygu2oHK2wfVQpmOPbyDSveJ+r/NQo+PWV43M6uEAeLVbTi09dFLhg==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.0.tgz", + "integrity": "sha512-x+7e5IqfwLwsxTdliHRtlIYkgdtYXzE0CkFeV6ytAqq431ZyxCFzNMNR5sr3WOlIG/ihVZr9K/y71VHTF/DUQA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.7.0", - "@typescript-eslint/visitor-keys": "5.7.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/visitor-keys": "5.10.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -818,13 +816,27 @@ "tsutils": "^3.21.0" } }, + "@typescript-eslint/utils": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.10.0.tgz", + "integrity": "sha512-IGYwlt1CVcFoE2ueW4/ioEwybR60RAdGeiJX/iDAw0t5w0wK3S7QncDwpmsM70nKgGTuVchEWB8lwZwHqPAWRg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/typescript-estree": "5.10.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + } + }, "@typescript-eslint/visitor-keys": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.7.0.tgz", - "integrity": "sha512-hdohahZ4lTFcglZSJ3DGdzxQHBSxsLVqHzkiOmKi7xVAWC4y2c1bIMKmPJSrA4aOEoRUPOKQ87Y/taC7yVHpFg==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.0.tgz", + "integrity": "sha512-GMxj0K1uyrFLPKASLmZzCuSddmjZVbVj3Ouy5QVuIGKZopxvOr24JsS7gruz6C3GExE01mublZ3mIBOaon9zuQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.7.0", + "@typescript-eslint/types": "5.10.0", "eslint-visitor-keys": "^3.0.0" } }, @@ -835,9 +847,9 @@ "dev": true }, "acorn": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz", - "integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==", + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", "dev": true }, "acorn-dynamic-import": { @@ -1105,15 +1117,15 @@ "dev": true }, "camelcase": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.1.tgz", - "integrity": "sha512-tVI4q5jjFV5CavAU8DXfza/TJcZutVKo/5Foskmsqcm0MsL91moHvwiGNnqaa2o6PF/7yT5ikDRcVcl8Rj6LCA==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true }, "caniuse-lite": { - "version": "1.0.30001287", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001287.tgz", - "integrity": "sha512-4udbs9bc0hfNrcje++AxBuc6PfLNHwh3PO9kbwnfCQWyqtlzg3py0YgFu8jyRTTo85VAz4U+VLxSlID09vNtWA==", + "version": "1.0.30001300", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001300.tgz", + "integrity": "sha512-cVjiJHWGcNlJi8TZVKNMnvMid3Z3TTdDHmLDzlOdIiZq138Exvo0G+G0wTdVYolxKb4AYwC+38pxodiInVtJSA==", "dev": true }, "chalk": { @@ -1242,9 +1254,9 @@ } }, "core-js": { - "version": "3.20.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.20.0.tgz", - "integrity": "sha512-KjbKU7UEfg4YPpskMtMXPhUKn7m/1OdTHTVjy09ScR2LVaoUXe8Jh0UdvN2EKUR6iKTJph52SJP95mAB0MnVLQ==", + "version": "3.20.3", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.20.3.tgz", + "integrity": "sha512-vVl8j8ph6tRS3B8qir40H7yw7voy17xL0piAjlbBUsH7WIfzoedL/ZOr1OV9FyZQLWXsayOJyV4tnRyXR85/ag==", "dev": true }, "cosmiconfig": { @@ -1364,9 +1376,9 @@ } }, "electron-to-chromium": { - "version": "1.4.21", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.21.tgz", - "integrity": "sha512-T04U2ciApGbm+dESFEBbewi2Xt0Dgyww8M4n4sOt9lnmFuYbaHEDWCROkx4jvAZDUWWry9YOdnAs+7468q80Qg==", + "version": "1.4.47", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.47.tgz", + "integrity": "sha512-ZHc8i3/cgeCRK/vC7W2htAG6JqUmOUgDNn/f9yY9J8UjfLjwzwOVEt4MWmgJAdvmxyrsR5KIFA/6+kUHGY0eUA==", "dev": true }, "emoji-regex": { @@ -1448,9 +1460,9 @@ } }, "es5-shim": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/es5-shim/-/es5-shim-4.6.2.tgz", - "integrity": "sha512-n0XTVMGps+Deyr38jtqKPR5F5hb9owYeRQcKJW39eFvzUk/u/9Ww315werRzbiNMnHCUw/YHDPBphTlEnzdi+A==", + "version": "4.6.4", + "resolved": "https://registry.npmjs.org/es5-shim/-/es5-shim-4.6.4.tgz", + "integrity": "sha512-Z0f7OUYZ8JfqT12d3Tgh2ErxIH5Shaz97GE8qyDG9quxb2Hmh2vvFHlOFjx6lzyD0CRgvJfnNYcisjdbRp7MPw==", "dev": true }, "es6-error": { @@ -1478,9 +1490,9 @@ "dev": true }, "eslint": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.4.1.tgz", - "integrity": "sha512-TxU/p7LB1KxQ6+7aztTnO7K0i+h0tDi81YRY9VzB6Id71kNz+fFYnf5HD5UOQmxkzcoa0TlVZf9dpMtUv0GpWg==", + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.7.0.tgz", + "integrity": "sha512-ifHYzkBGrzS2iDU7KjhCAVMGCvF6M3Xfs8X8b37cgrUlDt6bWRTpRh6T/gtSXv1HJ/BUGgmjvNvOEGu85Iif7w==", "dev": true, "requires": { "@eslint/eslintrc": "^1.0.5", @@ -1490,12 +1502,11 @@ "cross-spawn": "^7.0.2", "debug": "^4.3.2", "doctrine": "^3.0.0", - "enquirer": "^2.3.5", "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.1.0", "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.1.0", - "espree": "^9.2.0", + "eslint-visitor-keys": "^3.2.0", + "espree": "^9.3.0", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -1503,7 +1514,7 @@ "functional-red-black-tree": "^1.0.1", "glob-parent": "^6.0.1", "globals": "^13.6.0", - "ignore": "^4.0.6", + "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", @@ -1514,9 +1525,7 @@ "minimatch": "^3.0.4", "natural-compare": "^1.4.0", "optionator": "^0.9.1", - "progress": "^2.0.0", "regexpp": "^3.2.0", - "semver": "^7.2.1", "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", "text-table": "^0.2.0", @@ -1594,12 +1603,6 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true - }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -1639,14 +1642,13 @@ } }, "eslint-module-utils": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.1.tgz", - "integrity": "sha512-fjoetBXQZq2tSTWZ9yWVl2KuFrTZZH3V+9iD1V1RfpDgxzJR+mPd/KZmMiA8gbPqdBzpNiEHOuT7IYEWxrH0zQ==", + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.2.tgz", + "integrity": "sha512-zquepFnWCY2ISMFwD/DqzaM++H+7PDzOpUvotJWm/y1BAFt5R4oeULgdrTejKqLkz7MA/tgstsUMNYc7wNdTrg==", "dev": true, "requires": { "debug": "^3.2.7", - "find-up": "^2.1.0", - "pkg-dir": "^2.0.0" + "find-up": "^2.1.0" }, "dependencies": { "debug": { @@ -1661,9 +1663,9 @@ } }, "eslint-plugin-import": { - "version": "2.25.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.25.3.tgz", - "integrity": "sha512-RzAVbby+72IB3iOEL8clzPLzL3wpDrlwjsTBAQXgyp5SeTqqY+0bFubwuo+y/HLhNZcXV4XqTBO4LGsfyHIDXg==", + "version": "2.25.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.25.4.tgz", + "integrity": "sha512-/KJBASVFxpu0xg1kIBn9AUa8hQVnszpwgE7Ld0lKAlx7Ie87yzEzCgSkekt+le/YVhiaosO4Y14GDAOc41nfxA==", "dev": true, "requires": { "array-includes": "^3.1.4", @@ -1671,14 +1673,14 @@ "debug": "^2.6.9", "doctrine": "^2.1.0", "eslint-import-resolver-node": "^0.3.6", - "eslint-module-utils": "^2.7.1", + "eslint-module-utils": "^2.7.2", "has": "^1.0.3", "is-core-module": "^2.8.0", "is-glob": "^4.0.3", "minimatch": "^3.0.4", "object.values": "^1.1.5", "resolve": "^1.20.0", - "tsconfig-paths": "^3.11.0" + "tsconfig-paths": "^3.12.0" }, "dependencies": { "debug": { @@ -1744,18 +1746,18 @@ } }, "eslint-visitor-keys": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.1.0.tgz", - "integrity": "sha512-yWJFpu4DtjsWKkt5GeNBBuZMlNcYVs6vRCLoCVEJrTjaSB6LC98gFipNK/erM2Heg/E8mIK+hXG/pJMLK+eRZA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.2.0.tgz", + "integrity": "sha512-IOzT0X126zn7ALX0dwFiUQEdsfzrm4+ISsQS8nukaJXwEyYKRSnEIIDULYg1mCtGp7UUXgfGl7BIolXREQK+XQ==", "dev": true }, "espree": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.2.0.tgz", - "integrity": "sha512-oP3utRkynpZWF/F2x/HZJ+AGtnIclaR7z1pYPxy7NYM2fSO6LgK/Rkny8anRSPK/VwEA1eqm2squui0T7ZMOBg==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.0.tgz", + "integrity": "sha512-d/5nCsb0JcqsSEeQzFZ8DH1RmxPcglRWh24EFTlUEmCKoehXGdpsx0RkHDubqUI8LSAIKMQp4r9SzQ3n+sm4HQ==", "dev": true, "requires": { - "acorn": "^8.6.0", + "acorn": "^8.7.0", "acorn-jsx": "^5.3.1", "eslint-visitor-keys": "^3.1.0" } @@ -1848,9 +1850,9 @@ "dev": true }, "fast-glob": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", - "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -1908,66 +1910,6 @@ "commondir": "^1.0.1", "make-dir": "^3.0.2", "pkg-dir": "^4.1.0" - }, - "dependencies": { - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } - } } }, "find-up": { @@ -2165,23 +2107,23 @@ } }, "globby": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", - "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, "requires": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", "slash": "^3.0.0" } }, "graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", + "version": "4.2.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", "dev": true }, "growl": { @@ -2279,9 +2221,9 @@ "dev": true }, "ignore": { - "version": "5.1.9", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", - "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true }, "import-fresh": { @@ -2380,9 +2322,9 @@ "dev": true }, "is-core-module": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", - "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", "dev": true, "requires": { "has": "^1.0.3" @@ -2654,9 +2596,9 @@ } }, "istanbul-reports": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.1.tgz", - "integrity": "sha512-q1kvhAXWSsXfMjCdNHNPKZZv94OlspKnoGv+R9RGbnqOOQ0VbNfLFgQDVgi7hHenKsndGq3/o0OBdzDXthWcNw==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.3.tgz", + "integrity": "sha512-x9LtDVtfm/t1GFiLl3NffC7hz+I1ragvgX1P/Lg1NlIagifZDKUkuuaAxH/qpwj2IuEfD8G2Bs/UKp+sZ/pKkg==", "dev": true, "requires": { "html-escaper": "^2.0.0", @@ -2871,9 +2813,9 @@ } }, "listr2": { - "version": "3.13.5", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.13.5.tgz", - "integrity": "sha512-3n8heFQDSk+NcwBn3CgxEibZGaRzx+pC64n3YjpMD1qguV4nWus3Al+Oo3KooqFKTQEJ1v7MmnbnyyNspgx3NA==", + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.14.0.tgz", + "integrity": "sha512-TyWI8G99GX9GjE54cJ+RrNMcIFBfwMPxc3XTFiAYGN4s10hWROGtOg7+O6u6LE3mNkyld7RSLE6nrKBvTfcs3g==", "dev": true, "requires": { "cli-truncate": "^2.1.0", @@ -2881,7 +2823,7 @@ "log-update": "^4.0.0", "p-map": "^4.0.0", "rfdc": "^1.3.0", - "rxjs": "^7.4.0", + "rxjs": "^7.5.1", "through": "^2.3.8", "wrap-ansi": "^7.0.0" } @@ -3142,9 +3084,9 @@ "dev": true }, "mocha": { - "version": "9.1.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.3.tgz", - "integrity": "sha512-Xcpl9FqXOAYqI3j79pEtHBBnQgVXIhpULjGQa7DVb0Po+VzmSIK9kanAiWLHoRR/dbZ2qpdPshuXr8l1VaHCzw==", + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.4.tgz", + "integrity": "sha512-+q2aV5VlJZuLgCWoBvGI5zEwPF9eEI0kr/sAA9Jm4xMND7RfIEyF8JE7C0JIg8WXRG+P1sdIAb5ccoHPlXLzcw==", "dev": true, "requires": { "@ungap/promise-all-settled": "1.1.2", @@ -3543,9 +3485,9 @@ } }, "object-inspect": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.1.tgz", - "integrity": "sha512-If7BjFlpkzzBeV1cqgT3OSWT3azyoxDGajR+iGnFBfVV2EWyDyWaZZW2ERDjUaY2QM8i5jI3Sj7mhsM4DDAqWA==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", "dev": true }, "object-keys": { @@ -3655,9 +3597,9 @@ } }, "package-name-regex": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/package-name-regex/-/package-name-regex-2.0.4.tgz", - "integrity": "sha512-p+ixFAmbQ9DE9TG3ptbjLc7/gwgdKEMCwdGpZwxzgD02D1q/SRRT/j32MyjGjJQ36CSTeVsvKt9Zp3PUHYWBnw==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/package-name-regex/-/package-name-regex-2.0.5.tgz", + "integrity": "sha512-F0lX+FBs/Bo7KWY6EuUXj+oarXU0Og1R2Zdg3F/fVcNw3pPQAKFKxUrugno0Ds5NUztlx/gRLnQW9MF+7VTqAw==", "dev": true }, "parent-module": { @@ -3724,9 +3666,9 @@ "dev": true }, "picomatch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", - "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, "pinst": { @@ -3739,12 +3681,63 @@ } }, "pkg-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", - "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", "dev": true, "requires": { - "find-up": "^2.1.0" + "find-up": "^4.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + } } }, "please-upgrade-node": { @@ -3801,12 +3794,6 @@ "fromentries": "^1.2.0" } }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, "pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -3940,13 +3927,14 @@ "dev": true }, "resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz", + "integrity": "sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==", "dev": true, "requires": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" + "is-core-module": "^2.8.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" } }, "resolve-from": { @@ -3987,18 +3975,18 @@ } }, "rollup": { - "version": "2.61.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.61.1.tgz", - "integrity": "sha512-BbTXlEvB8d+XFbK/7E5doIcRtxWPRiqr0eb5vQ0+2paMM04Ye4PZY5nHOQef2ix24l/L0SpLd5hwcH15QHPdvA==", + "version": "2.64.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.64.0.tgz", + "integrity": "sha512-+c+lbw1lexBKSMb1yxGDVfJ+vchJH3qLbmavR+awDinTDA2C5Ug9u7lkOzj62SCu0PKUExsW36tpgW7Fmpn3yQ==", "dev": true, "requires": { "fsevents": "~2.3.2" } }, "rollup-plugin-license": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-license/-/rollup-plugin-license-2.6.0.tgz", - "integrity": "sha512-ilM+sb9xCvP+23tmzsCqJSm33877nIFeO6lMDGbckxc1jq2nW6WtU1nFD4cfOrKYl0cw1dkz4rC3VMAe8dA8cQ==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-license/-/rollup-plugin-license-2.6.1.tgz", + "integrity": "sha512-JPtlXF0tZKyHztKJsyd3HHmQFSkXei+596Xrb/a/bHIdDhvFuNSKimCKkQpoXyspfeVQk7CNay1MyGpFHAXjvg==", "dev": true, "requires": { "commenting": "1.1.0", @@ -4007,7 +3995,7 @@ "magic-string": "0.25.7", "mkdirp": "1.0.4", "moment": "2.29.1", - "package-name-regex": "2.0.4", + "package-name-regex": "2.0.5", "spdx-expression-validate": "2.0.0", "spdx-satisfies": "5.0.1" } @@ -4077,20 +4065,12 @@ } }, "rxjs": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.4.0.tgz", - "integrity": "sha512-7SQDi7xeTMCJpqViXh8gL/lebcwlp3d831F05+9B44A4B0WfsEwUQHR64gsH1kvJ+Ep/J9K2+n1hVl1CsGN23w==", + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.2.tgz", + "integrity": "sha512-PwDt186XaL3QN5qXj/H9DGyHhP3/RYYgZZwqBv9Tv8rsAaiwFH1IsJJlcgD37J7UW5a6O67qX0KWKS3/pu0m4w==", "dev": true, "requires": { - "tslib": "~2.1.0" - }, - "dependencies": { - "tslib": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", - "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==", - "dev": true - } + "tslib": "^2.1.0" } }, "safe-buffer": { @@ -4186,9 +4166,9 @@ "dev": true }, "shelljs": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", - "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", "dev": true, "requires": { "glob": "^7.0.0", @@ -4197,13 +4177,13 @@ } }, "shx": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.3.tgz", - "integrity": "sha512-nZJ3HFWVoTSyyB+evEKjJ1STiixGztlqwKLTUNV5KqMWtGey9fTd4KU1gdZ1X9BV6215pswQ/Jew9NsuS/fNDA==", + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.4.tgz", + "integrity": "sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g==", "dev": true, "requires": { "minimist": "^1.2.3", - "shelljs": "^0.8.4" + "shelljs": "^0.8.5" } }, "side-channel": { @@ -4459,6 +4439,12 @@ "has-flag": "^3.0.0" } }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, "systemjs": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/systemjs/-/systemjs-6.11.0.tgz", diff --git a/package.json b/package.json index 91bb6ad1d95..3d02483e836 100644 --- a/package.json +++ b/package.json @@ -58,33 +58,33 @@ "fsevents": "~2.3.2" }, "devDependencies": { - "@rollup/plugin-alias": "^3.1.8", + "@rollup/plugin-alias": "^3.1.9", "@rollup/plugin-buble": "^0.21.3", "@rollup/plugin-commonjs": "^21.0.1", "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^13.1.1", - "@rollup/plugin-replace": "^3.0.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "@rollup/plugin-replace": "^3.0.1", "@rollup/plugin-typescript": "^8.2.5", "@rollup/pluginutils": "^4.1.2", "@types/node": "^10.17.60", "@types/require-relative": "^0.8.0", "@types/signal-exit": "^3.0.1", "@types/yargs-parser": "^20.2.1", - "@typescript-eslint/eslint-plugin": "^5.7.0", - "@typescript-eslint/parser": "^5.7.0", - "acorn": "^8.6.0", + "@typescript-eslint/eslint-plugin": "^5.10.0", + "@typescript-eslint/parser": "^5.10.0", + "acorn": "^8.7.0", "acorn-jsx": "^5.3.2", "acorn-walk": "^8.2.0", "buble": "^0.20.0", "chokidar": "^3.5.2", "colorette": "^2.0.16", - "core-js": "^3.20.0", + "core-js": "^3.20.3", "date-time": "^4.0.0", - "es5-shim": "^4.6.2", + "es5-shim": "^4.6.4", "es6-shim": "^0.35.6", - "eslint": "^8.4.1", + "eslint": "^8.7.0", "eslint-config-prettier": "^8.3.0", - "eslint-plugin-import": "^2.25.3", + "eslint-plugin-import": "^2.25.4", "eslint-plugin-prettier": "^4.0.0", "execa": "^5.1.1", "fixturify": "^2.1.1", @@ -94,7 +94,7 @@ "lint-staged": "^10.5.4", "locate-character": "^2.0.5", "magic-string": "^0.25.7", - "mocha": "^9.1.3", + "mocha": "^9.1.4", "nyc": "^15.1.0", "pinst": "^2.1.6", "prettier": "^2.5.1", @@ -102,13 +102,13 @@ "pretty-ms": "^7.0.1", "require-relative": "^0.8.7", "requirejs": "^2.3.6", - "rollup": "^2.61.1", - "rollup-plugin-license": "^2.5.0", + "rollup": "^2.64.0", + "rollup-plugin-license": "^2.6.1", "rollup-plugin-string": "^3.0.0", "rollup-plugin-terser": "^7.0.2", "rollup-plugin-thatworks": "^1.0.4", "sander": "^0.6.0", - "shx": "^0.3.3", + "shx": "^0.3.4", "signal-exit": "^3.0.6", "source-map": "^0.7.3", "source-map-support": "^0.5.21", diff --git a/test/form/samples/supports-core-js/_expected.js b/test/form/samples/supports-core-js/_expected.js index 127ad3d53e1..52096257f9d 100644 --- a/test/form/samples/supports-core-js/_expected.js +++ b/test/form/samples/supports-core-js/_expected.js @@ -5,7 +5,7 @@ var check = function (it) { }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 -var global$1$ = +var global$20 = // eslint-disable-next-line es/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || @@ -17,7 +17,7 @@ var global$1$ = var objectGetOwnPropertyDescriptor = {}; -var fails$1d = function (exec) { +var fails$1f = function (exec) { try { return !!exec(); } catch (error) { @@ -25,18 +25,28 @@ var fails$1d = function (exec) { } }; -var fails$1c = fails$1d; +var fails$1e = fails$1f; // Detect IE8's incomplete defineProperty implementation -var descriptors = !fails$1c(function () { +var descriptors = !fails$1e(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); -var call$_ = Function.prototype.call; +var fails$1d = fails$1f; -var functionCall = call$_.bind ? call$_.bind(call$_) : function () { - return call$_.apply(call$_, arguments); +var functionBindNative = !fails$1d(function () { + var test = (function () { /* empty */ }).bind(); + // eslint-disable-next-line no-prototype-builtins -- safe + return typeof test != 'function' || test.hasOwnProperty('prototype'); +}); + +var NATIVE_BIND$4 = functionBindNative; + +var call$$ = Function.prototype.call; + +var functionCall = NATIVE_BIND$4 ? call$$.bind(call$$) : function () { + return call$$.apply(call$$, arguments); }; var objectPropertyIsEnumerable = {}; @@ -64,16 +74,18 @@ var createPropertyDescriptor$c = function (bitmap, value) { }; }; +var NATIVE_BIND$3 = functionBindNative; + var FunctionPrototype$4 = Function.prototype; -var bind$w = FunctionPrototype$4.bind; -var call$Z = FunctionPrototype$4.call; -var callBind = bind$w && bind$w.bind(call$Z); +var bind$v = FunctionPrototype$4.bind; +var call$_ = FunctionPrototype$4.call; +var uncurryThis$1q = NATIVE_BIND$3 && bind$v.bind(call$_, call$_); -var functionUncurryThis = bind$w ? function (fn) { - return fn && callBind(call$Z, fn); +var functionUncurryThis = NATIVE_BIND$3 ? function (fn) { + return fn && uncurryThis$1q(fn); } : function (fn) { return fn && function () { - return call$Z.apply(fn, arguments); + return call$_.apply(fn, arguments); }; }; @@ -86,16 +98,16 @@ var classofRaw$1 = function (it) { return stringSlice$h(toString$y(it), 8, -1); }; -var global$1_ = global$1$; +var global$1$ = global$20; var uncurryThis$1o = functionUncurryThis; -var fails$1b = fails$1d; +var fails$1c = fails$1f; var classof$k = classofRaw$1; -var Object$8 = global$1_.Object; +var Object$8 = global$1$.Object; var split$3 = uncurryThis$1o(''.split); // fallback for non-array-like ES3 and non-enumerable old V8 strings -var indexedObject = fails$1b(function () { +var indexedObject = fails$1c(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins -- safe return !Object$8('z').propertyIsEnumerable(0); @@ -103,14 +115,14 @@ var indexedObject = fails$1b(function () { return classof$k(it) == 'String' ? split$3(it, '') : Object$8(it); } : Object$8; -var global$1Z = global$1$; +var global$1_ = global$20; -var TypeError$H = global$1Z.TypeError; +var TypeError$I = global$1_.TypeError; // `RequireObjectCoercible` abstract operation // https://tc39.es/ecma262/#sec-requireobjectcoercible var requireObjectCoercible$k = function (it) { - if (it == undefined) throw TypeError$H("Can't call method on " + it); + if (it == undefined) throw TypeError$I("Can't call method on " + it); return it; }; @@ -118,7 +130,7 @@ var requireObjectCoercible$k = function (it) { var IndexedObject$7 = indexedObject; var requireObjectCoercible$j = requireObjectCoercible$k; -var toIndexedObject$j = function (it) { +var toIndexedObject$k = function (it) { return IndexedObject$7(requireObjectCoercible$j(it)); }; @@ -134,7 +146,7 @@ var isObject$C = function (it) { return typeof it == 'object' ? it !== null : isCallable$z(it); }; -var global$1Y = global$1$; +var global$1Z = global$20; var isCallable$y = isCallable$A; var aFunction = function (argument) { @@ -142,7 +154,7 @@ var aFunction = function (argument) { }; var getBuiltIn$F = function (namespace, method) { - return arguments.length < 2 ? aFunction(global$1Y[namespace]) : global$1Y[namespace] && global$1Y[namespace][method]; + return arguments.length < 2 ? aFunction(global$1Z[namespace]) : global$1Z[namespace] && global$1Z[namespace][method]; }; var uncurryThis$1n = functionUncurryThis; @@ -153,11 +165,11 @@ var getBuiltIn$E = getBuiltIn$F; var engineUserAgent = getBuiltIn$E('navigator', 'userAgent') || ''; -var global$1X = global$1$; +var global$1Y = global$20; var userAgent$7 = engineUserAgent; -var process$4 = global$1X.process; -var Deno = global$1X.Deno; +var process$4 = global$1Y.process; +var Deno = global$1Y.Deno; var versions = process$4 && process$4.versions || Deno && Deno.version; var v8 = versions && versions.v8; var match, version; @@ -184,10 +196,10 @@ var engineV8Version = version; /* eslint-disable es/no-symbol -- required for testing */ var V8_VERSION$3 = engineV8Version; -var fails$1a = fails$1d; +var fails$1b = fails$1f; // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing -var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$1a(function () { +var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$1b(function () { var symbol = Symbol(); // Chrome 38 Symbol has incorrect toString conversion // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances @@ -204,13 +216,13 @@ var useSymbolAsUid = NATIVE_SYMBOL$3 && !Symbol.sham && typeof Symbol.iterator == 'symbol'; -var global$1W = global$1$; +var global$1X = global$20; var getBuiltIn$D = getBuiltIn$F; var isCallable$x = isCallable$A; var isPrototypeOf$e = objectIsPrototypeOf; var USE_SYMBOL_AS_UID$1 = useSymbolAsUid; -var Object$7 = global$1W.Object; +var Object$7 = global$1X.Object; var isSymbol$6 = USE_SYMBOL_AS_UID$1 ? function (it) { return typeof it == 'symbol'; @@ -219,9 +231,9 @@ var isSymbol$6 = USE_SYMBOL_AS_UID$1 ? function (it) { return isCallable$x($Symbol) && isPrototypeOf$e($Symbol.prototype, Object$7(it)); }; -var global$1V = global$1$; +var global$1W = global$20; -var String$7 = global$1V.String; +var String$7 = global$1W.String; var tryToString$5 = function (argument) { try { @@ -231,16 +243,16 @@ var tryToString$5 = function (argument) { } }; -var global$1U = global$1$; +var global$1V = global$20; var isCallable$w = isCallable$A; var tryToString$4 = tryToString$5; -var TypeError$G = global$1U.TypeError; +var TypeError$H = global$1V.TypeError; // `Assert: IsCallable(argument) is true` var aCallable$V = function (argument) { if (isCallable$w(argument)) return argument; - throw TypeError$G(tryToString$4(argument) + ' is not a function'); + throw TypeError$H(tryToString$4(argument) + ' is not a function'); }; var aCallable$U = aCallable$V; @@ -252,45 +264,45 @@ var getMethod$h = function (V, P) { return func == null ? undefined : aCallable$U(func); }; -var global$1T = global$1$; -var call$Y = functionCall; +var global$1U = global$20; +var call$Z = functionCall; var isCallable$v = isCallable$A; var isObject$B = isObject$C; -var TypeError$F = global$1T.TypeError; +var TypeError$G = global$1U.TypeError; // `OrdinaryToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-ordinarytoprimitive var ordinaryToPrimitive$2 = function (input, pref) { var fn, val; - if (pref === 'string' && isCallable$v(fn = input.toString) && !isObject$B(val = call$Y(fn, input))) return val; - if (isCallable$v(fn = input.valueOf) && !isObject$B(val = call$Y(fn, input))) return val; - if (pref !== 'string' && isCallable$v(fn = input.toString) && !isObject$B(val = call$Y(fn, input))) return val; - throw TypeError$F("Can't convert object to primitive value"); + if (pref === 'string' && isCallable$v(fn = input.toString) && !isObject$B(val = call$Z(fn, input))) return val; + if (isCallable$v(fn = input.valueOf) && !isObject$B(val = call$Z(fn, input))) return val; + if (pref !== 'string' && isCallable$v(fn = input.toString) && !isObject$B(val = call$Z(fn, input))) return val; + throw TypeError$G("Can't convert object to primitive value"); }; var shared$7 = {exports: {}}; var isPure = false; -var global$1S = global$1$; +var global$1T = global$20; // eslint-disable-next-line es/no-object-defineproperty -- safe -var defineProperty$j = Object.defineProperty; +var defineProperty$k = Object.defineProperty; var setGlobal$3 = function (key, value) { try { - defineProperty$j(global$1S, key, { value: value, configurable: true, writable: true }); + defineProperty$k(global$1T, key, { value: value, configurable: true, writable: true }); } catch (error) { - global$1S[key] = value; + global$1T[key] = value; } return value; }; -var global$1R = global$1$; +var global$1S = global$20; var setGlobal$2 = setGlobal$3; var SHARED = '__core-js_shared__'; -var store$5 = global$1R[SHARED] || setGlobal$2(SHARED, {}); +var store$5 = global$1S[SHARED] || setGlobal$2(SHARED, {}); var sharedStore = store$5; @@ -299,31 +311,33 @@ var store$4 = sharedStore; (shared$7.exports = function (key, value) { return store$4[key] || (store$4[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.20.0', + version: '3.20.3', mode: 'global', - copyright: '© 2021 Denis Pushkarev (zloirock.ru)' + copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)', + license: 'https://github.com/zloirock/core-js/blob/v3.20.3/LICENSE', + source: 'https://github.com/zloirock/core-js' }); -var global$1Q = global$1$; +var global$1R = global$20; var requireObjectCoercible$i = requireObjectCoercible$k; -var Object$6 = global$1Q.Object; +var Object$6 = global$1R.Object; // `ToObject` abstract operation // https://tc39.es/ecma262/#sec-toobject -var toObject$A = function (argument) { +var toObject$z = function (argument) { return Object$6(requireObjectCoercible$i(argument)); }; var uncurryThis$1m = functionUncurryThis; -var toObject$z = toObject$A; +var toObject$y = toObject$z; var hasOwnProperty = uncurryThis$1m({}.hasOwnProperty); // `HasOwnProperty` abstract operation // https://tc39.es/ecma262/#sec-hasownproperty var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) { - return hasOwnProperty(toObject$z(it), key); + return hasOwnProperty(toObject$y(it), key); }; var uncurryThis$1l = functionUncurryThis; @@ -336,7 +350,7 @@ var uid$6 = function (key) { return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$x(++id$2 + postfix, 36); }; -var global$1P = global$1$; +var global$1Q = global$20; var shared$6 = shared$7.exports; var hasOwn$w = hasOwnProperty_1; var uid$5 = uid$6; @@ -344,7 +358,7 @@ var NATIVE_SYMBOL$2 = nativeSymbol; var USE_SYMBOL_AS_UID = useSymbolAsUid; var WellKnownSymbolsStore$1 = shared$6('wks'); -var Symbol$3 = global$1P.Symbol; +var Symbol$3 = global$1Q.Symbol; var symbolFor = Symbol$3 && Symbol$3['for']; var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$3 : Symbol$3 && Symbol$3.withoutSetter || uid$5; @@ -361,15 +375,15 @@ var wellKnownSymbol$H = function (name) { } return WellKnownSymbolsStore$1[name]; }; -var global$1O = global$1$; -var call$X = functionCall; +var global$1P = global$20; +var call$Y = functionCall; var isObject$A = isObject$C; var isSymbol$5 = isSymbol$6; var getMethod$g = getMethod$h; var ordinaryToPrimitive$1 = ordinaryToPrimitive$2; var wellKnownSymbol$G = wellKnownSymbol$H; -var TypeError$E = global$1O.TypeError; +var TypeError$F = global$1P.TypeError; var TO_PRIMITIVE$2 = wellKnownSymbol$G('toPrimitive'); // `ToPrimitive` abstract operation @@ -380,9 +394,9 @@ var toPrimitive$3 = function (input, pref) { var result; if (exoticToPrim) { if (pref === undefined) pref = 'default'; - result = call$X(exoticToPrim, input, pref); + result = call$Y(exoticToPrim, input, pref); if (!isObject$A(result) || isSymbol$5(result)) return result; - throw TypeError$E("Can't convert object to primitive value"); + throw TypeError$F("Can't convert object to primitive value"); } if (pref === undefined) pref = 'number'; return ordinaryToPrimitive$1(input, pref); @@ -398,10 +412,10 @@ var toPropertyKey$9 = function (argument) { return isSymbol$4(key) ? key : key + ''; }; -var global$1N = global$1$; +var global$1O = global$20; var isObject$z = isObject$C; -var document$3 = global$1N.document; +var document$3 = global$1O.document; // typeof document.createElement is 'object' in old IE var EXISTS$1 = isObject$z(document$3) && isObject$z(document$3.createElement); @@ -409,75 +423,109 @@ var documentCreateElement$2 = function (it) { return EXISTS$1 ? document$3.createElement(it) : {}; }; -var DESCRIPTORS$E = descriptors; -var fails$19 = fails$1d; +var DESCRIPTORS$F = descriptors; +var fails$1a = fails$1f; var createElement$1 = documentCreateElement$2; -// Thank's IE8 for his funny defineProperty -var ie8DomDefine = !DESCRIPTORS$E && !fails$19(function () { - // eslint-disable-next-line es/no-object-defineproperty -- requied for testing +// Thanks to IE8 for its funny defineProperty +var ie8DomDefine = !DESCRIPTORS$F && !fails$1a(function () { + // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty(createElement$1('div'), 'a', { get: function () { return 7; } }).a != 7; }); -var DESCRIPTORS$D = descriptors; -var call$W = functionCall; +var DESCRIPTORS$E = descriptors; +var call$X = functionCall; var propertyIsEnumerableModule$2 = objectPropertyIsEnumerable; var createPropertyDescriptor$b = createPropertyDescriptor$c; -var toIndexedObject$i = toIndexedObject$j; +var toIndexedObject$j = toIndexedObject$k; var toPropertyKey$8 = toPropertyKey$9; var hasOwn$v = hasOwnProperty_1; var IE8_DOM_DEFINE$1 = ie8DomDefine; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe -var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; +var $getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor -objectGetOwnPropertyDescriptor.f = DESCRIPTORS$D ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) { - O = toIndexedObject$i(O); +objectGetOwnPropertyDescriptor.f = DESCRIPTORS$E ? $getOwnPropertyDescriptor$2 : function getOwnPropertyDescriptor(O, P) { + O = toIndexedObject$j(O); P = toPropertyKey$8(P); if (IE8_DOM_DEFINE$1) try { - return $getOwnPropertyDescriptor$1(O, P); + return $getOwnPropertyDescriptor$2(O, P); } catch (error) { /* empty */ } - if (hasOwn$v(O, P)) return createPropertyDescriptor$b(!call$W(propertyIsEnumerableModule$2.f, O, P), O[P]); + if (hasOwn$v(O, P)) return createPropertyDescriptor$b(!call$X(propertyIsEnumerableModule$2.f, O, P), O[P]); }; var objectDefineProperty = {}; -var global$1M = global$1$; +var DESCRIPTORS$D = descriptors; +var fails$19 = fails$1f; + +// V8 ~ Chrome 36- +// https://bugs.chromium.org/p/v8/issues/detail?id=3334 +var v8PrototypeDefineBug = DESCRIPTORS$D && fails$19(function () { + // eslint-disable-next-line es/no-object-defineproperty -- required for testing + return Object.defineProperty(function () { /* empty */ }, 'prototype', { + value: 42, + writable: false + }).prototype != 42; +}); + +var global$1N = global$20; var isObject$y = isObject$C; -var String$6 = global$1M.String; -var TypeError$D = global$1M.TypeError; +var String$6 = global$1N.String; +var TypeError$E = global$1N.TypeError; // `Assert: Type(argument) is Object` var anObject$1F = function (argument) { if (isObject$y(argument)) return argument; - throw TypeError$D(String$6(argument) + ' is not an object'); + throw TypeError$E(String$6(argument) + ' is not an object'); }; -var global$1L = global$1$; +var global$1M = global$20; var DESCRIPTORS$C = descriptors; var IE8_DOM_DEFINE = ie8DomDefine; +var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug; var anObject$1E = anObject$1F; var toPropertyKey$7 = toPropertyKey$9; -var TypeError$C = global$1L.TypeError; +var TypeError$D = global$1M.TypeError; // eslint-disable-next-line es/no-object-defineproperty -- safe var $defineProperty$1 = Object.defineProperty; +// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe +var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; +var ENUMERABLE = 'enumerable'; +var CONFIGURABLE$1 = 'configurable'; +var WRITABLE = 'writable'; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty -objectDefineProperty.f = DESCRIPTORS$C ? $defineProperty$1 : function defineProperty(O, P, Attributes) { +objectDefineProperty.f = DESCRIPTORS$C ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) { + anObject$1E(O); + P = toPropertyKey$7(P); + anObject$1E(Attributes); + if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { + var current = $getOwnPropertyDescriptor$1(O, P); + if (current && current[WRITABLE]) { + O[P] = Attributes.value; + Attributes = { + configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1], + enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], + writable: false + }; + } + } return $defineProperty$1(O, P, Attributes); +} : $defineProperty$1 : function defineProperty(O, P, Attributes) { anObject$1E(O); P = toPropertyKey$7(P); anObject$1E(Attributes); if (IE8_DOM_DEFINE) try { return $defineProperty$1(O, P, Attributes); } catch (error) { /* empty */ } - if ('get' in Attributes || 'set' in Attributes) throw TypeError$C('Accessors not supported'); + if ('get' in Attributes || 'set' in Attributes) throw TypeError$D('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; @@ -510,11 +558,11 @@ if (!isCallable$u(store$3.inspectSource)) { var inspectSource$5 = store$3.inspectSource; -var global$1K = global$1$; +var global$1L = global$20; var isCallable$t = isCallable$A; var inspectSource$4 = inspectSource$5; -var WeakMap$4 = global$1K.WeakMap; +var WeakMap$4 = global$1L.WeakMap; var nativeWeakMap = isCallable$t(WeakMap$4) && /native code/.test(inspectSource$4(WeakMap$4)); @@ -530,7 +578,7 @@ var sharedKey$4 = function (key) { var hiddenKeys$6 = {}; var NATIVE_WEAK_MAP$1 = nativeWeakMap; -var global$1J = global$1$; +var global$1K = global$20; var uncurryThis$1j = functionUncurryThis; var isObject$x = isObject$C; var createNonEnumerableProperty$i = createNonEnumerableProperty$j; @@ -540,8 +588,8 @@ var sharedKey$3 = sharedKey$4; var hiddenKeys$5 = hiddenKeys$6; var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; -var TypeError$B = global$1J.TypeError; -var WeakMap$3 = global$1J.WeakMap; +var TypeError$C = global$1K.TypeError; +var WeakMap$3 = global$1K.WeakMap; var set$3, get$2, has; var enforce = function (it) { @@ -552,7 +600,7 @@ var getterFor$2 = function (TYPE) { return function (it) { var state; if (!isObject$x(it) || (state = get$2(it)).type !== TYPE) { - throw TypeError$B('Incompatible receiver, ' + TYPE + ' required'); + throw TypeError$C('Incompatible receiver, ' + TYPE + ' required'); } return state; }; }; @@ -563,7 +611,7 @@ if (NATIVE_WEAK_MAP$1 || shared$4.state) { var wmhas = uncurryThis$1j(store$2.has); var wmset = uncurryThis$1j(store$2.set); set$3 = function (it, metadata) { - if (wmhas(store$2, it)) throw new TypeError$B(OBJECT_ALREADY_INITIALIZED); + if (wmhas(store$2, it)) throw new TypeError$C(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; wmset(store$2, it, metadata); return metadata; @@ -578,7 +626,7 @@ if (NATIVE_WEAK_MAP$1 || shared$4.state) { var STATE = sharedKey$3('state'); hiddenKeys$5[STATE] = true; set$3 = function (it, metadata) { - if (hasOwn$u(it, STATE)) throw new TypeError$B(OBJECT_ALREADY_INITIALIZED); + if (hasOwn$u(it, STATE)) throw new TypeError$C(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; createNonEnumerableProperty$i(it, STATE, metadata); return metadata; @@ -617,7 +665,7 @@ var functionName = { CONFIGURABLE: CONFIGURABLE }; -var global$1I = global$1$; +var global$1J = global$20; var isCallable$s = isCallable$A; var hasOwn$s = hasOwnProperty_1; var createNonEnumerableProperty$h = createNonEnumerableProperty$j; @@ -627,7 +675,7 @@ var InternalStateModule$k = internalState; var CONFIGURABLE_FUNCTION_NAME$2 = functionName.CONFIGURABLE; var getInternalState$i = InternalStateModule$k.get; -var enforceInternalState$1 = InternalStateModule$k.enforce; +var enforceInternalState$2 = InternalStateModule$k.enforce; var TEMPLATE = String(String).split('String'); (redefine$n.exports = function (O, key, value, options) { @@ -643,12 +691,12 @@ var TEMPLATE = String(String).split('String'); if (!hasOwn$s(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$2 && value.name !== name)) { createNonEnumerableProperty$h(value, 'name', name); } - state = enforceInternalState$1(value); + state = enforceInternalState$2(value); if (!state.source) { state.source = TEMPLATE.join(typeof name == 'string' ? name : ''); } } - if (O === global$1I) { + if (O === global$1J) { if (simple) O[key] = value; else setGlobal$1(key, value); return; @@ -708,14 +756,14 @@ var lengthOfArrayLike$x = function (obj) { return toLength$c(obj.length); }; -var toIndexedObject$h = toIndexedObject$j; +var toIndexedObject$i = toIndexedObject$k; var toAbsoluteIndex$9 = toAbsoluteIndex$a; var lengthOfArrayLike$w = lengthOfArrayLike$x; // `Array.prototype.{ indexOf, includes }` methods implementation var createMethod$8 = function (IS_INCLUDES) { return function ($this, el, fromIndex) { - var O = toIndexedObject$h($this); + var O = toIndexedObject$i($this); var length = lengthOfArrayLike$w(O); var index = toAbsoluteIndex$9(fromIndex, length); var value; @@ -743,14 +791,14 @@ var arrayIncludes = { var uncurryThis$1i = functionUncurryThis; var hasOwn$r = hasOwnProperty_1; -var toIndexedObject$g = toIndexedObject$j; +var toIndexedObject$h = toIndexedObject$k; var indexOf$2 = arrayIncludes.indexOf; var hiddenKeys$4 = hiddenKeys$6; var push$m = uncurryThis$1i([].push); var objectKeysInternal = function (object, names) { - var O = toIndexedObject$g(object); + var O = toIndexedObject$h(object); var i = 0; var result = []; var key; @@ -822,7 +870,7 @@ var copyConstructorProperties$4 = function (target, source, exceptions) { } }; -var fails$18 = fails$1d; +var fails$18 = fails$1f; var isCallable$r = isCallable$A; var replacement = /#|\.prototype\./; @@ -845,7 +893,7 @@ var POLYFILL = isForced$5.POLYFILL = 'P'; var isForced_1 = isForced$5; -var global$1H = global$1$; +var global$1I = global$20; var getOwnPropertyDescriptor$8 = objectGetOwnPropertyDescriptor.f; var createNonEnumerableProperty$g = createNonEnumerableProperty$j; var redefine$m = redefine$n.exports; @@ -874,11 +922,11 @@ var _export = function (options, source) { var STATIC = options.stat; var FORCED, target, key, targetProperty, sourceProperty, descriptor; if (GLOBAL) { - target = global$1H; + target = global$1I; } else if (STATIC) { - target = global$1H[TARGET] || setGlobal(TARGET, {}); + target = global$1I[TARGET] || setGlobal(TARGET, {}); } else { - target = (global$1H[TARGET] || {}).prototype; + target = (global$1I[TARGET] || {}).prototype; } if (target) for (key in source) { sourceProperty = source[key]; @@ -901,14 +949,15 @@ var _export = function (options, source) { } }; +var NATIVE_BIND$2 = functionBindNative; + var FunctionPrototype$2 = Function.prototype; var apply$r = FunctionPrototype$2.apply; -var bind$v = FunctionPrototype$2.bind; -var call$V = FunctionPrototype$2.call; +var call$W = FunctionPrototype$2.call; // eslint-disable-next-line es/no-reflect -- safe -var functionApply$1 = typeof Reflect == 'object' && Reflect.apply || (bind$v ? call$V.bind(apply$r) : function () { - return call$V.apply(apply$r, arguments); +var functionApply$1 = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$2 ? call$W.bind(apply$r) : function () { + return call$W.apply(apply$r, arguments); }); var classof$j = classofRaw$1; @@ -929,14 +978,14 @@ test$2[TO_STRING_TAG$9] = 'z'; var toStringTagSupport = String(test$2) === '[object z]'; -var global$1G = global$1$; +var global$1H = global$20; var TO_STRING_TAG_SUPPORT$2 = toStringTagSupport; var isCallable$q = isCallable$A; var classofRaw = classofRaw$1; var wellKnownSymbol$E = wellKnownSymbol$H; var TO_STRING_TAG$8 = wellKnownSymbol$E('toStringTag'); -var Object$5 = global$1G.Object; +var Object$5 = global$1H.Object; // ES3 wrong here var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments'; @@ -960,16 +1009,18 @@ var classof$i = TO_STRING_TAG_SUPPORT$2 ? classofRaw : function (it) { : (result = classofRaw(O)) == 'Object' && isCallable$q(O.callee) ? 'Arguments' : result; }; -var global$1F = global$1$; +var global$1G = global$20; var classof$h = classof$i; -var String$5 = global$1F.String; +var String$5 = global$1G.String; var toString$w = function (argument) { if (classof$h(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string'); return String$5(argument); }; +var objectDefineProperties = {}; + var internalObjectKeys = objectKeysInternal; var enumBugKeys$1 = enumBugKeys$3; @@ -981,17 +1032,18 @@ var objectKeys$6 = Object.keys || function keys(O) { }; var DESCRIPTORS$z = descriptors; +var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug; var definePropertyModule$a = objectDefineProperty; var anObject$1C = anObject$1F; -var toIndexedObject$f = toIndexedObject$j; +var toIndexedObject$g = toIndexedObject$k; var objectKeys$5 = objectKeys$6; // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties // eslint-disable-next-line es/no-object-defineproperties -- safe -var objectDefineProperties = DESCRIPTORS$z ? Object.defineProperties : function defineProperties(O, Properties) { +objectDefineProperties.f = DESCRIPTORS$z && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) { anObject$1C(O); - var props = toIndexedObject$f(Properties); + var props = toIndexedObject$g(Properties); var keys = objectKeys$5(Properties); var length = keys.length; var index = 0; @@ -1007,7 +1059,7 @@ var html$2 = getBuiltIn$B('document', 'documentElement'); /* global ActiveXObject -- old IE, WSH */ var anObject$1B = anObject$1F; -var defineProperties$4 = objectDefineProperties; +var definePropertiesModule$1 = objectDefineProperties; var enumBugKeys = enumBugKeys$3; var hiddenKeys$2 = hiddenKeys$6; var html$1 = html$2; @@ -1085,7 +1137,7 @@ var objectCreate$1 = Object.create || function create(O, Properties) { // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO$1] = O; } else result = NullProtoObject(); - return Properties === undefined ? result : defineProperties$4(result, Properties); + return Properties === undefined ? result : definePropertiesModule$1.f(result, Properties); }; var objectGetOwnPropertyNamesExternal = {}; @@ -1100,12 +1152,12 @@ var createProperty$9 = function (object, key, value) { else object[propertyKey] = value; }; -var global$1E = global$1$; +var global$1F = global$20; var toAbsoluteIndex$8 = toAbsoluteIndex$a; var lengthOfArrayLike$v = lengthOfArrayLike$x; var createProperty$8 = createProperty$9; -var Array$f = global$1E.Array; +var Array$f = global$1F.Array; var max$7 = Math.max; var arraySliceSimple = function (O, start, end) { @@ -1121,7 +1173,7 @@ var arraySliceSimple = function (O, start, end) { /* eslint-disable es/no-object-getownpropertynames -- safe */ var classof$g = classofRaw$1; -var toIndexedObject$e = toIndexedObject$j; +var toIndexedObject$f = toIndexedObject$k; var $getOwnPropertyNames$1 = objectGetOwnPropertyNames.f; var arraySlice$f = arraySliceSimple; @@ -1140,7 +1192,7 @@ var getWindowNames = function (it) { objectGetOwnPropertyNamesExternal.f = function getOwnPropertyNames(it) { return windowNames && classof$g(it) == 'Window' ? getWindowNames(it) - : $getOwnPropertyNames$1(toIndexedObject$e(it)); + : $getOwnPropertyNames$1(toIndexedObject$f(it)); }; var uncurryThis$1g = functionUncurryThis; @@ -1153,23 +1205,23 @@ var wellKnownSymbol$D = wellKnownSymbol$H; wellKnownSymbolWrapped.f = wellKnownSymbol$D; -var global$1D = global$1$; +var global$1E = global$20; -var path$1 = global$1D; +var path$1 = global$1E; var path = path$1; var hasOwn$p = hasOwnProperty_1; var wrappedWellKnownSymbolModule$1 = wellKnownSymbolWrapped; -var defineProperty$i = objectDefineProperty.f; +var defineProperty$j = objectDefineProperty.f; var defineWellKnownSymbol$l = function (NAME) { var Symbol = path.Symbol || (path.Symbol = {}); - if (!hasOwn$p(Symbol, NAME)) defineProperty$i(Symbol, NAME, { + if (!hasOwn$p(Symbol, NAME)) defineProperty$j(Symbol, NAME, { value: wrappedWellKnownSymbolModule$1.f(NAME) }); }; -var defineProperty$h = objectDefineProperty.f; +var defineProperty$i = objectDefineProperty.f; var hasOwn$o = hasOwnProperty_1; var wellKnownSymbol$C = wellKnownSymbol$H; @@ -1178,25 +1230,26 @@ var TO_STRING_TAG$7 = wellKnownSymbol$C('toStringTag'); var setToStringTag$c = function (target, TAG, STATIC) { if (target && !STATIC) target = target.prototype; if (target && !hasOwn$o(target, TO_STRING_TAG$7)) { - defineProperty$h(target, TO_STRING_TAG$7, { configurable: true, value: TAG }); + defineProperty$i(target, TO_STRING_TAG$7, { configurable: true, value: TAG }); } }; var uncurryThis$1f = functionUncurryThis; var aCallable$T = aCallable$V; +var NATIVE_BIND$1 = functionBindNative; var bind$u = uncurryThis$1f(uncurryThis$1f.bind); // optional / simple context binding var functionBindContext = function (fn, that) { aCallable$T(fn); - return that === undefined ? fn : bind$u ? bind$u(fn, that) : function (/* ...args */) { + return that === undefined ? fn : NATIVE_BIND$1 ? bind$u(fn, that) : function (/* ...args */) { return fn.apply(that, arguments); }; }; var uncurryThis$1e = functionUncurryThis; -var fails$17 = fails$1d; +var fails$17 = fails$1f; var isCallable$p = isCallable$A; var classof$f = classof$i; var getBuiltIn$A = getBuiltIn$F; @@ -1248,14 +1301,14 @@ var isConstructor$9 = !construct$1 || fails$17(function () { || called; }) ? isConstructorLegacy : isConstructorModern; -var global$1C = global$1$; +var global$1D = global$20; var isArray$7 = isArray$8; var isConstructor$8 = isConstructor$9; var isObject$w = isObject$C; var wellKnownSymbol$B = wellKnownSymbol$H; var SPECIES$6 = wellKnownSymbol$B('species'); -var Array$e = global$1C.Array; +var Array$e = global$1D.Array; // a part of `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate @@ -1283,7 +1336,7 @@ var arraySpeciesCreate$6 = function (originalArray, length) { var bind$t = functionBindContext; var uncurryThis$1d = functionUncurryThis; var IndexedObject$6 = indexedObject; -var toObject$y = toObject$A; +var toObject$x = toObject$z; var lengthOfArrayLike$u = lengthOfArrayLike$x; var arraySpeciesCreate$5 = arraySpeciesCreate$6; @@ -1299,7 +1352,7 @@ var createMethod$7 = function (TYPE) { var IS_FILTER_REJECT = TYPE == 7; var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; return function ($this, callbackfn, that, specificCreate) { - var O = toObject$y($this); + var O = toObject$x($this); var self = IndexedObject$6(O); var boundFunction = bind$t(callbackfn, that); var length = lengthOfArrayLike$u(self); @@ -1355,14 +1408,14 @@ var arrayIteration = { }; var $$4y = _export; -var global$1B = global$1$; +var global$1C = global$20; var getBuiltIn$z = getBuiltIn$F; var apply$q = functionApply$1; -var call$U = functionCall; +var call$V = functionCall; var uncurryThis$1c = functionUncurryThis; var DESCRIPTORS$y = descriptors; var NATIVE_SYMBOL$1 = nativeSymbol; -var fails$16 = fails$1d; +var fails$16 = fails$1f; var hasOwn$n = hasOwnProperty_1; var isArray$6 = isArray$8; var isCallable$o = isCallable$A; @@ -1370,8 +1423,8 @@ var isObject$v = isObject$C; var isPrototypeOf$d = objectIsPrototypeOf; var isSymbol$3 = isSymbol$6; var anObject$1A = anObject$1F; -var toObject$x = toObject$A; -var toIndexedObject$d = toIndexedObject$j; +var toObject$w = toObject$z; +var toIndexedObject$e = toIndexedObject$k; var toPropertyKey$5 = toPropertyKey$9; var $toString$3 = toString$w; var createPropertyDescriptor$8 = createPropertyDescriptor$c; @@ -1382,6 +1435,7 @@ var getOwnPropertyNamesExternal = objectGetOwnPropertyNamesExternal; var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols; var getOwnPropertyDescriptorModule$5 = objectGetOwnPropertyDescriptor; var definePropertyModule$8 = objectDefineProperty; +var definePropertiesModule = objectDefineProperties; var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable; var arraySlice$d = arraySlice$e; var redefine$l = redefine$n.exports; @@ -1405,10 +1459,10 @@ var setInternalState$j = InternalStateModule$j.set; var getInternalState$h = InternalStateModule$j.getterFor(SYMBOL); var ObjectPrototype$4 = Object[PROTOTYPE$1]; -var $Symbol = global$1B.Symbol; +var $Symbol = global$1C.Symbol; var SymbolPrototype$1 = $Symbol && $Symbol[PROTOTYPE$1]; -var TypeError$A = global$1B.TypeError; -var QObject = global$1B.QObject; +var TypeError$B = global$1C.TypeError; +var QObject = global$1C.QObject; var $stringify$1 = getBuiltIn$z('JSON', 'stringify'); var nativeGetOwnPropertyDescriptor$2 = getOwnPropertyDescriptorModule$5.f; var nativeDefineProperty$1 = definePropertyModule$8.f; @@ -1468,10 +1522,10 @@ var $defineProperty = function defineProperty(O, P, Attributes) { var $defineProperties = function defineProperties(O, Properties) { anObject$1A(O); - var properties = toIndexedObject$d(Properties); + var properties = toIndexedObject$e(Properties); var keys = objectKeys$4(properties).concat($getOwnPropertySymbols(properties)); $forEach$3(keys, function (key) { - if (!DESCRIPTORS$y || call$U($propertyIsEnumerable$1, properties, key)) $defineProperty(O, key, properties[key]); + if (!DESCRIPTORS$y || call$V($propertyIsEnumerable$1, properties, key)) $defineProperty(O, key, properties[key]); }); return O; }; @@ -1482,14 +1536,14 @@ var $create = function create(O, Properties) { var $propertyIsEnumerable$1 = function propertyIsEnumerable(V) { var P = toPropertyKey$5(V); - var enumerable = call$U(nativePropertyIsEnumerable, this, P); + var enumerable = call$V(nativePropertyIsEnumerable, this, P); if (this === ObjectPrototype$4 && hasOwn$n(AllSymbols, P) && !hasOwn$n(ObjectPrototypeSymbols, P)) return false; return enumerable || !hasOwn$n(this, P) || !hasOwn$n(AllSymbols, P) || hasOwn$n(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) { - var it = toIndexedObject$d(O); + var it = toIndexedObject$e(O); var key = toPropertyKey$5(P); if (it === ObjectPrototype$4 && hasOwn$n(AllSymbols, key) && !hasOwn$n(ObjectPrototypeSymbols, key)) return; var descriptor = nativeGetOwnPropertyDescriptor$2(it, key); @@ -1500,7 +1554,7 @@ var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) { }; var $getOwnPropertyNames = function getOwnPropertyNames(O) { - var names = nativeGetOwnPropertyNames(toIndexedObject$d(O)); + var names = nativeGetOwnPropertyNames(toIndexedObject$e(O)); var result = []; $forEach$3(names, function (key) { if (!hasOwn$n(AllSymbols, key) && !hasOwn$n(hiddenKeys$1, key)) push$k(result, key); @@ -1510,7 +1564,7 @@ var $getOwnPropertyNames = function getOwnPropertyNames(O) { var $getOwnPropertySymbols = function getOwnPropertySymbols(O) { var IS_OBJECT_PROTOTYPE = O === ObjectPrototype$4; - var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject$d(O)); + var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject$e(O)); var result = []; $forEach$3(names, function (key) { if (hasOwn$n(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn$n(ObjectPrototype$4, key))) { @@ -1524,11 +1578,11 @@ var $getOwnPropertySymbols = function getOwnPropertySymbols(O) { // https://tc39.es/ecma262/#sec-symbol-constructor if (!NATIVE_SYMBOL$1) { $Symbol = function Symbol() { - if (isPrototypeOf$d(SymbolPrototype$1, this)) throw TypeError$A('Symbol is not a constructor'); + if (isPrototypeOf$d(SymbolPrototype$1, this)) throw TypeError$B('Symbol is not a constructor'); var description = !arguments.length || arguments[0] === undefined ? undefined : $toString$3(arguments[0]); var tag = uid$3(description); var setter = function (value) { - if (this === ObjectPrototype$4) call$U(setter, ObjectPrototypeSymbols, value); + if (this === ObjectPrototype$4) call$V(setter, ObjectPrototypeSymbols, value); if (hasOwn$n(this, HIDDEN) && hasOwn$n(this[HIDDEN], tag)) this[HIDDEN][tag] = false; setSymbolDescriptor(this, tag, createPropertyDescriptor$8(1, value)); }; @@ -1548,6 +1602,7 @@ if (!NATIVE_SYMBOL$1) { propertyIsEnumerableModule$1.f = $propertyIsEnumerable$1; definePropertyModule$8.f = $defineProperty; + definePropertiesModule.f = $defineProperties; getOwnPropertyDescriptorModule$5.f = $getOwnPropertyDescriptor; getOwnPropertyNamesModule$1.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames; getOwnPropertySymbolsModule$1.f = $getOwnPropertySymbols; @@ -1592,7 +1647,7 @@ $$4y({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL$1 }, { // `Symbol.keyFor` method // https://tc39.es/ecma262/#sec-symbol.keyfor keyFor: function keyFor(sym) { - if (!isSymbol$3(sym)) throw TypeError$A(sym + ' is not a symbol'); + if (!isSymbol$3(sym)) throw TypeError$B(sym + ' is not a symbol'); if (hasOwn$n(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; }, useSetter: function () { USE_SETTER = true; }, @@ -1627,7 +1682,7 @@ $$4y({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL$1 }, { // https://bugs.chromium.org/p/v8/issues/detail?id=3443 $$4y({ target: 'Object', stat: true, forced: fails$16(function () { getOwnPropertySymbolsModule$1.f(1); }) }, { getOwnPropertySymbols: function getOwnPropertySymbols(it) { - return getOwnPropertySymbolsModule$1.f(toObject$x(it)); + return getOwnPropertySymbolsModule$1.f(toObject$w(it)); } }); @@ -1651,7 +1706,7 @@ if ($stringify$1) { var $replacer = replacer; if (!isObject$v(replacer) && it === undefined || isSymbol$3(it)) return; // IE8 returns string on undefined if (!isArray$6(replacer)) replacer = function (key, value) { - if (isCallable$o($replacer)) value = call$U($replacer, this, key, value); + if (isCallable$o($replacer)) value = call$V($replacer, this, key, value); if (!isSymbol$3(value)) return value; }; args[1] = replacer; @@ -1667,7 +1722,7 @@ if (!SymbolPrototype$1[TO_PRIMITIVE$1]) { // eslint-disable-next-line no-unused-vars -- required for .length redefine$l(SymbolPrototype$1, TO_PRIMITIVE$1, function (hint) { // TODO: improve hint logic - return call$U(valueOf, this); + return call$V(valueOf, this); }); } // `Symbol.prototype[@@toStringTag]` property @@ -1678,16 +1733,16 @@ hiddenKeys$1[HIDDEN] = true; var $$4x = _export; var DESCRIPTORS$x = descriptors; -var global$1A = global$1$; +var global$1B = global$20; var uncurryThis$1b = functionUncurryThis; var hasOwn$m = hasOwnProperty_1; var isCallable$n = isCallable$A; var isPrototypeOf$c = objectIsPrototypeOf; var toString$v = toString$w; -var defineProperty$g = objectDefineProperty.f; +var defineProperty$h = objectDefineProperty.f; var copyConstructorProperties$2 = copyConstructorProperties$4; -var NativeSymbol = global$1A.Symbol; +var NativeSymbol = global$1B.Symbol; var SymbolPrototype = NativeSymbol && NativeSymbol.prototype; if (DESCRIPTORS$x && isCallable$n(NativeSymbol) && (!('description' in SymbolPrototype) || @@ -1717,7 +1772,7 @@ if (DESCRIPTORS$x && isCallable$n(NativeSymbol) && (!('description' in SymbolPro var replace$a = uncurryThis$1b(''.replace); var stringSlice$g = uncurryThis$1b(''.slice); - defineProperty$g(SymbolPrototype, 'description', { + defineProperty$h(SymbolPrototype, 'description', { configurable: true, get: function description() { var symbol = symbolValueOf(this); @@ -1811,15 +1866,15 @@ var defineWellKnownSymbol$7 = defineWellKnownSymbol$l; // https://tc39.es/ecma262/#sec-symbol.unscopables defineWellKnownSymbol$7('unscopables'); -var global$1z = global$1$; +var global$1A = global$20; var isCallable$m = isCallable$A; -var String$4 = global$1z.String; -var TypeError$z = global$1z.TypeError; +var String$4 = global$1A.String; +var TypeError$A = global$1A.TypeError; var aPossiblePrototype$2 = function (argument) { if (typeof argument == 'object' || isCallable$m(argument)) return argument; - throw TypeError$z("Can't set " + String$4(argument) + ' as a prototype'); + throw TypeError$A("Can't set " + String$4(argument) + ' as a prototype'); }; /* eslint-disable no-proto -- safe */ @@ -1901,7 +1956,7 @@ var clearErrorStack$4 = function (stack, dropEntries) { } return stack; }; -var fails$15 = fails$1d; +var fails$15 = fails$1f; var createPropertyDescriptor$7 = createPropertyDescriptor$c; var errorStackInstallable = !fails$15(function () { @@ -1974,26 +2029,26 @@ var wrapErrorConstructorWithCause$2 = function (FULL_NAME, wrapper, FORCED, IS_A /* eslint-disable no-unused-vars -- required for functions `.length` */ var $$4w = _export; -var global$1y = global$1$; +var global$1z = global$20; var apply$p = functionApply$1; var wrapErrorConstructorWithCause$1 = wrapErrorConstructorWithCause$2; var WEB_ASSEMBLY = 'WebAssembly'; -var WebAssembly$1 = global$1y[WEB_ASSEMBLY]; +var WebAssembly$1 = global$1z[WEB_ASSEMBLY]; -var FORCED$x = Error('e', { cause: 7 }).cause !== 7; +var FORCED$w = Error('e', { cause: 7 }).cause !== 7; var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) { var O = {}; - O[ERROR_NAME] = wrapErrorConstructorWithCause$1(ERROR_NAME, wrapper, FORCED$x); - $$4w({ global: true, forced: FORCED$x }, O); + O[ERROR_NAME] = wrapErrorConstructorWithCause$1(ERROR_NAME, wrapper, FORCED$w); + $$4w({ global: true, forced: FORCED$w }, O); }; var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) { if (WebAssembly$1 && WebAssembly$1[ERROR_NAME]) { var O = {}; - O[ERROR_NAME] = wrapErrorConstructorWithCause$1(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED$x); - $$4w({ target: WEB_ASSEMBLY, stat: true, forced: FORCED$x }, O); + O[ERROR_NAME] = wrapErrorConstructorWithCause$1(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED$w); + $$4w({ target: WEB_ASSEMBLY, stat: true, forced: FORCED$w }, O); } }; @@ -2030,7 +2085,7 @@ exportWebAssemblyErrorCauseWrapper('RuntimeError', function (init) { }); var DESCRIPTORS$w = descriptors; -var fails$14 = fails$1d; +var fails$14 = fails$1f; var anObject$1y = anObject$1F; var create$f = objectCreate$1; var normalizeStringArgument$3 = normalizeStringArgument$5; @@ -2070,7 +2125,7 @@ if (ErrorPrototype$1.toString !== errorToString$1) { redefine$k(ErrorPrototype$1, 'toString', errorToString$1); } -var fails$13 = fails$1d; +var fails$13 = fails$1f; var correctPrototypeGetter = !fails$13(function () { function F() { /* empty */ } @@ -2079,21 +2134,21 @@ var correctPrototypeGetter = !fails$13(function () { return Object.getPrototypeOf(new F()) !== F.prototype; }); -var global$1x = global$1$; +var global$1y = global$20; var hasOwn$k = hasOwnProperty_1; var isCallable$k = isCallable$A; -var toObject$w = toObject$A; +var toObject$v = toObject$z; var sharedKey = sharedKey$4; var CORRECT_PROTOTYPE_GETTER$2 = correctPrototypeGetter; var IE_PROTO = sharedKey('IE_PROTO'); -var Object$4 = global$1x.Object; +var Object$4 = global$1y.Object; var ObjectPrototype$3 = Object$4.prototype; // `Object.getPrototypeOf` method // https://tc39.es/ecma262/#sec-object.getprototypeof var objectGetPrototypeOf$1 = CORRECT_PROTOTYPE_GETTER$2 ? Object$4.getPrototypeOf : function (O) { - var object = toObject$w(O); + var object = toObject$v(O); if (hasOwn$k(object, IE_PROTO)) return object[IE_PROTO]; var constructor = object.constructor; if (isCallable$k(constructor) && object instanceof constructor) { @@ -2127,22 +2182,22 @@ var getIteratorMethod$9 = function (it) { || Iterators$3[classof$e(it)]; }; -var global$1w = global$1$; -var call$T = functionCall; +var global$1x = global$20; +var call$U = functionCall; var aCallable$S = aCallable$V; var anObject$1x = anObject$1F; var tryToString$3 = tryToString$5; var getIteratorMethod$8 = getIteratorMethod$9; -var TypeError$y = global$1w.TypeError; +var TypeError$z = global$1x.TypeError; var getIterator$b = function (argument, usingIterator) { var iteratorMethod = arguments.length < 2 ? getIteratorMethod$8(argument) : usingIterator; - if (aCallable$S(iteratorMethod)) return anObject$1x(call$T(iteratorMethod, argument)); - throw TypeError$y(tryToString$3(argument) + ' is not iterable'); + if (aCallable$S(iteratorMethod)) return anObject$1x(call$U(iteratorMethod, argument)); + throw TypeError$z(tryToString$3(argument) + ' is not iterable'); }; -var call$S = functionCall; +var call$T = functionCall; var anObject$1w = anObject$1F; var getMethod$e = getMethod$h; @@ -2155,7 +2210,7 @@ var iteratorClose$4 = function (iterator, kind, value) { if (kind === 'throw') throw value; return value; } - innerResult = call$S(innerResult, iterator); + innerResult = call$T(innerResult, iterator); } catch (error) { innerError = true; innerResult = error; @@ -2166,9 +2221,9 @@ var iteratorClose$4 = function (iterator, kind, value) { return value; }; -var global$1v = global$1$; +var global$1w = global$20; var bind$s = functionBindContext; -var call$R = functionCall; +var call$S = functionCall; var anObject$1v = anObject$1F; var tryToString$2 = tryToString$5; var isArrayIteratorMethod$2 = isArrayIteratorMethod$3; @@ -2178,7 +2233,7 @@ var getIterator$a = getIterator$b; var getIteratorMethod$7 = getIteratorMethod$9; var iteratorClose$3 = iteratorClose$4; -var TypeError$x = global$1v.TypeError; +var TypeError$y = global$1w.TypeError; var Result = function (stopped, result) { this.stopped = stopped; @@ -2211,7 +2266,7 @@ var iterate$I = function (iterable, unboundFunction, options) { iterator = iterable; } else { iterFn = getIteratorMethod$7(iterable); - if (!iterFn) throw TypeError$x(tryToString$2(iterable) + ' is not iterable'); + if (!iterFn) throw TypeError$y(tryToString$2(iterable) + ' is not iterable'); // optimisation for array iterators if (isArrayIteratorMethod$2(iterFn)) { for (index = 0, length = lengthOfArrayLike$t(iterable); length > index; index++) { @@ -2223,7 +2278,7 @@ var iterate$I = function (iterable, unboundFunction, options) { } next = iterator.next; - while (!(step = call$R(next, iterator)).done) { + while (!(step = call$S(next, iterator)).done) { try { result = callFn(step.value); } catch (error) { @@ -2234,7 +2289,7 @@ var iterate$I = function (iterable, unboundFunction, options) { }; var $$4v = _export; -var global$1u = global$1$; +var global$1v = global$20; var isPrototypeOf$9 = objectIsPrototypeOf; var getPrototypeOf$d = objectGetPrototypeOf$1; var setPrototypeOf$6 = objectSetPrototypeOf$1; @@ -2250,7 +2305,7 @@ var wellKnownSymbol$x = wellKnownSymbol$H; var ERROR_STACK_INSTALLABLE$1 = errorStackInstallable; var TO_STRING_TAG$6 = wellKnownSymbol$x('toStringTag'); -var Error$5 = global$1u.Error; +var Error$5 = global$1v.Error; var push$j = [].push; var $AggregateError$1 = function AggregateError(errors, message /* , options */) { @@ -2290,23 +2345,23 @@ $$4v({ global: true }, { var $$4u = _export; var getBuiltIn$x = getBuiltIn$F; var apply$o = functionApply$1; -var fails$12 = fails$1d; +var fails$12 = fails$1f; var wrapErrorConstructorWithCause = wrapErrorConstructorWithCause$2; var AGGREGATE_ERROR = 'AggregateError'; var $AggregateError = getBuiltIn$x(AGGREGATE_ERROR); -var FORCED$w = !fails$12(function () { +var FORCED$v = !fails$12(function () { return $AggregateError([1]).errors[0] !== 1; }) && fails$12(function () { return $AggregateError([1], AGGREGATE_ERROR, { cause: 7 }).cause !== 7; }); // https://github.com/tc39/proposal-error-cause -$$4u({ global: true, forced: FORCED$w }, { +$$4u({ global: true, forced: FORCED$v }, { AggregateError: wrapErrorConstructorWithCause(AGGREGATE_ERROR, function (init) { // eslint-disable-next-line no-unused-vars -- required for functions `.length` return function AggregateError(errors, message) { return apply$o(init, this, arguments); }; - }, FORCED$w, true) + }, FORCED$v, true) }); var wellKnownSymbol$w = wellKnownSymbol$H; @@ -2331,7 +2386,7 @@ var addToUnscopables$l = function (key) { }; var $$4t = _export; -var toObject$v = toObject$A; +var toObject$u = toObject$z; var lengthOfArrayLike$s = lengthOfArrayLike$x; var toIntegerOrInfinity$j = toIntegerOrInfinity$m; var addToUnscopables$k = addToUnscopables$l; @@ -2340,7 +2395,7 @@ var addToUnscopables$k = addToUnscopables$l; // https://github.com/tc39/proposal-relative-indexing-method $$4t({ target: 'Array', proto: true }, { at: function at(index) { - var O = toObject$v(this); + var O = toObject$u(this); var len = lengthOfArrayLike$s(O); var relativeIndex = toIntegerOrInfinity$j(index); var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; @@ -2350,7 +2405,7 @@ $$4t({ target: 'Array', proto: true }, { addToUnscopables$k('at'); -var fails$11 = fails$1d; +var fails$11 = fails$1f; var wellKnownSymbol$v = wellKnownSymbol$H; var V8_VERSION$2 = engineV8Version; @@ -2371,11 +2426,11 @@ var arrayMethodHasSpeciesSupport$5 = function (METHOD_NAME) { }; var $$4s = _export; -var global$1t = global$1$; -var fails$10 = fails$1d; +var global$1u = global$20; +var fails$10 = fails$1f; var isArray$5 = isArray$8; var isObject$s = isObject$C; -var toObject$u = toObject$A; +var toObject$t = toObject$z; var lengthOfArrayLike$r = lengthOfArrayLike$x; var createProperty$7 = createProperty$9; var arraySpeciesCreate$4 = arraySpeciesCreate$6; @@ -2386,7 +2441,7 @@ var V8_VERSION$1 = engineV8Version; var IS_CONCAT_SPREADABLE = wellKnownSymbol$u('isConcatSpreadable'); var MAX_SAFE_INTEGER$2 = 0x1FFFFFFFFFFFFF; var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; -var TypeError$w = global$1t.TypeError; +var TypeError$x = global$1u.TypeError; // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation @@ -2405,15 +2460,15 @@ var isConcatSpreadable = function (O) { return spreadable !== undefined ? !!spreadable : isArray$5(O); }; -var FORCED$v = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; +var FORCED$u = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; // `Array.prototype.concat` method // https://tc39.es/ecma262/#sec-array.prototype.concat // with adding support of @@isConcatSpreadable and @@species -$$4s({ target: 'Array', proto: true, forced: FORCED$v }, { +$$4s({ target: 'Array', proto: true, forced: FORCED$u }, { // eslint-disable-next-line no-unused-vars -- required for `.length` concat: function concat(arg) { - var O = toObject$u(this); + var O = toObject$t(this); var A = arraySpeciesCreate$4(O, 0); var n = 0; var i, k, length, len, E; @@ -2421,10 +2476,10 @@ $$4s({ target: 'Array', proto: true, forced: FORCED$v }, { E = i === -1 ? O : arguments[i]; if (isConcatSpreadable(E)) { len = lengthOfArrayLike$r(E); - if (n + len > MAX_SAFE_INTEGER$2) throw TypeError$w(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + if (n + len > MAX_SAFE_INTEGER$2) throw TypeError$x(MAXIMUM_ALLOWED_INDEX_EXCEEDED); for (k = 0; k < len; k++, n++) if (k in E) createProperty$7(A, n, E[k]); } else { - if (n >= MAX_SAFE_INTEGER$2) throw TypeError$w(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + if (n >= MAX_SAFE_INTEGER$2) throw TypeError$x(MAXIMUM_ALLOWED_INDEX_EXCEEDED); createProperty$7(A, n++, E); } } @@ -2433,7 +2488,7 @@ $$4s({ target: 'Array', proto: true, forced: FORCED$v }, { } }); -var toObject$t = toObject$A; +var toObject$s = toObject$z; var toAbsoluteIndex$7 = toAbsoluteIndex$a; var lengthOfArrayLike$q = lengthOfArrayLike$x; @@ -2443,7 +2498,7 @@ var min$9 = Math.min; // https://tc39.es/ecma262/#sec-array.prototype.copywithin // eslint-disable-next-line es/no-array-prototype-copywithin -- safe var arrayCopyWithin = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) { - var O = toObject$t(this); + var O = toObject$s(this); var len = lengthOfArrayLike$q(O); var to = toAbsoluteIndex$7(target, len); var from = toAbsoluteIndex$7(start, len); @@ -2476,7 +2531,7 @@ $$4r({ target: 'Array', proto: true }, { // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables$j('copyWithin'); -var fails$$ = fails$1d; +var fails$$ = fails$1f; var arrayMethodIsStrict$9 = function (METHOD_NAME, argument) { var method = [][METHOD_NAME]; @@ -2500,14 +2555,14 @@ $$4q({ target: 'Array', proto: true, forced: !STRICT_METHOD$8 }, { } }); -var toObject$s = toObject$A; +var toObject$r = toObject$z; var toAbsoluteIndex$6 = toAbsoluteIndex$a; var lengthOfArrayLike$p = lengthOfArrayLike$x; // `Array.prototype.fill` method implementation // https://tc39.es/ecma262/#sec-array.prototype.fill var arrayFill$1 = function fill(value /* , start = 0, end = @length */) { - var O = toObject$s(this); + var O = toObject$r(this); var length = lengthOfArrayLike$p(O); var argumentsLength = arguments.length; var index = toAbsoluteIndex$6(argumentsLength > 1 ? arguments[1] : undefined, length); @@ -2587,12 +2642,12 @@ $$4m({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables$g(FIND_INDEX); -var global$1s = global$1$; +var global$1t = global$20; var isArray$4 = isArray$8; var lengthOfArrayLike$o = lengthOfArrayLike$x; var bind$r = functionBindContext; -var TypeError$v = global$1s.TypeError; +var TypeError$w = global$1t.TypeError; // `FlattenIntoArray` abstract operation // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray @@ -2610,7 +2665,7 @@ var flattenIntoArray$2 = function (target, original, source, sourceLen, start, d elementLen = lengthOfArrayLike$o(element); targetIndex = flattenIntoArray$2(target, original, element, elementLen, targetIndex, depth - 1) - 1; } else { - if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError$v('Exceed the acceptable array length'); + if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError$w('Exceed the acceptable array length'); target[targetIndex] = element; } @@ -2625,7 +2680,7 @@ var flattenIntoArray_1 = flattenIntoArray$2; var $$4l = _export; var flattenIntoArray$1 = flattenIntoArray_1; -var toObject$r = toObject$A; +var toObject$q = toObject$z; var lengthOfArrayLike$n = lengthOfArrayLike$x; var toIntegerOrInfinity$i = toIntegerOrInfinity$m; var arraySpeciesCreate$3 = arraySpeciesCreate$6; @@ -2635,7 +2690,7 @@ var arraySpeciesCreate$3 = arraySpeciesCreate$6; $$4l({ target: 'Array', proto: true }, { flat: function flat(/* depthArg = 1 */) { var depthArg = arguments.length ? arguments[0] : undefined; - var O = toObject$r(this); + var O = toObject$q(this); var sourceLen = lengthOfArrayLike$n(O); var A = arraySpeciesCreate$3(O, 0); A.length = flattenIntoArray$1(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toIntegerOrInfinity$i(depthArg)); @@ -2646,7 +2701,7 @@ $$4l({ target: 'Array', proto: true }, { var $$4k = _export; var flattenIntoArray = flattenIntoArray_1; var aCallable$R = aCallable$V; -var toObject$q = toObject$A; +var toObject$p = toObject$z; var lengthOfArrayLike$m = lengthOfArrayLike$x; var arraySpeciesCreate$2 = arraySpeciesCreate$6; @@ -2654,7 +2709,7 @@ var arraySpeciesCreate$2 = arraySpeciesCreate$6; // https://tc39.es/ecma262/#sec-array.prototype.flatmap $$4k({ target: 'Array', proto: true }, { flatMap: function flatMap(callbackfn /* , thisArg */) { - var O = toObject$q(this); + var O = toObject$p(this); var sourceLen = lengthOfArrayLike$m(O); var A; aCallable$R(callbackfn); @@ -2698,10 +2753,10 @@ var callWithSafeIterationClosing$3 = function (iterator, fn, value, ENTRIES) { } }; -var global$1r = global$1$; +var global$1s = global$20; var bind$q = functionBindContext; -var call$Q = functionCall; -var toObject$p = toObject$A; +var call$R = functionCall; +var toObject$o = toObject$z; var callWithSafeIterationClosing$2 = callWithSafeIterationClosing$3; var isArrayIteratorMethod$1 = isArrayIteratorMethod$3; var isConstructor$7 = isConstructor$9; @@ -2710,12 +2765,12 @@ var createProperty$6 = createProperty$9; var getIterator$9 = getIterator$b; var getIteratorMethod$6 = getIteratorMethod$9; -var Array$d = global$1r.Array; +var Array$d = global$1s.Array; // `Array.from` method implementation // https://tc39.es/ecma262/#sec-array.from var arrayFrom$1 = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { - var O = toObject$p(arrayLike); + var O = toObject$o(arrayLike); var IS_CONSTRUCTOR = isConstructor$7(this); var argumentsLength = arguments.length; var mapfn = argumentsLength > 1 ? arguments[1] : undefined; @@ -2729,7 +2784,7 @@ var arrayFrom$1 = function from(arrayLike /* , mapfn = undefined, thisArg = unde iterator = getIterator$9(O, iteratorMethod); next = iterator.next; result = IS_CONSTRUCTOR ? new this() : []; - for (;!(step = call$Q(next, iterator)).done; index++) { + for (;!(step = call$R(next, iterator)).done; index++) { value = mapping ? callWithSafeIterationClosing$2(iterator, mapfn, [step.value, index], true) : step.value; createProperty$6(result, index, value); } @@ -2846,7 +2901,7 @@ $$4f({ target: 'Array', stat: true }, { isArray: isArray$3 }); -var fails$_ = fails$1d; +var fails$_ = fails$1f; var isCallable$j = isCallable$A; var getPrototypeOf$c = objectGetPrototypeOf$1; var redefine$j = redefine$n.exports; @@ -2908,7 +2963,7 @@ var createIteratorConstructor$7 = function (IteratorConstructor, NAME, next, ENU }; var $$4e = _export; -var call$P = functionCall; +var call$Q = functionCall; var FunctionName$1 = functionName; var isCallable$i = isCallable$A; var createIteratorConstructor$6 = createIteratorConstructor$7; @@ -2977,7 +3032,7 @@ var defineIterator$3 = function (Iterable, NAME, IteratorConstructor, next, DEFA createNonEnumerableProperty$c(IterablePrototype, 'name', VALUES); } else { INCORRECT_VALUES_NAME = true; - defaultIterator = function values() { return call$P(nativeIterator, this); }; + defaultIterator = function values() { return call$Q(nativeIterator, this); }; } } @@ -3004,11 +3059,11 @@ var defineIterator$3 = function (Iterable, NAME, IteratorConstructor, next, DEFA return methods; }; -var toIndexedObject$c = toIndexedObject$j; +var toIndexedObject$d = toIndexedObject$k; var addToUnscopables$e = addToUnscopables$l; var Iterators = iterators; var InternalStateModule$i = internalState; -var defineProperty$f = objectDefineProperty.f; +var defineProperty$g = objectDefineProperty.f; var defineIterator$2 = defineIterator$3; var DESCRIPTORS$v = descriptors; @@ -3029,7 +3084,7 @@ var getInternalState$g = InternalStateModule$i.getterFor(ARRAY_ITERATOR); var es_array_iterator = defineIterator$2(Array, 'Array', function (iterated, kind) { setInternalState$i(this, { type: ARRAY_ITERATOR, - target: toIndexedObject$c(iterated), // target + target: toIndexedObject$d(iterated), // target index: 0, // next index kind: kind // kind }); @@ -3061,13 +3116,13 @@ addToUnscopables$e('entries'); // V8 ~ Chrome 45- bug if (DESCRIPTORS$v && values.name !== 'values') try { - defineProperty$f(values, 'name', { value: 'values' }); + defineProperty$g(values, 'name', { value: 'values' }); } catch (error) { /* empty */ } var $$4d = _export; var uncurryThis$17 = functionUncurryThis; var IndexedObject$5 = indexedObject; -var toIndexedObject$b = toIndexedObject$j; +var toIndexedObject$c = toIndexedObject$k; var arrayMethodIsStrict$5 = arrayMethodIsStrict$9; var un$Join = uncurryThis$17([].join); @@ -3079,13 +3134,13 @@ var STRICT_METHOD$5 = arrayMethodIsStrict$5('join', ','); // https://tc39.es/ecma262/#sec-array.prototype.join $$4d({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$5 }, { join: function join(separator) { - return un$Join(toIndexedObject$b(this), separator === undefined ? ',' : separator); + return un$Join(toIndexedObject$c(this), separator === undefined ? ',' : separator); } }); /* eslint-disable es/no-array-prototype-lastindexof -- safe */ var apply$n = functionApply$1; -var toIndexedObject$a = toIndexedObject$j; +var toIndexedObject$b = toIndexedObject$k; var toIntegerOrInfinity$h = toIntegerOrInfinity$m; var lengthOfArrayLike$k = lengthOfArrayLike$x; var arrayMethodIsStrict$4 = arrayMethodIsStrict$9; @@ -3094,14 +3149,14 @@ var min$8 = Math.min; var $lastIndexOf$1 = [].lastIndexOf; var NEGATIVE_ZERO = !!$lastIndexOf$1 && 1 / [1].lastIndexOf(1, -0) < 0; var STRICT_METHOD$4 = arrayMethodIsStrict$4('lastIndexOf'); -var FORCED$u = NEGATIVE_ZERO || !STRICT_METHOD$4; +var FORCED$t = NEGATIVE_ZERO || !STRICT_METHOD$4; // `Array.prototype.lastIndexOf` method implementation // https://tc39.es/ecma262/#sec-array.prototype.lastindexof -var arrayLastIndexOf = FORCED$u ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { +var arrayLastIndexOf = FORCED$t ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { // convert -0 to +0 if (NEGATIVE_ZERO) return apply$n($lastIndexOf$1, this, arguments) || 0; - var O = toIndexedObject$a(this); + var O = toIndexedObject$b(this); var length = lengthOfArrayLike$k(O); var index = length - 1; if (arguments.length > 1) index = min$8(index, toIntegerOrInfinity$h(arguments[1])); @@ -3136,12 +3191,12 @@ $$4b({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 }, { }); var $$4a = _export; -var global$1q = global$1$; -var fails$Z = fails$1d; +var global$1r = global$20; +var fails$Z = fails$1f; var isConstructor$6 = isConstructor$9; var createProperty$5 = createProperty$9; -var Array$c = global$1q.Array; +var Array$c = global$1r.Array; var ISNT_GENERIC = fails$Z(function () { function F() { /* empty */ } @@ -3162,19 +3217,19 @@ $$4a({ target: 'Array', stat: true, forced: ISNT_GENERIC }, { } }); -var global$1p = global$1$; +var global$1q = global$20; var aCallable$Q = aCallable$V; -var toObject$o = toObject$A; +var toObject$n = toObject$z; var IndexedObject$4 = indexedObject; var lengthOfArrayLike$j = lengthOfArrayLike$x; -var TypeError$u = global$1p.TypeError; +var TypeError$v = global$1q.TypeError; // `Array.prototype.{ reduce, reduceRight }` methods implementation var createMethod$6 = function (IS_RIGHT) { return function (that, callbackfn, argumentsLength, memo) { aCallable$Q(callbackfn); - var O = toObject$o(that); + var O = toObject$n(that); var self = IndexedObject$4(O); var length = lengthOfArrayLike$j(O); var index = IS_RIGHT ? length - 1 : 0; @@ -3187,7 +3242,7 @@ var createMethod$6 = function (IS_RIGHT) { } index += i; if (IS_RIGHT ? index < 0 : length <= index) { - throw TypeError$u('Reduce of empty array with no initial value'); + throw TypeError$v('Reduce of empty array with no initial value'); } } for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) { @@ -3207,9 +3262,9 @@ var arrayReduce = { }; var classof$d = classofRaw$1; -var global$1o = global$1$; +var global$1p = global$20; -var engineIsNode = classof$d(global$1o.process) == 'process'; +var engineIsNode = classof$d(global$1p.process) == 'process'; var $$49 = _export; var $reduce$1 = arrayReduce.left; @@ -3270,13 +3325,13 @@ $$47({ target: 'Array', proto: true, forced: String(test$1) === String(test$1.re }); var $$46 = _export; -var global$1n = global$1$; +var global$1o = global$20; var isArray$1 = isArray$8; var isConstructor$5 = isConstructor$9; var isObject$r = isObject$C; var toAbsoluteIndex$5 = toAbsoluteIndex$a; var lengthOfArrayLike$i = lengthOfArrayLike$x; -var toIndexedObject$9 = toIndexedObject$j; +var toIndexedObject$a = toIndexedObject$k; var createProperty$4 = createProperty$9; var wellKnownSymbol$q = wellKnownSymbol$H; var arrayMethodHasSpeciesSupport$1 = arrayMethodHasSpeciesSupport$5; @@ -3285,7 +3340,7 @@ var un$Slice = arraySlice$e; var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport$1('slice'); var SPECIES$4 = wellKnownSymbol$q('species'); -var Array$b = global$1n.Array; +var Array$b = global$1o.Array; var max$6 = Math.max; // `Array.prototype.slice` method @@ -3293,7 +3348,7 @@ var max$6 = Math.max; // fallback for not array-like ES3 strings and DOM objects $$46({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, { slice: function slice(start, end) { - var O = toIndexedObject$9(this); + var O = toIndexedObject$a(this); var length = lengthOfArrayLike$i(O); var k = toAbsoluteIndex$5(start, length); var fin = toAbsoluteIndex$5(end === undefined ? length : end, length); @@ -3397,10 +3452,10 @@ var engineWebkitVersion = !!webkit && +webkit[1]; var $$44 = _export; var uncurryThis$15 = functionUncurryThis; var aCallable$P = aCallable$V; -var toObject$n = toObject$A; +var toObject$m = toObject$z; var lengthOfArrayLike$h = lengthOfArrayLike$x; var toString$t = toString$w; -var fails$Y = fails$1d; +var fails$Y = fails$1f; var internalSort$1 = arraySort$1; var arrayMethodIsStrict = arrayMethodIsStrict$9; var FF$1 = engineFfVersion; @@ -3458,7 +3513,7 @@ var STABLE_SORT$1 = !fails$Y(function () { return result !== 'DGBEFHACIJK'; }); -var FORCED$t = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT$1; +var FORCED$s = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT$1; var getSortCompare$1 = function (comparefn) { return function (x, y) { @@ -3471,11 +3526,11 @@ var getSortCompare$1 = function (comparefn) { // `Array.prototype.sort` method // https://tc39.es/ecma262/#sec-array.prototype.sort -$$44({ target: 'Array', proto: true, forced: FORCED$t }, { +$$44({ target: 'Array', proto: true, forced: FORCED$s }, { sort: function sort(comparefn) { if (comparefn !== undefined) aCallable$P(comparefn); - var array = toObject$n(this); + var array = toObject$m(this); if (STABLE_SORT$1) return comparefn === undefined ? un$Sort$1(array) : un$Sort$1(array, comparefn); @@ -3525,18 +3580,18 @@ var setSpecies$6 = setSpecies$7; setSpecies$6('Array'); var $$43 = _export; -var global$1m = global$1$; +var global$1n = global$20; var toAbsoluteIndex$4 = toAbsoluteIndex$a; var toIntegerOrInfinity$g = toIntegerOrInfinity$m; var lengthOfArrayLike$g = lengthOfArrayLike$x; -var toObject$m = toObject$A; +var toObject$l = toObject$z; var arraySpeciesCreate$1 = arraySpeciesCreate$6; var createProperty$3 = createProperty$9; var arrayMethodHasSpeciesSupport = arrayMethodHasSpeciesSupport$5; var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice'); -var TypeError$t = global$1m.TypeError; +var TypeError$u = global$1n.TypeError; var max$5 = Math.max; var min$7 = Math.min; var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF; @@ -3547,7 +3602,7 @@ var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; // with adding support of @@species $$43({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { splice: function splice(start, deleteCount /* , ...items */) { - var O = toObject$m(this); + var O = toObject$l(this); var len = lengthOfArrayLike$g(O); var actualStart = toAbsoluteIndex$4(start, len); var argumentsLength = arguments.length; @@ -3562,7 +3617,7 @@ $$43({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { actualDeleteCount = min$7(max$5(toIntegerOrInfinity$g(deleteCount), 0), len - actualStart); } if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) { - throw TypeError$t(MAXIMUM_ALLOWED_LENGTH_EXCEEDED); + throw TypeError$u(MAXIMUM_ALLOWED_LENGTH_EXCEEDED); } A = arraySpeciesCreate$1(O, actualDeleteCount); for (k = 0; k < actualDeleteCount; k++) { @@ -3618,21 +3673,21 @@ var redefineAll$a = function (target, src, options) { return target; }; -var global$1l = global$1$; +var global$1m = global$20; var isPrototypeOf$8 = objectIsPrototypeOf; -var TypeError$s = global$1l.TypeError; +var TypeError$t = global$1m.TypeError; var anInstance$d = function (it, Prototype) { if (isPrototypeOf$8(Prototype, it)) return it; - throw TypeError$s('Incorrect invocation'); + throw TypeError$t('Incorrect invocation'); }; -var global$1k = global$1$; +var global$1l = global$20; var toIntegerOrInfinity$f = toIntegerOrInfinity$m; var toLength$b = toLength$d; -var RangeError$f = global$1k.RangeError; +var RangeError$f = global$1l.RangeError; // `ToIndex` abstract operation // https://tc39.es/ecma262/#sec-toindex @@ -3645,9 +3700,9 @@ var toIndex$2 = function (it) { }; // IEEE754 conversions based on https://github.com/feross/ieee754 -var global$1j = global$1$; +var global$1k = global$20; -var Array$a = global$1j.Array; +var Array$a = global$1k.Array; var abs$8 = Math.abs; var pow$5 = Math.pow; var floor$9 = Math.floor; @@ -3749,14 +3804,14 @@ var ieee754 = { unpack: unpack }; -var global$1i = global$1$; +var global$1j = global$20; var uncurryThis$14 = functionUncurryThis; var DESCRIPTORS$t = descriptors; var NATIVE_ARRAY_BUFFER$2 = arrayBufferNative; var FunctionName = functionName; var createNonEnumerableProperty$b = createNonEnumerableProperty$j; var redefineAll$9 = redefineAll$a; -var fails$X = fails$1d; +var fails$X = fails$1f; var anInstance$c = anInstance$d; var toIntegerOrInfinity$e = toIntegerOrInfinity$m; var toLength$a = toLength$d; @@ -3765,7 +3820,7 @@ var IEEE754 = ieee754; var getPrototypeOf$a = objectGetPrototypeOf$1; var setPrototypeOf$4 = objectSetPrototypeOf$1; var getOwnPropertyNames$4 = objectGetOwnPropertyNames.f; -var defineProperty$e = objectDefineProperty.f; +var defineProperty$f = objectDefineProperty.f; var arrayFill = arrayFill$1; var arraySlice$b = arraySliceSimple; var setToStringTag$8 = setToStringTag$c; @@ -3780,14 +3835,14 @@ var DATA_VIEW = 'DataView'; var PROTOTYPE = 'prototype'; var WRONG_LENGTH$1 = 'Wrong length'; var WRONG_INDEX = 'Wrong index'; -var NativeArrayBuffer$1 = global$1i[ARRAY_BUFFER$1]; +var NativeArrayBuffer$1 = global$1j[ARRAY_BUFFER$1]; var $ArrayBuffer = NativeArrayBuffer$1; var ArrayBufferPrototype$1 = $ArrayBuffer && $ArrayBuffer[PROTOTYPE]; -var $DataView = global$1i[DATA_VIEW]; +var $DataView = global$1j[DATA_VIEW]; var DataViewPrototype$1 = $DataView && $DataView[PROTOTYPE]; var ObjectPrototype$2 = Object.prototype; -var Array$9 = global$1i.Array; -var RangeError$e = global$1i.RangeError; +var Array$9 = global$1j.Array; +var RangeError$e = global$1j.RangeError; var fill = uncurryThis$14(arrayFill); var reverse = uncurryThis$14([].reverse); @@ -3819,7 +3874,7 @@ var packFloat64 = function (number) { }; var addGetter$1 = function (Constructor, key) { - defineProperty$e(Constructor[PROTOTYPE], key, { get: function () { return getInternalState$f(this)[key]; } }); + defineProperty$f(Constructor[PROTOTYPE], key, { get: function () { return getInternalState$f(this)[key]; } }); }; var get$1 = function (view, count, index, isLittleEndian) { @@ -3997,13 +4052,13 @@ var arrayBuffer = { }; var $$42 = _export; -var global$1h = global$1$; +var global$1i = global$20; var arrayBufferModule = arrayBuffer; var setSpecies$5 = setSpecies$7; var ARRAY_BUFFER = 'ArrayBuffer'; var ArrayBuffer$4 = arrayBufferModule[ARRAY_BUFFER]; -var NativeArrayBuffer = global$1h[ARRAY_BUFFER]; +var NativeArrayBuffer = global$1i[ARRAY_BUFFER]; // `ArrayBuffer` constructor // https://tc39.es/ecma262/#sec-arraybuffer-constructor @@ -4015,7 +4070,7 @@ setSpecies$5(ARRAY_BUFFER); var NATIVE_ARRAY_BUFFER$1 = arrayBufferNative; var DESCRIPTORS$s = descriptors; -var global$1g = global$1$; +var global$1h = global$20; var isCallable$h = isCallable$A; var isObject$q = isObject$C; var hasOwn$j = hasOwnProperty_1; @@ -4023,28 +4078,28 @@ var classof$c = classof$i; var tryToString$1 = tryToString$5; var createNonEnumerableProperty$a = createNonEnumerableProperty$j; var redefine$g = redefine$n.exports; -var defineProperty$d = objectDefineProperty.f; +var defineProperty$e = objectDefineProperty.f; var isPrototypeOf$7 = objectIsPrototypeOf; var getPrototypeOf$9 = objectGetPrototypeOf$1; var setPrototypeOf$3 = objectSetPrototypeOf$1; var wellKnownSymbol$o = wellKnownSymbol$H; var uid$2 = uid$6; -var Int8Array$3 = global$1g.Int8Array; -var Int8ArrayPrototype = Int8Array$3 && Int8Array$3.prototype; -var Uint8ClampedArray = global$1g.Uint8ClampedArray; -var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype; -var TypedArray$1 = Int8Array$3 && getPrototypeOf$9(Int8Array$3); -var TypedArrayPrototype$2 = Int8ArrayPrototype && getPrototypeOf$9(Int8ArrayPrototype); +var Int8Array$4 = global$1h.Int8Array; +var Int8ArrayPrototype$1 = Int8Array$4 && Int8Array$4.prototype; +var Uint8ClampedArray$1 = global$1h.Uint8ClampedArray; +var Uint8ClampedArrayPrototype = Uint8ClampedArray$1 && Uint8ClampedArray$1.prototype; +var TypedArray$1 = Int8Array$4 && getPrototypeOf$9(Int8Array$4); +var TypedArrayPrototype$2 = Int8ArrayPrototype$1 && getPrototypeOf$9(Int8ArrayPrototype$1); var ObjectPrototype$1 = Object.prototype; -var TypeError$r = global$1g.TypeError; +var TypeError$s = global$1h.TypeError; var TO_STRING_TAG$5 = wellKnownSymbol$o('toStringTag'); var TYPED_ARRAY_TAG$1 = uid$2('TYPED_ARRAY_TAG'); var TYPED_ARRAY_CONSTRUCTOR$6 = uid$2('TYPED_ARRAY_CONSTRUCTOR'); // Fixing native typed arrays in Opera Presto crashes the browser, see #595 -var NATIVE_ARRAY_BUFFER_VIEWS$3 = NATIVE_ARRAY_BUFFER$1 && !!setPrototypeOf$3 && classof$c(global$1g.opera) !== 'Opera'; -var TYPED_ARRAY_TAG_REQIRED = false; +var NATIVE_ARRAY_BUFFER_VIEWS$3 = NATIVE_ARRAY_BUFFER$1 && !!setPrototypeOf$3 && classof$c(global$1h.opera) !== 'Opera'; +var TYPED_ARRAY_TAG_REQUIRED = false; var NAME$1, Constructor, Prototype; var TypedArrayConstructorsList = { @@ -4081,25 +4136,30 @@ var isTypedArray$1 = function (it) { var aTypedArray$x = function (it) { if (isTypedArray$1(it)) return it; - throw TypeError$r('Target is not a typed array'); + throw TypeError$s('Target is not a typed array'); }; var aTypedArrayConstructor$5 = function (C) { if (isCallable$h(C) && (!setPrototypeOf$3 || isPrototypeOf$7(TypedArray$1, C))) return C; - throw TypeError$r(tryToString$1(C) + ' is not a typed array constructor'); + throw TypeError$s(tryToString$1(C) + ' is not a typed array constructor'); }; var exportTypedArrayMethod$y = function (KEY, property, forced, options) { if (!DESCRIPTORS$s) return; if (forced) for (var ARRAY in TypedArrayConstructorsList) { - var TypedArrayConstructor = global$1g[ARRAY]; + var TypedArrayConstructor = global$1h[ARRAY]; if (TypedArrayConstructor && hasOwn$j(TypedArrayConstructor.prototype, KEY)) try { delete TypedArrayConstructor.prototype[KEY]; - } catch (error) { /* empty */ } + } catch (error) { + // old WebKit bug - some methods are non-configurable + try { + TypedArrayConstructor.prototype[KEY] = property; + } catch (error2) { /* empty */ } + } } if (!TypedArrayPrototype$2[KEY] || forced) { redefine$g(TypedArrayPrototype$2, KEY, forced ? property - : NATIVE_ARRAY_BUFFER_VIEWS$3 && Int8ArrayPrototype[KEY] || property, options); + : NATIVE_ARRAY_BUFFER_VIEWS$3 && Int8ArrayPrototype$1[KEY] || property, options); } }; @@ -4108,7 +4168,7 @@ var exportTypedArrayStaticMethod$3 = function (KEY, property, forced) { if (!DESCRIPTORS$s) return; if (setPrototypeOf$3) { if (forced) for (ARRAY in TypedArrayConstructorsList) { - TypedArrayConstructor = global$1g[ARRAY]; + TypedArrayConstructor = global$1h[ARRAY]; if (TypedArrayConstructor && hasOwn$j(TypedArrayConstructor, KEY)) try { delete TypedArrayConstructor[KEY]; } catch (error) { /* empty */ } @@ -4121,7 +4181,7 @@ var exportTypedArrayStaticMethod$3 = function (KEY, property, forced) { } else return; } for (ARRAY in TypedArrayConstructorsList) { - TypedArrayConstructor = global$1g[ARRAY]; + TypedArrayConstructor = global$1h[ARRAY]; if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) { redefine$g(TypedArrayConstructor, KEY, property); } @@ -4129,14 +4189,14 @@ var exportTypedArrayStaticMethod$3 = function (KEY, property, forced) { }; for (NAME$1 in TypedArrayConstructorsList) { - Constructor = global$1g[NAME$1]; + Constructor = global$1h[NAME$1]; Prototype = Constructor && Constructor.prototype; if (Prototype) createNonEnumerableProperty$a(Prototype, TYPED_ARRAY_CONSTRUCTOR$6, Constructor); else NATIVE_ARRAY_BUFFER_VIEWS$3 = false; } for (NAME$1 in BigIntArrayConstructorsList) { - Constructor = global$1g[NAME$1]; + Constructor = global$1h[NAME$1]; Prototype = Constructor && Constructor.prototype; if (Prototype) createNonEnumerableProperty$a(Prototype, TYPED_ARRAY_CONSTRUCTOR$6, Constructor); } @@ -4145,17 +4205,17 @@ for (NAME$1 in BigIntArrayConstructorsList) { if (!NATIVE_ARRAY_BUFFER_VIEWS$3 || !isCallable$h(TypedArray$1) || TypedArray$1 === Function.prototype) { // eslint-disable-next-line no-shadow -- safe TypedArray$1 = function TypedArray() { - throw TypeError$r('Incorrect invocation'); + throw TypeError$s('Incorrect invocation'); }; if (NATIVE_ARRAY_BUFFER_VIEWS$3) for (NAME$1 in TypedArrayConstructorsList) { - if (global$1g[NAME$1]) setPrototypeOf$3(global$1g[NAME$1], TypedArray$1); + if (global$1h[NAME$1]) setPrototypeOf$3(global$1h[NAME$1], TypedArray$1); } } if (!NATIVE_ARRAY_BUFFER_VIEWS$3 || !TypedArrayPrototype$2 || TypedArrayPrototype$2 === ObjectPrototype$1) { TypedArrayPrototype$2 = TypedArray$1.prototype; if (NATIVE_ARRAY_BUFFER_VIEWS$3) for (NAME$1 in TypedArrayConstructorsList) { - if (global$1g[NAME$1]) setPrototypeOf$3(global$1g[NAME$1].prototype, TypedArrayPrototype$2); + if (global$1h[NAME$1]) setPrototypeOf$3(global$1h[NAME$1].prototype, TypedArrayPrototype$2); } } @@ -4165,19 +4225,19 @@ if (NATIVE_ARRAY_BUFFER_VIEWS$3 && getPrototypeOf$9(Uint8ClampedArrayPrototype) } if (DESCRIPTORS$s && !hasOwn$j(TypedArrayPrototype$2, TO_STRING_TAG$5)) { - TYPED_ARRAY_TAG_REQIRED = true; - defineProperty$d(TypedArrayPrototype$2, TO_STRING_TAG$5, { get: function () { + TYPED_ARRAY_TAG_REQUIRED = true; + defineProperty$e(TypedArrayPrototype$2, TO_STRING_TAG$5, { get: function () { return isObject$q(this) ? this[TYPED_ARRAY_TAG$1] : undefined; } }); - for (NAME$1 in TypedArrayConstructorsList) if (global$1g[NAME$1]) { - createNonEnumerableProperty$a(global$1g[NAME$1], TYPED_ARRAY_TAG$1, NAME$1); + for (NAME$1 in TypedArrayConstructorsList) if (global$1h[NAME$1]) { + createNonEnumerableProperty$a(global$1h[NAME$1], TYPED_ARRAY_TAG$1, NAME$1); } } var arrayBufferViewCore = { NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS$3, TYPED_ARRAY_CONSTRUCTOR: TYPED_ARRAY_CONSTRUCTOR$6, - TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG$1, + TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG$1, aTypedArray: aTypedArray$x, aTypedArrayConstructor: aTypedArrayConstructor$5, exportTypedArrayMethod: exportTypedArrayMethod$y, @@ -4199,16 +4259,16 @@ $$41({ target: 'ArrayBuffer', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS$2 } isView: ArrayBufferViewCore$B.isView }); -var global$1f = global$1$; +var global$1g = global$20; var isConstructor$4 = isConstructor$9; var tryToString = tryToString$5; -var TypeError$q = global$1f.TypeError; +var TypeError$r = global$1g.TypeError; // `Assert: IsConstructor(argument) is true` var aConstructor$5 = function (argument) { if (isConstructor$4(argument)) return argument; - throw TypeError$q(tryToString(argument) + ' is not a constructor'); + throw TypeError$r(tryToString(argument) + ' is not a constructor'); }; var anObject$1t = anObject$1F; @@ -4227,7 +4287,7 @@ var speciesConstructor$f = function (O, defaultConstructor) { var $$40 = _export; var uncurryThis$13 = functionUncurryThis; -var fails$W = fails$1d; +var fails$W = fails$1f; var ArrayBufferModule$2 = arrayBuffer; var anObject$1s = anObject$1F; var toAbsoluteIndex$3 = toAbsoluteIndex$a; @@ -4277,9 +4337,9 @@ $$3$({ global: true, forced: !NATIVE_ARRAY_BUFFER }, { var $$3_ = _export; var uncurryThis$12 = functionUncurryThis; -var fails$V = fails$1d; +var fails$V = fails$1f; -var FORCED$s = fails$V(function () { +var FORCED$r = fails$V(function () { return new Date(16e11).getYear() !== 120; }); @@ -4287,17 +4347,17 @@ var getFullYear = uncurryThis$12(Date.prototype.getFullYear); // `Date.prototype.getYear` method // https://tc39.es/ecma262/#sec-date.prototype.getyear -$$3_({ target: 'Date', proto: true, forced: FORCED$s }, { +$$3_({ target: 'Date', proto: true, forced: FORCED$r }, { getYear: function getYear() { return getFullYear(this) - 1900; } }); var $$3Z = _export; -var global$1e = global$1$; +var global$1f = global$20; var uncurryThis$11 = functionUncurryThis; -var Date$2 = global$1e.Date; +var Date$2 = global$1f.Date; var getTime$4 = uncurryThis$11(Date$2.prototype.getTime); // `Date.now` method @@ -4336,12 +4396,12 @@ $$3X({ target: 'Date', proto: true }, { toGMTString: Date.prototype.toUTCString }); -var global$1d = global$1$; +var global$1e = global$20; var toIntegerOrInfinity$c = toIntegerOrInfinity$m; var toString$s = toString$w; var requireObjectCoercible$h = requireObjectCoercible$k; -var RangeError$d = global$1d.RangeError; +var RangeError$d = global$1e.RangeError; // `String.prototype.repeat` method implementation // https://tc39.es/ecma262/#sec-string.prototype.repeat @@ -4390,12 +4450,12 @@ var stringPad = { end: createMethod$5(true) }; -var global$1c = global$1$; +var global$1d = global$20; var uncurryThis$_ = functionUncurryThis; -var fails$U = fails$1d; +var fails$U = fails$1f; var padStart = stringPad.start; -var RangeError$c = global$1c.RangeError; +var RangeError$c = global$1d.RangeError; var abs$7 = Math.abs; var DatePrototype$2 = Date.prototype; var n$DateToISOString = DatePrototype$2.toISOString; @@ -4442,38 +4502,38 @@ $$3W({ target: 'Date', proto: true, forced: Date.prototype.toISOString !== toISO }); var $$3V = _export; -var fails$T = fails$1d; -var toObject$l = toObject$A; +var fails$T = fails$1f; +var toObject$k = toObject$z; var toPrimitive$1 = toPrimitive$3; -var FORCED$r = fails$T(function () { +var FORCED$q = fails$T(function () { return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1; }); // `Date.prototype.toJSON` method // https://tc39.es/ecma262/#sec-date.prototype.tojson -$$3V({ target: 'Date', proto: true, forced: FORCED$r }, { +$$3V({ target: 'Date', proto: true, forced: FORCED$q }, { // eslint-disable-next-line no-unused-vars -- required for `.length` toJSON: function toJSON(key) { - var O = toObject$l(this); + var O = toObject$k(this); var pv = toPrimitive$1(O, 'number'); return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString(); } }); -var global$1b = global$1$; +var global$1c = global$20; var anObject$1r = anObject$1F; var ordinaryToPrimitive = ordinaryToPrimitive$2; -var TypeError$p = global$1b.TypeError; +var TypeError$q = global$1c.TypeError; // `Date.prototype[@@toPrimitive](hint)` method implementation // https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive var dateToPrimitive$1 = function (hint) { anObject$1r(this); if (hint === 'string' || hint === 'default') hint = 'string'; - else if (hint !== 'number') throw TypeError$p('Incorrect hint'); + else if (hint !== 'number') throw TypeError$q('Incorrect hint'); return ordinaryToPrimitive(this, hint); }; @@ -4553,14 +4613,15 @@ $$3U({ global: true }, { } }); -var global$1a = global$1$; +var global$1b = global$20; var uncurryThis$X = functionUncurryThis; var aCallable$O = aCallable$V; var isObject$p = isObject$C; var hasOwn$h = hasOwnProperty_1; var arraySlice$a = arraySlice$e; +var NATIVE_BIND = functionBindNative; -var Function$3 = global$1a.Function; +var Function$3 = global$1b.Function; var concat$3 = uncurryThis$X([].concat); var join$7 = uncurryThis$X([].join); var factories = {}; @@ -4574,7 +4635,7 @@ var construct = function (C, argsLength, args) { // `Function.prototype.bind` method implementation // https://tc39.es/ecma262/#sec-function.prototype.bind -var functionBind = Function$3.bind || function bind(that /* , ...args */) { +var functionBind = NATIVE_BIND ? Function$3.bind : function bind(that /* , ...args */) { var F = aCallable$O(this); var Prototype = F.prototype; var partArgs = arraySlice$a(arguments, 1); @@ -4591,7 +4652,7 @@ var bind$p = functionBind; // `Function.prototype.bind` method // https://tc39.es/ecma262/#sec-function.prototype.bind -$$3T({ target: 'Function', proto: true }, { +$$3T({ target: 'Function', proto: true, forced: Function.bind !== bind$p }, { bind: bind$p }); @@ -4620,7 +4681,7 @@ if (!(HAS_INSTANCE in FunctionPrototype$1)) { var DESCRIPTORS$r = descriptors; var FUNCTION_NAME_EXISTS = functionName.EXISTS; var uncurryThis$W = functionUncurryThis; -var defineProperty$c = objectDefineProperty.f; +var defineProperty$d = objectDefineProperty.f; var FunctionPrototype = Function.prototype; var functionToString = uncurryThis$W(FunctionPrototype.toString); @@ -4631,7 +4692,7 @@ var NAME = 'name'; // Function instances `.name` property // https://tc39.es/ecma262/#sec-function-instances-name if (DESCRIPTORS$r && !FUNCTION_NAME_EXISTS) { - defineProperty$c(FunctionPrototype, NAME, { + defineProperty$d(FunctionPrototype, NAME, { configurable: true, get: function () { try { @@ -4644,22 +4705,22 @@ if (DESCRIPTORS$r && !FUNCTION_NAME_EXISTS) { } var $$3S = _export; -var global$19 = global$1$; +var global$1a = global$20; // `globalThis` object // https://tc39.es/ecma262/#sec-globalthis $$3S({ global: true }, { - globalThis: global$19 + globalThis: global$1a }); var $$3R = _export; -var global$18 = global$1$; +var global$19 = global$20; var getBuiltIn$v = getBuiltIn$F; var apply$m = functionApply$1; var uncurryThis$V = functionUncurryThis; -var fails$S = fails$1d; +var fails$S = fails$1f; -var Array$8 = global$18.Array; +var Array$8 = global$19.Array; var $stringify = getBuiltIn$v('JSON', 'stringify'); var exec$9 = uncurryThis$V(/./.exec); var charAt$e = uncurryThis$V(''.charAt); @@ -4679,7 +4740,7 @@ var fix = function (match, offset, string) { } return match; }; -var FORCED$q = fails$S(function () { +var FORCED$p = fails$S(function () { return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"' || $stringify('\uDEAD') !== '"\\udead"'; }); @@ -4688,7 +4749,7 @@ if ($stringify) { // `JSON.stringify` method // https://tc39.es/ecma262/#sec-json.stringify // https://github.com/tc39/proposal-well-formed-stringify - $$3R({ target: 'JSON', stat: true, forced: FORCED$q }, { + $$3R({ target: 'JSON', stat: true, forced: FORCED$p }, { // eslint-disable-next-line no-unused-vars -- required for `.length` stringify: function stringify(it, replacer, space) { for (var i = 0, l = arguments.length, args = Array$8(l); i < l; i++) args[i] = arguments[i]; @@ -4698,17 +4759,17 @@ if ($stringify) { }); } -var global$17 = global$1$; +var global$18 = global$20; var setToStringTag$7 = setToStringTag$c; // JSON[@@toStringTag] property // https://tc39.es/ecma262/#sec-json-@@tostringtag -setToStringTag$7(global$17.JSON, 'JSON', true); +setToStringTag$7(global$18.JSON, 'JSON', true); var internalMetadata = {exports: {}}; // FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it -var fails$R = fails$1d; +var fails$R = fails$1f; var arrayBufferNonExtensible = fails$R(function () { if (typeof ArrayBuffer == 'function') { @@ -4718,7 +4779,7 @@ var arrayBufferNonExtensible = fails$R(function () { } }); -var fails$Q = fails$1d; +var fails$Q = fails$1f; var isObject$n = isObject$C; var classof$b = classofRaw$1; var ARRAY_BUFFER_NON_EXTENSIBLE$2 = arrayBufferNonExtensible; @@ -4735,7 +4796,7 @@ var objectIsExtensible = (FAILS_ON_PRIMITIVES$9 || ARRAY_BUFFER_NON_EXTENSIBLE$2 return $isExtensible$2 ? $isExtensible$2(it) : true; } : $isExtensible$2; -var fails$P = fails$1d; +var fails$P = fails$1f; var freezing = !fails$P(function () { // eslint-disable-next-line es/no-object-isextensible, es/no-object-preventextensions -- required for testing @@ -4747,7 +4808,7 @@ var uncurryThis$U = functionUncurryThis; var hiddenKeys = hiddenKeys$6; var isObject$m = isObject$C; var hasOwn$g = hasOwnProperty_1; -var defineProperty$b = objectDefineProperty.f; +var defineProperty$c = objectDefineProperty.f; var getOwnPropertyNamesModule = objectGetOwnPropertyNames; var getOwnPropertyNamesExternalModule = objectGetOwnPropertyNamesExternal; var isExtensible$1 = objectIsExtensible; @@ -4759,7 +4820,7 @@ var METADATA = uid$1('meta'); var id$1 = 0; var setMetadata = function (it) { - defineProperty$b(it, METADATA, { value: { + defineProperty$c(it, METADATA, { value: { objectID: 'O' + id$1++, // object ID weakData: {} // weak collections IDs } }); @@ -4833,7 +4894,7 @@ var meta = internalMetadata.exports = { hiddenKeys[METADATA] = true; var $$3P = _export; -var global$16 = global$1$; +var global$17 = global$20; var uncurryThis$T = functionUncurryThis; var isForced$3 = isForced_1; var redefine$d = redefine$n.exports; @@ -4842,7 +4903,7 @@ var iterate$G = iterate$I; var anInstance$b = anInstance$d; var isCallable$f = isCallable$A; var isObject$l = isObject$C; -var fails$O = fails$1d; +var fails$O = fails$1f; var checkCorrectnessOfIteration$2 = checkCorrectnessOfIteration$4; var setToStringTag$6 = setToStringTag$c; var inheritIfRequired$4 = inheritIfRequired$6; @@ -4851,7 +4912,7 @@ var collection$4 = function (CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; var ADDER = IS_MAP ? 'set' : 'add'; - var NativeConstructor = global$16[CONSTRUCTOR_NAME]; + var NativeConstructor = global$17[CONSTRUCTOR_NAME]; var NativePrototype = NativeConstructor && NativeConstructor.prototype; var Constructor = NativeConstructor; var exported = {}; @@ -4937,7 +4998,7 @@ var collection$4 = function (CONSTRUCTOR_NAME, wrapper, common) { return Constructor; }; -var defineProperty$a = objectDefineProperty.f; +var defineProperty$b = objectDefineProperty.f; var create$b = objectCreate$1; var redefineAll$8 = redefineAll$a; var bind$o = functionBindContext; @@ -5088,7 +5149,7 @@ var collectionStrong$2 = { return define(this, value = value === 0 ? 0 : value, value); } }); - if (DESCRIPTORS$q) defineProperty$a(Prototype, 'size', { + if (DESCRIPTORS$q) defineProperty$b(Prototype, 'size', { get: function () { return getInternalState(this).size; } @@ -5168,7 +5229,7 @@ var log$6 = Math.log; var sqrt$2 = Math.sqrt; var LN2$1 = Math.LN2; -var FORCED$p = !$acosh +var FORCED$o = !$acosh // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 || Math.floor($acosh(Number.MAX_VALUE)) != 710 // Tor Browser bug: Math.acosh(Infinity) -> NaN @@ -5176,7 +5237,7 @@ var FORCED$p = !$acosh // `Math.acosh` method // https://tc39.es/ecma262/#sec-math.acosh -$$3O({ target: 'Math', stat: true, forced: FORCED$p }, { +$$3O({ target: 'Math', stat: true, forced: FORCED$o }, { acosh: function acosh(x) { return (x = +x) < 1 ? NaN : x > 94906265.62425156 ? log$6(x) + LN2$1 @@ -5365,19 +5426,19 @@ $$3G({ target: 'Math', stat: true, forced: BUGGY }, { }); var $$3F = _export; -var fails$N = fails$1d; +var fails$N = fails$1f; // eslint-disable-next-line es/no-math-imul -- required for testing var $imul = Math.imul; -var FORCED$o = fails$N(function () { +var FORCED$n = fails$N(function () { return $imul(0xFFFFFFFF, 5) != -5 || $imul.length != 2; }); // `Math.imul` method // https://tc39.es/ecma262/#sec-math.imul // some WebKit versions fails with big numbers, some has wrong arity -$$3F({ target: 'Math', stat: true, forced: FORCED$o }, { +$$3F({ target: 'Math', stat: true, forced: FORCED$n }, { imul: function imul(x, y) { var UINT16 = 0xFFFF; var xn = +x; @@ -5435,14 +5496,14 @@ $$3B({ target: 'Math', stat: true }, { }); var $$3A = _export; -var fails$M = fails$1d; +var fails$M = fails$1f; var expm1$1 = mathExpm1; var abs$2 = Math.abs; var exp$1 = Math.exp; var E = Math.E; -var FORCED$n = fails$M(function () { +var FORCED$m = fails$M(function () { // eslint-disable-next-line es/no-math-sinh -- required for testing return Math.sinh(-2e-17) != -2e-17; }); @@ -5450,7 +5511,7 @@ var FORCED$n = fails$M(function () { // `Math.sinh` method // https://tc39.es/ecma262/#sec-math.sinh // V8 near Chromium 38 has a problem with very small numbers -$$3A({ target: 'Math', stat: true, forced: FORCED$n }, { +$$3A({ target: 'Math', stat: true, forced: FORCED$m }, { sinh: function sinh(x) { return abs$2(x = +x) < 1 ? (expm1$1(x) - expm1$1(-x)) / 2 : (exp$1(x - 1) - exp$1(-x - 1)) * (E / 2); } @@ -5533,7 +5594,7 @@ var stringTrim = { }; var DESCRIPTORS$p = descriptors; -var global$15 = global$1$; +var global$16 = global$20; var uncurryThis$Q = functionUncurryThis; var isForced$2 = isForced_1; var redefine$c = redefine$n.exports; @@ -5542,17 +5603,17 @@ var inheritIfRequired$3 = inheritIfRequired$6; var isPrototypeOf$6 = objectIsPrototypeOf; var isSymbol$2 = isSymbol$6; var toPrimitive = toPrimitive$3; -var fails$L = fails$1d; +var fails$L = fails$1f; var getOwnPropertyNames$3 = objectGetOwnPropertyNames.f; var getOwnPropertyDescriptor$7 = objectGetOwnPropertyDescriptor.f; -var defineProperty$9 = objectDefineProperty.f; +var defineProperty$a = objectDefineProperty.f; var thisNumberValue$3 = thisNumberValue$4; var trim$2 = stringTrim.trim; var NUMBER = 'Number'; -var NativeNumber = global$15[NUMBER]; +var NativeNumber = global$16[NUMBER]; var NumberPrototype = NativeNumber.prototype; -var TypeError$o = global$15.TypeError; +var TypeError$p = global$16.TypeError; var arraySlice$9 = uncurryThis$Q(''.slice); var charCodeAt$2 = uncurryThis$Q(''.charCodeAt); @@ -5568,7 +5629,7 @@ var toNumeric = function (value) { var toNumber = function (argument) { var it = toPrimitive(argument, 'number'); var first, third, radix, maxCode, digits, length, index, code; - if (isSymbol$2(it)) throw TypeError$o('Cannot convert a Symbol value to a number'); + if (isSymbol$2(it)) throw TypeError$p('Cannot convert a Symbol value to a number'); if (typeof it == 'string' && it.length > 2) { it = trim$2(it); first = charCodeAt$2(it, 0); @@ -5612,12 +5673,12 @@ if (isForced$2(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNu 'fromString,range' ).split(','), j = 0, key$2; keys$1.length > j; j++) { if (hasOwn$f(NativeNumber, key$2 = keys$1[j]) && !hasOwn$f(NumberWrapper, key$2)) { - defineProperty$9(NumberWrapper, key$2, getOwnPropertyDescriptor$7(NativeNumber, key$2)); + defineProperty$a(NumberWrapper, key$2, getOwnPropertyDescriptor$7(NativeNumber, key$2)); } } NumberWrapper.prototype = NumberPrototype; NumberPrototype.constructor = NumberWrapper; - redefine$c(global$15, NUMBER, NumberWrapper); + redefine$c(global$16, NUMBER, NumberWrapper); } var $$3x = _export; @@ -5628,9 +5689,9 @@ $$3x({ target: 'Number', stat: true }, { EPSILON: Math.pow(2, -52) }); -var global$14 = global$1$; +var global$15 = global$20; -var globalIsFinite = global$14.isFinite; +var globalIsFinite = global$15.isFinite; // `Number.isFinite` method // https://tc39.es/ecma262/#sec-number.isfinite @@ -5706,24 +5767,24 @@ $$3r({ target: 'Number', stat: true }, { MIN_SAFE_INTEGER: -0x1FFFFFFFFFFFFF }); -var global$13 = global$1$; -var fails$K = fails$1d; +var global$14 = global$20; +var fails$K = fails$1f; var uncurryThis$P = functionUncurryThis; var toString$o = toString$w; var trim$1 = stringTrim.trim; var whitespaces$2 = whitespaces$4; var charAt$d = uncurryThis$P(''.charAt); -var n$ParseFloat = global$13.parseFloat; -var Symbol$2 = global$13.Symbol; +var n$ParseFloat = global$14.parseFloat; +var Symbol$2 = global$14.Symbol; var ITERATOR$5 = Symbol$2 && Symbol$2.iterator; -var FORCED$m = 1 / n$ParseFloat(whitespaces$2 + '-0') !== -Infinity +var FORCED$l = 1 / n$ParseFloat(whitespaces$2 + '-0') !== -Infinity // MS Edge 18- broken with boxed symbols || (ITERATOR$5 && !fails$K(function () { n$ParseFloat(Object(ITERATOR$5)); })); // `parseFloat` method // https://tc39.es/ecma262/#sec-parsefloat-string -var numberParseFloat = FORCED$m ? function parseFloat(string) { +var numberParseFloat = FORCED$l ? function parseFloat(string) { var trimmedString = trim$1(toString$o(string)); var result = n$ParseFloat(trimmedString); return result === 0 && charAt$d(trimmedString, 0) == '-' ? -0 : result; @@ -5739,25 +5800,25 @@ $$3q({ target: 'Number', stat: true, forced: Number.parseFloat != parseFloat$1 } parseFloat: parseFloat$1 }); -var global$12 = global$1$; -var fails$J = fails$1d; +var global$13 = global$20; +var fails$J = fails$1f; var uncurryThis$O = functionUncurryThis; var toString$n = toString$w; var trim = stringTrim.trim; var whitespaces$1 = whitespaces$4; -var $parseInt$1 = global$12.parseInt; -var Symbol$1 = global$12.Symbol; +var $parseInt$1 = global$13.parseInt; +var Symbol$1 = global$13.Symbol; var ITERATOR$4 = Symbol$1 && Symbol$1.iterator; var hex = /^[+-]?0x/i; var exec$8 = uncurryThis$O(hex.exec); -var FORCED$l = $parseInt$1(whitespaces$1 + '08') !== 8 || $parseInt$1(whitespaces$1 + '0x16') !== 22 +var FORCED$k = $parseInt$1(whitespaces$1 + '08') !== 8 || $parseInt$1(whitespaces$1 + '0x16') !== 22 // MS Edge 18- broken with boxed symbols || (ITERATOR$4 && !fails$J(function () { $parseInt$1(Object(ITERATOR$4)); })); // `parseInt` method // https://tc39.es/ecma262/#sec-parseint-string-radix -var numberParseInt = FORCED$l ? function parseInt(string, radix) { +var numberParseInt = FORCED$k ? function parseInt(string, radix) { var S = trim(toString$n(string)); return $parseInt$1(S, (radix >>> 0) || (exec$8(hex, S) ? 16 : 10)); } : $parseInt$1; @@ -5773,17 +5834,17 @@ $$3p({ target: 'Number', stat: true, forced: Number.parseInt != parseInt$3 }, { }); var $$3o = _export; -var global$11 = global$1$; +var global$12 = global$20; var uncurryThis$N = functionUncurryThis; var toIntegerOrInfinity$b = toIntegerOrInfinity$m; var thisNumberValue$2 = thisNumberValue$4; var $repeat$1 = stringRepeat; var log10 = mathLog10; -var fails$I = fails$1d; +var fails$I = fails$1f; -var RangeError$b = global$11.RangeError; -var String$3 = global$11.String; -var isFinite$1 = global$11.isFinite; +var RangeError$b = global$12.RangeError; +var String$3 = global$12.String; +var isFinite$1 = global$12.isFinite; var abs = Math.abs; var floor$5 = Math.floor; var pow$2 = Math.pow; @@ -5815,11 +5876,11 @@ var PROPER_NON_FINITE_THIS_CHECK = !fails$I(function () { un$ToExponential(NaN, Infinity); }); -var FORCED$k = !ROUNDS_PROPERLY || !THROWS_ON_INFINITY_FRACTION || !PROPER_NON_FINITE_THIS_CHECK; +var FORCED$j = !ROUNDS_PROPERLY || !THROWS_ON_INFINITY_FRACTION || !PROPER_NON_FINITE_THIS_CHECK; // `Number.prototype.toExponential` method // https://tc39.es/ecma262/#sec-number.prototype.toexponential -$$3o({ target: 'Number', proto: true, forced: FORCED$k }, { +$$3o({ target: 'Number', proto: true, forced: FORCED$j }, { toExponential: function toExponential(fractionDigits) { var x = thisNumberValue$2(this); if (fractionDigits === undefined) return un$ToExponential(x); @@ -5873,15 +5934,15 @@ $$3o({ target: 'Number', proto: true, forced: FORCED$k }, { }); var $$3n = _export; -var global$10 = global$1$; +var global$11 = global$20; var uncurryThis$M = functionUncurryThis; var toIntegerOrInfinity$a = toIntegerOrInfinity$m; var thisNumberValue$1 = thisNumberValue$4; var $repeat = stringRepeat; -var fails$H = fails$1d; +var fails$H = fails$1f; -var RangeError$a = global$10.RangeError; -var String$2 = global$10.String; +var RangeError$a = global$11.RangeError; +var String$2 = global$11.String; var floor$4 = Math.floor; var repeat$1 = uncurryThis$M($repeat); var stringSlice$d = uncurryThis$M(''.slice); @@ -5935,7 +5996,7 @@ var dataToString = function (data) { } return s; }; -var FORCED$j = fails$H(function () { +var FORCED$i = fails$H(function () { return un$ToFixed(0.00008, 3) !== '0.000' || un$ToFixed(0.9, 0) !== '1' || un$ToFixed(1.255, 2) !== '1.25' || @@ -5947,7 +6008,7 @@ var FORCED$j = fails$H(function () { // `Number.prototype.toFixed` method // https://tc39.es/ecma262/#sec-number.prototype.tofixed -$$3n({ target: 'Number', proto: true, forced: FORCED$j }, { +$$3n({ target: 'Number', proto: true, forced: FORCED$i }, { toFixed: function toFixed(fractionDigits) { var number = thisNumberValue$1(this); var fractDigits = toIntegerOrInfinity$a(fractionDigits); @@ -6006,12 +6067,12 @@ $$3n({ target: 'Number', proto: true, forced: FORCED$j }, { var $$3m = _export; var uncurryThis$L = functionUncurryThis; -var fails$G = fails$1d; +var fails$G = fails$1f; var thisNumberValue = thisNumberValue$4; var un$ToPrecision = uncurryThis$L(1.0.toPrecision); -var FORCED$i = fails$G(function () { +var FORCED$h = fails$G(function () { // IE7- return un$ToPrecision(1, undefined) !== '1'; }) || !fails$G(function () { @@ -6021,7 +6082,7 @@ var FORCED$i = fails$G(function () { // `Number.prototype.toPrecision` method // https://tc39.es/ecma262/#sec-number.prototype.toprecision -$$3m({ target: 'Number', proto: true, forced: FORCED$i }, { +$$3m({ target: 'Number', proto: true, forced: FORCED$h }, { toPrecision: function toPrecision(precision) { return precision === undefined ? un$ToPrecision(thisNumberValue(this)) @@ -6031,28 +6092,28 @@ $$3m({ target: 'Number', proto: true, forced: FORCED$i }, { var DESCRIPTORS$o = descriptors; var uncurryThis$K = functionUncurryThis; -var call$O = functionCall; -var fails$F = fails$1d; +var call$P = functionCall; +var fails$F = fails$1f; var objectKeys$3 = objectKeys$6; var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols; var propertyIsEnumerableModule = objectPropertyIsEnumerable; -var toObject$k = toObject$A; +var toObject$j = toObject$z; var IndexedObject$3 = indexedObject; // eslint-disable-next-line es/no-object-assign -- safe var $assign = Object.assign; // eslint-disable-next-line es/no-object-defineproperty -- required for testing -var defineProperty$8 = Object.defineProperty; +var defineProperty$9 = Object.defineProperty; var concat$2 = uncurryThis$K([].concat); // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign var objectAssign = !$assign || fails$F(function () { // should have correct order of operations (Edge bug) - if (DESCRIPTORS$o && $assign({ b: 1 }, $assign(defineProperty$8({}, 'a', { + if (DESCRIPTORS$o && $assign({ b: 1 }, $assign(defineProperty$9({}, 'a', { enumerable: true, get: function () { - defineProperty$8(this, 'b', { + defineProperty$9(this, 'b', { value: 3, enumerable: false }); @@ -6068,7 +6129,7 @@ var objectAssign = !$assign || fails$F(function () { alphabet.split('').forEach(function (chr) { B[chr] = chr; }); return $assign({}, A)[symbol] != 7 || objectKeys$3($assign({}, B)).join('') != alphabet; }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length` - var T = toObject$k(target); + var T = toObject$j(target); var argumentsLength = arguments.length; var index = 1; var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; @@ -6081,7 +6142,7 @@ var objectAssign = !$assign || fails$F(function () { var key; while (length > j) { key = keys[j++]; - if (!DESCRIPTORS$o || call$O(propertyIsEnumerable, S, key)) T[key] = S[key]; + if (!DESCRIPTORS$o || call$P(propertyIsEnumerable, S, key)) T[key] = S[key]; } } return T; } : $assign; @@ -6106,8 +6167,8 @@ $$3k({ target: 'Object', stat: true, sham: !DESCRIPTORS$n }, { create: create$a }); -var global$$ = global$1$; -var fails$E = fails$1d; +var global$10 = global$20; +var fails$E = fails$1f; var WEBKIT$1 = engineWebkitVersion; // Forced replacement object prototype accessors methods @@ -6119,59 +6180,61 @@ var objectPrototypeAccessorsForced = !fails$E(function () { // In FF throws only define methods // eslint-disable-next-line no-undef, no-useless-call -- required for testing __defineSetter__.call(null, key, function () { /* empty */ }); - delete global$$[key]; + delete global$10[key]; }); var $$3j = _export; var DESCRIPTORS$m = descriptors; -var FORCED$h = objectPrototypeAccessorsForced; +var FORCED$g = objectPrototypeAccessorsForced; var aCallable$N = aCallable$V; -var toObject$j = toObject$A; +var toObject$i = toObject$z; var definePropertyModule$4 = objectDefineProperty; // `Object.prototype.__defineGetter__` method // https://tc39.es/ecma262/#sec-object.prototype.__defineGetter__ if (DESCRIPTORS$m) { - $$3j({ target: 'Object', proto: true, forced: FORCED$h }, { + $$3j({ target: 'Object', proto: true, forced: FORCED$g }, { __defineGetter__: function __defineGetter__(P, getter) { - definePropertyModule$4.f(toObject$j(this), P, { get: aCallable$N(getter), enumerable: true, configurable: true }); + definePropertyModule$4.f(toObject$i(this), P, { get: aCallable$N(getter), enumerable: true, configurable: true }); } }); } var $$3i = _export; var DESCRIPTORS$l = descriptors; -var defineProperties$3 = objectDefineProperties; +var defineProperties$3 = objectDefineProperties.f; // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties -$$3i({ target: 'Object', stat: true, forced: !DESCRIPTORS$l, sham: !DESCRIPTORS$l }, { +// eslint-disable-next-line es/no-object-defineproperties -- safe +$$3i({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties$3, sham: !DESCRIPTORS$l }, { defineProperties: defineProperties$3 }); var $$3h = _export; var DESCRIPTORS$k = descriptors; -var objectDefinePropertyModile = objectDefineProperty; +var defineProperty$8 = objectDefineProperty.f; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty -$$3h({ target: 'Object', stat: true, forced: !DESCRIPTORS$k, sham: !DESCRIPTORS$k }, { - defineProperty: objectDefinePropertyModile.f +// eslint-disable-next-line es/no-object-defineproperty -- safe +$$3h({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty$8, sham: !DESCRIPTORS$k }, { + defineProperty: defineProperty$8 }); var $$3g = _export; var DESCRIPTORS$j = descriptors; -var FORCED$g = objectPrototypeAccessorsForced; +var FORCED$f = objectPrototypeAccessorsForced; var aCallable$M = aCallable$V; -var toObject$i = toObject$A; +var toObject$h = toObject$z; var definePropertyModule$3 = objectDefineProperty; // `Object.prototype.__defineSetter__` method // https://tc39.es/ecma262/#sec-object.prototype.__defineSetter__ if (DESCRIPTORS$j) { - $$3g({ target: 'Object', proto: true, forced: FORCED$g }, { + $$3g({ target: 'Object', proto: true, forced: FORCED$f }, { __defineSetter__: function __defineSetter__(P, setter) { - definePropertyModule$3.f(toObject$i(this), P, { set: aCallable$M(setter), enumerable: true, configurable: true }); + definePropertyModule$3.f(toObject$h(this), P, { set: aCallable$M(setter), enumerable: true, configurable: true }); } }); } @@ -6179,7 +6242,7 @@ if (DESCRIPTORS$j) { var DESCRIPTORS$i = descriptors; var uncurryThis$J = functionUncurryThis; var objectKeys$2 = objectKeys$6; -var toIndexedObject$8 = toIndexedObject$j; +var toIndexedObject$9 = toIndexedObject$k; var $propertyIsEnumerable = objectPropertyIsEnumerable.f; var propertyIsEnumerable = uncurryThis$J($propertyIsEnumerable); @@ -6188,7 +6251,7 @@ var push$h = uncurryThis$J([].push); // `Object.{ entries, values }` methods implementation var createMethod$3 = function (TO_ENTRIES) { return function (it) { - var O = toIndexedObject$8(it); + var O = toIndexedObject$9(it); var keys = objectKeys$2(O); var length = keys.length; var i = 0; @@ -6226,7 +6289,7 @@ $$3f({ target: 'Object', stat: true }, { var $$3e = _export; var FREEZING$3 = freezing; -var fails$D = fails$1d; +var fails$D = fails$1f; var isObject$j = isObject$C; var onFreeze$2 = internalMetadata.exports.onFreeze; @@ -6259,26 +6322,26 @@ $$3d({ target: 'Object', stat: true }, { }); var $$3c = _export; -var fails$C = fails$1d; -var toIndexedObject$7 = toIndexedObject$j; +var fails$C = fails$1f; +var toIndexedObject$8 = toIndexedObject$k; var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; var DESCRIPTORS$h = descriptors; var FAILS_ON_PRIMITIVES$7 = fails$C(function () { nativeGetOwnPropertyDescriptor$1(1); }); -var FORCED$f = !DESCRIPTORS$h || FAILS_ON_PRIMITIVES$7; +var FORCED$e = !DESCRIPTORS$h || FAILS_ON_PRIMITIVES$7; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor -$$3c({ target: 'Object', stat: true, forced: FORCED$f, sham: !DESCRIPTORS$h }, { +$$3c({ target: 'Object', stat: true, forced: FORCED$e, sham: !DESCRIPTORS$h }, { getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) { - return nativeGetOwnPropertyDescriptor$1(toIndexedObject$7(it), key); + return nativeGetOwnPropertyDescriptor$1(toIndexedObject$8(it), key); } }); var $$3b = _export; var DESCRIPTORS$g = descriptors; var ownKeys$1 = ownKeys$3; -var toIndexedObject$6 = toIndexedObject$j; +var toIndexedObject$7 = toIndexedObject$k; var getOwnPropertyDescriptorModule$4 = objectGetOwnPropertyDescriptor; var createProperty$1 = createProperty$9; @@ -6286,7 +6349,7 @@ var createProperty$1 = createProperty$9; // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors $$3b({ target: 'Object', stat: true, sham: !DESCRIPTORS$g }, { getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { - var O = toIndexedObject$6(object); + var O = toIndexedObject$7(object); var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule$4.f; var keys = ownKeys$1(O); var result = {}; @@ -6301,7 +6364,7 @@ $$3b({ target: 'Object', stat: true, sham: !DESCRIPTORS$g }, { }); var $$3a = _export; -var fails$B = fails$1d; +var fails$B = fails$1f; var getOwnPropertyNames$2 = objectGetOwnPropertyNamesExternal.f; // eslint-disable-next-line es/no-object-getownpropertynames -- required for testing @@ -6314,8 +6377,8 @@ $$3a({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$6 }, { }); var $$39 = _export; -var fails$A = fails$1d; -var toObject$h = toObject$A; +var fails$A = fails$1f; +var toObject$g = toObject$z; var nativeGetPrototypeOf = objectGetPrototypeOf$1; var CORRECT_PROTOTYPE_GETTER$1 = correctPrototypeGetter; @@ -6325,7 +6388,7 @@ var FAILS_ON_PRIMITIVES$5 = fails$A(function () { nativeGetPrototypeOf(1); }); // https://tc39.es/ecma262/#sec-object.getprototypeof $$39({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$5, sham: !CORRECT_PROTOTYPE_GETTER$1 }, { getPrototypeOf: function getPrototypeOf(it) { - return nativeGetPrototypeOf(toObject$h(it)); + return nativeGetPrototypeOf(toObject$g(it)); } }); @@ -6366,7 +6429,7 @@ $$36({ target: 'Object', stat: true, forced: Object.isExtensible !== $isExtensib }); var $$35 = _export; -var fails$z = fails$1d; +var fails$z = fails$1f; var isObject$i = isObject$C; var classof$a = classofRaw$1; var ARRAY_BUFFER_NON_EXTENSIBLE$1 = arrayBufferNonExtensible; @@ -6386,7 +6449,7 @@ $$35({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$4 || ARRAY_BUFF }); var $$34 = _export; -var fails$y = fails$1d; +var fails$y = fails$1f; var isObject$h = isObject$C; var classof$9 = classofRaw$1; var ARRAY_BUFFER_NON_EXTENSIBLE = arrayBufferNonExtensible; @@ -6406,9 +6469,9 @@ $$34({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$3 || ARRAY_BUFF }); var $$33 = _export; -var toObject$g = toObject$A; +var toObject$f = toObject$z; var nativeKeys = objectKeys$6; -var fails$x = fails$1d; +var fails$x = fails$1f; var FAILS_ON_PRIMITIVES$2 = fails$x(function () { nativeKeys(1); }); @@ -6416,14 +6479,14 @@ var FAILS_ON_PRIMITIVES$2 = fails$x(function () { nativeKeys(1); }); // https://tc39.es/ecma262/#sec-object.keys $$33({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$2 }, { keys: function keys(it) { - return nativeKeys(toObject$g(it)); + return nativeKeys(toObject$f(it)); } }); var $$32 = _export; var DESCRIPTORS$f = descriptors; -var FORCED$e = objectPrototypeAccessorsForced; -var toObject$f = toObject$A; +var FORCED$d = objectPrototypeAccessorsForced; +var toObject$e = toObject$z; var toPropertyKey$4 = toPropertyKey$9; var getPrototypeOf$7 = objectGetPrototypeOf$1; var getOwnPropertyDescriptor$6 = objectGetOwnPropertyDescriptor.f; @@ -6431,9 +6494,9 @@ var getOwnPropertyDescriptor$6 = objectGetOwnPropertyDescriptor.f; // `Object.prototype.__lookupGetter__` method // https://tc39.es/ecma262/#sec-object.prototype.__lookupGetter__ if (DESCRIPTORS$f) { - $$32({ target: 'Object', proto: true, forced: FORCED$e }, { + $$32({ target: 'Object', proto: true, forced: FORCED$d }, { __lookupGetter__: function __lookupGetter__(P) { - var O = toObject$f(this); + var O = toObject$e(this); var key = toPropertyKey$4(P); var desc; do { @@ -6445,8 +6508,8 @@ if (DESCRIPTORS$f) { var $$31 = _export; var DESCRIPTORS$e = descriptors; -var FORCED$d = objectPrototypeAccessorsForced; -var toObject$e = toObject$A; +var FORCED$c = objectPrototypeAccessorsForced; +var toObject$d = toObject$z; var toPropertyKey$3 = toPropertyKey$9; var getPrototypeOf$6 = objectGetPrototypeOf$1; var getOwnPropertyDescriptor$5 = objectGetOwnPropertyDescriptor.f; @@ -6454,9 +6517,9 @@ var getOwnPropertyDescriptor$5 = objectGetOwnPropertyDescriptor.f; // `Object.prototype.__lookupSetter__` method // https://tc39.es/ecma262/#sec-object.prototype.__lookupSetter__ if (DESCRIPTORS$e) { - $$31({ target: 'Object', proto: true, forced: FORCED$d }, { + $$31({ target: 'Object', proto: true, forced: FORCED$c }, { __lookupSetter__: function __lookupSetter__(P) { - var O = toObject$e(this); + var O = toObject$d(this); var key = toPropertyKey$3(P); var desc; do { @@ -6470,7 +6533,7 @@ var $$30 = _export; var isObject$g = isObject$C; var onFreeze$1 = internalMetadata.exports.onFreeze; var FREEZING$2 = freezing; -var fails$w = fails$1d; +var fails$w = fails$1f; // eslint-disable-next-line es/no-object-preventextensions -- safe var $preventExtensions = Object.preventExtensions; @@ -6488,7 +6551,7 @@ var $$2$ = _export; var isObject$f = isObject$C; var onFreeze = internalMetadata.exports.onFreeze; var FREEZING$1 = freezing; -var fails$v = fails$1d; +var fails$v = fails$1f; // eslint-disable-next-line es/no-object-seal -- safe var $seal = Object.seal; @@ -6559,47 +6622,47 @@ $$2X({ global: true, forced: parseInt != $parseInt }, { parseInt: $parseInt }); -var global$_ = global$1$; +var global$$ = global$20; -var nativePromiseConstructor = global$_.Promise; +var nativePromiseConstructor = global$$.Promise; var userAgent$4 = engineUserAgent; var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$4); -var global$Z = global$1$; +var global$_ = global$20; var apply$l = functionApply$1; var bind$n = functionBindContext; var isCallable$e = isCallable$A; var hasOwn$d = hasOwnProperty_1; -var fails$u = fails$1d; +var fails$u = fails$1f; var html = html$2; var arraySlice$8 = arraySlice$e; var createElement = documentCreateElement$2; var IS_IOS$1 = engineIsIos; var IS_NODE$4 = engineIsNode; -var set$1 = global$Z.setImmediate; -var clear = global$Z.clearImmediate; -var process$3 = global$Z.process; -var Dispatch = global$Z.Dispatch; -var Function$2 = global$Z.Function; -var MessageChannel = global$Z.MessageChannel; -var String$1 = global$Z.String; +var set$1 = global$_.setImmediate; +var clear = global$_.clearImmediate; +var process$3 = global$_.process; +var Dispatch = global$_.Dispatch; +var Function$2 = global$_.Function; +var MessageChannel = global$_.MessageChannel; +var String$1 = global$_.String; var counter = 0; -var queue = {}; +var queue$1 = {}; var ONREADYSTATECHANGE = 'onreadystatechange'; var location, defer, channel, port; try { // Deno throws a ReferenceError on `location` access without `--location` flag - location = global$Z.location; + location = global$_.location; } catch (error) { /* empty */ } var run = function (id) { - if (hasOwn$d(queue, id)) { - var fn = queue[id]; - delete queue[id]; + if (hasOwn$d(queue$1, id)) { + var fn = queue$1[id]; + delete queue$1[id]; fn(); } }; @@ -6616,21 +6679,21 @@ var listener = function (event) { var post = function (id) { // old engines have not location.origin - global$Z.postMessage(String$1(id), location.protocol + '//' + location.host); + global$_.postMessage(String$1(id), location.protocol + '//' + location.host); }; // Node.js 0.9+ & IE10+ has setImmediate, otherwise: if (!set$1 || !clear) { set$1 = function setImmediate(fn) { var args = arraySlice$8(arguments, 1); - queue[++counter] = function () { + queue$1[++counter] = function () { apply$l(isCallable$e(fn) ? fn : Function$2(fn), undefined, args); }; defer(counter); return counter; }; clear = function clearImmediate(id) { - delete queue[id]; + delete queue$1[id]; }; // Node.js 0.8- if (IS_NODE$4) { @@ -6652,14 +6715,14 @@ if (!set$1 || !clear) { // Browsers with postMessage, skip WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' } else if ( - global$Z.addEventListener && - isCallable$e(global$Z.postMessage) && - !global$Z.importScripts && + global$_.addEventListener && + isCallable$e(global$_.postMessage) && + !global$_.importScripts && location && location.protocol !== 'file:' && !fails$u(post) ) { defer = post; - global$Z.addEventListener('message', listener, false); + global$_.addEventListener('message', listener, false); // IE8- } else if (ONREADYSTATECHANGE in createElement('script')) { defer = function (id) { @@ -6682,15 +6745,15 @@ var task$2 = { }; var userAgent$3 = engineUserAgent; -var global$Y = global$1$; +var global$Z = global$20; -var engineIsIosPebble = /ipad|iphone|ipod/i.test(userAgent$3) && global$Y.Pebble !== undefined; +var engineIsIosPebble = /ipad|iphone|ipod/i.test(userAgent$3) && global$Z.Pebble !== undefined; var userAgent$2 = engineUserAgent; var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent$2); -var global$X = global$1$; +var global$Y = global$20; var bind$m = functionBindContext; var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f; var macrotask = task$2.set; @@ -6699,12 +6762,12 @@ var IS_IOS_PEBBLE = engineIsIosPebble; var IS_WEBOS_WEBKIT = engineIsWebosWebkit; var IS_NODE$3 = engineIsNode; -var MutationObserver = global$X.MutationObserver || global$X.WebKitMutationObserver; -var document$2 = global$X.document; -var process$2 = global$X.process; -var Promise$4 = global$X.Promise; +var MutationObserver = global$Y.MutationObserver || global$Y.WebKitMutationObserver; +var document$2 = global$Y.document; +var process$2 = global$Y.process; +var Promise$4 = global$Y.Promise; // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask` -var queueMicrotaskDescriptor = getOwnPropertyDescriptor$4(global$X, 'queueMicrotask'); +var queueMicrotaskDescriptor = getOwnPropertyDescriptor$4(global$Y, 'queueMicrotask'); var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value; var flush, head, last, notify$1, toggle, node, promise, then; @@ -6760,7 +6823,7 @@ if (!queueMicrotask) { // - setTimeout } else { // strange IE + webpack dev server bug - use .bind(global) - macrotask = bind$m(macrotask, global$X); + macrotask = bind$m(macrotask, global$Y); notify$1 = function () { macrotask(flush); }; @@ -6810,10 +6873,10 @@ var promiseResolve$2 = function (C, x) { return promiseCapability.promise; }; -var global$W = global$1$; +var global$X = global$20; var hostReportErrors$2 = function (a, b) { - var console = global$W.console; + var console = global$X.console; if (console && console.error) { arguments.length == 1 ? console.error(a) : console.error(a, b); } @@ -6827,12 +6890,36 @@ var perform$4 = function (exec) { } }; +var Queue$1 = function () { + this.head = null; + this.tail = null; +}; + +Queue$1.prototype = { + add: function (item) { + var entry = { item: item, next: null }; + if (this.head) this.tail.next = entry; + else this.head = entry; + this.tail = entry; + }, + get: function () { + var entry = this.head; + if (entry) { + this.head = entry.next; + if (this.tail === entry) this.tail = null; + return entry.item; + } + } +}; + +var queue = Queue$1; + var engineIsBrowser = typeof window == 'object'; var $$2W = _export; -var global$V = global$1$; +var global$W = global$20; var getBuiltIn$u = getBuiltIn$F; -var call$N = functionCall; +var call$O = functionCall; var NativePromise$1 = nativePromiseConstructor; var redefine$a = redefine$n.exports; var redefineAll$7 = redefineAll$a; @@ -6853,6 +6940,7 @@ var promiseResolve$1 = promiseResolve$2; var hostReportErrors$1 = hostReportErrors$2; var newPromiseCapabilityModule$3 = newPromiseCapability$2; var perform$3 = perform$4; +var Queue = queue; var InternalStateModule$f = internalState; var isForced$1 = isForced_1; var wellKnownSymbol$k = wellKnownSymbol$H; @@ -6869,14 +6957,14 @@ var getInternalPromiseState = InternalStateModule$f.getterFor(PROMISE); var NativePromisePrototype = NativePromise$1 && NativePromise$1.prototype; var PromiseConstructor = NativePromise$1; var PromisePrototype = NativePromisePrototype; -var TypeError$n = global$V.TypeError; -var document$1 = global$V.document; -var process$1 = global$V.process; +var TypeError$o = global$W.TypeError; +var document$1 = global$W.document; +var process$1 = global$W.process; var newPromiseCapability = newPromiseCapabilityModule$3.f; var newGenericPromiseCapability = newPromiseCapability; -var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global$V.dispatchEvent); -var NATIVE_REJECTION_EVENT = isCallable$d(global$V.PromiseRejectionEvent); +var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global$W.dispatchEvent); +var NATIVE_REJECTION_EVENT = isCallable$d(global$W.PromiseRejectionEvent); var UNHANDLED_REJECTION = 'unhandledrejection'; var REJECTION_HANDLED = 'rejectionhandled'; var PENDING = 0; @@ -6888,7 +6976,7 @@ var SUBCLASSING = false; var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen; -var FORCED$c = isForced$1(PROMISE, function () { +var FORCED$b = isForced$1(PROMISE, function () { var PROMISE_CONSTRUCTOR_SOURCE = inspectSource$1(PromiseConstructor); var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor); // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables @@ -6912,7 +7000,7 @@ var FORCED$c = isForced$1(PROMISE, function () { return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_REJECTION_EVENT; }); -var INCORRECT_ITERATION = FORCED$c || !checkCorrectnessOfIteration$1(function (iterable) { +var INCORRECT_ITERATION = FORCED$b || !checkCorrectnessOfIteration$1(function (iterable) { PromiseConstructor.all(iterable)['catch'](function () { /* empty */ }); }); @@ -6922,49 +7010,50 @@ var isThenable = function (it) { return isObject$d(it) && isCallable$d(then = it.then) ? then : false; }; +var callReaction = function (reaction, state) { + var value = state.value; + var ok = state.state == FULFILLED; + var handler = ok ? reaction.ok : reaction.fail; + var resolve = reaction.resolve; + var reject = reaction.reject; + var domain = reaction.domain; + var result, then, exited; + try { + if (handler) { + if (!ok) { + if (state.rejection === UNHANDLED) onHandleUnhandled(state); + state.rejection = HANDLED; + } + if (handler === true) result = value; + else { + if (domain) domain.enter(); + result = handler(value); // can throw + if (domain) { + domain.exit(); + exited = true; + } + } + if (result === reaction.promise) { + reject(TypeError$o('Promise-chain cycle')); + } else if (then = isThenable(result)) { + call$O(then, result, resolve, reject); + } else resolve(result); + } else reject(value); + } catch (error) { + if (domain && !exited) domain.exit(); + reject(error); + } +}; + var notify = function (state, isReject) { if (state.notified) return; state.notified = true; - var chain = state.reactions; microtask$1(function () { - var value = state.value; - var ok = state.state == FULFILLED; - var index = 0; - // variable length - can't use forEach - while (chain.length > index) { - var reaction = chain[index++]; - var handler = ok ? reaction.ok : reaction.fail; - var resolve = reaction.resolve; - var reject = reaction.reject; - var domain = reaction.domain; - var result, then, exited; - try { - if (handler) { - if (!ok) { - if (state.rejection === UNHANDLED) onHandleUnhandled(state); - state.rejection = HANDLED; - } - if (handler === true) result = value; - else { - if (domain) domain.enter(); - result = handler(value); // can throw - if (domain) { - domain.exit(); - exited = true; - } - } - if (result === reaction.promise) { - reject(TypeError$n('Promise-chain cycle')); - } else if (then = isThenable(result)) { - call$N(then, result, resolve, reject); - } else resolve(result); - } else reject(value); - } catch (error) { - if (domain && !exited) domain.exit(); - reject(error); - } + var reactions = state.reactions; + var reaction; + while (reaction = reactions.get()) { + callReaction(reaction, state); } - state.reactions = []; state.notified = false; if (isReject && !state.rejection) onUnhandled(state); }); @@ -6977,14 +7066,14 @@ var dispatchEvent = function (name, promise, reason) { event.promise = promise; event.reason = reason; event.initEvent(name, false, true); - global$V.dispatchEvent(event); + global$W.dispatchEvent(event); } else event = { promise: promise, reason: reason }; - if (!NATIVE_REJECTION_EVENT && (handler = global$V['on' + name])) handler(event); + if (!NATIVE_REJECTION_EVENT && (handler = global$W['on' + name])) handler(event); else if (name === UNHANDLED_REJECTION) hostReportErrors$1('Unhandled promise rejection', reason); }; var onUnhandled = function (state) { - call$N(task$1, global$V, function () { + call$O(task$1, global$W, function () { var promise = state.facade; var value = state.value; var IS_UNHANDLED = isUnhandled(state); @@ -7007,7 +7096,7 @@ var isUnhandled = function (state) { }; var onHandleUnhandled = function (state) { - call$N(task$1, global$V, function () { + call$O(task$1, global$W, function () { var promise = state.facade; if (IS_NODE$2) { process$1.emit('rejectionHandled', promise); @@ -7035,13 +7124,13 @@ var internalResolve = function (state, value, unwrap) { state.done = true; if (unwrap) state = unwrap; try { - if (state.facade === value) throw TypeError$n("Promise can't be resolved itself"); + if (state.facade === value) throw TypeError$o("Promise can't be resolved itself"); var then = isThenable(value); if (then) { microtask$1(function () { var wrapper = { done: false }; try { - call$N(then, value, + call$O(then, value, bind$l(internalResolve, wrapper, state), bind$l(internalReject, wrapper, state) ); @@ -7060,12 +7149,12 @@ var internalResolve = function (state, value, unwrap) { }; // constructor polyfill -if (FORCED$c) { +if (FORCED$b) { // 25.4.3.1 Promise(executor) PromiseConstructor = function Promise(executor) { anInstance$9(this, PromisePrototype); aCallable$K(executor); - call$N(Internal, this); + call$O(Internal, this); var state = getInternalState$e(this); try { executor(bind$l(internalResolve, state), bind$l(internalReject, state)); @@ -7081,7 +7170,7 @@ if (FORCED$c) { done: false, notified: false, parent: false, - reactions: [], + reactions: new Queue(), rejection: false, state: PENDING, value: undefined @@ -7090,16 +7179,18 @@ if (FORCED$c) { Internal.prototype = redefineAll$7(PromisePrototype, { // `Promise.prototype.then` method // https://tc39.es/ecma262/#sec-promise.prototype.then + // eslint-disable-next-line unicorn/no-thenable -- safe then: function then(onFulfilled, onRejected) { var state = getInternalPromiseState(this); - var reactions = state.reactions; var reaction = newPromiseCapability(speciesConstructor$d(this, PromiseConstructor)); + state.parent = true; reaction.ok = isCallable$d(onFulfilled) ? onFulfilled : true; reaction.fail = isCallable$d(onRejected) && onRejected; reaction.domain = IS_NODE$2 ? process$1.domain : undefined; - state.parent = true; - reactions[reactions.length] = reaction; - if (state.state != PENDING) notify(state, false); + if (state.state == PENDING) state.reactions.add(reaction); + else microtask$1(function () { + callReaction(reaction, state); + }); return reaction.promise; }, // `Promise.prototype.catch` method @@ -7129,7 +7220,7 @@ if (FORCED$c) { redefine$a(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) { var that = this; return new PromiseConstructor(function (resolve, reject) { - call$N(nativeThen, that, resolve, reject); + call$O(nativeThen, that, resolve, reject); }).then(onFulfilled, onRejected); // https://github.com/zloirock/core-js/issues/640 }, { unsafe: true }); @@ -7150,7 +7241,7 @@ if (FORCED$c) { } } -$$2W({ global: true, wrap: true, forced: FORCED$c }, { +$$2W({ global: true, wrap: true, forced: FORCED$b }, { Promise: PromiseConstructor }); @@ -7160,17 +7251,17 @@ setSpecies$3(PROMISE); PromiseWrapper = getBuiltIn$u(PROMISE); // statics -$$2W({ target: PROMISE, stat: true, forced: FORCED$c }, { +$$2W({ target: PROMISE, stat: true, forced: FORCED$b }, { // `Promise.reject` method // https://tc39.es/ecma262/#sec-promise.reject reject: function reject(r) { var capability = newPromiseCapability(this); - call$N(capability.reject, undefined, r); + call$O(capability.reject, undefined, r); return capability.promise; } }); -$$2W({ target: PROMISE, stat: true, forced: FORCED$c }, { +$$2W({ target: PROMISE, stat: true, forced: FORCED$b }, { // `Promise.resolve` method // https://tc39.es/ecma262/#sec-promise.resolve resolve: function resolve(x) { @@ -7195,7 +7286,7 @@ $$2W({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, { var index = counter++; var alreadyCalled = false; remaining++; - call$N($promiseResolve, C, promise).then(function (value) { + call$O($promiseResolve, C, promise).then(function (value) { if (alreadyCalled) return; alreadyCalled = true; values[index] = value; @@ -7216,7 +7307,7 @@ $$2W({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, { var result = perform$3(function () { var $promiseResolve = aCallable$K(C.resolve); iterate$D(iterable, function (promise) { - call$N($promiseResolve, C, promise).then(capability.resolve, reject); + call$O($promiseResolve, C, promise).then(capability.resolve, reject); }); }); if (result.error) reject(result.value); @@ -7225,7 +7316,7 @@ $$2W({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, { }); var $$2V = _export; -var call$M = functionCall; +var call$N = functionCall; var aCallable$J = aCallable$V; var newPromiseCapabilityModule$2 = newPromiseCapability$2; var perform$2 = perform$4; @@ -7248,7 +7339,7 @@ $$2V({ target: 'Promise', stat: true }, { var index = counter++; var alreadyCalled = false; remaining++; - call$M(promiseResolve, C, promise).then(function (value) { + call$N(promiseResolve, C, promise).then(function (value) { if (alreadyCalled) return; alreadyCalled = true; values[index] = { status: 'fulfilled', value: value }; @@ -7270,7 +7361,7 @@ $$2V({ target: 'Promise', stat: true }, { var $$2U = _export; var aCallable$I = aCallable$V; var getBuiltIn$t = getBuiltIn$F; -var call$L = functionCall; +var call$M = functionCall; var newPromiseCapabilityModule$1 = newPromiseCapability$2; var perform$1 = perform$4; var iterate$B = iterate$I; @@ -7296,7 +7387,7 @@ $$2U({ target: 'Promise', stat: true }, { var index = counter++; var alreadyRejected = false; remaining++; - call$L(promiseResolve, C, promise).then(function (value) { + call$M(promiseResolve, C, promise).then(function (value) { if (alreadyRejected || alreadyResolved) return; alreadyResolved = true; resolve(value); @@ -7316,7 +7407,7 @@ $$2U({ target: 'Promise', stat: true }, { var $$2T = _export; var NativePromise = nativePromiseConstructor; -var fails$t = fails$1d; +var fails$t = fails$1f; var getBuiltIn$s = getBuiltIn$F; var isCallable$c = isCallable$A; var speciesConstructor$c = speciesConstructor$f; @@ -7325,6 +7416,7 @@ var redefine$9 = redefine$n.exports; // Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829 var NON_GENERIC = !!NativePromise && fails$t(function () { + // eslint-disable-next-line unicorn/no-thenable -- required for testing NativePromise.prototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ }); }); @@ -7357,7 +7449,7 @@ var $$2S = _export; var functionApply = functionApply$1; var aCallable$H = aCallable$V; var anObject$1p = anObject$1F; -var fails$s = fails$1d; +var fails$s = fails$1f; // MS Edge argumentsList argument is optional var OPTIONAL_ARGUMENTS_LIST = !fails$s(function () { @@ -7381,7 +7473,7 @@ var aConstructor$3 = aConstructor$5; var anObject$1o = anObject$1F; var isObject$c = isObject$C; var create$9 = objectCreate$1; -var fails$r = fails$1d; +var fails$r = fails$1f; var nativeConstruct = getBuiltIn$r('Reflect', 'construct'); var ObjectPrototype = Object.prototype; @@ -7400,9 +7492,9 @@ var ARGS_BUG = !fails$r(function () { nativeConstruct(function () { /* empty */ }); }); -var FORCED$b = NEW_TARGET_BUG || ARGS_BUG; +var FORCED$a = NEW_TARGET_BUG || ARGS_BUG; -$$2R({ target: 'Reflect', stat: true, forced: FORCED$b, sham: FORCED$b }, { +$$2R({ target: 'Reflect', stat: true, forced: FORCED$a, sham: FORCED$a }, { construct: function construct(Target, args /* , newTarget */) { aConstructor$3(Target); anObject$1o(args); @@ -7435,7 +7527,7 @@ var DESCRIPTORS$d = descriptors; var anObject$1n = anObject$1F; var toPropertyKey$2 = toPropertyKey$9; var definePropertyModule$2 = objectDefineProperty; -var fails$q = fails$1d; +var fails$q = fails$1f; // MS Edge has broken Reflect.defineProperty - throwing instead of returning false var ERROR_INSTEAD_OF_FALSE = fails$q(function () { @@ -7479,7 +7571,7 @@ var isDataDescriptor$2 = function (descriptor) { }; var $$2O = _export; -var call$K = functionCall; +var call$L = functionCall; var isObject$b = isObject$C; var anObject$1l = anObject$1F; var isDataDescriptor$1 = isDataDescriptor$2; @@ -7495,7 +7587,7 @@ function get(target, propertyKey /* , receiver */) { descriptor = getOwnPropertyDescriptorModule$3.f(target, propertyKey); if (descriptor) return isDataDescriptor$1(descriptor) ? descriptor.value - : descriptor.get === undefined ? undefined : call$K(descriptor.get, receiver); + : descriptor.get === undefined ? undefined : call$L(descriptor.get, receiver); if (isObject$b(prototype = getPrototypeOf$5(target))) return get(prototype, propertyKey, receiver); } @@ -7582,11 +7674,11 @@ $$2I({ target: 'Reflect', stat: true, sham: !FREEZING }, { }); var $$2H = _export; -var call$J = functionCall; +var call$K = functionCall; var anObject$1g = anObject$1F; var isObject$a = isObject$C; var isDataDescriptor = isDataDescriptor$2; -var fails$p = fails$1d; +var fails$p = fails$1f; var definePropertyModule$1 = objectDefineProperty; var getOwnPropertyDescriptorModule$1 = objectGetOwnPropertyDescriptor; var getPrototypeOf$4 = objectGetPrototypeOf$1; @@ -7614,7 +7706,7 @@ function set(target, propertyKey, V /* , receiver */) { } else { setter = ownDescriptor.set; if (setter === undefined) return false; - call$J(setter, receiver, V); + call$K(setter, receiver, V); } return true; } @@ -7652,14 +7744,14 @@ if (objectSetPrototypeOf) $$2G({ target: 'Reflect', stat: true }, { }); var $$2F = _export; -var global$U = global$1$; +var global$V = global$20; var setToStringTag$3 = setToStringTag$c; $$2F({ global: true }, { Reflect: {} }); // Reflect[@@toStringTag] property // https://tc39.es/ecma262/#sec-reflect-@@tostringtag -setToStringTag$3(global$U.Reflect, 'Reflect', true); +setToStringTag$3(global$V.Reflect, 'Reflect', true); var isObject$9 = isObject$C; var classof$7 = classofRaw$1; @@ -7690,11 +7782,11 @@ var regexpFlags$1 = function () { return result; }; -var fails$o = fails$1d; -var global$T = global$1$; +var fails$o = fails$1f; +var global$U = global$20; // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError -var $RegExp$2 = global$T.RegExp; +var $RegExp$2 = global$U.RegExp; var UNSUPPORTED_Y$3 = fails$o(function () { var re = $RegExp$2('a', 'y'); @@ -7721,22 +7813,22 @@ var regexpStickyHelpers = { UNSUPPORTED_Y: UNSUPPORTED_Y$3 }; -var fails$n = fails$1d; -var global$S = global$1$; +var fails$n = fails$1f; +var global$T = global$20; // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError -var $RegExp$1 = global$S.RegExp; +var $RegExp$1 = global$T.RegExp; var regexpUnsupportedDotAll = fails$n(function () { var re = $RegExp$1('.', 's'); return !(re.dotAll && re.exec('\n') && re.flags === 's'); }); -var fails$m = fails$1d; -var global$R = global$1$; +var fails$m = fails$1f; +var global$S = global$20; // babel-minify and Closure Compiler transpiles RegExp('(?b)', 'g') -> /(?b)/g and it causes SyntaxError -var $RegExp = global$R.RegExp; +var $RegExp = global$S.RegExp; var regexpUnsupportedNcg = fails$m(function () { var re = $RegExp('(?b)', 'g'); @@ -7745,7 +7837,7 @@ var regexpUnsupportedNcg = fails$m(function () { }); var DESCRIPTORS$b = descriptors; -var global$Q = global$1$; +var global$R = global$20; var uncurryThis$I = functionUncurryThis; var isForced = isForced_1; var inheritIfRequired$2 = inheritIfRequired$6; @@ -7758,18 +7850,18 @@ var toString$l = toString$w; var regExpFlags$5 = regexpFlags$1; var stickyHelpers$2 = regexpStickyHelpers; var redefine$8 = redefine$n.exports; -var fails$l = fails$1d; +var fails$l = fails$1f; var hasOwn$b = hasOwnProperty_1; -var enforceInternalState = internalState.enforce; +var enforceInternalState$1 = internalState.enforce; var setSpecies$2 = setSpecies$7; var wellKnownSymbol$i = wellKnownSymbol$H; var UNSUPPORTED_DOT_ALL$2 = regexpUnsupportedDotAll; var UNSUPPORTED_NCG$1 = regexpUnsupportedNcg; var MATCH$1 = wellKnownSymbol$i('match'); -var NativeRegExp = global$Q.RegExp; +var NativeRegExp = global$R.RegExp; var RegExpPrototype$7 = NativeRegExp.prototype; -var SyntaxError$2 = global$Q.SyntaxError; +var SyntaxError$2 = global$R.SyntaxError; var getFlags$4 = uncurryThis$I(regExpFlags$5); var exec$7 = uncurryThis$I(RegExpPrototype$7.exec); var charAt$c = uncurryThis$I(''.charAt); @@ -7907,7 +7999,7 @@ if (isForced('RegExp', BASE_FORCED)) { result = inheritIfRequired$2(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype$7, RegExpWrapper); if (dotAll || sticky || groups.length) { - state = enforceInternalState(result); + state = enforceInternalState$1(result); if (dotAll) { state.dotAll = true; state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags); @@ -7938,13 +8030,13 @@ if (isForced('RegExp', BASE_FORCED)) { RegExpPrototype$7.constructor = RegExpWrapper; RegExpWrapper.prototype = RegExpPrototype$7; - redefine$8(global$Q, 'RegExp', RegExpWrapper); + redefine$8(global$R, 'RegExp', RegExpWrapper); } // https://tc39.es/ecma262/#sec-get-regexp-@@species setSpecies$2('RegExp'); -var global$P = global$1$; +var global$Q = global$20; var DESCRIPTORS$a = descriptors; var UNSUPPORTED_DOT_ALL$1 = regexpUnsupportedDotAll; var classof$6 = classofRaw$1; @@ -7952,7 +8044,7 @@ var defineProperty$6 = objectDefineProperty.f; var getInternalState$d = internalState.get; var RegExpPrototype$6 = RegExp.prototype; -var TypeError$m = global$P.TypeError; +var TypeError$n = global$Q.TypeError; // `RegExp.prototype.dotAll` getter // https://tc39.es/ecma262/#sec-get-regexp.prototype.dotall @@ -7966,14 +8058,14 @@ if (DESCRIPTORS$a && UNSUPPORTED_DOT_ALL$1) { if (classof$6(this) === 'RegExp') { return !!getInternalState$d(this).dotAll; } - throw TypeError$m('Incompatible receiver, RegExp required'); + throw TypeError$n('Incompatible receiver, RegExp required'); } }); } /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */ /* eslint-disable regexp/no-useless-quantifier -- testing */ -var call$I = functionCall; +var call$J = functionCall; var uncurryThis$H = functionUncurryThis; var toString$k = toString$w; var regexpFlags = regexpFlags$1; @@ -7995,8 +8087,8 @@ var stringSlice$b = uncurryThis$H(''.slice); var UPDATES_LAST_INDEX_WRONG = (function () { var re1 = /a/; var re2 = /b*/g; - call$I(nativeExec, re1, 'a'); - call$I(nativeExec, re2, 'a'); + call$J(nativeExec, re1, 'a'); + call$J(nativeExec, re2, 'a'); return re1.lastIndex !== 0 || re2.lastIndex !== 0; })(); @@ -8017,14 +8109,14 @@ if (PATCH) { if (raw) { raw.lastIndex = re.lastIndex; - result = call$I(patchedExec, raw, str); + result = call$J(patchedExec, raw, str); re.lastIndex = raw.lastIndex; return result; } var groups = state.groups; var sticky = UNSUPPORTED_Y$1 && re.sticky; - var flags = call$I(regexpFlags, re); + var flags = call$J(regexpFlags, re); var source = re.source; var charsAdded = 0; var strCopy = str; @@ -8052,7 +8144,7 @@ if (PATCH) { } if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex; - match = call$I(nativeExec, sticky ? reCopy : re, strCopy); + match = call$J(nativeExec, sticky ? reCopy : re, strCopy); if (sticky) { if (match) { @@ -8067,7 +8159,7 @@ if (PATCH) { if (NPCG_INCLUDED && match && match.length > 1) { // Fix browsers whose `exec` methods don't consistently return `undefined` // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ - call$I(nativeReplace, match[0], reCopy, function () { + call$J(nativeReplace, match[0], reCopy, function () { for (i = 1; i < arguments.length - 2; i++) { if (arguments[i] === undefined) match[i] = undefined; } @@ -8100,23 +8192,23 @@ $$2E({ target: 'RegExp', proto: true, forced: /./.exec !== exec$6 }, { var DESCRIPTORS$9 = descriptors; var objectDefinePropertyModule = objectDefineProperty; var regExpFlags$4 = regexpFlags$1; -var fails$k = fails$1d; +var fails$k = fails$1f; var RegExpPrototype$5 = RegExp.prototype; -var FORCED$a = DESCRIPTORS$9 && fails$k(function () { +var FORCED$9 = DESCRIPTORS$9 && fails$k(function () { // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe return Object.getOwnPropertyDescriptor(RegExpPrototype$5, 'flags').get.call({ dotAll: true, sticky: true }) !== 'sy'; }); // `RegExp.prototype.flags` getter // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags -if (FORCED$a) objectDefinePropertyModule.f(RegExpPrototype$5, 'flags', { +if (FORCED$9) objectDefinePropertyModule.f(RegExpPrototype$5, 'flags', { configurable: true, get: regExpFlags$4 }); -var global$O = global$1$; +var global$P = global$20; var DESCRIPTORS$8 = descriptors; var MISSED_STICKY = regexpStickyHelpers.MISSED_STICKY; var classof$5 = classofRaw$1; @@ -8124,7 +8216,7 @@ var defineProperty$5 = objectDefineProperty.f; var getInternalState$b = internalState.get; var RegExpPrototype$4 = RegExp.prototype; -var TypeError$l = global$O.TypeError; +var TypeError$m = global$P.TypeError; // `RegExp.prototype.sticky` getter // https://tc39.es/ecma262/#sec-get-regexp.prototype.sticky @@ -8138,7 +8230,7 @@ if (DESCRIPTORS$8 && MISSED_STICKY) { if (classof$5(this) === 'RegExp') { return !!getInternalState$b(this).sticky; } - throw TypeError$l('Incompatible receiver, RegExp required'); + throw TypeError$m('Incompatible receiver, RegExp required'); } }); } @@ -8146,8 +8238,8 @@ if (DESCRIPTORS$8 && MISSED_STICKY) { // TODO: Remove from `core-js@4` since it's moved to entry points var $$2D = _export; -var global$N = global$1$; -var call$H = functionCall; +var global$O = global$20; +var call$I = functionCall; var uncurryThis$G = functionUncurryThis; var isCallable$b = isCallable$A; var isObject$8 = isObject$C; @@ -8162,7 +8254,7 @@ var DELEGATES_TO_EXEC = function () { return re.test('abc') === true && execCalled; }(); -var Error$4 = global$N.Error; +var Error$4 = global$O.Error; var un$Test = uncurryThis$G(/./.test); // `RegExp.prototype.test` method @@ -8171,7 +8263,7 @@ $$2D({ target: 'RegExp', proto: true, forced: !DELEGATES_TO_EXEC }, { test: function (str) { var exec = this.exec; if (!isCallable$b(exec)) return un$Test(this, str); - var result = call$H(exec, this, str); + var result = call$I(exec, this, str); if (result !== null && !isObject$8(result)) { throw new Error$4('RegExp exec method returned something other than an Object or null'); } @@ -8185,7 +8277,7 @@ var redefine$7 = redefine$n.exports; var anObject$1d = anObject$1F; var isPrototypeOf$4 = objectIsPrototypeOf; var $toString$2 = toString$w; -var fails$j = fails$1d; +var fails$j = fails$1f; var regExpFlags$3 = regexpFlags$1; var TO_STRING = 'toString'; @@ -8223,17 +8315,17 @@ var uncurryThis$E = functionUncurryThis; var requireObjectCoercible$e = requireObjectCoercible$k; var toIntegerOrInfinity$9 = toIntegerOrInfinity$m; var toString$j = toString$w; -var fails$i = fails$1d; +var fails$i = fails$1f; var charAt$a = uncurryThis$E(''.charAt); -var FORCED$9 = fails$i(function () { +var FORCED$8 = fails$i(function () { return '𠮷'.at(-2) !== '\uD842'; }); // `String.prototype.at` method // https://github.com/tc39/proposal-relative-indexing-method -$$2C({ target: 'String', proto: true, forced: FORCED$9 }, { +$$2C({ target: 'String', proto: true, forced: FORCED$8 }, { at: function at(index) { var S = toString$j(requireObjectCoercible$e(this)); var len = S.length; @@ -8291,14 +8383,14 @@ $$2B({ target: 'String', proto: true }, { } }); -var global$M = global$1$; +var global$N = global$20; var isRegExp$3 = isRegexp; -var TypeError$k = global$M.TypeError; +var TypeError$l = global$N.TypeError; var notARegexp = function (it) { if (isRegExp$3(it)) { - throw TypeError$k("The method doesn't accept regular expressions"); + throw TypeError$l("The method doesn't accept regular expressions"); } return it; }; @@ -8356,11 +8448,11 @@ $$2A({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG$1 && !CORRECT_IS }); var $$2z = _export; -var global$L = global$1$; +var global$M = global$20; var uncurryThis$B = functionUncurryThis; var toAbsoluteIndex$2 = toAbsoluteIndex$a; -var RangeError$9 = global$L.RangeError; +var RangeError$9 = global$M.RangeError; var fromCharCode$2 = String.fromCharCode; // eslint-disable-next-line es/no-string-fromcodepoint -- required for testing var $fromCodePoint = String.fromCodePoint; @@ -8444,7 +8536,7 @@ defineIterator(String, 'String', function (iterated) { var uncurryThis$z = functionUncurryThis; var redefine$6 = redefine$n.exports; var regexpExec$2 = regexpExec$3; -var fails$h = fails$1d; +var fails$h = fails$1f; var wellKnownSymbol$g = wellKnownSymbol$H; var createNonEnumerableProperty$8 = createNonEnumerableProperty$j; @@ -8521,29 +8613,29 @@ var advanceStringIndex$4 = function (S, index, unicode) { return index + (unicode ? charAt$7(S, index).length : 1); }; -var global$K = global$1$; -var call$G = functionCall; +var global$L = global$20; +var call$H = functionCall; var anObject$1c = anObject$1F; var isCallable$a = isCallable$A; var classof$4 = classofRaw$1; var regexpExec$1 = regexpExec$3; -var TypeError$j = global$K.TypeError; +var TypeError$k = global$L.TypeError; // `RegExpExec` abstract operation // https://tc39.es/ecma262/#sec-regexpexec var regexpExecAbstract = function (R, S) { var exec = R.exec; if (isCallable$a(exec)) { - var result = call$G(exec, R, S); + var result = call$H(exec, R, S); if (result !== null) anObject$1c(result); return result; } - if (classof$4(R) === 'RegExp') return call$G(regexpExec$1, R, S); - throw TypeError$j('RegExp#exec called on incompatible receiver'); + if (classof$4(R) === 'RegExp') return call$H(regexpExec$1, R, S); + throw TypeError$k('RegExp#exec called on incompatible receiver'); }; -var call$F = functionCall; +var call$G = functionCall; var fixRegExpWellKnownSymbolLogic$3 = fixRegexpWellKnownSymbolLogic; var anObject$1b = anObject$1F; var toLength$6 = toLength$d; @@ -8561,7 +8653,7 @@ fixRegExpWellKnownSymbolLogic$3('match', function (MATCH, nativeMatch, maybeCall function match(regexp) { var O = requireObjectCoercible$a(this); var matcher = regexp == undefined ? undefined : getMethod$d(regexp, MATCH); - return matcher ? call$F(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString$e(O)); + return matcher ? call$G(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString$e(O)); }, // `RegExp.prototype[@@match]` method // https://tc39.es/ecma262/#sec-regexp.prototype-@@match @@ -8592,8 +8684,8 @@ fixRegExpWellKnownSymbolLogic$3('match', function (MATCH, nativeMatch, maybeCall /* eslint-disable es/no-string-prototype-matchall -- safe */ var $$2x = _export; -var global$J = global$1$; -var call$E = functionCall; +var global$K = global$20; +var call$F = functionCall; var uncurryThis$y = functionUncurryThis; var createIteratorConstructor$5 = createIteratorConstructor$7; var requireObjectCoercible$9 = requireObjectCoercible$k; @@ -8606,7 +8698,7 @@ var isRegExp$2 = isRegexp; var regExpFlags$2 = regexpFlags$1; var getMethod$c = getMethod$h; var redefine$5 = redefine$n.exports; -var fails$g = fails$1d; +var fails$g = fails$1f; var wellKnownSymbol$f = wellKnownSymbol$H; var speciesConstructor$b = speciesConstructor$f; var advanceStringIndex$2 = advanceStringIndex$4; @@ -8620,7 +8712,7 @@ var REGEXP_STRING_ITERATOR = REGEXP_STRING + ' Iterator'; var setInternalState$d = InternalStateModule$d.set; var getInternalState$9 = InternalStateModule$d.getterFor(REGEXP_STRING_ITERATOR); var RegExpPrototype$1 = RegExp.prototype; -var TypeError$i = global$J.TypeError; +var TypeError$j = global$K.TypeError; var getFlags$2 = uncurryThis$y(regExpFlags$2); var stringIndexOf$2 = uncurryThis$y(''.indexOf); var un$MatchAll = uncurryThis$y(''.matchAll); @@ -8682,12 +8774,12 @@ $$2x({ target: 'String', proto: true, forced: WORKS_WITH_NON_GLOBAL_REGEX }, { ? regexp.flags : getFlags$2(regexp) )); - if (!~stringIndexOf$2(flags, 'g')) throw TypeError$i('`.matchAll` does not allow non-global regexes'); + if (!~stringIndexOf$2(flags, 'g')) throw TypeError$j('`.matchAll` does not allow non-global regexes'); } if (WORKS_WITH_NON_GLOBAL_REGEX) return un$MatchAll(O, regexp); matcher = getMethod$c(regexp, MATCH_ALL); if (matcher === undefined && IS_PURE$D && classof$3(regexp) == 'RegExp') matcher = $matchAll; - if (matcher) return call$E(matcher, regexp, O); + if (matcher) return call$F(matcher, regexp, O); } else if (WORKS_WITH_NON_GLOBAL_REGEX) return un$MatchAll(O, regexp); S = toString$d(O); rx = new RegExp(regexp, 'g'); @@ -8728,8 +8820,8 @@ $$2v({ target: 'String', proto: true, forced: WEBKIT_BUG }, { var $$2u = _export; var uncurryThis$x = functionUncurryThis; -var toIndexedObject$5 = toIndexedObject$j; -var toObject$d = toObject$A; +var toIndexedObject$6 = toIndexedObject$k; +var toObject$c = toObject$z; var toString$c = toString$w; var lengthOfArrayLike$f = lengthOfArrayLike$x; @@ -8740,7 +8832,7 @@ var join$5 = uncurryThis$x([].join); // https://tc39.es/ecma262/#sec-string.raw $$2u({ target: 'String', stat: true }, { raw: function raw(template) { - var rawTemplate = toIndexedObject$5(toObject$d(template).raw); + var rawTemplate = toIndexedObject$6(toObject$c(template).raw); var literalSegments = lengthOfArrayLike$f(rawTemplate); var argumentsLength = arguments.length; var elements = []; @@ -8763,7 +8855,7 @@ $$2t({ target: 'String', proto: true }, { }); var uncurryThis$w = functionUncurryThis; -var toObject$c = toObject$A; +var toObject$b = toObject$z; var floor$3 = Math.floor; var charAt$6 = uncurryThis$w(''.charAt); @@ -8779,7 +8871,7 @@ var getSubstitution$2 = function (matched, str, position, captures, namedCapture var m = captures.length; var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; if (namedCaptures !== undefined) { - namedCaptures = toObject$c(namedCaptures); + namedCaptures = toObject$b(namedCaptures); symbols = SUBSTITUTION_SYMBOLS; } return replace$4(replacement, symbols, function (match, ch) { @@ -8808,10 +8900,10 @@ var getSubstitution$2 = function (matched, str, position, captures, namedCapture }; var apply$j = functionApply$1; -var call$D = functionCall; +var call$E = functionCall; var uncurryThis$v = functionUncurryThis; var fixRegExpWellKnownSymbolLogic$2 = fixRegexpWellKnownSymbolLogic; -var fails$f = fails$1d; +var fails$f = fails$1f; var anObject$19 = anObject$1F; var isCallable$9 = isCallable$A; var toIntegerOrInfinity$7 = toIntegerOrInfinity$m; @@ -8873,8 +8965,8 @@ fixRegExpWellKnownSymbolLogic$2('replace', function (_, nativeReplace, maybeCall var O = requireObjectCoercible$8(this); var replacer = searchValue == undefined ? undefined : getMethod$b(searchValue, REPLACE$1); return replacer - ? call$D(replacer, searchValue, O, replaceValue) - : call$D(nativeReplace, toString$b(O), searchValue, replaceValue); + ? call$E(replacer, searchValue, O, replaceValue) + : call$E(nativeReplace, toString$b(O), searchValue, replaceValue); }, // `RegExp.prototype[@@replace]` method // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace @@ -8944,8 +9036,8 @@ fixRegExpWellKnownSymbolLogic$2('replace', function (_, nativeReplace, maybeCall }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE); var $$2s = _export; -var global$I = global$1$; -var call$C = functionCall; +var global$J = global$20; +var call$D = functionCall; var uncurryThis$u = functionUncurryThis; var requireObjectCoercible$7 = requireObjectCoercible$k; var isCallable$8 = isCallable$A; @@ -8958,7 +9050,7 @@ var wellKnownSymbol$d = wellKnownSymbol$H; var REPLACE = wellKnownSymbol$d('replace'); var RegExpPrototype = RegExp.prototype; -var TypeError$h = global$I.TypeError; +var TypeError$i = global$J.TypeError; var getFlags$1 = uncurryThis$u(regExpFlags$1); var indexOf = uncurryThis$u(''.indexOf); uncurryThis$u(''.replace); @@ -8987,11 +9079,11 @@ $$2s({ target: 'String', proto: true }, { ? searchValue.flags : getFlags$1(searchValue) )); - if (!~indexOf(flags, 'g')) throw TypeError$h('`.replaceAll` does not allow non-global regexes'); + if (!~indexOf(flags, 'g')) throw TypeError$i('`.replaceAll` does not allow non-global regexes'); } replacer = getMethod$a(searchValue, REPLACE); if (replacer) { - return call$C(replacer, searchValue, O, replaceValue); + return call$D(replacer, searchValue, O, replaceValue); } } string = toString$a(O); @@ -9016,7 +9108,7 @@ $$2s({ target: 'String', proto: true }, { } }); -var call$B = functionCall; +var call$C = functionCall; var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic; var anObject$18 = anObject$1F; var requireObjectCoercible$6 = requireObjectCoercible$k; @@ -9033,7 +9125,7 @@ fixRegExpWellKnownSymbolLogic$1('search', function (SEARCH, nativeSearch, maybeC function search(regexp) { var O = requireObjectCoercible$6(this); var searcher = regexp == undefined ? undefined : getMethod$9(regexp, SEARCH); - return searcher ? call$B(searcher, regexp, O) : new RegExp(regexp)[SEARCH](toString$9(O)); + return searcher ? call$C(searcher, regexp, O) : new RegExp(regexp)[SEARCH](toString$9(O)); }, // `RegExp.prototype[@@search]` method // https://tc39.es/ecma262/#sec-regexp.prototype-@@search @@ -9054,7 +9146,7 @@ fixRegExpWellKnownSymbolLogic$1('search', function (SEARCH, nativeSearch, maybeC }); var apply$i = functionApply$1; -var call$A = functionCall; +var call$B = functionCall; var uncurryThis$t = functionUncurryThis; var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic; var isRegExp = isRegexp; @@ -9069,7 +9161,7 @@ var arraySlice$7 = arraySliceSimple; var callRegExpExec = regexpExecAbstract; var regexpExec = regexpExec$3; var stickyHelpers = regexpStickyHelpers; -var fails$e = fails$1d; +var fails$e = fails$1f; var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y; var MAX_UINT32 = 0xFFFFFFFF; @@ -9111,7 +9203,7 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa if (separator === undefined) return [string]; // If `separator` is not a regex, use native split if (!isRegExp(separator)) { - return call$A(nativeSplit, string, separator, lim); + return call$B(nativeSplit, string, separator, lim); } var output = []; var flags = (separator.ignoreCase ? 'i' : '') + @@ -9122,7 +9214,7 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa // Make `global` and avoid `lastIndex` issues by working with a copy var separatorCopy = new RegExp(separator.source, flags + 'g'); var match, lastIndex, lastLength; - while (match = call$A(regexpExec, separatorCopy, string)) { + while (match = call$B(regexpExec, separatorCopy, string)) { lastIndex = separatorCopy.lastIndex; if (lastIndex > lastLastIndex) { push$d(output, stringSlice$6(string, lastLastIndex, match.index)); @@ -9141,7 +9233,7 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa // Chakra, V8 } else if ('0'.split(undefined, 0).length) { internalSplit = function (separator, limit) { - return separator === undefined && limit === 0 ? [] : call$A(nativeSplit, this, separator, limit); + return separator === undefined && limit === 0 ? [] : call$B(nativeSplit, this, separator, limit); }; } else internalSplit = nativeSplit; @@ -9152,8 +9244,8 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa var O = requireObjectCoercible$5(this); var splitter = separator == undefined ? undefined : getMethod$8(separator, SPLIT); return splitter - ? call$A(splitter, separator, O, limit) - : call$A(internalSplit, toString$8(O), separator, limit); + ? call$B(splitter, separator, O, limit) + : call$B(internalSplit, toString$8(O), separator, limit); }, // `RegExp.prototype[@@split]` method // https://tc39.es/ecma262/#sec-regexp.prototype-@@split @@ -9255,11 +9347,11 @@ var max$2 = Math.max; var min$2 = Math.min; // eslint-disable-next-line unicorn/prefer-string-slice -- required for testing -var FORCED$8 = !''.substr || 'ab'.substr(-1) !== 'b'; +var FORCED$7 = !''.substr || 'ab'.substr(-1) !== 'b'; // `String.prototype.substr` method // https://tc39.es/ecma262/#sec-string.prototype.substr -$$2q({ target: 'String', proto: true, forced: FORCED$8 }, { +$$2q({ target: 'String', proto: true, forced: FORCED$7 }, { substr: function substr(start, length) { var that = toString$6(requireObjectCoercible$3(this)); var size = that.length; @@ -9275,7 +9367,7 @@ $$2q({ target: 'String', proto: true, forced: FORCED$8 }, { }); var PROPER_FUNCTION_NAME = functionName.PROPER; -var fails$d = fails$1d; +var fails$d = fails$1f; var whitespaces = whitespaces$4; var non = '\u200B\u0085\u180E'; @@ -9306,9 +9398,9 @@ var $$2o = _export; var $trimEnd = stringTrim.end; var forcedStringTrimMethod$1 = stringTrimForced; -var FORCED$7 = forcedStringTrimMethod$1('trimEnd'); +var FORCED$6 = forcedStringTrimMethod$1('trimEnd'); -var trimEnd = FORCED$7 ? function trimEnd() { +var trimEnd = FORCED$6 ? function trimEnd() { return $trimEnd(this); // eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe } : ''.trimEnd; @@ -9316,7 +9408,7 @@ var trimEnd = FORCED$7 ? function trimEnd() { // `String.prototype.{ trimEnd, trimRight }` methods // https://tc39.es/ecma262/#sec-string.prototype.trimend // https://tc39.es/ecma262/#String.prototype.trimright -$$2o({ target: 'String', proto: true, name: 'trimEnd', forced: FORCED$7 }, { +$$2o({ target: 'String', proto: true, name: 'trimEnd', forced: FORCED$6 }, { trimEnd: trimEnd, trimRight: trimEnd }); @@ -9325,9 +9417,9 @@ var $$2n = _export; var $trimStart = stringTrim.start; var forcedStringTrimMethod = stringTrimForced; -var FORCED$6 = forcedStringTrimMethod('trimStart'); +var FORCED$5 = forcedStringTrimMethod('trimStart'); -var trimStart = FORCED$6 ? function trimStart() { +var trimStart = FORCED$5 ? function trimStart() { return $trimStart(this); // eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe } : ''.trimStart; @@ -9335,7 +9427,7 @@ var trimStart = FORCED$6 ? function trimStart() { // `String.prototype.{ trimStart, trimLeft }` methods // https://tc39.es/ecma262/#sec-string.prototype.trimstart // https://tc39.es/ecma262/#String.prototype.trimleft -$$2n({ target: 'String', proto: true, name: 'trimStart', forced: FORCED$6 }, { +$$2n({ target: 'String', proto: true, name: 'trimStart', forced: FORCED$5 }, { trimStart: trimStart, trimLeft: trimStart }); @@ -9356,7 +9448,7 @@ var createHtml = function (string, tag, attribute, value) { return p1 + '>' + S + ''; }; -var fails$c = fails$1d; +var fails$c = fails$1f; // check the existence of a method, lowercase // of a tag and escaping quotes in arguments @@ -9527,32 +9619,32 @@ var typedArrayConstructor = {exports: {}}; /* eslint-disable no-new -- required for testing */ -var global$H = global$1$; -var fails$b = fails$1d; +var global$I = global$20; +var fails$b = fails$1f; var checkCorrectnessOfIteration = checkCorrectnessOfIteration$4; var NATIVE_ARRAY_BUFFER_VIEWS$1 = arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; -var ArrayBuffer$2 = global$H.ArrayBuffer; -var Int8Array$2 = global$H.Int8Array; +var ArrayBuffer$2 = global$I.ArrayBuffer; +var Int8Array$3 = global$I.Int8Array; var typedArrayConstructorsRequireWrappers = !NATIVE_ARRAY_BUFFER_VIEWS$1 || !fails$b(function () { - Int8Array$2(1); + Int8Array$3(1); }) || !fails$b(function () { - new Int8Array$2(-1); + new Int8Array$3(-1); }) || !checkCorrectnessOfIteration(function (iterable) { - new Int8Array$2(); - new Int8Array$2(null); - new Int8Array$2(1.5); - new Int8Array$2(iterable); + new Int8Array$3(); + new Int8Array$3(null); + new Int8Array$3(1.5); + new Int8Array$3(iterable); }, true) || fails$b(function () { // Safari (11+) bug - a reason why even Safari 13 should load a typed array polyfill - return new Int8Array$2(new ArrayBuffer$2(2), 1, undefined).length !== 1; + return new Int8Array$3(new ArrayBuffer$2(2), 1, undefined).length !== 1; }); -var global$G = global$1$; +var global$H = global$20; var toIntegerOrInfinity$5 = toIntegerOrInfinity$m; -var RangeError$8 = global$G.RangeError; +var RangeError$8 = global$H.RangeError; var toPositiveInteger$5 = function (it) { var result = toIntegerOrInfinity$5(it); @@ -9560,10 +9652,10 @@ var toPositiveInteger$5 = function (it) { return result; }; -var global$F = global$1$; +var global$G = global$20; var toPositiveInteger$4 = toPositiveInteger$5; -var RangeError$7 = global$F.RangeError; +var RangeError$7 = global$G.RangeError; var toOffset$2 = function (it, BYTES) { var offset = toPositiveInteger$4(it); @@ -9572,9 +9664,9 @@ var toOffset$2 = function (it, BYTES) { }; var bind$j = functionBindContext; -var call$z = functionCall; +var call$A = functionCall; var aConstructor$2 = aConstructor$5; -var toObject$b = toObject$A; +var toObject$a = toObject$z; var lengthOfArrayLike$e = lengthOfArrayLike$x; var getIterator$8 = getIterator$b; var getIteratorMethod$5 = getIteratorMethod$9; @@ -9583,7 +9675,7 @@ var aTypedArrayConstructor$4 = arrayBufferViewCore.aTypedArrayConstructor; var typedArrayFrom$2 = function from(source /* , mapfn, thisArg */) { var C = aConstructor$2(this); - var O = toObject$b(source); + var O = toObject$a(source); var argumentsLength = arguments.length; var mapfn = argumentsLength > 1 ? arguments[1] : undefined; var mapping = mapfn !== undefined; @@ -9593,7 +9685,7 @@ var typedArrayFrom$2 = function from(source /* , mapfn, thisArg */) { iterator = getIterator$8(O, iteratorMethod); next = iterator.next; O = []; - while (!(step = call$z(next, iterator)).done) { + while (!(step = call$A(next, iterator)).done) { O.push(step.value); } } @@ -9609,8 +9701,8 @@ var typedArrayFrom$2 = function from(source /* , mapfn, thisArg */) { }; var $$29 = _export; -var global$E = global$1$; -var call$y = functionCall; +var global$F = global$20; +var call$z = functionCall; var DESCRIPTORS$7 = descriptors; var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS$3 = typedArrayConstructorsRequireWrappers; var ArrayBufferViewCore$A = arrayBufferViewCore; @@ -9644,7 +9736,7 @@ var setInternalState$c = InternalStateModule$c.set; var nativeDefineProperty = definePropertyModule.f; var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; var round = Math.round; -var RangeError$6 = global$E.RangeError; +var RangeError$6 = global$F.RangeError; var ArrayBuffer$1 = ArrayBufferModule.ArrayBuffer; var ArrayBufferPrototype = ArrayBuffer$1.prototype; var DataView$1 = ArrayBufferModule.DataView; @@ -9730,7 +9822,7 @@ if (DESCRIPTORS$7) { var CONSTRUCTOR_NAME = TYPE + (CLAMPED ? 'Clamped' : '') + 'Array'; var GETTER = 'get' + TYPE; var SETTER = 'set' + TYPE; - var NativeTypedArrayConstructor = global$E[CONSTRUCTOR_NAME]; + var NativeTypedArrayConstructor = global$F[CONSTRUCTOR_NAME]; var TypedArrayConstructor = NativeTypedArrayConstructor; var TypedArrayConstructorPrototype = TypedArrayConstructor && TypedArrayConstructor.prototype; var exported = {}; @@ -9784,7 +9876,7 @@ if (DESCRIPTORS$7) { } else if (isTypedArray(data)) { return fromList(TypedArrayConstructor, data); } else { - return call$y(typedArrayFrom$1, TypedArrayConstructor, data); + return call$z(typedArrayFrom$1, TypedArrayConstructor, data); } setInternalState$c(that, { buffer: buffer, @@ -9809,7 +9901,7 @@ if (DESCRIPTORS$7) { ? new NativeTypedArrayConstructor(data, toOffset$1(typedArrayOffset, BYTES)) : new NativeTypedArrayConstructor(data); if (isTypedArray(data)) return fromList(TypedArrayConstructor, data); - return call$y(typedArrayFrom$1, TypedArrayConstructor, data); + return call$z(typedArrayFrom$1, TypedArrayConstructor, data); }(), dummy, TypedArrayConstructor); }); @@ -9984,7 +10076,7 @@ exportTypedArrayMethod$v('every', function every(callbackfn /* , thisArg */) { }); var ArrayBufferViewCore$w = arrayBufferViewCore; -var call$x = functionCall; +var call$y = functionCall; var $fill = arrayFill$1; var aTypedArray$t = ArrayBufferViewCore$w.aTypedArray; @@ -9994,7 +10086,7 @@ var exportTypedArrayMethod$u = ArrayBufferViewCore$w.exportTypedArrayMethod; // https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill exportTypedArrayMethod$u('fill', function fill(value /* , start, end */) { var length = arguments.length; - return call$x( + return call$y( $fill, aTypedArray$t(this), value, @@ -10114,15 +10206,15 @@ exportTypedArrayMethod$o('indexOf', function indexOf(searchElement /* , fromInde return $indexOf(aTypedArray$n(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }); -var global$D = global$1$; -var fails$a = fails$1d; +var global$E = global$20; +var fails$a = fails$1f; var uncurryThis$o = functionUncurryThis; var ArrayBufferViewCore$o = arrayBufferViewCore; var ArrayIterators = es_array_iterator; var wellKnownSymbol$c = wellKnownSymbol$H; var ITERATOR$3 = wellKnownSymbol$c('iterator'); -var Uint8Array$1 = global$D.Uint8Array; +var Uint8Array$1 = global$E.Uint8Array; var arrayValues = uncurryThis$o(ArrayIterators.values); var arrayKeys = uncurryThis$o(ArrayIterators.keys); var arrayEntries = uncurryThis$o(ArrayIterators.entries); @@ -10265,20 +10357,34 @@ exportTypedArrayMethod$h('reverse', function reverse() { } return that; }); -var global$C = global$1$; +var global$D = global$20; +var call$x = functionCall; var ArrayBufferViewCore$g = arrayBufferViewCore; var lengthOfArrayLike$b = lengthOfArrayLike$x; var toOffset = toOffset$2; -var toObject$a = toObject$A; -var fails$9 = fails$1d; +var toIndexedObject$5 = toObject$z; +var fails$9 = fails$1f; -var RangeError$5 = global$C.RangeError; +var RangeError$5 = global$D.RangeError; +var Int8Array$2 = global$D.Int8Array; +var Int8ArrayPrototype = Int8Array$2 && Int8Array$2.prototype; +var $set = Int8ArrayPrototype && Int8ArrayPrototype.set; var aTypedArray$f = ArrayBufferViewCore$g.aTypedArray; var exportTypedArrayMethod$g = ArrayBufferViewCore$g.exportTypedArrayMethod; -var FORCED$5 = fails$9(function () { +var WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS = !fails$9(function () { // eslint-disable-next-line es/no-typed-arrays -- required for testing - new Int8Array(1).set({}); + var array = new Uint8ClampedArray(2); + call$x($set, array, { length: 1, 0: 3 }, 1); + return array[1] !== 3; +}); + +// https://bugs.chromium.org/p/v8/issues/detail?id=11294 and other +var TO_OBJECT_BUG = WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS && ArrayBufferViewCore$g.NATIVE_ARRAY_BUFFER_VIEWS && fails$9(function () { + var array = new Int8Array$2(2); + array.set(1); + array.set('2', 1); + return array[0] !== 0 || array[1] !== 2; }); // `%TypedArray%.prototype.set` method @@ -10286,17 +10392,18 @@ var FORCED$5 = fails$9(function () { exportTypedArrayMethod$g('set', function set(arrayLike /* , offset */) { aTypedArray$f(this); var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1); + var src = toIndexedObject$5(arrayLike); + if (WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS) return call$x($set, this, src, offset); var length = this.length; - var src = toObject$a(arrayLike); var len = lengthOfArrayLike$b(src); var index = 0; if (len + offset > length) throw RangeError$5('Wrong length'); while (index < len) this[offset + index] = src[index++]; -}, FORCED$5); +}, !WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS || TO_OBJECT_BUG); var ArrayBufferViewCore$f = arrayBufferViewCore; var typedArraySpeciesConstructor$2 = typedArraySpeciesConstructor$5; -var fails$8 = fails$1d; +var fails$8 = fails$1f; var arraySlice$6 = arraySlice$e; var aTypedArray$e = ArrayBufferViewCore$f.aTypedArray; @@ -10331,9 +10438,9 @@ exportTypedArrayMethod$e('some', function some(callbackfn /* , thisArg */) { return $some$1(aTypedArray$d(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); -var global$B = global$1$; +var global$C = global$20; var uncurryThis$m = functionUncurryThis; -var fails$7 = fails$1d; +var fails$7 = fails$1f; var aCallable$G = aCallable$V; var internalSort = arraySort$1; var ArrayBufferViewCore$d = arrayBufferViewCore; @@ -10342,10 +10449,10 @@ var IE_OR_EDGE = engineIsIeOrEdge; var V8 = engineV8Version; var WEBKIT = engineWebkitVersion; -var Array$7 = global$B.Array; +var Array$7 = global$C.Array; var aTypedArray$c = ArrayBufferViewCore$d.aTypedArray; var exportTypedArrayMethod$d = ArrayBufferViewCore$d.exportTypedArrayMethod; -var Uint16Array = global$B.Uint16Array; +var Uint16Array = global$C.Uint16Array; var un$Sort = Uint16Array && uncurryThis$m(Uint16Array.prototype.sort); // WebKit @@ -10424,13 +10531,13 @@ exportTypedArrayMethod$c('subarray', function subarray(begin, end) { ); }); -var global$A = global$1$; +var global$B = global$20; var apply$g = functionApply$1; var ArrayBufferViewCore$b = arrayBufferViewCore; -var fails$6 = fails$1d; +var fails$6 = fails$1f; var arraySlice$5 = arraySlice$e; -var Int8Array$1 = global$A.Int8Array; +var Int8Array$1 = global$B.Int8Array; var aTypedArray$a = ArrayBufferViewCore$b.aTypedArray; var exportTypedArrayMethod$b = ArrayBufferViewCore$b.exportTypedArrayMethod; var $toLocaleString = [].toLocaleString; @@ -10457,11 +10564,11 @@ exportTypedArrayMethod$b('toLocaleString', function toLocaleString() { }, FORCED$3); var exportTypedArrayMethod$a = arrayBufferViewCore.exportTypedArrayMethod; -var fails$5 = fails$1d; -var global$z = global$1$; +var fails$5 = fails$1f; +var global$A = global$20; var uncurryThis$l = functionUncurryThis; -var Uint8Array = global$z.Uint8Array; +var Uint8Array = global$A.Uint8Array; var Uint8ArrayPrototype = Uint8Array && Uint8Array.prototype || {}; var arrayToString = [].toString; var join$4 = uncurryThis$l([].join); @@ -10653,7 +10760,7 @@ var collectionWeak$2 = { } }; -var global$y = global$1$; +var global$z = global$20; var uncurryThis$i = functionUncurryThis; var redefineAll$5 = redefineAll$a; var InternalMetadataModule = internalMetadata.exports; @@ -10661,10 +10768,10 @@ var collection$1 = collection$4; var collectionWeak$1 = collectionWeak$2; var isObject$5 = isObject$C; var isExtensible = objectIsExtensible; -var enforceIternalState = internalState.enforce; +var enforceInternalState = internalState.enforce; var NATIVE_WEAK_MAP = nativeWeakMap; -var IS_IE11 = !global$y.ActiveXObject && 'ActiveXObject' in global$y; +var IS_IE11 = !global$z.ActiveXObject && 'ActiveXObject' in global$z; var InternalWeakMap; var wrapper = function (init) { @@ -10691,28 +10798,28 @@ if (NATIVE_WEAK_MAP && IS_IE11) { redefineAll$5(WeakMapPrototype, { 'delete': function (key) { if (isObject$5(key) && !isExtensible(key)) { - var state = enforceIternalState(this); + var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeDelete(this, key) || state.frozen['delete'](key); } return nativeDelete(this, key); }, has: function has(key) { if (isObject$5(key) && !isExtensible(key)) { - var state = enforceIternalState(this); + var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeHas(this, key) || state.frozen.has(key); } return nativeHas(this, key); }, get: function get(key) { if (isObject$5(key) && !isExtensible(key)) { - var state = enforceIternalState(this); + var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key); } return nativeGet(this, key); }, set: function set(key, value) { if (isObject$5(key) && !isExtensible(key)) { - var state = enforceIternalState(this); + var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value); } else nativeSet(this, key, value); @@ -10730,7 +10837,7 @@ collection('WeakSet', function (init) { return function WeakSet() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionWeak); -var global$x = global$1$; +var global$y = global$20; var shared$1 = sharedStore; var isCallable$7 = isCallable$A; var getPrototypeOf$3 = objectGetPrototypeOf$1; @@ -10739,7 +10846,7 @@ var wellKnownSymbol$b = wellKnownSymbol$H; var USE_FUNCTION_CONSTRUCTOR = 'USE_FUNCTION_CONSTRUCTOR'; var ASYNC_ITERATOR$3 = wellKnownSymbol$b('asyncIterator'); -var AsyncIterator = global$x.AsyncIterator; +var AsyncIterator = global$y.AsyncIterator; var PassedAsyncIteratorPrototype = shared$1.AsyncIteratorPrototype; var AsyncIteratorPrototype$4, prototype; @@ -10747,7 +10854,7 @@ if (PassedAsyncIteratorPrototype) { AsyncIteratorPrototype$4 = PassedAsyncIteratorPrototype; } else if (isCallable$7(AsyncIterator)) { AsyncIteratorPrototype$4 = AsyncIterator.prototype; -} else if (shared$1[USE_FUNCTION_CONSTRUCTOR] || global$x[USE_FUNCTION_CONSTRUCTOR]) { +} else if (shared$1[USE_FUNCTION_CONSTRUCTOR] || global$y[USE_FUNCTION_CONSTRUCTOR]) { try { // eslint-disable-next-line no-new-func -- we have no alternatives without usage of modern syntax prototype = getPrototypeOf$3(getPrototypeOf$3(getPrototypeOf$3(Function('return async function*(){}()')()))); @@ -10842,15 +10949,15 @@ var getAsyncIterator$3 = function (it, usingIterator) { return method ? anObject$14(call$w(method, it)) : new AsyncFromSyncIterator$3(getIterator$7(it)); }; -var global$w = global$1$; +var global$x = global$20; var entryVirtual = function (CONSTRUCTOR) { - return global$w[CONSTRUCTOR].prototype; + return global$x[CONSTRUCTOR].prototype; }; // https://github.com/tc39/proposal-iterator-helpers // https://github.com/tc39/proposal-array-from-async -var global$v = global$1$; +var global$w = global$20; var call$v = functionCall; var aCallable$F = aCallable$V; var anObject$13 = anObject$1F; @@ -10858,7 +10965,7 @@ var getBuiltIn$o = getBuiltIn$F; var getMethod$5 = getMethod$h; var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; -var TypeError$g = global$v.TypeError; +var TypeError$h = global$w.TypeError; var createMethod$1 = function (TYPE) { var IS_TO_ARRAY = TYPE == 0; @@ -10896,7 +11003,7 @@ var createMethod$1 = function (TYPE) { var loop = function () { try { if (IS_TO_ARRAY && (index > MAX_SAFE_INTEGER) && MAPPING) { - throw TypeError$g('The allowed number of iterations has been exceeded'); + throw TypeError$h('The allowed number of iterations has been exceeded'); } Promise.resolve(anObject$13(call$v(next, iterator))).then(function (step) { try { @@ -10944,7 +11051,7 @@ var asyncIteratorIteration = { }; var bind$i = functionBindContext; -var toObject$9 = toObject$A; +var toObject$9 = toObject$z; var isConstructor$3 = isConstructor$9; var getAsyncIterator$2 = getAsyncIterator$3; var getIterator$6 = getIterator$b; @@ -11019,7 +11126,7 @@ addToUnscopables$a('filterReject'); var bind$h = functionBindContext; var IndexedObject$2 = indexedObject; -var toObject$8 = toObject$A; +var toObject$8 = toObject$z; var lengthOfArrayLike$a = lengthOfArrayLike$x; // `Array.prototype.{ findLast, findLastIndex }` methods implementation @@ -11080,17 +11187,17 @@ $$23({ target: 'Array', proto: true }, { addToUnscopables$8('findLastIndex'); -var global$u = global$1$; +var global$v = global$20; var bind$g = functionBindContext; var uncurryThis$h = functionUncurryThis; var IndexedObject$1 = indexedObject; -var toObject$7 = toObject$A; +var toObject$7 = toObject$z; var toPropertyKey = toPropertyKey$9; var lengthOfArrayLike$9 = lengthOfArrayLike$x; var objectCreate = objectCreate$1; var arrayFromConstructorAndList$3 = arrayFromConstructorAndList$5; -var Array$6 = global$u.Array; +var Array$6 = global$v.Array; var push$c = uncurryThis$h([].push); var arrayGroupBy = function ($this, callbackfn, that, specificConstructor) { @@ -11138,7 +11245,7 @@ var getBuiltIn$m = getBuiltIn$F; var bind$f = functionBindContext; var uncurryThis$g = functionUncurryThis; var IndexedObject = indexedObject; -var toObject$6 = toObject$A; +var toObject$6 = toObject$z; var lengthOfArrayLike$8 = lengthOfArrayLike$x; var addToUnscopables$6 = addToUnscopables$l; @@ -11203,7 +11310,7 @@ $$20({ target: 'Array', stat: true }, { var DESCRIPTORS$6 = descriptors; var addToUnscopables$5 = addToUnscopables$l; -var toObject$5 = toObject$A; +var toObject$5 = toObject$z; var lengthOfArrayLike$7 = lengthOfArrayLike$x; var defineProperty$4 = objectDefineProperty.f; @@ -11224,7 +11331,7 @@ if (DESCRIPTORS$6 && !('lastIndex' in [])) { var DESCRIPTORS$5 = descriptors; var addToUnscopables$4 = addToUnscopables$l; -var toObject$4 = toObject$A; +var toObject$4 = toObject$z; var lengthOfArrayLike$6 = lengthOfArrayLike$x; var defineProperty$3 = objectDefineProperty.f; @@ -11261,12 +11368,12 @@ var arrayToReversed$2 = function (O, C) { }; var $$1$ = _export; -var global$t = global$1$; +var global$u = global$20; var arrayToReversed$1 = arrayToReversed$2; -var toIndexedObject$4 = toIndexedObject$j; +var toIndexedObject$4 = toIndexedObject$k; var addToUnscopables$3 = addToUnscopables$l; -var Array$5 = global$t.Array; +var Array$5 = global$u.Array; // `Array.prototype.toReversed` method // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed @@ -11279,15 +11386,15 @@ $$1$({ target: 'Array', proto: true }, { addToUnscopables$3('toReversed'); var $$1_ = _export; -var global$s = global$1$; +var global$t = global$20; var uncurryThis$f = functionUncurryThis; var aCallable$E = aCallable$V; -var toIndexedObject$3 = toIndexedObject$j; +var toIndexedObject$3 = toIndexedObject$k; var arrayFromConstructorAndList$2 = arrayFromConstructorAndList$5; var getVirtual = entryVirtual; var addToUnscopables$2 = addToUnscopables$l; -var Array$4 = global$s.Array; +var Array$4 = global$t.Array; var sort$1 = uncurryThis$f(getVirtual('Array').sort); // `Array.prototype.toSorted` method @@ -11340,13 +11447,13 @@ var arrayToSpliced$2 = function (O, C, args) { }; var $$1Z = _export; -var global$r = global$1$; -var toIndexedObject$2 = toIndexedObject$j; +var global$s = global$20; +var toIndexedObject$2 = toIndexedObject$k; var arraySlice$4 = arraySlice$e; var arrayToSpliced$1 = arrayToSpliced$2; var addToUnscopables$1 = addToUnscopables$l; -var Array$3 = global$r.Array; +var Array$3 = global$s.Array; // `Array.prototype.toSpliced` method // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSpliced @@ -11363,7 +11470,7 @@ var getBuiltIn$l = getBuiltIn$F; var uncurryThis$e = functionUncurryThis; var aCallable$D = aCallable$V; var lengthOfArrayLike$3 = lengthOfArrayLike$x; -var toObject$3 = toObject$A; +var toObject$3 = toObject$z; var arraySpeciesCreate = arraySpeciesCreate$6; var Map$4 = getBuiltIn$l('Map'); @@ -11407,11 +11514,11 @@ $$1Y({ target: 'Array', proto: true }, { addToUnscopables('uniqueBy'); -var global$q = global$1$; +var global$r = global$20; var lengthOfArrayLike$2 = lengthOfArrayLike$x; var toIntegerOrInfinity$2 = toIntegerOrInfinity$m; -var RangeError$4 = global$q.RangeError; +var RangeError$4 = global$r.RangeError; // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.with // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.with @@ -11427,11 +11534,11 @@ var arrayWith$2 = function (O, C, index, value) { }; var $$1X = _export; -var global$p = global$1$; +var global$q = global$20; var arrayWith$1 = arrayWith$2; -var toIndexedObject$1 = toIndexedObject$j; +var toIndexedObject$1 = toIndexedObject$k; -var Array$2 = global$p.Array; +var Array$2 = global$q.Array; // `Array.prototype.with` method // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.with @@ -11756,7 +11863,7 @@ $$1P({ target: 'AsyncIterator', proto: true, real: true }, { var $$1O = _export; var apply$b = functionApply$1; var anObject$Z = anObject$1F; -var toObject$2 = toObject$A; +var toObject$2 = toObject$z; var isPrototypeOf$1 = objectIsPrototypeOf; var AsyncIteratorPrototype = asyncIteratorPrototype; var createAsyncIteratorProxy$2 = asyncIteratorCreateProxy; @@ -11823,14 +11930,14 @@ $$1N({ target: 'AsyncIterator', proto: true, real: true }, { // https://github.com/tc39/proposal-iterator-helpers var $$1M = _export; -var global$o = global$1$; +var global$p = global$20; var call$s = functionCall; var aCallable$y = aCallable$V; var anObject$X = anObject$1F; var getBuiltIn$j = getBuiltIn$F; var Promise$1 = getBuiltIn$j('Promise'); -var TypeError$f = global$o.TypeError; +var TypeError$g = global$p.TypeError; $$1M({ target: 'AsyncIterator', proto: true, real: true }, { reduce: function reduce(reducer /* , initialValue */) { @@ -11846,7 +11953,7 @@ $$1M({ target: 'AsyncIterator', proto: true, real: true }, { Promise$1.resolve(anObject$X(call$s(next, iterator))).then(function (step) { try { if (anObject$X(step).done) { - noInitial ? reject(TypeError$f('Reduce of empty iterator with no initial value')) : resolve(accumulator); + noInitial ? reject(TypeError$g('Reduce of empty iterator with no initial value')) : resolve(accumulator); } else { var value = step.value; if (noInitial) { @@ -11923,11 +12030,11 @@ $$1J({ target: 'AsyncIterator', proto: true, real: true }, { } }); -var global$n = global$1$; +var global$o = global$20; var InternalStateModule$8 = internalState; var createIteratorConstructor$4 = createIteratorConstructor$7; var isObject$4 = isObject$C; -var defineProperties$2 = objectDefineProperties; +var defineProperties$2 = objectDefineProperties.f; var DESCRIPTORS$4 = descriptors; var INCORRECT_RANGE = 'Incorrect Number.range arguments'; @@ -11936,12 +12043,12 @@ var NUMERIC_RANGE_ITERATOR = 'NumericRangeIterator'; var setInternalState$8 = InternalStateModule$8.set; var getInternalState$5 = InternalStateModule$8.getterFor(NUMERIC_RANGE_ITERATOR); -var RangeError$3 = global$n.RangeError; -var TypeError$e = global$n.TypeError; +var RangeError$3 = global$o.RangeError; +var TypeError$f = global$o.TypeError; var $RangeIterator = createIteratorConstructor$4(function NumericRangeIterator(start, end, option, type, zero, one) { if (typeof start != type || (end !== Infinity && end !== -Infinity && typeof end != type)) { - throw new TypeError$e(INCORRECT_RANGE); + throw new TypeError$f(INCORRECT_RANGE); } if (start === Infinity || start === -Infinity) { throw new RangeError$3(INCORRECT_RANGE); @@ -11957,13 +12064,13 @@ var $RangeIterator = createIteratorConstructor$4(function NumericRangeIterator(s } else if (typeof option == type) { step = option; } else { - throw new TypeError$e(INCORRECT_RANGE); + throw new TypeError$f(INCORRECT_RANGE); } if (step == null) { step = ifIncrease ? one : -one; } if (typeof step != type) { - throw new TypeError$e(INCORRECT_RANGE); + throw new TypeError$f(INCORRECT_RANGE); } if (step === Infinity || step === -Infinity || (step === zero && start !== end)) { throw new RangeError$3(INCORRECT_RANGE); @@ -12046,13 +12153,13 @@ if (typeof BigInt == 'function') { // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` -var global$m = global$1$; +var global$n = global$20; var getBuiltIn$i = getBuiltIn$F; var create$4 = objectCreate$1; var isObject$3 = isObject$C; -var Object$3 = global$m.Object; -var TypeError$d = global$m.TypeError; +var Object$3 = global$n.Object; +var TypeError$e = global$n.TypeError; var Map$3 = getBuiltIn$i('Map'); var WeakMap$2 = getBuiltIn$i('WeakMap'); @@ -12088,20 +12195,20 @@ var compositeKey = function () { for (i = 0; i < length; i++) { if (isObject$3(it = arguments[i])) active = active.next(i, it, true); } - if (this === Object$3 && active === root) throw TypeError$d('Composite keys must contain a non-primitive component'); + if (this === Object$3 && active === root) throw TypeError$e('Composite keys must contain a non-primitive component'); for (i = 0; i < length; i++) { if (!isObject$3(it = arguments[i])) active = active.next(i, it, false); } return active; }; var $$1H = _export; -var global$l = global$1$; +var global$m = global$20; var apply$8 = functionApply$1; var getCompositeKeyNode$1 = compositeKey; var getBuiltIn$h = getBuiltIn$F; var create$3 = objectCreate$1; -var Object$2 = global$l.Object; +var Object$2 = global$m.Object; var initializer = function () { var freeze = getBuiltIn$h('Object', 'freeze'); @@ -12181,18 +12288,18 @@ $$1D({ target: 'Function', proto: true }, { // https://github.com/tc39/proposal-iterator-helpers var $$1C = _export; -var global$k = global$1$; +var global$l = global$20; var anInstance$5 = anInstance$d; var isCallable$6 = isCallable$A; var createNonEnumerableProperty$4 = createNonEnumerableProperty$j; -var fails$4 = fails$1d; +var fails$4 = fails$1f; var hasOwn$6 = hasOwnProperty_1; var wellKnownSymbol$5 = wellKnownSymbol$H; var IteratorPrototype$2 = iteratorsCore.IteratorPrototype; var TO_STRING_TAG$2 = wellKnownSymbol$5('toStringTag'); -var NativeIterator = global$k.Iterator; +var NativeIterator = global$l.Iterator; // FF56- have non-standard global helper `Iterator` var FORCED$2 = !isCallable$6(NativeIterator) @@ -12394,7 +12501,7 @@ $$1x({ target: 'Iterator', proto: true, real: true }, { // https://github.com/tc39/proposal-iterator-helpers var $$1w = _export; -var global$j = global$1$; +var global$k = global$20; var call$o = functionCall; var aCallable$s = aCallable$V; var anObject$P = anObject$1F; @@ -12402,7 +12509,7 @@ var getIteratorMethod$2 = getIteratorMethod$9; var createIteratorProxy$3 = iteratorCreateProxy; var iteratorClose$1 = iteratorClose$4; -var TypeError$c = global$j.TypeError; +var TypeError$d = global$k.TypeError; var IteratorProxy$3 = createIteratorProxy$3(function () { var iterator = this.iterator; @@ -12425,7 +12532,7 @@ var IteratorProxy$3 = createIteratorProxy$3(function () { iteratorMethod = getIteratorMethod$2(mapped); if (!iteratorMethod) { - throw TypeError$c('.flatMap callback should return an iterable object'); + throw TypeError$d('.flatMap callback should return an iterable object'); } this.innerIterator = innerIterator = anObject$P(call$o(iteratorMethod, mapped)); @@ -12462,7 +12569,7 @@ $$1v({ target: 'Iterator', proto: true, real: true }, { var $$1u = _export; var apply$3 = functionApply$1; var anObject$N = anObject$1F; -var toObject$1 = toObject$A; +var toObject$1 = toObject$z; var isPrototypeOf = objectIsPrototypeOf; var IteratorPrototype = iteratorsCore.IteratorPrototype; var createIteratorProxy$2 = iteratorCreateProxy; @@ -12515,12 +12622,12 @@ $$1t({ target: 'Iterator', proto: true, real: true }, { // https://github.com/tc39/proposal-iterator-helpers var $$1s = _export; -var global$i = global$1$; +var global$j = global$20; var iterate$w = iterate$I; var aCallable$q = aCallable$V; var anObject$L = anObject$1F; -var TypeError$b = global$i.TypeError; +var TypeError$c = global$j.TypeError; $$1s({ target: 'Iterator', proto: true, real: true }, { reduce: function reduce(reducer /* , initialValue */) { @@ -12536,7 +12643,7 @@ $$1s({ target: 'Iterator', proto: true, real: true }, { accumulator = reducer(accumulator, value); } }, { IS_ITERATOR: true }); - if (noInitial) throw TypeError$b('Reduce of empty iterator with no initial value'); + if (noInitial) throw TypeError$c('Reduce of empty iterator with no initial value'); return accumulator; } }); @@ -12949,7 +13056,7 @@ var iterate$i = iterate$I; // https://github.com/tc39/proposal-collection-methods $$1a({ target: 'Map', proto: true, real: true, forced: IS_PURE$r }, { // eslint-disable-next-line no-unused-vars -- required for `.length` - merge: function merge(iterable /* ...iterbles */) { + merge: function merge(iterable /* ...iterables */) { var map = anObject$x(this); var setter = aCallable$g(map.set); var argumentsLength = arguments.length; @@ -12978,14 +13085,14 @@ $$19({ target: 'Map', stat: true }, { }); var $$18 = _export; -var global$h = global$1$; +var global$i = global$20; var IS_PURE$q = isPure; var anObject$w = anObject$1F; var aCallable$f = aCallable$V; var getMapIterator$1 = getMapIterator$a; var iterate$h = iterate$I; -var TypeError$a = global$h.TypeError; +var TypeError$b = global$i.TypeError; // `Map.prototype.reduce` method // https://github.com/tc39/proposal-collection-methods @@ -13004,7 +13111,7 @@ $$18({ target: 'Map', proto: true, real: true, forced: IS_PURE$q }, { accumulator = callbackfn(accumulator, value, key, map); } }, { AS_ENTRIES: true, IS_ITERATOR: true }); - if (noInitial) throw TypeError$a('Reduce of empty map with no initial value'); + if (noInitial) throw TypeError$b('Reduce of empty map with no initial value'); return accumulator; } }); @@ -13031,12 +13138,12 @@ $$17({ target: 'Map', proto: true, real: true, forced: IS_PURE$p }, { var IS_PURE$o = isPure; var $$16 = _export; -var global$g = global$1$; +var global$h = global$20; var call$e = functionCall; var anObject$u = anObject$1F; var aCallable$e = aCallable$V; -var TypeError$9 = global$g.TypeError; +var TypeError$a = global$h.TypeError; // `Set.prototype.update` method // https://github.com/tc39/proposal-collection-methods @@ -13050,7 +13157,7 @@ $$16({ target: 'Map', proto: true, real: true, forced: IS_PURE$o }, { aCallable$e(callback); var isPresentInMap = call$e(has, map, key); if (!isPresentInMap && length < 3) { - throw TypeError$9('Updating absent value'); + throw TypeError$a('Updating absent value'); } var value = isPresentInMap ? call$e(get, map, key) : aCallable$e(length > 2 ? arguments[2] : undefined)(key, map); call$e(set, map, key, callback(value, key, map)); @@ -13058,13 +13165,13 @@ $$16({ target: 'Map', proto: true, real: true, forced: IS_PURE$o }, { } }); -var global$f = global$1$; +var global$g = global$20; var call$d = functionCall; var aCallable$d = aCallable$V; var isCallable$5 = isCallable$A; var anObject$t = anObject$1F; -var TypeError$8 = global$f.TypeError; +var TypeError$9 = global$g.TypeError; // `Map.prototype.upsert` method // https://github.com/thumbsupep/proposal-upsert @@ -13076,7 +13183,7 @@ var mapUpsert = function upsert(key, updateFn /* , insertFn */) { var insertFn = arguments.length > 2 ? arguments[2] : undefined; var value; if (!isCallable$5(updateFn) && !isCallable$5(insertFn)) { - throw TypeError$8('At least one callback required'); + throw TypeError$9('At least one callback required'); } if (call$d(has, map, key)) { value = call$d(get, map, key); @@ -13249,7 +13356,7 @@ $$W({ target: 'Math', stat: true }, { }); var $$V = _export; -var global$e = global$1$; +var global$f = global$20; var anObject$s = anObject$1F; var numberIsFinite = numberIsFinite$2; var createIteratorConstructor$3 = createIteratorConstructor$7; @@ -13260,7 +13367,7 @@ var SEEDED_RANDOM_GENERATOR = SEEDED_RANDOM + ' Generator'; var SEED_TYPE_ERROR = 'Math.seededPRNG() argument should have a "seed" field with a finite value.'; var setInternalState$6 = InternalStateModule$6.set; var getInternalState$3 = InternalStateModule$6.getterFor(SEEDED_RANDOM_GENERATOR); -var TypeError$7 = global$e.TypeError; +var TypeError$8 = global$f.TypeError; var $SeededRandomGenerator = createIteratorConstructor$3(function SeededRandomGenerator(seed) { setInternalState$6(this, { @@ -13279,7 +13386,7 @@ var $SeededRandomGenerator = createIteratorConstructor$3(function SeededRandomGe $$V({ target: 'Math', stat: true, forced: true }, { seededPRNG: function seededPRNG(it) { var seed = anObject$s(it).seed; - if (!numberIsFinite(seed)) throw TypeError$7(SEED_TYPE_ERROR); + if (!numberIsFinite(seed)) throw TypeError$8(SEED_TYPE_ERROR); return new $SeededRandomGenerator(seed); } }); @@ -13314,16 +13421,16 @@ $$T({ target: 'Math', stat: true }, { }); var $$S = _export; -var global$d = global$1$; +var global$e = global$20; var uncurryThis$a = functionUncurryThis; var toIntegerOrInfinity$1 = toIntegerOrInfinity$m; var parseInt$2 = numberParseInt; var INVALID_NUMBER_REPRESENTATION = 'Invalid number representation'; var INVALID_RADIX = 'Invalid radix'; -var RangeError$2 = global$d.RangeError; -var SyntaxError$1 = global$d.SyntaxError; -var TypeError$6 = global$d.TypeError; +var RangeError$2 = global$e.RangeError; +var SyntaxError$1 = global$e.SyntaxError; +var TypeError$7 = global$e.TypeError; var valid = /^[\da-z]+$/; var charAt$4 = uncurryThis$a(''.charAt); var exec$2 = uncurryThis$a(valid.exec); @@ -13336,7 +13443,7 @@ $$S({ target: 'Number', stat: true }, { fromString: function fromString(string, radix) { var sign = 1; var R, mathNum; - if (typeof string != 'string') throw TypeError$6(INVALID_NUMBER_REPRESENTATION); + if (typeof string != 'string') throw TypeError$7(INVALID_NUMBER_REPRESENTATION); if (!string.length) throw SyntaxError$1(INVALID_NUMBER_REPRESENTATION); if (charAt$4(string, 0) == '-') { sign = -1; @@ -13367,7 +13474,7 @@ var InternalStateModule$5 = internalState; var createIteratorConstructor$2 = createIteratorConstructor$7; var hasOwn$5 = hasOwnProperty_1; var objectKeys$1 = objectKeys$6; -var toObject = toObject$A; +var toObject = toObject$z; var OBJECT_ITERATOR = 'Object Iterator'; var setInternalState$5 = InternalStateModule$5.set; @@ -13435,7 +13542,7 @@ $$O({ target: 'Object', stat: true }, { // https://github.com/tc39/proposal-observable var $$N = _export; -var global$c = global$1$; +var global$d = global$20; var call$c = functionCall; var DESCRIPTORS$2 = descriptors; var setSpecies = setSpecies$7; @@ -13464,7 +13571,7 @@ var setInternalState$4 = InternalStateModule$4.set; var getObservableInternalState = getterFor$1(OBSERVABLE); var getSubscriptionInternalState = getterFor$1(SUBSCRIPTION); var getSubscriptionObserverInternalState = getterFor$1(SUBSCRIPTION_OBSERVER); -var Array$1 = global$c.Array; +var Array$1 = global$d.Array; var SubscriptionState = function (observer) { this.observer = anObject$r(observer); @@ -14206,14 +14313,14 @@ $$p({ target: 'Set', stat: true }, { }); var $$o = _export; -var global$b = global$1$; +var global$c = global$20; var IS_PURE$9 = isPure; var aCallable$3 = aCallable$V; var anObject$6 = anObject$1F; var getSetIterator$1 = getSetIterator$7; var iterate$4 = iterate$I; -var TypeError$5 = global$b.TypeError; +var TypeError$6 = global$c.TypeError; // `Set.prototype.reduce` method // https://github.com/tc39/proposal-collection-methods @@ -14232,7 +14339,7 @@ $$o({ target: 'Set', proto: true, real: true, forced: IS_PURE$9 }, { accumulator = callbackfn(accumulator, value, value, set); } }, { IS_ITERATOR: true }); - if (noInitial) throw TypeError$5('Reduce of empty set with no initial value'); + if (noInitial) throw TypeError$6('Reduce of empty set with no initial value'); return accumulator; } }); @@ -14302,7 +14409,7 @@ $$l({ target: 'Set', proto: true, real: true, forced: IS_PURE$6 }, { var $$k = _export; var charAt$3 = stringMultibyte.charAt; -var fails$3 = fails$1d; +var fails$3 = fails$1f; var requireObjectCoercible$1 = requireObjectCoercible$k; var toIntegerOrInfinity = toIntegerOrInfinity$m; var toString$2 = toString$w; @@ -14324,13 +14431,13 @@ $$k({ target: 'String', proto: true, forced: FORCED$1 }, { }); var $$j = _export; -var global$a = global$1$; +var global$b = global$20; var uncurryThis$6 = functionUncurryThis; -var toIndexedObject = toIndexedObject$j; +var toIndexedObject = toIndexedObject$k; var toString$1 = toString$w; var lengthOfArrayLike$1 = lengthOfArrayLike$x; -var TypeError$4 = global$a.TypeError; +var TypeError$5 = global$b.TypeError; var ArrayPrototype = Array.prototype; var push$4 = uncurryThis$6(ArrayPrototype.push); var join$3 = uncurryThis$6(ArrayPrototype.join); @@ -14346,7 +14453,7 @@ $$j({ target: 'String', stat: true }, { var i = 0; while (literalSegments > i) { var nextVal = cookedTemplate[i++]; - if (nextVal === undefined) throw TypeError$4('Incorrect template'); + if (nextVal === undefined) throw TypeError$5('Incorrect template'); push$4(elements, toString$1(nextVal)); if (i === literalSegments) return join$3(elements, ''); if (i < argumentsLength) push$4(elements, toString$1(arguments[i])); @@ -14735,7 +14842,7 @@ var DOMTokenListPrototype$2 = classList && classList.constructor && classList.co var domTokenListPrototype = DOMTokenListPrototype$2 === Object.prototype ? undefined : DOMTokenListPrototype$2; -var global$9 = global$1$; +var global$a = global$20; var DOMIterables$1 = domIterables; var DOMTokenListPrototype$1 = domTokenListPrototype; var forEach = arrayForEach; @@ -14752,13 +14859,13 @@ var handlePrototype$1 = function (CollectionPrototype) { for (var COLLECTION_NAME$1 in DOMIterables$1) { if (DOMIterables$1[COLLECTION_NAME$1]) { - handlePrototype$1(global$9[COLLECTION_NAME$1] && global$9[COLLECTION_NAME$1].prototype); + handlePrototype$1(global$a[COLLECTION_NAME$1] && global$a[COLLECTION_NAME$1].prototype); } } handlePrototype$1(DOMTokenListPrototype$1); -var global$8 = global$1$; +var global$9 = global$20; var DOMIterables = domIterables; var DOMTokenListPrototype = domTokenListPrototype; var ArrayIteratorMethods = es_array_iterator; @@ -14792,7 +14899,7 @@ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) { }; for (var COLLECTION_NAME in DOMIterables) { - handlePrototype(global$8[COLLECTION_NAME] && global$8[COLLECTION_NAME].prototype, COLLECTION_NAME); + handlePrototype(global$9[COLLECTION_NAME] && global$9[COLLECTION_NAME].prototype, COLLECTION_NAME); } handlePrototype(DOMTokenListPrototype, 'DOMTokenList'); @@ -14837,11 +14944,11 @@ var domExceptionConstants = { var $$8 = _export; var tryNodeRequire = tryNodeRequire$1; var getBuiltIn$3 = getBuiltIn$F; -var fails$2 = fails$1d; +var fails$2 = fails$1f; var create$1 = objectCreate$1; var createPropertyDescriptor$2 = createPropertyDescriptor$c; var defineProperty$1 = objectDefineProperty.f; -var defineProperties$1 = objectDefineProperties; +var defineProperties$1 = objectDefineProperties.f; var redefine$2 = redefine$n.exports; var hasOwn$4 = hasOwnProperty_1; var anInstance$3 = anInstance$d; @@ -15039,10 +15146,10 @@ var DOM_EXCEPTION = 'DOMException'; setToStringTag$2(getBuiltIn$1(DOM_EXCEPTION), DOM_EXCEPTION); var $$6 = _export; -var global$7 = global$1$; +var global$8 = global$20; var task = task$2; -var FORCED = !global$7.setImmediate || !global$7.clearImmediate; +var FORCED = !global$8.setImmediate || !global$8.clearImmediate; // http://w3c.github.io/setImmediate/ $$6({ global: true, bind: true, enumerable: true, forced: FORCED }, { @@ -15055,11 +15162,11 @@ $$6({ global: true, bind: true, enumerable: true, forced: FORCED }, { }); var $$5 = _export; -var global$6 = global$1$; +var global$7 = global$20; var microtask = microtask$2; var IS_NODE = engineIsNode; -var process = global$6.process; +var process = global$7.process; // `queueMicrotask` method // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask @@ -15070,11 +15177,20 @@ $$5({ global: true, enumerable: true, noTargetGet: true }, { } }); +var global$6 = global$20; + +var TypeError$4 = global$6.TypeError; + +var validateArgumentsLength$2 = function (passed, required) { + if (passed < required) throw TypeError$4('Not enough arguments'); + return passed; +}; + var $$4 = _export; -var global$5 = global$1$; +var global$5 = global$20; var getBuiltin = getBuiltIn$F; var uncurryThis$3 = functionUncurryThis; -var fails$1 = fails$1d; +var fails$1 = fails$1f; var uid = uid$6; var isCallable$2 = isCallable$A; var isConstructor = isConstructor$9; @@ -15087,6 +15203,7 @@ var hasOwn$2 = hasOwnProperty_1; var createProperty = createProperty$9; var createNonEnumerableProperty = createNonEnumerableProperty$j; var lengthOfArrayLike = lengthOfArrayLike$x; +var validateArgumentsLength$1 = validateArgumentsLength$2; var regExpFlags = regexpFlags$1; var ERROR_STACK_INSTALLABLE = errorStackInstallable; @@ -15114,7 +15231,7 @@ var mapSet = uncurryThis$3(MapPrototype.set); var setAdd = uncurryThis$3(Set$1.prototype.add); var objectKeys = getBuiltin('Object', 'keys'); var push$3 = uncurryThis$3([].push); -var bolleanValueOf = uncurryThis$3(true.valueOf); +var booleanValueOf = uncurryThis$3(true.valueOf); var numberValueOf = uncurryThis$3(1.0.valueOf); var stringValueOf = uncurryThis$3(''.valueOf); var getFlags = uncurryThis$3(regExpFlags); @@ -15319,7 +15436,7 @@ var structuredCloneInternal = function (value, map) { cloned = Object$1(value.valueOf()); break; case 'Boolean': - cloned = Object$1(bolleanValueOf(value)); + cloned = Object$1(booleanValueOf(value)); break; case 'Number': cloned = Object$1(numberValueOf(value)); @@ -15349,7 +15466,7 @@ var structuredCloneInternal = function (value, map) { } } } catch (error) { - throw new DOMException('ArrayBuffer is deatched', DATA_CLONE_ERROR); + throw new DOMException('ArrayBuffer is detached', DATA_CLONE_ERROR); } break; case 'SharedArrayBuffer': // SharedArrayBuffer should use shared memory, we can't polyfill it, so return the original @@ -15518,7 +15635,7 @@ var tryToTransfer = function (rawTransfer, map) { $$4({ global: true, enumerable: true, sham: !PROPER_TRANSFER, forced: FORCED_REPLACEMENT }, { structuredClone: function structuredClone(value /* , { transfer } */) { - var options = arguments.length > 1 ? anObject$1(arguments[1]) : undefined; + var options = validateArgumentsLength$1(arguments.length, 1) > 1 ? anObject$1(arguments[1]) : undefined; var transfer = options ? options.transfer : undefined; var map; @@ -15532,7 +15649,7 @@ $$4({ global: true, enumerable: true, sham: !PROPER_TRANSFER, forced: FORCED_REP }); var $$3 = _export; -var global$4 = global$1$; +var global$4 = global$20; var apply = functionApply$1; var isCallable$1 = isCallable$A; var userAgent = engineUserAgent; @@ -15562,13 +15679,14 @@ $$3({ global: true, bind: true, forced: MSIE }, { setInterval: wrap(global$4.setInterval) }); -var fails = fails$1d; +var fails = fails$1f; var wellKnownSymbol$1 = wellKnownSymbol$H; var IS_PURE = isPure; var ITERATOR$1 = wellKnownSymbol$1('iterator'); var nativeUrl = !fails(function () { + // eslint-disable-next-line unicorn/relative-url-style -- required for testing var url = new URL('b?a=1&b=2&c=3', 'http://a'); var searchParams = url.searchParams; var result = ''; @@ -15597,7 +15715,7 @@ var nativeUrl = !fails(function () { }); // based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js -var global$3 = global$1$; +var global$3 = global$20; var uncurryThis$2 = functionUncurryThis; var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 @@ -15781,7 +15899,7 @@ var stringPunycodeToAscii = function (input) { // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` var $$2 = _export; -var global$2 = global$1$; +var global$2 = global$20; var getBuiltIn = getBuiltIn$F; var call$1 = functionCall; var uncurryThis$1 = functionUncurryThis; @@ -15803,6 +15921,7 @@ var create = objectCreate$1; var createPropertyDescriptor = createPropertyDescriptor$c; var getIterator = getIterator$b; var getIteratorMethod = getIteratorMethod$9; +var validateArgumentsLength = validateArgumentsLength$2; var wellKnownSymbol = wellKnownSymbol$H; var arraySort = arraySort$1; @@ -15878,10 +15997,6 @@ var serialize = function (it) { return replace$1(encodeURIComponent$1(it), find, replacer); }; -var validateArgumentsLength = function (passed, required) { - if (passed < required) throw TypeError$2('Not enough arguments'); -}; - var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) { setInternalState$1(this, { type: URL_SEARCH_PARAMS_ITERATOR, @@ -16169,10 +16284,10 @@ var web_urlSearchParams = { var $$1 = _export; var DESCRIPTORS = descriptors; var USE_NATIVE_URL = nativeUrl; -var global$1 = global$1$; +var global$1 = global$20; var bind = functionBindContext; var uncurryThis = functionUncurryThis; -var defineProperties = objectDefineProperties; +var defineProperties = objectDefineProperties.f; var redefine = redefine$n.exports; var anInstance = anInstance$d; var hasOwn = hasOwnProperty_1; diff --git a/test/form/samples/supports-es5-shim/_expected.js b/test/form/samples/supports-es5-shim/_expected.js index a7c1574d7fd..aca992cb227 100644 --- a/test/form/samples/supports-es5-shim/_expected.js +++ b/test/form/samples/supports-es5-shim/_expected.js @@ -120,6 +120,38 @@ var es5Shim = {exports: {}}; }; }(ObjectPrototype.hasOwnProperty)); + // this is needed in Chrome 15 (probably earlier) - 36 + // https://bugs.chromium.org/p/v8/issues/detail?id=3334 + if ($Object.defineProperty) { + var F = function () {}; + var toStringSentinel = {}; + var sentinel = { toString: toStringSentinel }; + $Object.defineProperty(F, 'prototype', { value: sentinel, writable: false }); + if ((new F()).toString !== toStringSentinel) { + var $dP = $Object.defineProperty; + var $gOPD = $Object.getOwnPropertyDescriptor; + defineProperties($Object, { + defineProperty: function defineProperty(o, k, d) { + var key = $String(k); + if (typeof o === 'function' && key === 'prototype') { + var desc = $gOPD(o, key); + if (desc.writable && !d.writable && 'value' in d) { + try { + o[key] = d.value; // eslint-disable-line no-param-reassign + } catch (e) { /**/ } + } + return $dP(o, key, { + configurable: 'configurable' in d ? d.configurable : desc.configurable, + enumerable: 'enumerable' in d ? d.enumerable : desc.enumerable, + writable: d.writable + }); + } + return $dP(o, key, d); + } + }, true); + } + } + // // Util // ====== @@ -1525,10 +1557,10 @@ var es5Shim = {exports: {}}; var t = month > 1 ? 1 : 0; return ( months[month] - + floor((year - 1969 + t) / 4) - - floor((year - 1901 + t) / 100) - + floor((year - 1601 + t) / 400) - + (365 * (year - 1970)) + + floor((year - 1969 + t) / 4) + - floor((year - 1901 + t) / 100) + + floor((year - 1601 + t) / 400) + + (365 * (year - 1970)) ); }; @@ -1797,10 +1829,11 @@ var es5Shim = {exports: {}}; }()); var originalToExponential = call.bind(NumberPrototype.toExponential); var numberToString = call.bind(NumberPrototype.toString); + var numberValueOf = call.bind(NumberPrototype.valueOf); defineProperties(NumberPrototype, { toExponential: function toExponential(fractionDigits) { // 1: Let x be this Number value. - var x = $Number(this); + var x = numberValueOf(this); if (typeof fractionDigits === 'undefined') { return originalToExponential(x); From 055a7bfd2fa1132ebc191702fcda8f5742134d4b Mon Sep 17 00:00:00 2001 From: dnalborczyk Date: Tue, 18 Jan 2022 10:47:01 -0500 Subject: [PATCH 20/30] refactor: replace require-relative with built-in require.resolve (#4352) --- LICENSE.md | 7 ------- cli/run/getConfigPath.ts | 9 ++++----- package-lock.json | 12 ------------ package.json | 2 -- 4 files changed, 4 insertions(+), 26 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 62ad8eb8fe6..1c0540c13ac 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -583,13 +583,6 @@ Repository: git://github.com/paulmillr/readdirp.git --------------------------------------- -## require-relative -License: MIT -By: Valerio Proietti -Repository: git://github.com/kamicane/require-relative.git - ---------------------------------------- - ## signal-exit License: ISC By: Ben Coe diff --git a/cli/run/getConfigPath.ts b/cli/run/getConfigPath.ts index e47039008fe..322b363d358 100644 --- a/cli/run/getConfigPath.ts +++ b/cli/run/getConfigPath.ts @@ -1,22 +1,21 @@ import { readdirSync } from 'fs'; import { resolve } from 'path'; -import relative from 'require-relative'; +import { cwd } from 'process'; import { handleError } from '../logging'; const DEFAULT_CONFIG_BASE = 'rollup.config'; export function getConfigPath(commandConfig: string | true): string { - const cwd = process.cwd(); if (commandConfig === true) { return resolve(findConfigFileNameInCwd()); } if (commandConfig.slice(0, 5) === 'node:') { const pkgName = commandConfig.slice(5); try { - return relative.resolve(`rollup-config-${pkgName}`, cwd); + return require.resolve(`rollup-config-${pkgName}`, { paths: [cwd()] }); } catch { try { - return relative.resolve(pkgName, cwd); + return require.resolve(pkgName, { paths: [cwd()] }); } catch (err: any) { if (err.code === 'MODULE_NOT_FOUND') { handleError({ @@ -32,7 +31,7 @@ export function getConfigPath(commandConfig: string | true): string { } function findConfigFileNameInCwd(): string { - const filesInWorkingDir = new Set(readdirSync(process.cwd())); + const filesInWorkingDir = new Set(readdirSync(cwd())); for (const extension of ['mjs', 'cjs', 'ts']) { const fileName = `${DEFAULT_CONFIG_BASE}.${extension}`; if (filesInWorkingDir.has(fileName)) return fileName; diff --git a/package-lock.json b/package-lock.json index cc8115d17cb..5ef6a95cf8b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -708,12 +708,6 @@ "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", "dev": true }, - "@types/require-relative": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@types/require-relative/-/require-relative-0.8.0.tgz", - "integrity": "sha512-3xDLWkeSGvkRmTWOhJS+WjqT7QT8oacisRorMQypA9Y3BSRnpzu0J0+YJUcNY4Kmg8vY+A4vAwc8qwM82k3cMA==", - "dev": true - }, "@types/resolve": { "version": "1.17.1", "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", @@ -3914,12 +3908,6 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, - "require-relative": { - "version": "0.8.7", - "resolved": "https://registry.npmjs.org/require-relative/-/require-relative-0.8.7.tgz", - "integrity": "sha1-eZlTn8ngR6N5KPoZb44VY9q9Nt4=", - "dev": true - }, "requirejs": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz", diff --git a/package.json b/package.json index 3d02483e836..886e688487f 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,6 @@ "@rollup/plugin-typescript": "^8.2.5", "@rollup/pluginutils": "^4.1.2", "@types/node": "^10.17.60", - "@types/require-relative": "^0.8.0", "@types/signal-exit": "^3.0.1", "@types/yargs-parser": "^20.2.1", "@typescript-eslint/eslint-plugin": "^5.10.0", @@ -100,7 +99,6 @@ "prettier": "^2.5.1", "pretty-bytes": "^5.6.0", "pretty-ms": "^7.0.1", - "require-relative": "^0.8.7", "requirejs": "^2.3.6", "rollup": "^2.64.0", "rollup-plugin-license": "^2.6.1", From a5988dc38e5518549158dd6803b3d26e90abf6ae Mon Sep 17 00:00:00 2001 From: dnalborczyk Date: Tue, 18 Jan 2022 10:53:45 -0500 Subject: [PATCH 21/30] refactor: re-use source mapping url (#4351) * refactor: re-use source mapping url * refactor: type/named import nits Co-authored-by: Lukas Taegert-Atkinson --- cli/run/build.ts | 10 +++++----- cli/sourceMappingUrl.ts | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) delete mode 100644 cli/sourceMappingUrl.ts diff --git a/cli/run/build.ts b/cli/run/build.ts index b613a42b899..6de3939f689 100644 --- a/cli/run/build.ts +++ b/cli/run/build.ts @@ -1,11 +1,11 @@ import ms from 'pretty-ms'; -import * as rollup from '../../src/node-entry'; -import { MergedRollupOptions } from '../../src/rollup/types'; +import { rollup } from '../../src/node-entry'; +import type { MergedRollupOptions } from '../../src/rollup/types'; import { bold, cyan, green } from '../../src/utils/colors'; import relativeId from '../../src/utils/relativeId'; +import { SOURCEMAPPING_URL } from '../../src/utils/sourceMappingURL'; import { handleError, stderr } from '../logging'; -import SOURCEMAPPING_URL from '../sourceMappingUrl'; -import { BatchWarnings } from './batchWarnings'; +import type { BatchWarnings } from './batchWarnings'; import { printTimings } from './timings'; export default async function build( @@ -29,7 +29,7 @@ export default async function build( stderr(cyan(`\n${bold(inputFiles!)} → ${bold(files.join(', '))}...`)); } - const bundle = await rollup.rollup(inputOptions as any); + const bundle = await rollup(inputOptions as any); if (useStdout) { const output = outputOptions[0]; if (output.sourcemap && output.sourcemap !== 'inline') { diff --git a/cli/sourceMappingUrl.ts b/cli/sourceMappingUrl.ts deleted file mode 100644 index e7c42659fde..00000000000 --- a/cli/sourceMappingUrl.ts +++ /dev/null @@ -1,4 +0,0 @@ -let SOURCEMAPPING_URL = 'sourceMa'; -SOURCEMAPPING_URL += 'ppingURL'; - -export default SOURCEMAPPING_URL; From d1079a329757b155ff2bafede1640bafedd53797 Mon Sep 17 00:00:00 2001 From: dnalborczyk Date: Fri, 21 Jan 2022 00:35:06 -0500 Subject: [PATCH 22/30] fix: timed plugin context (#4357) * fix: timed plugin context * add test --- src/utils/timers.ts | 16 +++++------ .../adds-plugin-context-to-plugins/_config.js | 27 +++++++++++++++++++ .../adds-plugin-context-to-plugins/foo.js | 1 + .../adds-plugin-context-to-plugins/main.js | 1 + 4 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 test/function/samples/adds-plugin-context-to-plugins/_config.js create mode 100644 test/function/samples/adds-plugin-context-to-plugins/foo.js create mode 100644 test/function/samples/adds-plugin-context-to-plugins/main.js diff --git a/src/utils/timers.ts b/src/utils/timers.ts index d097f15131f..e8554eb3307 100644 --- a/src/utils/timers.ts +++ b/src/utils/timers.ts @@ -1,4 +1,4 @@ -import { InputOptions, Plugin, SerializedTimings } from '../rollup/types'; +import type { InputOptions, Plugin, SerializedTimings } from '../rollup/types'; import performance from './performance'; import process from './process'; @@ -77,8 +77,6 @@ export let timeEnd: (label: string, level?: number) => void = NOOP; const TIMED_PLUGIN_HOOKS = ['load', 'resolveDynamicImport', 'resolveId', 'transform'] as const; function getPluginWithTimers(plugin: any, index: number): Plugin { - const timedPlugin: Pick = {}; - for (const hook of TIMED_PLUGIN_HOOKS) { if (hook in plugin) { let timerLabel = `plugin ${index}`; @@ -86,9 +84,12 @@ function getPluginWithTimers(plugin: any, index: number): Plugin { timerLabel += ` (${plugin.name})`; } timerLabel += ` - ${hook}`; - timedPlugin[hook] = function (...args: unknown[]) { + + const func = plugin[hook]; + + plugin[hook] = function (...args: readonly unknown[]) { timeStart(timerLabel, 4); - const result = plugin[hook](...args); + const result = func.apply(this, args); timeEnd(timerLabel, 4); if (result && typeof result.then === 'function') { timeStart(`${timerLabel} (async)`, 4); @@ -101,10 +102,7 @@ function getPluginWithTimers(plugin: any, index: number): Plugin { }; } } - return { - ...plugin, - ...timedPlugin - }; + return plugin; } export function initialiseTimers(inputOptions: InputOptions): void { diff --git a/test/function/samples/adds-plugin-context-to-plugins/_config.js b/test/function/samples/adds-plugin-context-to-plugins/_config.js new file mode 100644 index 00000000000..df0c2752171 --- /dev/null +++ b/test/function/samples/adds-plugin-context-to-plugins/_config.js @@ -0,0 +1,27 @@ +const assert = require('assert'); + +module.exports = { + description: 'Adds plugin context to plugins with perf=true', + options: { + perf: true, + plugins: [ + { + load() { + assert.ok(typeof this.parse === 'function'); + }, + + resolveDynamicImport() { + assert.ok(typeof this.parse === 'function'); + }, + + resolveId() { + assert.ok(typeof this.parse === 'function'); + }, + + transform() { + assert.ok(typeof this.parse === 'function'); + } + } + ] + } +}; diff --git a/test/function/samples/adds-plugin-context-to-plugins/foo.js b/test/function/samples/adds-plugin-context-to-plugins/foo.js new file mode 100644 index 00000000000..d02ba545bd3 --- /dev/null +++ b/test/function/samples/adds-plugin-context-to-plugins/foo.js @@ -0,0 +1 @@ +export default 'foo'; diff --git a/test/function/samples/adds-plugin-context-to-plugins/main.js b/test/function/samples/adds-plugin-context-to-plugins/main.js new file mode 100644 index 00000000000..92c66c7eb7c --- /dev/null +++ b/test/function/samples/adds-plugin-context-to-plugins/main.js @@ -0,0 +1 @@ +import('./foo'); From 2256dcda187d4d2d61e45d38155ac58bb4eb2aea Mon Sep 17 00:00:00 2001 From: dnalborczyk Date: Fri, 21 Jan 2022 00:46:14 -0500 Subject: [PATCH 23/30] chore: remove external from config (#4355) * chore: remove external from config * simplify named imports * nits * fix: mark fsevents as external * fix: set interop to default * Revert "fix: mark fsevents as external" This reverts commit 4a5fa733d4fb54d18bb5e7b738665638b467181f. * chore: bump chokidar * simplify alias plugin params * Revert "Revert "fix: mark fsevents as external"" This reverts commit 2ef6c5b3c567c273d9acbc0588f5de961206a69d. * add bogus types for fsevents * exclude fsevents from import linting * add back comment * bump typescript * re-use env var Co-authored-by: Lukas Taegert-Atkinson --- .eslintrc.js | 5 +- build-plugins/conditional-fsevents-import.ts | 2 +- package-lock.json | 68 ++++++++++++-------- package.json | 4 +- rollup.config.ts | 59 ++++++----------- src/watch/fsevents-importer.ts | 10 +-- typings/fsevents.d.ts | 6 ++ 7 files changed, 78 insertions(+), 76 deletions(-) create mode 100644 typings/fsevents.d.ts diff --git a/.eslintrc.js b/.eslintrc.js index 30e12eaa53a..4a501ad0045 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -73,7 +73,10 @@ module.exports = { 'dot-notation': 'error', 'import/no-unresolved': [ 'error', - { ignore: ['package.json', 'is-reference', 'help.md', 'types'] } + { + // 'fsevents' is ony available on macOS, and not installed on linux/windows + ignore: ['fsevents', 'help.md', 'is-reference', 'package.json', 'types'] + } ], 'import/order': ['error', { alphabetize: { order: 'asc' } }], 'no-constant-condition': ['error', { checkLoops: false }], diff --git a/build-plugins/conditional-fsevents-import.ts b/build-plugins/conditional-fsevents-import.ts index 5378269cf20..ba3f22ce639 100644 --- a/build-plugins/conditional-fsevents-import.ts +++ b/build-plugins/conditional-fsevents-import.ts @@ -1,5 +1,5 @@ import MagicString from 'magic-string'; -import { Plugin } from 'rollup'; +import type { Plugin } from 'rollup'; const FSEVENTS_REQUIRE = "require('fsevents')"; const REPLACEMENT = "require('../../../src/watch/fsevents-importer').getFsEvents()"; diff --git a/package-lock.json b/package-lock.json index 5ef6a95cf8b..3651b4a138c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,20 +20,20 @@ "dev": true }, "@babel/core": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.7.tgz", - "integrity": "sha512-aeLaqcqThRNZYmbMqtulsetOQZ/5gbR/dWruUCJcpas4Qoyy+QeagfDsPdMrqwsPRDNxJvBlRiZxxX7THO7qtA==", + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.10.tgz", + "integrity": "sha512-pbiIdZbCiMx/MM6toR+OfXarYix3uz0oVsnNtfdAGTcCTu3w/JGF8JhirevXLBJUu0WguSZI12qpKnx7EeMyLA==", "dev": true, "requires": { "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.16.7", + "@babel/generator": "^7.16.8", "@babel/helper-compilation-targets": "^7.16.7", "@babel/helper-module-transforms": "^7.16.7", "@babel/helpers": "^7.16.7", - "@babel/parser": "^7.16.7", + "@babel/parser": "^7.16.10", "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7", + "@babel/traverse": "^7.16.10", + "@babel/types": "^7.16.8", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -215,9 +215,9 @@ } }, "@babel/highlight": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.7.tgz", - "integrity": "sha512-aKpPMfLvGO3Q97V0qhw/V2SWNWlwfJknuwAunU7wZLSfrM4xTBvg7E5opUVi1kJTBKihE38CPg4nBiqX83PWYw==", + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.10.tgz", + "integrity": "sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.16.7", @@ -226,9 +226,9 @@ } }, "@babel/parser": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.8.tgz", - "integrity": "sha512-i7jDUfrVBWc+7OKcBzEe5n7fbv3i2fWtxKzzCvOjnzSxMfWMigAhtfJ7qzZNGFNMsCCd67+uz553dYKWXPvCKw==", + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.10.tgz", + "integrity": "sha512-Sm/S9Or6nN8uiFsQU1yodyDW3MWXQhFeqzMPM+t8MJjM+pLsnFVxFZzkpXKvUXh+Gz9cbMoYYs484+Jw/NTEFQ==", "dev": true }, "@babel/template": { @@ -243,9 +243,9 @@ } }, "@babel/traverse": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.8.tgz", - "integrity": "sha512-xe+H7JlvKsDQwXRsBhSnq1/+9c+LlQcCK3Tn/l5sbx02HYns/cn7ibp9+RV1sIUqu7hKg91NWsgHurO9dowITQ==", + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.10.tgz", + "integrity": "sha512-yzuaYXoRJBGMlBhsMJoUW7G1UmSb/eXr/JHYM/MsOJgavJibLwASijW7oXBdw3NQ6T0bW7Ty5P/VarOs9cHmqw==", "dev": true, "requires": { "@babel/code-frame": "^7.16.7", @@ -254,7 +254,7 @@ "@babel/helper-function-name": "^7.16.7", "@babel/helper-hoist-variables": "^7.16.7", "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/parser": "^7.16.8", + "@babel/parser": "^7.16.10", "@babel/types": "^7.16.8", "debug": "^4.1.0", "globals": "^11.1.0" @@ -1134,9 +1134,9 @@ } }, "chokidar": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", - "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", "dev": true, "requires": { "anymatch": "~3.1.2", @@ -1370,9 +1370,9 @@ } }, "electron-to-chromium": { - "version": "1.4.47", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.47.tgz", - "integrity": "sha512-ZHc8i3/cgeCRK/vC7W2htAG6JqUmOUgDNn/f9yY9J8UjfLjwzwOVEt4MWmgJAdvmxyrsR5KIFA/6+kUHGY0eUA==", + "version": "1.4.49", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.49.tgz", + "integrity": "sha512-k/0t1TRfonHIp8TJKfjBu2cKj8MqYTiEpOhci+q7CVEE5xnCQnx1pTa+V8b/sdhe4S3PR4p4iceEQWhGrKQORQ==", "dev": true }, "emoji-regex": { @@ -3109,6 +3109,22 @@ "yargs-unparser": "2.0.0" }, "dependencies": { + "chokidar": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", + "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, "debug": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", @@ -4562,9 +4578,9 @@ } }, "typescript": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", - "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", + "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", "dev": true }, "unbox-primitive": { diff --git a/package.json b/package.json index 886e688487f..3337193c7fd 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "acorn-jsx": "^5.3.2", "acorn-walk": "^8.2.0", "buble": "^0.20.0", - "chokidar": "^3.5.2", + "chokidar": "^3.5.3", "colorette": "^2.0.16", "core-js": "^3.20.3", "date-time": "^4.0.0", @@ -114,7 +114,7 @@ "systemjs": "^6.11.0", "terser": "^5.10.0", "tslib": "^2.3.1", - "typescript": "^4.5.4", + "typescript": "^4.5.5", "weak-napi": "^2.0.2", "yargs-parser": "^20.2.9" }, diff --git a/rollup.config.ts b/rollup.config.ts index 51ce7f40ace..6be0690ae8f 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -1,11 +1,12 @@ import { readFileSync } from 'fs'; -import path from 'path'; +import { resolve } from 'path'; +import process from 'process'; import alias from '@rollup/plugin-alias'; import commonjs from '@rollup/plugin-commonjs'; import json from '@rollup/plugin-json'; -import resolve from '@rollup/plugin-node-resolve'; +import { nodeResolve } from '@rollup/plugin-node-resolve'; import typescript from '@rollup/plugin-typescript'; -import { RollupOptions, WarningHandlerWithDefault } from 'rollup'; +import type { RollupOptions, WarningHandlerWithDefault } from 'rollup'; import { string } from 'rollup-plugin-string'; import { terser } from 'rollup-plugin-terser'; import addCliEntry from './build-plugins/add-cli-entry'; @@ -14,7 +15,7 @@ import emitModulePackageFile from './build-plugins/emit-module-package-file'; import esmDynamicImport from './build-plugins/esm-dynamic-import'; import getLicenseHandler from './build-plugins/generate-license-file'; import replaceBrowserModules from './build-plugins/replace-browser-modules'; -import pkg from './package.json'; +import { version } from './package.json'; const commitHash = (function () { try { @@ -24,15 +25,12 @@ const commitHash = (function () { } })(); -const now = new Date( - process.env.SOURCE_DATE_EPOCH - ? 1000 * parseInt(process.env.SOURCE_DATE_EPOCH) - : new Date().getTime() -).toUTCString(); +const { SOURCE_DATE_EPOCH } = process.env; +const now = new Date(SOURCE_DATE_EPOCH ? 1000 * +SOURCE_DATE_EPOCH : Date.now()).toUTCString(); const banner = `/* @license - Rollup.js v${pkg.version} + Rollup.js v${version} ${now} - commit ${commitHash} https://github.com/rollup/rollup @@ -50,11 +48,11 @@ const onwarn: WarningHandlerWithDefault = warning => { }; const moduleAliases = { - entries: [ - { find: 'help.md', replacement: path.resolve('cli/help.md') }, - { find: 'package.json', replacement: path.resolve('package.json') }, - { find: 'acorn', replacement: path.resolve('node_modules/acorn/dist/acorn.mjs') } - ], + entries: { + acorn: resolve('node_modules/acorn/dist/acorn.mjs'), + 'help.md': resolve('cli/help.md'), + 'package.json': resolve('package.json') + }, resolve: ['.js', '.json', '.md'] }; @@ -66,7 +64,7 @@ const treeshake = { const nodePlugins = [ alias(moduleAliases), - resolve(), + nodeResolve(), json(), conditionalFsEventsImport(), string({ include: '**/*.md' }), @@ -80,24 +78,8 @@ const nodePlugins = [ export default (command: Record): RollupOptions | RollupOptions[] => { const { collectLicenses, writeLicense } = getLicenseHandler(); const commonJSBuild: RollupOptions = { - // fsevents is a dependency of chokidar that cannot be bundled as it contains binary code - external: [ - 'buffer', - '@rollup/plugin-typescript', - 'assert', - 'crypto', - 'events', - 'fs', - 'fsevents', - 'module', - 'os', - 'path', - 'perf_hooks', - 'process', - 'stream', - 'url', - 'util' - ], + // 'fsevents' is a dependency of 'chokidar' that cannot be bundled as it contains binary code + external: ['fsevents'], input: { 'loadConfigFile.js': 'cli/run/loadConfigFile.ts', 'rollup.js': 'src/node-entry.ts' @@ -114,12 +96,7 @@ export default (command: Record): RollupOptions | RollupOptions format: 'cjs', freeze: false, generatedCode: 'es2015', - interop: id => { - if (id === 'fsevents') { - return 'defaultOnly'; - } - return 'default'; - }, + interop: 'default', manualChunks: { rollup: ['src/node-entry.ts'] }, sourcemap: true }, @@ -160,7 +137,7 @@ export default (command: Record): RollupOptions | RollupOptions plugins: [ replaceBrowserModules(), alias(moduleAliases), - resolve({ browser: true }), + nodeResolve({ browser: true }), json(), commonjs(), typescript(), diff --git a/src/watch/fsevents-importer.ts b/src/watch/fsevents-importer.ts index 34e76ac5a90..fde4c2815e7 100644 --- a/src/watch/fsevents-importer.ts +++ b/src/watch/fsevents-importer.ts @@ -1,18 +1,18 @@ -let fsEvents: unknown; +import type FsEvents from 'fsevents'; + +let fsEvents: typeof FsEvents; let fsEventsImportError: Error | undefined; export async function loadFsEvents(): Promise { - const moduleName = 'fsevents'; - try { - ({ default: fsEvents } = await import(moduleName)); + ({ default: fsEvents } = await import('fsevents')); } catch (err: any) { fsEventsImportError = err; } } // A call to this function will be injected into the chokidar code -export function getFsEvents(): unknown { +export function getFsEvents(): typeof FsEvents { if (fsEventsImportError) throw fsEventsImportError; return fsEvents; } diff --git a/typings/fsevents.d.ts b/typings/fsevents.d.ts new file mode 100644 index 00000000000..fe400f2c7cd --- /dev/null +++ b/typings/fsevents.d.ts @@ -0,0 +1,6 @@ +// 'fsevents' (which also has typings included) is an optional dependency installed on macOS, +// and not installed on linux/windows. this will provide (bogus) type information for +// linux/windows, and overwrite (replace) the types coming with the 'fsevents' module on macOS +declare module 'fsevents' { + export default {}; +} From 61adedf837ae06c5d0a22f9253378e6ffd7520c6 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 21 Jan 2022 06:57:19 +0100 Subject: [PATCH 24/30] Add importedIdResolutions to moduleInfo (#4354) --- docs/05-plugin-development.md | 14 +++- src/ExternalModule.ts | 2 + src/Module.ts | 9 +++ src/rollup/types.d.ts | 2 + .../_config.js | 20 ++++++ .../implicitly-dependent-entry/_config.js | 20 ++++++ .../multiple-dependencies/_config.js | 72 +++++++++++++++++++ .../single-dependency/_config.js | 20 ++++++ .../deprecated/manual-chunks-info/_config.js | 47 ++++++++++++ .../samples/manual-chunks-info/_config.js | 47 ++++++++++++ .../samples/module-parsed-hook/_config.js | 12 ++++ .../plugin-module-information/_config.js | 49 +++++++++++++ .../samples/preload-module/_config.js | 4 ++ 13 files changed, 316 insertions(+), 2 deletions(-) diff --git a/docs/05-plugin-development.md b/docs/05-plugin-development.md index ab5ead9f000..068abb62045 100644 --- a/docs/05-plugin-development.md +++ b/docs/05-plugin-development.md @@ -122,7 +122,7 @@ This hook is called each time a module has been fully parsed by Rollup. See [`th In contrast to the [`transform`](guide/en/#transform) hook, this hook is never cached and can be used to get information about both cached and other modules, including the final shape of the `meta` property, the `code` and the `ast`. -This hook will wait until all imports are resolved so that the information in `moduleInfo.importedIds` and `moduleInfo.dynamicallyImportedIds` is complete and accurate. Note however that information about importing modules may be incomplete as additional importers could be discovered later. If you need this information, use the [`buildEnd`](guide/en/#buildend) hook. +This hook will wait until all imports are resolved so that the information in `moduleInfo.importedIds`, `moduleInfo.dynamicallyImportedIds`, `moduleInfo.importedIdResolutions`, and `moduleInfo.dynamicallyImportedIdResolutions` is complete and accurate. Note however that information about importing modules may be incomplete as additional importers could be discovered later. If you need this information, use the [`buildEnd`](guide/en/#buildend) hook. #### `options` @@ -677,8 +677,10 @@ type ModuleInfo = { isExternal: boolean; // for external modules that are referenced but not included in the graph isIncluded: boolean | null; // is the module included after tree-shaking, `null` if external or not yet available importedIds: string[]; // the module ids statically imported by this module + importedIdResolutions: ResolvedId[]; // how statically imported ids were resolved, for use with this.load importers: string[]; // the ids of all modules that statically import this module dynamicallyImportedIds: string[]; // the module ids imported by this module via dynamic import() + dynamicallyImportedIdResolutions: ResolvedId[]; // how ids imported via dynamic import() were resolved dynamicImporters: string[]; // the ids of all modules that import this module via dynamic import() implicitlyLoadedAfterOneOf: string[]; // implicit relationships, declared via this.emitFile implicitlyLoadedBefore: string[]; // implicit relationships, declared via this.emitFile @@ -686,6 +688,14 @@ type ModuleInfo = { meta: { [plugin: string]: any }; // custom module meta-data syntheticNamedExports: boolean | string; // final value of synthetic named exports }; + +type ResolvedId = { + id: string; // the id of the imported module + external: boolean | 'absolute'; // is this module external, "absolute" means it will not be rendered as relative in the module + moduleSideEffects: boolean | 'no-treeshake'; // are side effects of the module observed, is tree-shaking enabled + syntheticNamedExports: boolean | string; // does the module allow importing non-existing named exports + meta: { [plugin: string]: any }; // custom module meta-data when resolving the module +}; ``` During the build, this object represents currently available information about the module. Before the [`buildEnd`](guide/en/#buildend) hook, this information may be incomplete as e.g. the `importedIds` are not yet resolved or additional `importers` are discovered. @@ -706,7 +716,7 @@ Loads and parses the module corresponding to the given id, attaching additional This allows you to inspect the final content of modules before deciding how to resolve them in the [`resolveId`](guide/en/#resolveid) hook and e.g. resolve to a proxy module instead. If the module becomes part of the graph later, there is no additional overhead from using this context function as the module will not be parsed again. The signature allows you to directly pass the return value of [`this.resolve`](guide/en/#thisresolve) to this function as long as it is neither `null` nor external. -The returned promise will resolve once the module has been fully transformed and parsed but before any imports have been resolved. That means that the resulting `ModuleInfo` will have empty `importedIds` and `dynamicallyImportedIds`. This helps to avoid deadlock situations when awaiting `this.load` in a `resolveId` hook. If you are interested in `importedIds` and `dynamicallyImportedIds`, you should implement a `moduleParsed` hook. +The returned promise will resolve once the module has been fully transformed and parsed but before any imports have been resolved. That means that the resulting `ModuleInfo` will have empty `importedIds`, `dynamicallyImportedIds`, `importedIdResolutions` and `dynamicallyImportedIdResolutions`. This helps to avoid deadlock situations when awaiting `this.load` in a `resolveId` hook. If you are interested in `importedIds` and `dynamicallyImportedIds`, you should implement a `moduleParsed` hook. Note that with regard to the `moduleSideEffects`, `syntheticNamedExports` and `meta` options, the same restrictions apply as for the `resolveId` hook: Their values only have an effect if the module has not been loaded yet. Thus, it is very important to use `this.resolve` first to find out if any plugins want to set special values for these options in their `resolveId` hook, and pass these options on to `this.load` if appropriate. The example below showcases how this can be handled to add a proxy module for modules containing a special code comment: diff --git a/src/ExternalModule.ts b/src/ExternalModule.ts index 97a66c36e67..efd5420de5f 100644 --- a/src/ExternalModule.ts +++ b/src/ExternalModule.ts @@ -41,6 +41,7 @@ export default class ExternalModule { this.info = { ast: null, code: null, + dynamicallyImportedIdResolutions: EMPTY_ARRAY, dynamicallyImportedIds: EMPTY_ARRAY, get dynamicImporters() { return dynamicImporters.sort(); @@ -49,6 +50,7 @@ export default class ExternalModule { id, implicitlyLoadedAfterOneOf: EMPTY_ARRAY, implicitlyLoadedBefore: EMPTY_ARRAY, + importedIdResolutions: EMPTY_ARRAY, importedIds: EMPTY_ARRAY, get importers() { return importers.sort(); diff --git a/src/Module.ts b/src/Module.ts index 12fe9b7c245..fe458e638b0 100644 --- a/src/Module.ts +++ b/src/Module.ts @@ -38,6 +38,7 @@ import { NormalizedInputOptions, PartialNull, PreserveEntrySignaturesOption, + ResolvedId, ResolvedIdMap, RollupError, RollupLogProps, @@ -259,6 +260,11 @@ export default class Module { this.info = { ast: null, code: null, + get dynamicallyImportedIdResolutions() { + return module.dynamicImports + .map(({ argument }) => typeof argument === 'string' && module.resolvedIds[argument]) + .filter(Boolean) as ResolvedId[]; + }, get dynamicallyImportedIds() { const dynamicallyImportedIds: string[] = []; for (const { id } of module.dynamicImports) { @@ -279,6 +285,9 @@ export default class Module { get implicitlyLoadedBefore() { return Array.from(module.implicitlyLoadedBefore, getId).sort(); }, + get importedIdResolutions() { + return Array.from(module.sources, source => module.resolvedIds[source]).filter(Boolean); + }, get importedIds() { return Array.from(module.sources, source => module.resolvedIds[source]?.id).filter(Boolean); }, diff --git a/src/rollup/types.d.ts b/src/rollup/types.d.ts index 45cabb78c10..cf2ffa4117e 100644 --- a/src/rollup/types.d.ts +++ b/src/rollup/types.d.ts @@ -160,11 +160,13 @@ interface ModuleInfo { ast: AcornNode | null; code: string | null; dynamicImporters: readonly string[]; + dynamicallyImportedIdResolutions: readonly ResolvedId[]; dynamicallyImportedIds: readonly string[]; hasModuleSideEffects: boolean | 'no-treeshake'; id: string; implicitlyLoadedAfterOneOf: readonly string[]; implicitlyLoadedBefore: readonly string[]; + importedIdResolutions: readonly ResolvedId[]; importedIds: readonly string[]; importers: readonly string[]; isEntry: boolean; diff --git a/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-emitted-entry/_config.js b/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-emitted-entry/_config.js index a0d90878714..661bf005fac 100644 --- a/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-emitted-entry/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-emitted-entry/_config.js @@ -70,12 +70,22 @@ module.exports = { sourceType: 'module' }, code: "import { value } from './lib';\nconsole.log(value);\n", + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], hasModuleSideEffects: true, id: ID_MAIN, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [ + { + external: false, + id: ID_LIB, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [ID_LIB], importers: [], isEntry: true, @@ -130,12 +140,22 @@ module.exports = { sourceType: 'module' }, code: "import { value } from './lib';\nconsole.log(value);\n", + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], hasModuleSideEffects: true, id: ID_DEP, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [ + { + external: false, + id: ID_LIB, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [ID_LIB], importers: [], isEntry: true, diff --git a/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-entry/_config.js b/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-entry/_config.js index 897835fb6d0..7856f608a24 100644 --- a/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-entry/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-entry/_config.js @@ -66,12 +66,22 @@ module.exports = { sourceType: 'module' }, code: "import { value } from './lib';\nconsole.log(value);\n", + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], hasModuleSideEffects: true, id: ID_MAIN, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [ + { + external: false, + id: ID_LIB, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [ID_LIB], importers: [], isEntry: true, @@ -126,12 +136,22 @@ module.exports = { sourceType: 'module' }, code: "import { value } from './lib';\nconsole.log(value);\n", + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], hasModuleSideEffects: true, id: ID_DEP, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [ + { + external: false, + id: ID_LIB, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [ID_LIB], importers: [], isEntry: true, diff --git a/test/chunking-form/samples/implicit-dependencies/multiple-dependencies/_config.js b/test/chunking-form/samples/implicit-dependencies/multiple-dependencies/_config.js index 2d38a4c3fd6..c0d26c83d4b 100644 --- a/test/chunking-form/samples/implicit-dependencies/multiple-dependencies/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/multiple-dependencies/_config.js @@ -114,12 +114,36 @@ module.exports = { sourceType: 'module' }, code: "import { lib1 } from './lib1';\nimport { lib1b } from './lib1b';\nimport { lib2 } from './lib2';\nconsole.log('main1', lib1, lib1b, lib2);\n", + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], hasModuleSideEffects: true, id: ID_MAIN1, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [ID_DEP], + importedIdResolutions: [ + { + external: false, + id: ID_LIB1, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + }, + { + external: false, + id: ID_LIB1B, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + }, + { + external: false, + id: ID_LIB2, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [ID_LIB1, ID_LIB1B, ID_LIB2], importers: [], isEntry: true, @@ -209,12 +233,36 @@ module.exports = { sourceType: 'module' }, code: "import { lib1 } from './lib1';\nimport { lib1b } from './lib1b';\nimport { lib3 } from './lib3';\nconsole.log('main2', lib1, lib1b, lib3);\n", + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], hasModuleSideEffects: true, id: ID_MAIN2, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [ID_DEP], + importedIdResolutions: [ + { + external: false, + id: ID_LIB1, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + }, + { + external: false, + id: ID_LIB1B, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + }, + { + external: false, + id: ID_LIB3, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [ID_LIB1, ID_LIB1B, ID_LIB3], importers: [], isEntry: true, @@ -303,12 +351,36 @@ module.exports = { sourceType: 'module' }, code: "import { lib1 } from './lib1';\nimport { lib2 } from './lib2';\nimport { lib3 } from './lib3';\nconsole.log(lib1, lib2, lib3);\n", + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], hasModuleSideEffects: true, id: ID_DEP, implicitlyLoadedAfterOneOf: [ID_MAIN1, ID_MAIN2], implicitlyLoadedBefore: [], + importedIdResolutions: [ + { + external: false, + id: ID_LIB1, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + }, + { + external: false, + id: ID_LIB2, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + }, + { + external: false, + id: ID_LIB3, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [ID_LIB1, ID_LIB2, ID_LIB3], importers: [], isEntry: false, diff --git a/test/chunking-form/samples/implicit-dependencies/single-dependency/_config.js b/test/chunking-form/samples/implicit-dependencies/single-dependency/_config.js index 26fab23a6d8..699ba45512e 100644 --- a/test/chunking-form/samples/implicit-dependencies/single-dependency/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/single-dependency/_config.js @@ -65,12 +65,22 @@ module.exports = { sourceType: 'module' }, code: "import { value } from './lib';\nconsole.log(value);\n", + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], hasModuleSideEffects: true, id: ID_MAIN, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [ID_DEP], + importedIdResolutions: [ + { + external: false, + id: ID_LIB, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [ID_LIB], importers: [], isEntry: true, @@ -125,12 +135,22 @@ module.exports = { sourceType: 'module' }, code: "import { value } from './lib';\nconsole.log(value);\n", + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], hasModuleSideEffects: true, id: ID_DEP, implicitlyLoadedAfterOneOf: [ID_MAIN], implicitlyLoadedBefore: [], + importedIdResolutions: [ + { + external: false, + id: ID_LIB, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [ID_LIB], importers: [], isEntry: false, diff --git a/test/function/samples/deprecated/manual-chunks-info/_config.js b/test/function/samples/deprecated/manual-chunks-info/_config.js index ac8ce09551e..c3d75ad7977 100644 --- a/test/function/samples/deprecated/manual-chunks-info/_config.js +++ b/test/function/samples/deprecated/manual-chunks-info/_config.js @@ -100,12 +100,37 @@ module.exports = { sourceType: 'module' }, code: "export const promise = import('./dynamic');\nexport { default as value } from './lib';\nexport { external } from 'external';\n", + dynamicallyImportedIdResolutions: [ + { + external: false, + id: getId('dynamic'), + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], dynamicallyImportedIds: [getId('dynamic')], dynamicImporters: [], hasModuleSideEffects: true, id: getId('main'), implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [ + { + external: false, + id: getId('lib'), + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + }, + { + external: true, + id: 'external', + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [getId('lib'), 'external'], importers: [], isEntry: true, @@ -117,12 +142,14 @@ module.exports = { { ast: null, code: null, + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [getId('dynamic')], hasModuleSideEffects: true, id: 'external', implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [], importedIds: [], importers: [getId('main')], isEntry: false, @@ -147,12 +174,14 @@ module.exports = { sourceType: 'module' }, code: 'export default 42;\n', + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], hasModuleSideEffects: true, id: getId('lib'), implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [], importedIds: [], importers: [getId('dynamic'), getId('main')], isEntry: false, @@ -220,12 +249,30 @@ module.exports = { sourceType: 'module' }, code: "export const promise = import('external');\nexport { default as internal } from './lib';\n", + dynamicallyImportedIdResolutions: [ + { + external: true, + id: 'external', + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], dynamicallyImportedIds: ['external'], dynamicImporters: [getId('main')], hasModuleSideEffects: true, id: getId('dynamic'), implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [ + { + external: false, + id: getId('lib'), + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [getId('lib')], importers: [], isEntry: false, diff --git a/test/function/samples/manual-chunks-info/_config.js b/test/function/samples/manual-chunks-info/_config.js index 9639ec5fbb2..4780bfcae47 100644 --- a/test/function/samples/manual-chunks-info/_config.js +++ b/test/function/samples/manual-chunks-info/_config.js @@ -99,12 +99,37 @@ module.exports = { sourceType: 'module' }, code: "export const promise = import('./dynamic');\nexport { default as value } from './lib';\nexport { external } from 'external';\n", + dynamicallyImportedIdResolutions: [ + { + external: false, + id: getId('dynamic'), + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], dynamicallyImportedIds: [getId('dynamic')], dynamicImporters: [], hasModuleSideEffects: true, id: getId('main'), implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [ + { + external: false, + id: getId('lib'), + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + }, + { + external: true, + id: 'external', + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [getId('lib'), 'external'], importers: [], isEntry: true, @@ -116,12 +141,14 @@ module.exports = { { ast: null, code: null, + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [getId('dynamic')], hasModuleSideEffects: true, id: 'external', implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [], importedIds: [], importers: [getId('main')], isEntry: false, @@ -146,12 +173,14 @@ module.exports = { sourceType: 'module' }, code: 'export default 42;\n', + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], hasModuleSideEffects: true, id: getId('lib'), implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [], importedIds: [], importers: [getId('dynamic'), getId('main')], isEntry: false, @@ -219,12 +248,30 @@ module.exports = { sourceType: 'module' }, code: "export const promise = import('external');\nexport { default as internal } from './lib';\n", + dynamicallyImportedIdResolutions: [ + { + external: true, + id: 'external', + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], dynamicallyImportedIds: ['external'], dynamicImporters: [getId('main')], hasModuleSideEffects: true, id: getId('dynamic'), implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [ + { + external: false, + id: getId('lib'), + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [getId('lib')], importers: [], isEntry: false, diff --git a/test/function/samples/module-parsed-hook/_config.js b/test/function/samples/module-parsed-hook/_config.js index f0dae77c7d3..c1505d17f54 100644 --- a/test/function/samples/module-parsed-hook/_config.js +++ b/test/function/samples/module-parsed-hook/_config.js @@ -48,12 +48,22 @@ module.exports = { sourceType: 'module' }, code: "export { value } from './dep.js';\n", + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], hasModuleSideEffects: true, id: ID_MAIN, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [ + { + external: false, + id: ID_DEP, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [ID_DEP], importers: [], isEntry: true, @@ -94,12 +104,14 @@ module.exports = { sourceType: 'module' }, code: 'export const value = 42;\n', + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], hasModuleSideEffects: true, id: ID_DEP, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [], importedIds: [], importers: [ID_MAIN], isEntry: false, diff --git a/test/function/samples/plugin-module-information/_config.js b/test/function/samples/plugin-module-information/_config.js index 0b8f55f201a..67a5202770d 100644 --- a/test/function/samples/plugin-module-information/_config.js +++ b/test/function/samples/plugin-module-information/_config.js @@ -18,11 +18,13 @@ module.exports = { ast: null, code: null, dynamicImporters: [], + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], hasModuleSideEffects: true, id, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [], importedIds: [], importers: [], isEntry: id === ID_MAIN, @@ -163,12 +165,37 @@ module.exports = { sourceType: 'module' }, code: "export { foo } from './foo.js';\nexport const nested = import('./nested/nested');\nexport const path = import('path');\nexport const pathAgain = import(thePath);\n", + dynamicallyImportedIdResolutions: [ + { + external: false, + id: ID_NESTED, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + }, + { + external: true, + id: ID_PATH, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], dynamicallyImportedIds: [ID_NESTED, ID_PATH], dynamicImporters: [], hasModuleSideEffects: true, id: ID_MAIN, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [ + { + external: false, + id: ID_FOO, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [ID_FOO], importers: [], isEntry: true, @@ -240,12 +267,22 @@ module.exports = { sourceType: 'module' }, code: "import path from 'path';\n\nexport const foo = path.resolve('foo');\n", + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], hasModuleSideEffects: true, id: ID_FOO, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [ + { + external: true, + id: ID_PATH, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [ID_PATH], importers: [ID_MAIN, ID_NESTED], isEntry: false, @@ -257,12 +294,14 @@ module.exports = { { ast: null, code: null, + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [ID_MAIN], hasModuleSideEffects: true, id: ID_PATH, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [], importedIds: [], importers: [ID_FOO], isEntry: false, @@ -337,12 +376,22 @@ module.exports = { sourceType: 'module' }, code: "import { foo } from '../foo.js';\n\nexport const nested = 'nested' + foo;\n", + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [ID_MAIN], hasModuleSideEffects: true, id: ID_NESTED, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [ + { + external: false, + id: ID_FOO, + meta: {}, + moduleSideEffects: true, + syntheticNamedExports: false + } + ], importedIds: [ID_FOO], importers: [], isEntry: false, diff --git a/test/function/samples/preload-module/_config.js b/test/function/samples/preload-module/_config.js index 9364c4b843f..15ce55e3c24 100644 --- a/test/function/samples/preload-module/_config.js +++ b/test/function/samples/preload-module/_config.js @@ -33,11 +33,13 @@ module.exports = { assert.deepStrictEqual(moduleInfo, { code: "import './dep';\nassert.ok(true);\n", dynamicImporters: [], + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], hasModuleSideEffects: true, id: ID_MAIN, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [], importedIds: [], importers: [], isEntry: false, @@ -71,11 +73,13 @@ module.exports = { assert.deepStrictEqual(moduleInfo, { code: 'assert.ok(true);\n', dynamicImporters: [], + dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], hasModuleSideEffects: true, id: ID_DEP, implicitlyLoadedAfterOneOf: [], implicitlyLoadedBefore: [], + importedIdResolutions: [], importedIds: [], importers: [ID_MAIN], isEntry: false, From 7fd90610f5d3b1d139e9a723426bfe389e684df3 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 21 Jan 2022 08:38:41 +0100 Subject: [PATCH 25/30] Update changelog --- CHANGELOG.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37a66c5b6ca..1aa746d878f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # rollup changelog +## 2.65.0 + +_2022-01-21_ + +### Features + +- Add complete import resolution objects to ModuleInfo for use in `this.load` (#4354) + +### Bug Fixes + +- Use correct context in plugin hooks with `perf: true` (#4357) + +### Pull Requests + +- [#4351](https://github.com/rollup/rollup/pull/4351): refactor: re-use source mapping url (@dnalborczyk) +- [#4352](https://github.com/rollup/rollup/pull/4352): refactor: replace require-relative with built-in require.resolve (@dnalborczyk) +- [#4353](https://github.com/rollup/rollup/pull/4353): chore: bump deps (@dnalborczyk) +- [#4354](https://github.com/rollup/rollup/pull/4354): Add importedIdResolutions to moduleInfo (@lukastaegert) +- [#4355](https://github.com/rollup/rollup/pull/4355): chore: remove external from config (@dnalborczyk) +- [#4357](https://github.com/rollup/rollup/pull/4357): fix: timed plugin context (@dnalborczyk) + ## 2.64.0 _2022-01-14_ From bebc50ddb613d240a03988d51787fd71b1a3914f Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 21 Jan 2022 08:38:53 +0100 Subject: [PATCH 26/30] 2.65.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3651b4a138c..20c6852f923 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "2.64.0", + "version": "2.65.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3337193c7fd..a2f9057fd46 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "2.64.0", + "version": "2.65.0", "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js", From e88edfd3b0a50ae24e34c3060c23323a6a947dd4 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Sat, 22 Jan 2022 07:21:37 +0100 Subject: [PATCH 27/30] Add hasDefaultExport to ModuleInfo (#4356) * Add hasDefaultExport to ModuleInfo * Improve example * Make export information available after loading, detect reexports * Manually fix vulnerability --- docs/05-plugin-development.md | 56 +++++++++++++------ package-lock.json | 39 +++++++------ package.json | 6 +- src/ExternalModule.ts | 1 + src/Module.ts | 7 +++ src/rollup/types.d.ts | 1 + .../_config.js | 2 + .../implicitly-dependent-entry/_config.js | 2 + .../multiple-dependencies/_config.js | 3 + .../single-dependency/_config.js | 2 + .../deprecated/manual-chunks-info/_config.js | 4 ++ .../samples/has-default-export/_config.js | 45 +++++++++++++++ .../samples/has-default-export/direct.js | 1 + .../samples/has-default-export/indirect.js | 2 + .../samples/has-default-export/main.js | 9 +++ .../samples/has-default-export/other.js | 2 + .../samples/has-default-export/reexport1.js | 1 + .../samples/has-default-export/reexport2.js | 1 + .../samples/manual-chunks-info/_config.js | 4 ++ .../samples/module-parsed-hook/_config.js | 2 + .../plugin-module-information/_config.js | 5 ++ .../samples/preload-module/_config.js | 2 + 22 files changed, 158 insertions(+), 39 deletions(-) create mode 100644 test/function/samples/has-default-export/_config.js create mode 100644 test/function/samples/has-default-export/direct.js create mode 100644 test/function/samples/has-default-export/indirect.js create mode 100644 test/function/samples/has-default-export/main.js create mode 100644 test/function/samples/has-default-export/other.js create mode 100644 test/function/samples/has-default-export/reexport1.js create mode 100644 test/function/samples/has-default-export/reexport2.js diff --git a/docs/05-plugin-development.md b/docs/05-plugin-development.md index 068abb62045..4b6615e0349 100644 --- a/docs/05-plugin-development.md +++ b/docs/05-plugin-development.md @@ -164,27 +164,42 @@ The `importer` is the fully resolved id of the importing module. When resolving For those cases, the `isEntry` option will tell you if we are resolving a user defined entry point, an emitted chunk, or if the `isEntry` parameter was provided for the [`this.resolve`](guide/en/#thisresolve) context function. -You can use this for instance as a mechanism to define custom proxy modules for entry points. The following plugin will only expose the default export from entry points while still keeping named exports available for internal usage: +You can use this for instance as a mechanism to define custom proxy modules for entry points. The following plugin will proxy all entry points to inject a polyfill import. ```js -function onlyDefaultForEntriesPlugin() { +function injectPolyfillPlugin() { return { - name: 'only-default-for-entries', + name: 'inject-polyfill', async resolveId(source, importer, options) { if (options.isEntry) { // We need to skip this plugin to avoid an infinite loop const resolution = await this.resolve(source, importer, { skipSelf: true, ...options }); - // If it cannot be resolved, return `null` so that Rollup displays an error - if (!resolution) return null; + // If it cannot be resolved or is external, just return it so that + // Rollup can display an error + if (!resolution || resolution.external) return resolution; + // In the load hook of the proxy, we want to use this.load to find out + // if the entry has a default export. In the load hook, however, we no + // longer have the full "resolution" object that may contain meta-data + // from other plugins that is only added on first load. Therefore we + // trigger loading here without waiting for it. + this.load(resolution); return `${resolution.id}?entry-proxy`; } return null; }, - load(id) { + async load(id) { if (id.endsWith('?entry-proxy')) { - const importee = id.slice(0, -'?entry-proxy'.length); - // Note that this will throw if there is no default export - return `export {default} from '${importee}';`; + const entryId = id.slice(0, -'?entry-proxy'.length); + // We need to load and parse the original entry first because we need + // to know if it has a default export + const { hasDefaultExport } = await this.load({ id: entryId }); + let code = `import 'polyfill';export * from ${JSON.stringify(entryId)};`; + // Namespace reexports do not reexport default, so we need special + // handling here + if (hasDefaultExport) { + code += `export { default } from ${JSON.stringify(entryId)};`; + } + return code; } return null; } @@ -673,6 +688,7 @@ type ModuleInfo = { id: string; // the id of the module, for convenience code: string | null; // the source code of the module, `null` if external or not yet available ast: ESTree.Program; // the parsed abstract syntax tree if available + hasDefaultExport: boolean | null; // is there a default export, `null` if external or not yet available isEntry: boolean; // is this a user- or plugin-defined entry point isExternal: boolean; // for external modules that are referenced but not included in the graph isIncluded: boolean | null; // is the module included after tree-shaking, `null` if external or not yet available @@ -718,7 +734,7 @@ This allows you to inspect the final content of modules before deciding how to r The returned promise will resolve once the module has been fully transformed and parsed but before any imports have been resolved. That means that the resulting `ModuleInfo` will have empty `importedIds`, `dynamicallyImportedIds`, `importedIdResolutions` and `dynamicallyImportedIdResolutions`. This helps to avoid deadlock situations when awaiting `this.load` in a `resolveId` hook. If you are interested in `importedIds` and `dynamicallyImportedIds`, you should implement a `moduleParsed` hook. -Note that with regard to the `moduleSideEffects`, `syntheticNamedExports` and `meta` options, the same restrictions apply as for the `resolveId` hook: Their values only have an effect if the module has not been loaded yet. Thus, it is very important to use `this.resolve` first to find out if any plugins want to set special values for these options in their `resolveId` hook, and pass these options on to `this.load` if appropriate. The example below showcases how this can be handled to add a proxy module for modules containing a special code comment: +Note that with regard to the `moduleSideEffects`, `syntheticNamedExports` and `meta` options, the same restrictions apply as for the `resolveId` hook: Their values only have an effect if the module has not been loaded yet. Thus, it is very important to use `this.resolve` first to find out if any plugins want to set special values for these options in their `resolveId` hook, and pass these options on to `this.load` if appropriate. The example below showcases how this can be handled to add a proxy module for modules containing a special code comment. Note the special handling for re-exporting the default export: ```js export default function addProxyPlugin() { @@ -744,7 +760,16 @@ export default function addProxyPlugin() { load(id) { if (id.endsWith('?proxy')) { const importee = id.slice(0, -'?proxy'.length); - return `console.log('proxy for ${importee}'); export * from ${JSON.stringify(importee)};`; + // Note that namespace reexports do not reexport default exports + let code = `console.log('proxy for ${importee}'); export * from ${JSON.stringify( + importee + )};`; + // We know that while resolving the proxy, importee was already fully + // loaded and parsed, so we can rely on hasDefaultExport + if (this.getModuleInfo(importee).hasDefaultExport) { + code += `export { default } from ${JSON.stringify(importee)};`; + } + return code; } return null; } @@ -1142,7 +1167,7 @@ function parentPlugin() { } } // ...plugin hooks - } + }; } function dependentPlugin() { @@ -1151,20 +1176,19 @@ function dependentPlugin() { name: 'dependent', buildStart({ plugins }) { const parentName = 'parent'; - const parentPlugin = options.plugins - .find(plugin => plugin.name === parentName); + const parentPlugin = options.plugins.find(plugin => plugin.name === parentName); if (!parentPlugin) { // or handle this silently if it is optional throw new Error(`This plugin depends on the "${parentName}" plugin.`); } // now you can access the API methods in subsequent hooks parentApi = parentPlugin.api; - } + }, transform(code, id) { if (thereIsAReasonToDoSomething(id)) { parentApi.doSomething(id); } } - } + }; } ``` diff --git a/package-lock.json b/package-lock.json index 20c6852f923..01c288d2117 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1117,9 +1117,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001300", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001300.tgz", - "integrity": "sha512-cVjiJHWGcNlJi8TZVKNMnvMid3Z3TTdDHmLDzlOdIiZq138Exvo0G+G0wTdVYolxKb4AYwC+38pxodiInVtJSA==", + "version": "1.0.30001301", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001301.tgz", + "integrity": "sha512-csfD/GpHMqgEL3V3uIgosvh+SVIQvCh43SNu9HRbP1lnxkKm1kjDG4f32PP571JplkLjfS+mg2p1gxR7MYrrIA==", "dev": true }, "chalk": { @@ -1370,9 +1370,9 @@ } }, "electron-to-chromium": { - "version": "1.4.49", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.49.tgz", - "integrity": "sha512-k/0t1TRfonHIp8TJKfjBu2cKj8MqYTiEpOhci+q7CVEE5xnCQnx1pTa+V8b/sdhe4S3PR4p4iceEQWhGrKQORQ==", + "version": "1.4.51", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.51.tgz", + "integrity": "sha512-JNEmcYl3mk1tGQmy0EvL5eik/CKSBuzAyGP0QFdG6LIgxQe3II0BL1m2zKc2MZMf3uGqHWE1TFddJML0RpjSHQ==", "dev": true }, "emoji-regex": { @@ -3098,7 +3098,7 @@ "log-symbols": "4.1.0", "minimatch": "3.0.4", "ms": "2.1.3", - "nanoid": "3.1.25", + "nanoid": "^3.1.31", "serialize-javascript": "6.0.0", "strip-json-comments": "3.1.1", "supports-color": "8.1.1", @@ -3247,10 +3247,9 @@ "dev": true }, "nanoid": { - "version": "3.1.25", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", - "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==", - "dev": true + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", + "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==" }, "natural-compare": { "version": "1.4.0", @@ -3931,9 +3930,9 @@ "dev": true }, "resolve": { - "version": "1.21.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz", - "integrity": "sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==", + "version": "1.21.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.1.tgz", + "integrity": "sha512-lfEImVbnolPuaSZuLQ52cAxPBHeI77sPwCOWRdy12UG/CNa8an7oBHH1R+Fp1/mUqSJi4c8TIP6FOIPSZAUrEQ==", "dev": true, "requires": { "is-core-module": "^2.8.0", @@ -3979,9 +3978,9 @@ } }, "rollup": { - "version": "2.64.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.64.0.tgz", - "integrity": "sha512-+c+lbw1lexBKSMb1yxGDVfJ+vchJH3qLbmavR+awDinTDA2C5Ug9u7lkOzj62SCu0PKUExsW36tpgW7Fmpn3yQ==", + "version": "2.65.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.65.0.tgz", + "integrity": "sha512-ohZVYrhtVMTqqeqH26sngfMiyGDg6gCUReOsoflXvYpzUkDHp8sVG8F9FQxjs72OfnLWpXP2nNNqQ9I0vkRovA==", "dev": true, "requires": { "fsevents": "~2.3.2" @@ -4450,9 +4449,9 @@ "dev": true }, "systemjs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/systemjs/-/systemjs-6.11.0.tgz", - "integrity": "sha512-7YPIY44j+BoY+E6cGBSw0oCU8SNTTIHKZgftcBdwWkDzs/M86Fdlr21FrzAyph7Zo8r3CFGscyFe4rrBtixrBg==", + "version": "6.12.1", + "resolved": "https://registry.npmjs.org/systemjs/-/systemjs-6.12.1.tgz", + "integrity": "sha512-hqTN6kW+pN6/qro6G9OZ7ceDQOcYno020zBQKpZQLsJhYTDMCMNfXi/Y8duF5iW+4WWZr42ry0MMkcRGpbwG2A==", "dev": true }, "terser": { diff --git a/package.json b/package.json index a2f9057fd46..2a6c131309e 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^13.1.3", "@rollup/plugin-replace": "^3.0.1", - "@rollup/plugin-typescript": "^8.2.5", + "@rollup/plugin-typescript": "^8.3.0", "@rollup/pluginutils": "^4.1.2", "@types/node": "^10.17.60", "@types/signal-exit": "^3.0.1", @@ -100,7 +100,7 @@ "pretty-bytes": "^5.6.0", "pretty-ms": "^7.0.1", "requirejs": "^2.3.6", - "rollup": "^2.64.0", + "rollup": "^2.65.0", "rollup-plugin-license": "^2.6.1", "rollup-plugin-string": "^3.0.0", "rollup-plugin-terser": "^7.0.2", @@ -111,7 +111,7 @@ "source-map": "^0.7.3", "source-map-support": "^0.5.21", "sourcemap-codec": "^1.4.8", - "systemjs": "^6.11.0", + "systemjs": "^6.12.1", "terser": "^5.10.0", "tslib": "^2.3.1", "typescript": "^4.5.5", diff --git a/src/ExternalModule.ts b/src/ExternalModule.ts index efd5420de5f..80e60e26fe1 100644 --- a/src/ExternalModule.ts +++ b/src/ExternalModule.ts @@ -46,6 +46,7 @@ export default class ExternalModule { get dynamicImporters() { return dynamicImporters.sort(); }, + hasDefaultExport: null, hasModuleSideEffects, id, implicitlyLoadedAfterOneOf: EMPTY_ARRAY, diff --git a/src/Module.ts b/src/Module.ts index fe458e638b0..93db11d47d6 100644 --- a/src/Module.ts +++ b/src/Module.ts @@ -277,6 +277,13 @@ export default class Module { get dynamicImporters() { return module.dynamicImporters.sort(); }, + get hasDefaultExport() { + // This information is only valid after parsing + if (!module.ast) { + return null; + } + return 'default' in module.exports || 'default' in module.reexportDescriptions; + }, hasModuleSideEffects, id, get implicitlyLoadedAfterOneOf() { diff --git a/src/rollup/types.d.ts b/src/rollup/types.d.ts index cf2ffa4117e..93f1c37e1b0 100644 --- a/src/rollup/types.d.ts +++ b/src/rollup/types.d.ts @@ -162,6 +162,7 @@ interface ModuleInfo { dynamicImporters: readonly string[]; dynamicallyImportedIdResolutions: readonly ResolvedId[]; dynamicallyImportedIds: readonly string[]; + hasDefaultExport: boolean | null; hasModuleSideEffects: boolean | 'no-treeshake'; id: string; implicitlyLoadedAfterOneOf: readonly string[]; diff --git a/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-emitted-entry/_config.js b/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-emitted-entry/_config.js index 661bf005fac..0651fc7ad26 100644 --- a/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-emitted-entry/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-emitted-entry/_config.js @@ -73,6 +73,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], + hasDefaultExport: false, hasModuleSideEffects: true, id: ID_MAIN, implicitlyLoadedAfterOneOf: [], @@ -143,6 +144,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], + hasDefaultExport: false, hasModuleSideEffects: true, id: ID_DEP, implicitlyLoadedAfterOneOf: [], diff --git a/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-entry/_config.js b/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-entry/_config.js index 7856f608a24..e25d1c64c4d 100644 --- a/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-entry/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-entry/_config.js @@ -69,6 +69,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], + hasDefaultExport: false, hasModuleSideEffects: true, id: ID_MAIN, implicitlyLoadedAfterOneOf: [], @@ -139,6 +140,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], + hasDefaultExport: false, hasModuleSideEffects: true, id: ID_DEP, implicitlyLoadedAfterOneOf: [], diff --git a/test/chunking-form/samples/implicit-dependencies/multiple-dependencies/_config.js b/test/chunking-form/samples/implicit-dependencies/multiple-dependencies/_config.js index c0d26c83d4b..8802c21bf44 100644 --- a/test/chunking-form/samples/implicit-dependencies/multiple-dependencies/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/multiple-dependencies/_config.js @@ -117,6 +117,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], + hasDefaultExport: false, hasModuleSideEffects: true, id: ID_MAIN1, implicitlyLoadedAfterOneOf: [], @@ -236,6 +237,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], + hasDefaultExport: false, hasModuleSideEffects: true, id: ID_MAIN2, implicitlyLoadedAfterOneOf: [], @@ -354,6 +356,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], + hasDefaultExport: false, hasModuleSideEffects: true, id: ID_DEP, implicitlyLoadedAfterOneOf: [ID_MAIN1, ID_MAIN2], diff --git a/test/chunking-form/samples/implicit-dependencies/single-dependency/_config.js b/test/chunking-form/samples/implicit-dependencies/single-dependency/_config.js index 699ba45512e..14c405191ee 100644 --- a/test/chunking-form/samples/implicit-dependencies/single-dependency/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/single-dependency/_config.js @@ -68,6 +68,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], + hasDefaultExport: false, hasModuleSideEffects: true, id: ID_MAIN, implicitlyLoadedAfterOneOf: [], @@ -138,6 +139,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], + hasDefaultExport: false, hasModuleSideEffects: true, id: ID_DEP, implicitlyLoadedAfterOneOf: [ID_MAIN], diff --git a/test/function/samples/deprecated/manual-chunks-info/_config.js b/test/function/samples/deprecated/manual-chunks-info/_config.js index c3d75ad7977..7749e615892 100644 --- a/test/function/samples/deprecated/manual-chunks-info/_config.js +++ b/test/function/samples/deprecated/manual-chunks-info/_config.js @@ -111,6 +111,7 @@ module.exports = { ], dynamicallyImportedIds: [getId('dynamic')], dynamicImporters: [], + hasDefaultExport: false, hasModuleSideEffects: true, id: getId('main'), implicitlyLoadedAfterOneOf: [], @@ -145,6 +146,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [getId('dynamic')], + hasDefaultExport: null, hasModuleSideEffects: true, id: 'external', implicitlyLoadedAfterOneOf: [], @@ -177,6 +179,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], + hasDefaultExport: true, hasModuleSideEffects: true, id: getId('lib'), implicitlyLoadedAfterOneOf: [], @@ -260,6 +263,7 @@ module.exports = { ], dynamicallyImportedIds: ['external'], dynamicImporters: [getId('main')], + hasDefaultExport: false, hasModuleSideEffects: true, id: getId('dynamic'), implicitlyLoadedAfterOneOf: [], diff --git a/test/function/samples/has-default-export/_config.js b/test/function/samples/has-default-export/_config.js new file mode 100644 index 00000000000..daea5948706 --- /dev/null +++ b/test/function/samples/has-default-export/_config.js @@ -0,0 +1,45 @@ +const assert = require('assert'); +const path = require('path'); + +module.exports = { + description: 'reports if a module has a default export', + options: { + plugins: [ + { + async buildStart() { + const ID_MAIN = path.join(__dirname, 'main.js'); + const loadMain = this.load({ id: ID_MAIN }); + assert.strictEqual(this.getModuleInfo(ID_MAIN).hasDefaultExport, null); + assert.strictEqual((await loadMain).hasDefaultExport, false); + + assert.strictEqual( + (await this.load({ id: path.join(__dirname, 'direct.js') })).hasDefaultExport, + true, + 'direct' + ); + assert.strictEqual( + (await this.load({ id: path.join(__dirname, 'indirect.js') })).hasDefaultExport, + true, + 'indirect' + ); + assert.strictEqual( + (await this.load({ id: path.join(__dirname, 'reexport1.js') })).hasDefaultExport, + true, + 'reexport' + ); + assert.strictEqual( + (await this.load({ id: path.join(__dirname, 'reexport2.js') })).hasDefaultExport, + true, + 'renamed reexport' + ); + }, + load(id) { + assert.strictEqual(this.getModuleInfo(id).hasDefaultExport, null, `load ${id}`); + }, + transform(code, id) { + assert.strictEqual(this.getModuleInfo(id).hasDefaultExport, null, `transform ${id}`); + } + } + ] + } +}; diff --git a/test/function/samples/has-default-export/direct.js b/test/function/samples/has-default-export/direct.js new file mode 100644 index 00000000000..f2f6d5c381b --- /dev/null +++ b/test/function/samples/has-default-export/direct.js @@ -0,0 +1 @@ +export default 'direct'; diff --git a/test/function/samples/has-default-export/indirect.js b/test/function/samples/has-default-export/indirect.js new file mode 100644 index 00000000000..28786796a99 --- /dev/null +++ b/test/function/samples/has-default-export/indirect.js @@ -0,0 +1,2 @@ +const indirect = 'indirect'; +export { indirect as default }; diff --git a/test/function/samples/has-default-export/main.js b/test/function/samples/has-default-export/main.js new file mode 100644 index 00000000000..28d6ee09c9c --- /dev/null +++ b/test/function/samples/has-default-export/main.js @@ -0,0 +1,9 @@ +import direct from './direct.js'; +import indirect from './indirect.js'; +import reexport1 from './reexport1.js'; +import reexport2 from './reexport2.js'; + +assert.strictEqual(direct, 'direct'); +assert.strictEqual(indirect, 'indirect'); +assert.strictEqual(reexport1, 'default'); +assert.strictEqual(reexport2, 'foo'); diff --git a/test/function/samples/has-default-export/other.js b/test/function/samples/has-default-export/other.js new file mode 100644 index 00000000000..a99ac05aa02 --- /dev/null +++ b/test/function/samples/has-default-export/other.js @@ -0,0 +1,2 @@ +export default 'default'; +export const foo = 'foo'; diff --git a/test/function/samples/has-default-export/reexport1.js b/test/function/samples/has-default-export/reexport1.js new file mode 100644 index 00000000000..b98cf73cdb9 --- /dev/null +++ b/test/function/samples/has-default-export/reexport1.js @@ -0,0 +1 @@ +export { default } from './other.js'; diff --git a/test/function/samples/has-default-export/reexport2.js b/test/function/samples/has-default-export/reexport2.js new file mode 100644 index 00000000000..08facccd528 --- /dev/null +++ b/test/function/samples/has-default-export/reexport2.js @@ -0,0 +1 @@ +export { foo as default } from './other.js'; diff --git a/test/function/samples/manual-chunks-info/_config.js b/test/function/samples/manual-chunks-info/_config.js index 4780bfcae47..b30f082d6e0 100644 --- a/test/function/samples/manual-chunks-info/_config.js +++ b/test/function/samples/manual-chunks-info/_config.js @@ -110,6 +110,7 @@ module.exports = { ], dynamicallyImportedIds: [getId('dynamic')], dynamicImporters: [], + hasDefaultExport: false, hasModuleSideEffects: true, id: getId('main'), implicitlyLoadedAfterOneOf: [], @@ -144,6 +145,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [getId('dynamic')], + hasDefaultExport: null, hasModuleSideEffects: true, id: 'external', implicitlyLoadedAfterOneOf: [], @@ -176,6 +178,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], + hasDefaultExport: true, hasModuleSideEffects: true, id: getId('lib'), implicitlyLoadedAfterOneOf: [], @@ -259,6 +262,7 @@ module.exports = { ], dynamicallyImportedIds: ['external'], dynamicImporters: [getId('main')], + hasDefaultExport: false, hasModuleSideEffects: true, id: getId('dynamic'), implicitlyLoadedAfterOneOf: [], diff --git a/test/function/samples/module-parsed-hook/_config.js b/test/function/samples/module-parsed-hook/_config.js index c1505d17f54..75e093d2e4d 100644 --- a/test/function/samples/module-parsed-hook/_config.js +++ b/test/function/samples/module-parsed-hook/_config.js @@ -51,6 +51,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], + hasDefaultExport: false, hasModuleSideEffects: true, id: ID_MAIN, implicitlyLoadedAfterOneOf: [], @@ -107,6 +108,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], + hasDefaultExport: false, hasModuleSideEffects: true, id: ID_DEP, implicitlyLoadedAfterOneOf: [], diff --git a/test/function/samples/plugin-module-information/_config.js b/test/function/samples/plugin-module-information/_config.js index 67a5202770d..f5ad0b6e12a 100644 --- a/test/function/samples/plugin-module-information/_config.js +++ b/test/function/samples/plugin-module-information/_config.js @@ -18,6 +18,7 @@ module.exports = { ast: null, code: null, dynamicImporters: [], + hasDefaultExport: null, dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], hasModuleSideEffects: true, @@ -183,6 +184,7 @@ module.exports = { ], dynamicallyImportedIds: [ID_NESTED, ID_PATH], dynamicImporters: [], + hasDefaultExport: false, hasModuleSideEffects: true, id: ID_MAIN, implicitlyLoadedAfterOneOf: [], @@ -270,6 +272,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [], + hasDefaultExport: false, hasModuleSideEffects: true, id: ID_FOO, implicitlyLoadedAfterOneOf: [], @@ -297,6 +300,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [ID_MAIN], + hasDefaultExport: null, hasModuleSideEffects: true, id: ID_PATH, implicitlyLoadedAfterOneOf: [], @@ -379,6 +383,7 @@ module.exports = { dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], dynamicImporters: [ID_MAIN], + hasDefaultExport: false, hasModuleSideEffects: true, id: ID_NESTED, implicitlyLoadedAfterOneOf: [], diff --git a/test/function/samples/preload-module/_config.js b/test/function/samples/preload-module/_config.js index 15ce55e3c24..51ec568846e 100644 --- a/test/function/samples/preload-module/_config.js +++ b/test/function/samples/preload-module/_config.js @@ -33,6 +33,7 @@ module.exports = { assert.deepStrictEqual(moduleInfo, { code: "import './dep';\nassert.ok(true);\n", dynamicImporters: [], + hasDefaultExport: false, dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], hasModuleSideEffects: true, @@ -73,6 +74,7 @@ module.exports = { assert.deepStrictEqual(moduleInfo, { code: 'assert.ok(true);\n', dynamicImporters: [], + hasDefaultExport: false, dynamicallyImportedIdResolutions: [], dynamicallyImportedIds: [], hasModuleSideEffects: true, From c568a1047e35875db7c82a9bfbc122be5aae292d Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Sat, 22 Jan 2022 07:31:44 +0100 Subject: [PATCH 28/30] Add "resolveDependencies" option to "this.load" (#4358) --- docs/05-plugin-development.md | 73 ++++++++++++++- src/ModuleLoader.ts | 73 ++++++++------- src/rollup/types.d.ts | 4 +- .../load-resolve-dependencies/_config.js | 93 +++++++++++++++++++ .../load-resolve-dependencies/first.js | 3 + .../samples/load-resolve-dependencies/main.js | 1 + .../load-resolve-dependencies/second.js | 1 + .../load-resolve-dependencies/third.js | 1 + 8 files changed, 214 insertions(+), 35 deletions(-) create mode 100644 test/function/samples/load-resolve-dependencies/_config.js create mode 100644 test/function/samples/load-resolve-dependencies/first.js create mode 100644 test/function/samples/load-resolve-dependencies/main.js create mode 100644 test/function/samples/load-resolve-dependencies/second.js create mode 100644 test/function/samples/load-resolve-dependencies/third.js diff --git a/docs/05-plugin-development.md b/docs/05-plugin-development.md index 4b6615e0349..2f02507230e 100644 --- a/docs/05-plugin-development.md +++ b/docs/05-plugin-development.md @@ -726,13 +726,13 @@ Get ids of the files which has been watched previously. Include both files added #### `this.load` -**Type:** `({id: string, moduleSideEffects?: boolean | 'no-treeshake' | null, syntheticNamedExports?: boolean | string | null, meta?: {[plugin: string]: any} | null}) => Promise` +**Type:** `({id: string, moduleSideEffects?: boolean | 'no-treeshake' | null, syntheticNamedExports?: boolean | string | null, meta?: {[plugin: string]: any} | null, resolveDependencies?: boolean}) => Promise` Loads and parses the module corresponding to the given id, attaching additional meta information to the module if provided. This will trigger the same [`load`](guide/en/#load), [`transform`](guide/en/#transform) and [`moduleParsed`](guide/en/#moduleparsed) hooks that would be triggered if the module were imported by another module. This allows you to inspect the final content of modules before deciding how to resolve them in the [`resolveId`](guide/en/#resolveid) hook and e.g. resolve to a proxy module instead. If the module becomes part of the graph later, there is no additional overhead from using this context function as the module will not be parsed again. The signature allows you to directly pass the return value of [`this.resolve`](guide/en/#thisresolve) to this function as long as it is neither `null` nor external. -The returned promise will resolve once the module has been fully transformed and parsed but before any imports have been resolved. That means that the resulting `ModuleInfo` will have empty `importedIds`, `dynamicallyImportedIds`, `importedIdResolutions` and `dynamicallyImportedIdResolutions`. This helps to avoid deadlock situations when awaiting `this.load` in a `resolveId` hook. If you are interested in `importedIds` and `dynamicallyImportedIds`, you should implement a `moduleParsed` hook. +The returned promise will resolve once the module has been fully transformed and parsed but before any imports have been resolved. That means that the resulting `ModuleInfo` will have empty `importedIds`, `dynamicallyImportedIds`, `importedIdResolutions` and `dynamicallyImportedIdResolutions`. This helps to avoid deadlock situations when awaiting `this.load` in a `resolveId` hook. If you are interested in `importedIds` and `dynamicallyImportedIds`, you can either implement a `moduleParsed` hook or pass the `resolveDependencies` flag, which will make the promise returned by `this.load` wait until all dependency ids have been resolved. Note that with regard to the `moduleSideEffects`, `syntheticNamedExports` and `meta` options, the same restrictions apply as for the `resolveId` hook: Their values only have an effect if the module has not been loaded yet. Thus, it is very important to use `this.resolve` first to find out if any plugins want to set special values for these options in their `resolveId` hook, and pass these options on to `this.load` if appropriate. The example below showcases how this can be handled to add a proxy module for modules containing a special code comment. Note the special handling for re-exporting the default export: @@ -777,10 +777,77 @@ export default function addProxyPlugin() { } ``` -If the module was already loaded, this will just wait for the parsing to complete and then return its module information. If the module was not yet imported by another module, this will not automatically trigger loading other modules imported by this module. Instead, static and dynamic dependencies will only be loaded once this module has actually been imported at least once. +If the module was already loaded, `this.load` will just wait for the parsing to complete and then return its module information. If the module was not yet imported by another module, it will not automatically trigger loading other modules imported by this module. Instead, static and dynamic dependencies will only be loaded once this module has actually been imported at least once. While it is safe to use `this.load` in a `resolveId` hook, you should be very careful when awaiting it in a `load` or `transform` hook. If there are cyclic dependencies in the module graph, this can easily lead to a deadlock, so any plugin needs to manually take care to avoid waiting for `this.load` inside the `load` or `transform` of the any module that is in a cycle with the loaded module. +Here is another, more elaborate example where we scan entire dependency sub-graphs via the `resolveDependencies` option and repeated calls to `this.load`. We use a `Set` of handled module ids to handle cyclic dependencies. The goal of the plugin is to add a log to each dynamically imported chunk that just lists all modules in the chunk. While this is just a toy example, the technique could be used to e.g. create a single style tag for all CSS imported in the sub-graph. + +```js +// The leading \0 instructs other plugins not to try to resolve, load or +// transform our proxy modules +const DYNAMIC_IMPORT_PROXY_PREFIX = '\0dynamic-import:'; + +export default function dynamicChunkLogsPlugin() { + return { + name: 'dynamic-chunk-logs', + async resolveDynamicImport(specifier, importer) { + // Ignore non-static targets + if (!(typeof specifier === 'string')) return; + // Get the id and initial meta information of the import target + const resolved = await this.resolve(specifier, importer); + // Ignore external targets. Explicit externals have the "external" + // property while unresolved imports are "null". + if (resolved && !resolved.external) { + // We trigger loading the module without waiting for it here + // because meta information attached by resolveId hooks, that may + // be contained in "resolved" and that plugins like "commonjs" may + // depend upon, is only attached to a module the first time it is + // loaded. + // This ensures that this meta information is not lost when we later + // use "this.load" again in the load hook with just the module id. + this.load(resolved); + return `${DYNAMIC_IMPORT_PROXY_PREFIX}${resolved.id}`; + } + }, + async load(id) { + // Ignore all files except our dynamic import proxies + if (!id.startsWith('\0dynamic-import:')) return null; + const actualId = id.slice(DYNAMIC_IMPORT_PROXY_PREFIX.length); + // To allow loading modules in parallel while keeping complexity low, + // we do not directly await each "this.load" call but put their + // promises into an array where we await them via an async for loop. + const moduleInfoPromises = [this.load({ id: actualId, resolveDependencies: true })]; + // We track each loaded dependency here so that we do not load a file + // twice and also do not get stuck when there are circular + // dependencies. + const dependencies = new Set([actualId]); + // "importedIdResolutions" tracks the objects created by resolveId + // hooks. We are using those instead of "importedIds" so that again, + // important meta information is not lost. + for await (const { importedIdResolutions } of moduleInfoPromises) { + for (const resolved of importedIdResolutions) { + if (!dependencies.has(resolved.id)) { + dependencies.add(resolved.id); + moduleInfoPromises.push(this.load({ ...resolved, resolveDependencies: true })); + } + } + } + // We log all modules in a dynamic chunk when it is loaded. + let code = `console.log([${[...dependencies] + .map(JSON.stringify) + .join(', ')}]); export * from ${JSON.stringify(actualId)};`; + // Namespace reexports do not reexport default exports, which is why + // we reexport it manually if it exists + if (this.getModuleInfo(actualId).hasDefaultExport) { + code += `export { default } from ${JSON.stringify(actualId)};`; + } + return code; + } + }; +} +``` + #### `this.meta` **Type:** `{rollupVersion: string, watchMode: boolean}` diff --git a/src/ModuleLoader.ts b/src/ModuleLoader.ts index 648d9aba78b..7fd31350013 100644 --- a/src/ModuleLoader.ts +++ b/src/ModuleLoader.ts @@ -60,6 +60,8 @@ type LoadModulePromise = Promise< loadAndResolveDependencies: Promise ] >; +type PreloadType = boolean | 'resolveDependencies'; +const RESOLVE_DEPENDENCIES: PreloadType = 'resolveDependencies'; export class ModuleLoader { private readonly hasModuleSideEffects: HasModuleSideEffects; @@ -161,12 +163,14 @@ export class ModuleLoader { return module; } - public async preloadModule(resolvedId: NormalizedResolveIdWithoutDefaults): Promise { + public async preloadModule( + resolvedId: { id: string; resolveDependencies?: boolean } & Partial> + ): Promise { const module = await this.fetchModule( - this.addDefaultsToResolvedId(resolvedId)!, + this.getResolvedIdWithDefaults(resolvedId)!, undefined, false, - true + resolvedId.resolveDependencies ? RESOLVE_DEPENDENCIES : true ); return module.info; } @@ -178,7 +182,7 @@ export class ModuleLoader { isEntry: boolean | undefined, skip: readonly { importer: string | undefined; plugin: Plugin; source: string }[] | null = null ): Promise => { - return this.addDefaultsToResolvedId( + return this.getResolvedIdWithDefaults( this.getNormalizedResolvedIdWithoutDefaults( this.options.external(source, importer, false) ? false @@ -199,23 +203,6 @@ export class ModuleLoader { ); }; - private addDefaultsToResolvedId( - resolvedId: NormalizedResolveIdWithoutDefaults | null - ): ResolvedId | null { - if (!resolvedId) { - return null; - } - const external = resolvedId.external || false; - return { - external, - id: resolvedId.id, - meta: resolvedId.meta || {}, - moduleSideEffects: - resolvedId.moduleSideEffects ?? this.hasModuleSideEffects(resolvedId.id, !!external), - syntheticNamedExports: resolvedId.syntheticNamedExports ?? false - }; - } - private addEntryWithImplicitDependants( unresolvedModule: UnresolvedModule, implicitlyLoadedAfter: readonly string[] @@ -353,7 +340,7 @@ export class ModuleLoader { { id, meta, moduleSideEffects, syntheticNamedExports }: ResolvedId, importer: string | undefined, isEntry: boolean, - isPreload: boolean + isPreload: PreloadType ): Promise { const existingModule = this.modulesById.get(id); if (existingModule instanceof Module) { @@ -377,11 +364,9 @@ export class ModuleLoader { this.getResolveDynamicImportPromises(module), loadAndResolveDependenciesPromise ]); - const loadAndResolveDependenciesPromise = loadPromise - .then(([resolveStaticDependencyPromises, resolveDynamicImportPromises]) => - Promise.all([...resolveStaticDependencyPromises, ...resolveDynamicImportPromises]) - ) - .then(() => this.pluginDriver.hookParallel('moduleParsed', [module.info])); + const loadAndResolveDependenciesPromise = waitForDependencyResolution(loadPromise).then(() => + this.pluginDriver.hookParallel('moduleParsed', [module.info]) + ); loadAndResolveDependenciesPromise.catch(() => { /* avoid unhandled promise rejections */ }); @@ -389,6 +374,8 @@ export class ModuleLoader { const resolveDependencyPromises = await loadPromise; if (!isPreload) { await this.fetchModuleDependencies(module, ...resolveDependencyPromises); + } else if (isPreload === RESOLVE_DEPENDENCIES) { + await loadAndResolveDependenciesPromise; } return module; } @@ -545,10 +532,29 @@ export class ModuleLoader { ); } - private async handleExistingModule(module: Module, isEntry: boolean, isPreload: boolean) { + private getResolvedIdWithDefaults( + resolvedId: NormalizedResolveIdWithoutDefaults | null + ): ResolvedId | null { + if (!resolvedId) { + return null; + } + const external = resolvedId.external || false; + return { + external, + id: resolvedId.id, + meta: resolvedId.meta || {}, + moduleSideEffects: + resolvedId.moduleSideEffects ?? this.hasModuleSideEffects(resolvedId.id, !!external), + syntheticNamedExports: resolvedId.syntheticNamedExports ?? false + }; + } + + private async handleExistingModule(module: Module, isEntry: boolean, isPreload: PreloadType) { const loadPromise = this.moduleLoadPromises.get(module)!; if (isPreload) { - return loadPromise; + return isPreload === RESOLVE_DEPENDENCIES + ? waitForDependencyResolution(loadPromise) + : loadPromise; } if (isEntry) { module.info.isEntry = true; @@ -620,7 +626,7 @@ export class ModuleLoader { ); } return this.fetchModule( - this.addDefaultsToResolvedId( + this.getResolvedIdWithDefaults( typeof resolveIdResult === 'object' ? (resolveIdResult as NormalizedResolveIdWithoutDefaults) : { id: resolveIdResult } @@ -663,7 +669,7 @@ export class ModuleLoader { )); } return this.handleResolveId( - this.addDefaultsToResolvedId( + this.getResolvedIdWithDefaults( this.getNormalizedResolvedIdWithoutDefaults(resolution, importer, specifier) ), specifier, @@ -708,3 +714,8 @@ function isNotAbsoluteExternal( !isAbsolute(id) ); } + +async function waitForDependencyResolution(loadPromise: LoadModulePromise) { + const [resolveStaticDependencyPromises, resolveDynamicImportPromises] = await loadPromise; + return Promise.all([...resolveStaticDependencyPromises, ...resolveDynamicImportPromises]); +} diff --git a/src/rollup/types.d.ts b/src/rollup/types.d.ts index 93f1c37e1b0..f1b6307eecf 100644 --- a/src/rollup/types.d.ts +++ b/src/rollup/types.d.ts @@ -202,7 +202,9 @@ export interface PluginContext extends MinimalPluginContext { getWatchFiles: () => string[]; /** @deprecated Use `this.resolve` instead */ isExternal: IsExternal; - load: (options: { id: string } & Partial>) => Promise; + load: ( + options: { id: string; resolveDependencies?: boolean } & Partial> + ) => Promise; /** @deprecated Use `this.getModuleIds` instead */ moduleIds: IterableIterator; parse: (input: string, options?: any) => AcornNode; diff --git a/test/function/samples/load-resolve-dependencies/_config.js b/test/function/samples/load-resolve-dependencies/_config.js new file mode 100644 index 00000000000..dcf1a498f7d --- /dev/null +++ b/test/function/samples/load-resolve-dependencies/_config.js @@ -0,0 +1,93 @@ +const assert = require('assert'); +const path = require('path'); +const DYNAMIC_IMPORT_PROXY_PREFIX = '\0dynamic-import:'; +const chunks = []; + +module.exports = { + description: 'allows to wait for dependency resolution in this.load to scan dependency trees', + context: { chunks }, + async exports(exports) { + assert.deepStrictEqual(chunks, []); + const { importSecond } = await exports.importFirst(); + const expectedFirstChunk = ['first.js', 'second.js', 'third.js'].map(name => + path.join(__dirname, name) + ); + assert.deepStrictEqual(chunks, [expectedFirstChunk]); + await importSecond(); + const expectedSecondChunk = ['second.js', 'third.js'].map(name => path.join(__dirname, name)); + assert.deepStrictEqual(chunks, [expectedFirstChunk, expectedSecondChunk]); + }, + options: { + plugins: [ + { + name: 'add-chunk-log', + async resolveDynamicImport(specifier, importer) { + // Ignore non-static targets + if (!(typeof specifier === 'string')) return; + // Get the id and initial meta information of the import target + const resolved = await this.resolve(specifier, importer); + // Ignore external targets. Explicit externals have the "external" + // property while unresolved imports are "null". + if (resolved && !resolved.external) { + // We trigger loading the module without waiting for it here + // because meta information attached by resolveId hooks (that may + // be contained in "resolved") is only attached to a module the + // first time it is loaded. + // That guarantees this meta information, that plugins like + // commonjs may depend upon, is not lost even if we use "this.load" + // with just the id in the load hook. + this.load(resolved); + return `${DYNAMIC_IMPORT_PROXY_PREFIX}${resolved.id}`; + } + }, + async load(id) { + // Ignore all files but our dynamic import proxies + if (!id.startsWith('\0dynamic-import:')) return null; + const actualId = id.slice(DYNAMIC_IMPORT_PROXY_PREFIX.length); + // To allow loading modules in parallel while keeping complexity low, + // we do not directly await each "this.load" call but put their + // promises into an array where we await each entry via an async for + // loop. + const moduleInfoPromises = [this.load({ id: actualId, resolveDependencies: true })]; + // We track each loaded dependency here so that we do not load a file + // twice and also do not get stuck when there are circular + // dependencies. + const dependencies = new Set([actualId]); + // "importedResolution" tracks the objects created via "resolveId". + // Again we are using those instead of "importedIds" so that + // important meta information is not lost. + for await (const { importedIdResolutions } of moduleInfoPromises) { + for (const resolved of importedIdResolutions) { + if (!dependencies.has(resolved.id)) { + dependencies.add(resolved.id); + moduleInfoPromises.push(this.load({ ...resolved, resolveDependencies: true })); + } + } + } + let code = `chunks.push([${[...dependencies] + .map(JSON.stringify) + .join(', ')}]); export * from ${JSON.stringify(actualId)};`; + // Namespace reexports do not reexport default exports, which is why + // we reexport it manually if it exists + if (this.getModuleInfo(actualId).hasDefaultExport) { + code += `export { default } from ${JSON.stringify(actualId)};`; + } + return code; + }, + async resolveId() { + // We delay resolution just slightly so that we can see the effect of + // resolveDependencies + return new Promise(resolve => setTimeout(() => resolve(null), 10)); + } + } + ] + }, + warnings: [ + { + code: 'CIRCULAR_DEPENDENCY', + cycle: ['second.js', 'third.js', 'second.js'], + importer: 'second.js', + message: 'Circular dependency: second.js -> third.js -> second.js' + } + ] +}; diff --git a/test/function/samples/load-resolve-dependencies/first.js b/test/function/samples/load-resolve-dependencies/first.js new file mode 100644 index 00000000000..df407ed8c89 --- /dev/null +++ b/test/function/samples/load-resolve-dependencies/first.js @@ -0,0 +1,3 @@ +import './second.js'; +import './third.js'; +export const importSecond = () => import('./second.js'); diff --git a/test/function/samples/load-resolve-dependencies/main.js b/test/function/samples/load-resolve-dependencies/main.js new file mode 100644 index 00000000000..c39b1a72fdb --- /dev/null +++ b/test/function/samples/load-resolve-dependencies/main.js @@ -0,0 +1 @@ +export const importFirst = () => import('./first.js') \ No newline at end of file diff --git a/test/function/samples/load-resolve-dependencies/second.js b/test/function/samples/load-resolve-dependencies/second.js new file mode 100644 index 00000000000..11611eedf50 --- /dev/null +++ b/test/function/samples/load-resolve-dependencies/second.js @@ -0,0 +1 @@ +import './third.js'; diff --git a/test/function/samples/load-resolve-dependencies/third.js b/test/function/samples/load-resolve-dependencies/third.js new file mode 100644 index 00000000000..f986185781a --- /dev/null +++ b/test/function/samples/load-resolve-dependencies/third.js @@ -0,0 +1 @@ +import './second.js'; From f1697c2bccda93650e7029a74bf0f4336d886482 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Sat, 22 Jan 2022 07:32:06 +0100 Subject: [PATCH 29/30] Update changelog --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1aa746d878f..641a8f24f27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # rollup changelog +## 2.66.0 + +_2022-01-22_ + +### Features + +- Note if a module has a default export in ModuleInfo to allow writing better proxy modules (#4356) +- Add option to wait until all imported ids have been resolved when awaiting `this.load` (#4358) + +### Pull Requests + +- [#4356](https://github.com/rollup/rollup/pull/4356): Add hasDefaultExport to ModuleInfo (@lukastaegert) +- [#4358](https://github.com/rollup/rollup/pull/4358): Add "resolveDependencies" option to "this.load" (@lukastaegert) + ## 2.65.0 _2022-01-21_ From 3ca594eb98846b6bca32a0280931b8356c522e0d Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Sat, 22 Jan 2022 07:32:12 +0100 Subject: [PATCH 30/30] 2.66.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 01c288d2117..aa8ec695c91 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "2.65.0", + "version": "2.66.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 2a6c131309e..cd30221bb23 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "2.65.0", + "version": "2.66.0", "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js",