diff --git a/docs/uncompiled/artplayer-plugin-chapter/index.js b/docs/uncompiled/artplayer-plugin-chapter/index.js index fefff8e01..534f03f22 100644 --- a/docs/uncompiled/artplayer-plugin-chapter/index.js +++ b/docs/uncompiled/artplayer-plugin-chapter/index.js @@ -6,7 +6,16 @@ // anything defined in a previous bundle is accessed via the // orig method which is the require for previous bundles -(function (modules, entry, mainEntry, parcelRequireName, globalName) { +(function ( + modules, + entry, + mainEntry, + parcelRequireName, + externals, + distDir, + publicUrl, + devServer +) { /* eslint-disable no-undef */ var globalObject = typeof globalThis !== 'undefined' @@ -25,6 +34,7 @@ typeof globalObject[parcelRequireName] === 'function' && globalObject[parcelRequireName]; + var importMap = previousRequire.i || {}; var cache = previousRequire.cache || {}; // Do not use `require` to prevent Webpack from trying to bundle this call var nodeRequire = @@ -35,6 +45,9 @@ function newRequire(name, jumped) { if (!cache[name]) { if (!modules[name]) { + if (externals[name]) { + return externals[name]; + } // if we cannot find the module within our internal map or // cache jump to the current global require ie. the last bundle // that was added to the page. @@ -73,7 +86,7 @@ localRequire, module, module.exports, - this + globalObject ); } @@ -81,7 +94,54 @@ function localRequire(x) { var res = localRequire.resolve(x); - return res === false ? {} : newRequire(res); + if (res === false) { + return {}; + } + // Synthesize a module to follow re-exports. + if (Array.isArray(res)) { + var m = {__esModule: true}; + res.forEach(function (v) { + var key = v[0]; + var id = v[1]; + var exp = v[2] || v[0]; + var x = newRequire(id); + if (key === '*') { + Object.keys(x).forEach(function (key) { + if ( + key === 'default' || + key === '__esModule' || + Object.prototype.hasOwnProperty.call(m, key) + ) { + return; + } + + Object.defineProperty(m, key, { + enumerable: true, + get: function () { + return x[key]; + }, + }); + }); + } else if (exp === '*') { + Object.defineProperty(m, key, { + enumerable: true, + value: x, + }); + } else { + Object.defineProperty(m, key, { + enumerable: true, + get: function () { + if (exp === 'default') { + return x.__esModule ? x.default : x; + } + return x[exp]; + }, + }); + } + }); + return m; + } + return newRequire(res); } function resolve(x) { @@ -93,6 +153,7 @@ function Module(moduleName) { this.id = moduleName; this.bundle = newRequire; + this.require = nodeRequire; this.exports = {}; } @@ -101,6 +162,10 @@ newRequire.modules = modules; newRequire.cache = cache; newRequire.parent = previousRequire; + newRequire.distDir = distDir; + newRequire.publicUrl = publicUrl; + newRequire.devServer = devServer; + newRequire.i = importMap; newRequire.register = function (id, exports) { modules[id] = [ function (require, module) { @@ -110,6 +175,10 @@ ]; }; + // Only insert newRequire.load when it is actually used. + // The code in this file is linted against ES5, so dynamic import is not allowed. + // INSERT_LOAD_HERE + Object.defineProperty(newRequire, 'root', { get: function () { return globalObject[parcelRequireName]; @@ -136,13 +205,9 @@ define(function () { return mainExports; }); - - //