diff --git a/dist/ncc/loaders/readme.md b/dist/ncc/loaders/readme.md index a83acdc7..98cad61a 100644 --- a/dist/ncc/loaders/readme.md +++ b/dist/ncc/loaders/readme.md @@ -2,8 +2,9 @@ This directory will contain: -- `node-loader.js` the ncc loader for supporting Node binary requires - `relocate-loader.js` the ncc loader for handling CommonJS asset and reference relocations +- `shebang-loader.js` the ncc loader to ensure proper hash bang support in Node.js CLI files +- `ts-loader.js` the ncc loader for handling TypeScript These are generated by the `build` step defined in `../../../package.json`. diff --git a/dist/ncc/readme.md b/dist/ncc/readme.md index 5da0c49d..36574a32 100644 --- a/dist/ncc/readme.md +++ b/dist/ncc/readme.md @@ -4,6 +4,7 @@ This directory will contain: - `index.js` the main ncc bundle - `cli.js` the CLI bundle, excluding the main ncc bundle +- `typescript.js` the TypeScript detection file These are generated by the `build` step defined in `../../package.json`. diff --git a/package.json b/package.json index 24e959d2..3495109f 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "@google-cloud/bigquery": "^2.0.1", "@google-cloud/firestore": "^0.19.0", "@sentry/node": "^4.3.0", - "acorn": "^6.0.4", + "@zeit/webpack-asset-relocator-loader": "^0.1.4", "analytics-node": "^3.3.0", "apollo-server-express": "^2.2.2", "arg": "^2.0.0", @@ -29,7 +29,6 @@ "aws-sdk": "^2.356.0", "axios": "^0.18.0", "azure-storage": "^2.10.2", - "bindings": "^1.3.1", "bytes": "^3.0.0", "canvas": "^2.2.0", "chromeless": "^1.5.2", @@ -37,7 +36,6 @@ "copy": "^0.3.2", "core-js": "^2.5.7", "cowsay": "^1.3.1", - "estree-walker": "^0.5.2", "express": "^4.16.4", "fetch-h2": "^1.0.2", "firebase": "^5.5.8", @@ -58,9 +56,7 @@ "jugglingdb": "^2.0.0-rc8", "koa": "^2.6.2", "leveldown": "^4.0.1", - "loader-utils": "^1.1.0", "loopback": "^3.24.0", - "magic-string": "^0.25.1", "mailgun": "^0.5.0", "mariadb": "^2.0.1-beta", "memcached": "^2.2.2", @@ -68,8 +64,6 @@ "mongoose": "^5.3.12", "mysql": "^2.16.0", "node-gyp": "^3.8.0", - "node-native-loader": "^1.1.1", - "node-pre-gyp": "^0.12.0", "passport": "^0.4.0", "passport-google-oauth": "^1.0.0", "path-platform": "^0.11.15", @@ -79,8 +73,6 @@ "react-dom": "^16.6.3", "redis": "^2.8.0", "request": "^2.88.0", - "resolve": "^1.8.1", - "rollup-pluginutils": "^2.3.3", "rxjs": "^6.3.3", "saslprep": "^1.0.2", "sharp": "^0.21.1", diff --git a/scripts/build.js b/scripts/build.js index 9cb1d831..4f64d6f8 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -35,15 +35,6 @@ async function main() { } ); - const { code: nodeLoader, assets: nodeLoaderAssets } = await ncc( - __dirname + "/../src/loaders/node-loader", - { - filename: "node-loader.js", - minify: true, - v8cache: true - } - ); - const { code: relocateLoader, assets: relocateLoaderAssets } = await ncc( __dirname + "/../src/loaders/relocate-loader", { filename: "relocate-loader.js", minify: true, v8cache: true } @@ -72,7 +63,6 @@ async function main() { const unknownAssets = [ ...Object.keys(cliAssets), ...Object.keys(indexAssets).filter(asset => !asset.startsWith('locales/')), - ...Object.keys(nodeLoaderAssets), ...Object.keys(relocateLoaderAssets), ...Object.keys(shebangLoaderAssets), ...Object.keys(tsLoaderAssets).filter(asset => !asset.startsWith('lib/')), @@ -87,7 +77,6 @@ async function main() { writeFileSync(__dirname + "/../dist/ncc/cli.js.cache", cliAssets["cli.js.cache"]); writeFileSync(__dirname + "/../dist/ncc/index.js.cache", indexAssets["index.js.cache"]); writeFileSync(__dirname + "/../dist/ncc/sourcemap-register.js.cache", sourcemapAssets["sourcemap-register.js.cache"]); - writeFileSync(__dirname + "/../dist/ncc/loaders/node-loader.js.cache", nodeLoaderAssets["node-loader.js.cache"]); writeFileSync(__dirname + "/../dist/ncc/loaders/relocate-loader.js.cache", relocateLoaderAssets["relocate-loader.js.cache"]); writeFileSync(__dirname + "/../dist/ncc/loaders/shebang-loader.js.cache", shebangLoaderAssets["shebang-loader.js.cache"]); writeFileSync(__dirname + "/../dist/ncc/loaders/ts-loader.js.cache", tsLoaderAssets["ts-loader.js.cache"]); @@ -95,7 +84,6 @@ async function main() { writeFileSync(__dirname + "/../dist/ncc/cli.js.cache.js", cliAssets["cli.js.cache.js"]); writeFileSync(__dirname + "/../dist/ncc/index.js.cache.js", indexAssets["index.js.cache.js"]); writeFileSync(__dirname + "/../dist/ncc/sourcemap-register.js.cache.js", sourcemapAssets["sourcemap-register.js.cache.js"]); - writeFileSync(__dirname + "/../dist/ncc/loaders/node-loader.js.cache.js", nodeLoaderAssets["node-loader.js.cache.js"]); writeFileSync(__dirname + "/../dist/ncc/loaders/relocate-loader.js.cache.js", relocateLoaderAssets["relocate-loader.js.cache.js"]); writeFileSync(__dirname + "/../dist/ncc/loaders/shebang-loader.js.cache.js", shebangLoaderAssets["shebang-loader.js.cache.js"]); writeFileSync(__dirname + "/../dist/ncc/loaders/ts-loader.js.cache.js", tsLoaderAssets["ts-loader.js.cache.js"]); @@ -118,7 +106,6 @@ catch (e) { module.exports = typescript; `); writeFileSync(__dirname + "/../dist/ncc/sourcemap-register.js", sourcemapSupport); - writeFileSync(__dirname + "/../dist/ncc/loaders/node-loader.js", nodeLoader); writeFileSync(__dirname + "/../dist/ncc/loaders/relocate-loader.js", relocateLoader); writeFileSync(__dirname + "/../dist/ncc/loaders/shebang-loader.js", shebangLoader); writeFileSync(__dirname + "/../dist/ncc/loaders/ts-loader.js", tsLoader); diff --git a/src/index.js b/src/index.js index 589a31ab..7cbde3b2 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,7 @@ const resolve = require("resolve"); const fs = require("graceful-fs"); const crypto = require("crypto"); -const { sep, dirname } = require("path"); +const { sep } = require("path"); const webpack = require("webpack"); const MemoryFS = require("memory-fs"); const terser = require("terser"); @@ -26,7 +26,6 @@ const hashOf = name => { .slice(0, 10); } -const nodeLoader = eval('require(__dirname + "/loaders/node-loader.js")'); const relocateLoader = eval('require(__dirname + "/loaders/relocate-loader.js")'); module.exports = ( @@ -45,26 +44,18 @@ module.exports = ( process.env.TYPESCRIPT_LOOKUP_PATH = resolvedEntry; const shebangMatch = fs.readFileSync(resolvedEntry).toString().match(shebangRegEx); const mfs = new MemoryFS(); - const assetNames = Object.create(null); - assetNames[filename] = true; - if (sourceMap) - assetNames[filename + '.map'] = true; - if (v8cache) - assetNames[filename + '.cache'] = assetNames[filename + '.cache.js'] = true; - const resolvePlugins = []; - let tsconfigMatchPath; - const assetState = { - assets: Object.create(null), - assetNames, - assetPermissions: undefined - }; - assetState.assetNames[filename] = true; + + const existingAssetNames = [filename]; if (sourceMap) { - assetState.assetNames[filename + '.map'] = true; - assetState.assetNames['sourcemap-register.js'] = true; + existingAssetNames.push(filename + '.map'); + existingAssetNames.push('sourcemap-register.js'); + } + if (v8cache) { + existingAssetNames.push(filename + '.cache'); + existingAssetNames.push(filename + '.cache.js'); } - nodeLoader.setAssetState(assetState); - relocateLoader.setAssetState(assetState); + const resolvePlugins = []; + let tsconfigMatchPath; // add TsconfigPathsPlugin to support `paths` resolution in tsconfig // we need to catch here because the plugin will // error if there's no tsconfig in the working directory @@ -137,18 +128,13 @@ module.exports = ( module: { rules: [ { - test: /\.node$/, - use: [{ - loader: eval('__dirname + "/loaders/node-loader.js"') - }] - }, - { - test: /\.(js|mjs|tsx?)$/, + test: /\.(js|mjs|tsx?|node)$/, use: [{ loader: eval('__dirname + "/loaders/relocate-loader.js"'), options: { - cwd: dirname(resolvedEntry), - entryId: resolvedEntry + existingAssetNames, + escapeNonAnalyzableRequires: true, + wrapperCompatibility: true } }] }, @@ -180,24 +166,10 @@ module.exports = ( plugins: [ { apply(compiler) { - /* compiler.hooks.afterCompile.tap("ncc", compilation => { - compilation.cache.store('/NccPlugin/' + resolvedEntry, null, JSON.stringify(assetState.assetPermissions.permissions), (err) => { - if (err) console.error(err); - }); - }); */ compiler.hooks.watchRun.tap("ncc", () => { if (rebuildHandler) rebuildHandler(); }); - // override "not found" context to try built require first - compiler.hooks.compilation.tap("ncc", compilation => { - assetState.assetPermissions = Object.create(null); - /* compilation.cache.get('/NccPlugin/' + resolvedEntry, null, (err, _assetPermissions) => { - if (err) console.error(err); - assetState.assetPermissions = JSON.parse(_assetPermissions || 'null') || Object.create(null); - }); */ - }); - compiler.hooks.normalModuleFactory.tap("ncc", NormalModuleFactory => { function handler(parser) { parser.hooks.assign.for("require").intercept({ @@ -283,7 +255,7 @@ module.exports = ( function finalizeHandler () { const assets = Object.create(null); - getFlatFiles(mfs.data, assets, assetState.assetPermissions); + getFlatFiles(mfs.data, assets, relocateLoader.getAssetPermissions); delete assets[filename]; delete assets[filename + ".map"]; let code = mfs.readFileSync(`/${filename}`, "utf8"); @@ -356,18 +328,18 @@ module.exports = ( }; // this could be rewritten with actual FS apis / globs, but this is simpler -function getFlatFiles(mfsData, output, assetPermissions, curBase = "") { +function getFlatFiles(mfsData, output, getAssetPermissions, curBase = "") { for (const path of Object.keys(mfsData)) { const item = mfsData[path]; const curPath = curBase + "/" + path; // directory - if (item[""] === true) getFlatFiles(item, output, assetPermissions, curPath); + if (item[""] === true) getFlatFiles(item, output, getAssetPermissions, curPath); // file else if (!curPath.endsWith("/")) { output[curPath.substr(1)] = { source: mfsData[path], - permissions: assetPermissions[curPath.substr(1)] - } + permissions: getAssetPermissions(curPath.substr(1)) + }; } } } diff --git a/src/loaders/node-loader.js b/src/loaders/node-loader.js deleted file mode 100644 index 391fab44..00000000 --- a/src/loaders/node-loader.js +++ /dev/null @@ -1,31 +0,0 @@ -const path = require('path'); -const getUniqueAssetName = require('../utils/dedupe-names'); -const sharedlibEmit = require('../utils/sharedlib-emit'); -const getPackageBase = require('../utils/get-package-base'); -const fs = require('fs'); - -module.exports = async function (content) { - if (this.cacheable) - this.cacheable(); - this.async(); - - const id = this.resourcePath; - - const pkgBase = getPackageBase(this.resourcePath) || path.dirname(id); - await sharedlibEmit(pkgBase, assetState, this.emitFile); - - const name = getUniqueAssetName(id.substr(pkgBase.length + 1), id, assetState.assetNames); - - const permissions = await new Promise((resolve, reject) => - fs.stat(id, (err, stats) => err ? reject(err) : resolve(stats.mode)) - ) - assetState.assetPermissions[name] = permissions; - this.emitFile(name, content); - - this.callback(null, 'module.exports = __non_webpack_require__("./' + name + '")'); -}; -module.exports.raw = true; -let assetState; -module.exports.setAssetState = function (state) { - assetState = state; -} \ No newline at end of file diff --git a/src/loaders/relocate-loader.js b/src/loaders/relocate-loader.js index c9d01743..2b00eb4f 100644 --- a/src/loaders/relocate-loader.js +++ b/src/loaders/relocate-loader.js @@ -1,545 +1 @@ -const path = require('path'); -const { readFile, stat, statSync, existsSync } = require('graceful-fs'); -const { walk } = require('estree-walker'); -const MagicString = require('magic-string'); -const { attachScopes } = require('rollup-pluginutils'); -const evaluate = require('../utils/static-eval'); -const acorn = require('acorn'); -const bindings = require('bindings'); -const getUniqueAssetName = require('../utils/dedupe-names'); -const sharedlibEmit = require('../utils/sharedlib-emit'); -const glob = require('glob'); -const getPackageBase = require('../utils/get-package-base'); -const { pregyp, nbind } = require('../utils/binary-locators'); -const handleWrappers = require('../utils/wrappers'); -const { getOptions } = require("loader-utils"); - -const staticPath = Object.assign({ default: path }, path); -const staticFs = { default: { existsSync }, existsSync }; - -function isExpressionReference(node, parent) { - if (parent.type === 'MemberExpression') return parent.computed || node === parent.object; - - // disregard the `bar` in { bar: foo } - if (parent.type === 'Property' && node !== parent.value) return false; - - // disregard the `bar` in `class Foo { bar () {...} }` - if (parent.type === 'MethodDefinition') return false; - - // disregard the `bar` in `export { foo as bar }` - if (parent.type === 'ExportSpecifier' && node !== parent.local) return false; - - // disregard the `bar` in var bar = asdf - if (parent.type === 'VariableDeclarator' && node.id === node) return false; - - return true; -} - -const relocateRegEx = /_\_dirname|_\_filename|require\.main|node-pre-gyp|bindings|define|require\(\s*[^'"]|__non_webpack_require__/; - -module.exports = function (code) { - if (this.cacheable) - this.cacheable(); - this.async(); - const id = this.resourcePath; - const options = getOptions(this); - const entryId = options.entryId; - - if (id.endsWith('.json') || !code.match(relocateRegEx)) - return this.callback(null, code); - - // calculate the base-level package folder to load bindings from - const pkgBase = getPackageBase(id); - - const staticModules = Object.assign(Object.create(null), { - path: staticPath, - fs: staticFs, - 'node-pre-gyp': pregyp, - 'node-pre-gyp/lib/pre-binding': pregyp, - 'node-pre-gyp/lib/pre-binding.js': pregyp, - 'nbind': nbind - }); - - let staticBindingsInstance = false; - function createBindings () { - return (opts = {}) => { - if (typeof opts === 'string') - opts = { bindings: opts }; - if (!opts.path) { - opts.path = true; - staticBindingsInstance = true; - } - opts.module_root = pkgBase; - return bindings(opts); - }; - } - - const emitAsset = (assetPath) => { - // JS assets to support require(assetPath) and not fs-based handling - // NB package.json is ambiguous here... - let outName = path.basename(assetPath); - - if (assetPath.endsWith('.node')) { - // retain directory depth structure for binaries for rpath to work out - if (pkgBase) - outName = assetPath.substr(pkgBase.length); - // If the asset is a ".node" binary, then glob for possible shared - // libraries that should also be included - assetEmissionPromises = assetEmissionPromises.then(sharedlibEmit(pkgBase, assetState, this.emitFile)); - } - - const name = assetState.assets[assetPath] || - (assetState.assets[assetPath] = getUniqueAssetName(outName, assetPath, assetState.assetNames)); - - // console.log('Emitting ' + assetPath + ' for module ' + id); - assetEmissionPromises = assetEmissionPromises.then(async () => { - const [source, permissions] = await Promise.all([ - new Promise((resolve, reject) => - readFile(assetPath, (err, source) => err ? reject(err) : resolve(source)) - ), - await new Promise((resolve, reject) => - stat(assetPath, (err, stats) => err ? reject(err) : resolve(stats.mode)) - ) - ]); - assetState.assetPermissions[name] = permissions; - this.emitFile(name, source); - }); - return "__dirname + '/" + JSON.stringify(name).slice(1, -1) + "'"; - }; - const emitAssetDirectory = (assetDirPath) => { - const dirName = path.basename(assetDirPath); - const name = assetState.assets[assetDirPath] || (assetState.assets[assetDirPath] = getUniqueAssetName(dirName, assetDirPath, assetState.assetNames)); - assetState.assets[assetDirPath] = name; - - assetEmissionPromises = assetEmissionPromises.then(async () => { - const files = await new Promise((resolve, reject) => - glob(assetDirPath + '/**/*', { mark: true, ignore: 'node_modules/**/*' }, (err, files) => err ? reject(err) : resolve(files)) - ); - await Promise.all(files.map(async file => { - // dont emit empty directories or ".js" files - if (file.endsWith('/') || file.endsWith('.js')) - return; - const [source, permissions] = await Promise.all([ - new Promise((resolve, reject) => - readFile(file, (err, source) => err ? reject(err) : resolve(source)) - ), - await new Promise((resolve, reject) => - stat(file, (err, stats) => err ? reject(err) : resolve(stats.mode)) - ) - ]); - assetState.assetPermissions[name + file.substr(assetDirPath.length)] = permissions; - this.emitFile(name + file.substr(assetDirPath.length), source); - })); - }); - - return "__dirname + '/" + JSON.stringify(name).slice(1, -1) + "'"; - }; - - let assetEmissionPromises = Promise.resolve(); - - const magicString = new MagicString(code); - - let ast, isESM; - try { - ast = acorn.parse(code, { allowReturnOutsideFunction: true }); - isESM = false; - } - catch (e) {} - if (!ast) { - ast = acorn.parse(code, { sourceType: 'module' }); - isESM = true; - } - - let scope = attachScopes(ast, 'scope'); - - const knownBindings = Object.assign(Object.create(null), { - __dirname: { - shadowDepth: 0, - value: path.resolve(id, '..') - }, - __filename: { - shadowDepth: 0, - value: id - } - }); - - if (!isESM) - knownBindings.require = { - shadowDepth: 0 - }; - - function setKnownBinding (name, value) { - // require is somewhat special in that we shadow it but don't - // statically analyze it ("known unknown" of sorts) - if (name === 'require') return; - knownBindings[name] = { - shadowDepth: 0, - value: value - }; - } - function getKnownBinding (name) { - const binding = knownBindings[name]; - if (binding) { - if (binding.shadowDepth === 0) { - return binding.value; - } - } - } - - let nbindId, pregypId, bindingsId; - - if (isESM) { - for (const decl of ast.body) { - if (decl.type === 'ImportDeclaration') { - const source = decl.source.value; - const staticModule = staticModules[source]; - if (staticModule) { - for (const impt of decl.specifiers) { - let bindingId; - if (impt.type === 'ImportNamespaceSpecifier') - setKnownBinding(bindingId = impt.local.name, staticModule); - else if (impt.type === 'ImportDefaultSpecifier' && 'default' in staticModule) - setKnownBinding(bindingId = impt.local.name, staticModule.default); - else if (impt.type === 'ImportSpecifier' && impt.imported.name in staticModule) - setKnownBinding(bindingId = impt.local.name, staticModule[impt.imported.name]); - - if (source === 'bindings') - bindingsId = bindingId; - else if (source === 'node-pre-gyp' || source === 'node-pre-gyp/lib/pre-binding' || source === 'node-pre-gyp/lib/pre-binding.js') - pregypId = bindingId; - else if (source === 'nbind') - nbindId = bindingId; - } - } - } - } - } - - let transformed = false; - - function computeStaticValue (expr) { - staticBindingsInstance = false; - // function expression analysis disabled due to static-eval locals bug - if (expr.type === 'FunctionExpression') - return; - - const vars = Object.create(null); - Object.keys(knownBindings).forEach(name => { - const { shadowDepth, value } = knownBindings[name]; - if (shadowDepth === 0 && value !== undefined) - vars[name] = value; - }); - - // evaluate returns undefined for non-statically-analyzable - return evaluate(expr, vars); - } - - // statically determinable leaves are tracked, and inlined when the - // greatest parent statically known leaf computation corresponds to an asset path - let staticChildNode, staticChildValue, staticChildValueBindingsInstance; - - // detect require('asdf'); - function isStaticRequire (node) { - return node && - node.type === 'CallExpression' && - node.callee.type === 'Identifier' && - node.callee.name === 'require' && - knownBindings.require.shadowDepth === 0 && - node.arguments.length === 1 && - node.arguments[0].type === 'Literal'; - } - - // detect require(...) - function isRequire (node) { - return node && - node.type === 'CallExpression' && - (node.callee.type === 'Identifier' && - node.callee.name === 'require' && - knownBindings.require.shadowDepth === 0 || - node.callee.type === 'MemberExpression' && - node.callee.object.type === 'Identifier' && - node.callee.object.name === 'require'); - } - - function isAnalyzableRequire (expression) { - if (expression.type === 'Identifier' || expression.type === 'MemberExpression') - return false; - // "possibly" analyzable (this can be further restricted over time) - return true; - } - - ({ ast, scope, transformed } = handleWrappers(ast, scope, magicString, code.length)); - - walk(ast, { - enter (node, parent) { - if (node.scope) { - scope = node.scope; - for (const id in node.scope.declarations) { - if (id in knownBindings) - knownBindings[id].shadowDepth++; - } - } - - if (staticChildNode) - return this.skip(); - - // detect asset leaf expression triggers (if not already) - // __dirname, __filename, binary only currently as well as require('bindings')(...) - // Can add require.resolve, import.meta.url, even path-like environment variables - if (node.type === 'Identifier' && isExpressionReference(node, parent)) { - if (node.name === '__dirname' || node.name === '__filename' || - node.name === pregypId || node.name === bindingsId) { - const binding = getKnownBinding(node.name); - if (binding) { - staticChildValue = computeStaticValue(node, false); - // if it computes, then we start backtracking - if (staticChildValue) { - staticChildNode = node; - staticChildValueBindingsInstance = staticBindingsInstance; - return this.skip(); - } - } - } - // __non_webpack_require__ -> eval('require') - else if (node.name === '__non_webpack_require__' && parent.type !== 'UnaryExpression') { - magicString.overwrite(node.start, node.end, 'eval("require")'); - transformed = true; - return this.skip(); - } - } - // require('bindings')('asdf') - else if (node.type === 'CallExpression' && !isESM && - isStaticRequire(node.callee) && - node.callee.arguments[0].value === 'bindings') { - let staticValue = computeStaticValue(node.arguments[0], true); - let bindingsValue; - if (staticValue && 'value' in staticValue) - bindingsValue = createBindings()(staticValue.value); - if (bindingsValue) { - staticChildValue = { value: bindingsValue }; - staticChildNode = node; - staticChildValueBindingsInstance = staticBindingsInstance; - return this.skip(); - } - } - // require(dynamic) -> __non_webpack_require__(dynamic) - else if (isRequire(node) && !isAnalyzableRequire(node.arguments[0])) { - transformed = true; - magicString.overwrite(node.callee.start, node.callee.end, "__non_webpack_require__"); - return this.skip(); - } - // nbind.init(...) -> require('./resolved.node') - else if (nbindId && node.type === 'CallExpression' && - node.callee.type === 'MemberExpression' && - node.callee.object.type === 'Identifier' && - node.callee.object.name === nbindId && - node.callee.property.type === 'Identifier' && - node.callee.property.name === 'init') { - const staticValue = computeStaticValue(node, false); - let bindingInfo; - if (staticValue && 'value' in staticValue) - bindingInfo = staticValue.value; - if (bindingInfo) { - bindingInfo.path = path.relative(path.dirname(id), bindingInfo.path); - transformed = true; - magicString.overwrite(node.start, node.end, `({ bind: require("${bindingInfo.path}").NBind.bind_value, lib: require("${bindingInfo.path}") })`); - return this.skip(); - } - } - - // require.main -> __non_webpack_require__.main - else if (!isESM && node.type === 'MemberExpression' && - node.object.type === 'Identifier' && - node.object.name === 'require' && - knownBindings.require.shadowDepth === 0 && - node.property.type === 'Identifier' && - node.property.name === 'main' && - !node.computed) { - if (parent && parent.type === 'BinaryExpression' && (parent.operator === '==' || parent.operator === '===')) { - let other; - other = parent.right === node ? parent.left : parent.right; - if (other.type === 'Identifier' && other.name === 'module') { - // inline the require.main check to be the target require.main check if this is the entry, - // and false otherwise - if (id === entryId) { - // require.main === module -> __non_webpack_require__.main == __non_webpack_require__.cache[eval('__filename')] - // can be simplified if we get a way to get outer "module" in Webpack - magicString.overwrite(other.start, other.end, "__non_webpack_require__.cache[eval('__filename')]"); - } - else { - magicString.overwrite(parent.start, parent.end, "false"); - transformed = true; - return this.skip(); - } - } - } - magicString.overwrite(node.object.start, node.object.end, '__non_webpack_require__'); - transformed = true; - return this.skip(); - } - else if (!isESM && node.type === 'Property' && node.value.type === 'Identifier' && - node.value.name === 'require' && knownBindings.require.shadowDepth === 0) { - magicString.overwrite(node.value.start, node.value.end, '__non_webpack_require__'); - transformed = true; - return this.skip(); - } - else if (node.type === 'VariableDeclaration') { - for (const decl of node.declarations) { - let binding; - if (!isESM && isStaticRequire(decl.init)) { - const source = decl.init.arguments[0].value; - const staticModule = staticModules[source]; - if (staticModule) { - // var known = require('known'); - if (decl.id.type === 'Identifier') { - setKnownBinding(decl.id.name, staticModule.default); - if (source === 'bindings') - bindingsId = decl.id.name; - else if (source === 'node-pre-gyp' || source === 'node-pre-gyp/lib/pre-binding' || source === 'node-pre-gyp/lib/pre-binding.js') - pregypId = decl.id.name; - else if (source === 'nbind') - nbindId = decl.id.name; - } - // var { known } = require('known); - else if (decl.id.type === 'ObjectPattern') { - for (const prop of decl.id.properties) { - if (prop.type !== 'Property' || - prop.key.type !== 'Identifier' || - prop.value.type !== 'Identifier' || - !(prop.key.name in staticModule)) - continue; - setKnownBinding(prop.value.name, staticModule[prop.key.name]); - } - } - } - } - // var { knownProp } = known; - else if (decl.id.type === 'ObjectPattern' && - decl.init && decl.init.type === 'Identifier' && - (binding = getKnownBinding(decl.init.name)) !== undefined && - prop.key.name in binding) { - setKnownBinding(prop.value.name, binding[prop.key.name]); - } - // var known = known.knownProp; - else if (decl.id.type === 'Identifier' && - decl.init && - decl.init.type === 'MemberExpression' && - decl.init.computed === false && - decl.init.object.type === 'Identifier' && - decl.init.property.type === 'Identifier' && - (binding = getKnownBinding(decl.init.object.name)) !== undefined && - decl.init.property.name in binding) { - setKnownBinding(decl.id.name, binding[decl.init.property.name]); - } - } - } - else if (node.type === 'AssignmentExpression') { - // path = require('path') - if (isStaticRequire(node.right) && node.right.arguments[0].value in staticModules && - node.left.type === 'Identifier' && scope.declarations[node.left.name]) { - setKnownBinding(node.left.name, staticModules[node.right.arguments[0].value]); - } - } - }, - leave (node, parent) { - if (node.scope) { - scope = scope.parent; - for (const id in node.scope.declarations) { - if (id in knownBindings) { - if (knownBindings[id].shadowDepth > 0) - knownBindings[id].shadowDepth--; - else - delete knownBindings[id]; - } - } - } - - // computing a static expression outward - // -> compute and backtrack - if (staticChildNode) { - const curStaticValue = computeStaticValue(node, false); - if (curStaticValue) { - staticChildValue = curStaticValue; - staticChildNode = node; - staticChildValueBindingsInstance = staticBindingsInstance; - return; - } - // Filter out emitting assets for a __filename call on its own - if (staticChildNode.type === 'Identifier' && staticChildNode.name === '__filename' || - staticChildNode.type === 'ReturnStatement' && staticChildNode.argument.type === 'Identifier' && - staticChildNode.argument.name === '__filename') { - staticChildNode = staticChildValue = undefined; - return; - } - // no static value -> see if we should emit the asset if it exists - // Currently we only handle files. In theory whole directories could also be emitted if necessary. - if ('value' in staticChildValue) { - const inlineString = getInlined(inlineType(staticChildValue.value), staticChildValue.value); - if (inlineString) { - magicString.overwrite(staticChildNode.start, staticChildNode.end, inlineString); - transformed = true; - } - } - else { - const thenInlineType = inlineType(staticChildValue.then); - const elseInlineType = inlineType(staticChildValue.else); - // only inline conditionals when both branches are known inlinings - if (thenInlineType && elseInlineType) { - const thenInlineString = getInlined(thenInlineType, staticChildValue.then); - const elseInlineString = getInlined(elseInlineType, staticChildValue.else); - magicString.overwrite( - staticChildNode.start, staticChildNode.end, - `${code.substring(staticChildValue.test.start, staticChildValue.test.end)} ? ${thenInlineString} : ${elseInlineString}` - ); - transformed = true; - } - } - function inlineType (value) { - let stats; - if (typeof value === 'string') { - try { - stats = statSync(value); - } - catch (e) {} - } - else if (typeof value === 'boolean') - return 'value'; - if (stats && stats.isFile()) - return 'file'; - else if (stats && stats.isDirectory()) - return 'directory'; - } - function getInlined (inlineType, value) { - switch (inlineType) { - case 'value': return String(value); - case 'file': - let replacement = emitAsset(path.resolve(value)); - // require('bindings')(...) - // -> require(require('bindings')(...)) - if (staticChildValueBindingsInstance) - replacement = '__non_webpack_require__(' + replacement + ')'; - return replacement; - case 'directory': - return emitAssetDirectory(path.resolve(value)); - } - } - staticChildNode = staticChildValue = undefined; - } - } - }); - - if (!transformed) - return this.callback(null, code); - - assetEmissionPromises.then(() => { - code = magicString.toString(); - const map = magicString.generateMap(); - - this.callback(null, code, map); - }); -}; - -let assetState; -module.exports.setAssetState = function (state) { - assetState = state; -}; \ No newline at end of file +module.exports = require('@zeit/webpack-asset-relocator-loader'); diff --git a/src/utils/binary-locators.js b/src/utils/binary-locators.js deleted file mode 100644 index 4ce1b834..00000000 --- a/src/utils/binary-locators.js +++ /dev/null @@ -1,83 +0,0 @@ -const path = require("path"); -const fs = require("fs"); - -// pregyp -const versioning = require("node-pre-gyp/lib/util/versioning.js"); -const napi = require("node-pre-gyp/lib/util/napi.js"); -const pregypFind = (package_json_path, opts) => { - const package_json = JSON.parse(fs.readFileSync(package_json_path).toString()); - versioning.validate_config(package_json, opts); - var napi_build_version; - if (napi.get_napi_build_versions (package_json, opts)) { - napi_build_version = napi.get_best_napi_build_version(package_json, opts); - } - opts = opts || {}; - if (!opts.module_root) opts.module_root = path.dirname(package_json_path); - var meta = versioning.evaluate(package_json,opts,napi_build_version); - return meta.module; -}; -exports.pregyp = { default: { find: pregypFind }, find: pregypFind }; - -// nbind -// Adapted from nbind.js -function makeModulePathList(root, name) { - return ([ - [root, name], - [root, "build", name], - [root, "build", "Debug", name], - [root, "build", "Release", name], - [root, "out", "Debug", name], - [root, "Debug", name], - [root, "out", "Release", name], - [root, "Release", name], - [root, "build", "default", name], - [ - root, - process.env["NODE_BINDINGS_COMPILED_DIR"] || "compiled", - process.versions.node, - process.platform, - process.arch, - name - ] - ]); -} -function findCompiledModule(basePath, specList) { - var resolvedList = []; - var ext = path.extname(basePath); - for (var _i = 0, specList_1 = specList; _i < specList_1.length; _i++) { - var spec = specList_1[_i]; - if (ext == spec.ext) { - try { - spec.path = eval("require.resolve(basePath)"); - return spec; - } - catch (err) { - resolvedList.push(basePath); - } - } - } - for (var _a = 0, specList_2 = specList; _a < specList_2.length; _a++) { - var spec = specList_2[_a]; - for (var _b = 0, _c = makeModulePathList(basePath, spec.name); _b < _c.length; _b++) { - var pathParts = _c[_b]; - var resolvedPath = path.resolve.apply(path, pathParts); - try { - spec.path = eval("require.resolve(resolvedPath)"); - } - catch (err) { - resolvedList.push(resolvedPath); - continue; - } - return spec; - } - } - return null; -} -function find(basePath = process.cwd()) { - return findCompiledModule(basePath, [ - { ext: ".node", name: "nbind.node", type: "node" }, - { ext: ".js", name: "nbind.js", type: "emcc" } - ]); -} -exports.nbind = { default: { init: find, find }, init: find, find }; - diff --git a/src/utils/dedupe-names.js b/src/utils/dedupe-names.js deleted file mode 100644 index 2893dc2a..00000000 --- a/src/utils/dedupe-names.js +++ /dev/null @@ -1,10 +0,0 @@ -const path = require("path"); - -module.exports = function (assetName, assetPath, assetNames) { - const ext = path.extname(assetName); - let uniqueName = assetName, i = 0; - while (uniqueName in assetNames && assetNames[uniqueName] !== assetPath) - uniqueName = assetName.substr(0, assetName.length - ext.length) + ++i + ext; - assetNames[uniqueName] = assetPath; - return uniqueName; -}; \ No newline at end of file diff --git a/src/utils/sharedlib-emit.js b/src/utils/sharedlib-emit.js deleted file mode 100644 index a22ca3f8..00000000 --- a/src/utils/sharedlib-emit.js +++ /dev/null @@ -1,34 +0,0 @@ -const os = require('os'); -const fs = require('graceful-fs'); -const glob = require('glob'); - -let sharedlibGlob; -switch (os.platform()) { - case 'darwin': - sharedlibGlob = '/**/*.dylib'; - break; - case 'win32': - sharedlibGlob = '/**/*.dll'; - break; - default: - sharedlibGlob = '/**/*.so?(.*)'; -} - -// helper for emitting the associated shared libraries when a binary is emitted -module.exports = async function (pkgPath, assetState, emitFile) { - const files = await new Promise((resolve, reject) => - glob(pkgPath + sharedlibGlob, { ignore: 'node_modules/**/*' }, (err, files) => err ? reject(err) : resolve(files)) - ); - await Promise.all(files.map(async file => { - const [source, permissions] = await Promise.all([ - new Promise((resolve, reject) => - fs.readFile(file, (err, source) => err ? reject(err) : resolve(source)) - ), - await new Promise((resolve, reject) => - fs.stat(file, (err, stats) => err ? reject(err) : resolve(stats.mode)) - ) - ]); - assetState.assetPermissions[file.substr(pkgPath.length)] = permissions; - emitFile(file.substr(pkgPath.length), source); - })); -}; \ No newline at end of file diff --git a/src/utils/static-eval.js b/src/utils/static-eval.js deleted file mode 100644 index b591cc95..00000000 --- a/src/utils/static-eval.js +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Adapted from https://github.com/substack/static-eval - * © 2013 - 2017 substack (James Halliday) - * - * This software is released under the MIT license: - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -// var unparse = require('escodegen').generate; - -module.exports = function (ast, vars = {}) { - return walk(ast); - - // walk returns: - // 1. Single known value: { value: value } - // 2. Conditional value: { test, then, else } - // 3. Unknown value: undefined - - function walk (node, scopeVars) { - if (node.type === 'Literal') { - return { value: node.value }; - } - else if (node.type === 'UnaryExpression'){ - var val = walk(node.argument); - if ('value' in val) { - if (node.operator === '+') return { value: +val.value }; - if (node.operator === '-') return { value: -val.value }; - if (node.operator === '~') return { value: ~val.value }; - if (node.operator === '!') return { value: !val.value }; - } - else if ('test' in val) { - if (node.operator === '+') return { test: val.test, then: +val.then, else: +val.else }; - if (node.operator === '-') return { test: val.test, then: -val.then, else: -val.else }; - if (node.operator === '~') return { test: val.test, then: ~val.then, else: ~val.else }; - if (node.operator === '!') return { test: val.test, then: !val.then, else: !val.else }; - } - return; - } - else if (node.type === 'ArrayExpression') { - var xs = []; - for (var i = 0, l = node.elements.length; i < l; i++) { - var x = walk(node.elements[i]); - if (!x) return; - if ('test' in x) return; - xs.push(x.value); - } - return { value: xs }; - } - else if (node.type === 'ObjectExpression') { - var obj = {}; - for (var i = 0; i < node.properties.length; i++) { - var prop = node.properties[i]; - var keyValue = prop.computed ? walk(prop.key) : { value: prop.key.name || prop.key.value }; - if (!keyValue || 'test' in keyValue) return; - var value = walk(prop.value); - if (!value || 'test' in value) return; - obj[keyValue.value] = value.value; - } - return obj; - } - else if (node.type === 'BinaryExpression' || node.type === 'LogicalExpression') { - var l = walk(node.left); - if (!l) return; - var r = walk(node.right); - if (!r) return; - - if ('test' in l && 'test' in r) - return; - - var op = node.operator; - // support right branches only - if ('test' in l) { - r = r.value; - if (op === '==') return { test: l.test, then: l.then == r, else: l.else == r }; - if (op === '===') return { test: l.test, then: l.then === r, else: l.else === r }; - if (op === '!=') return { test: l.test, then: l.then != r, else: l.else != r }; - if (op === '!==') return { test: l.test, then: l.then !== r, else: l.else !== r }; - if (op === '+') return { test: l.test, then: l.then + r, else: l.else + r }; - if (op === '-') return { test: l.test, then: l.then - r, else: l.else - r }; - if (op === '*') return { test: l.test, then: l.then * r, else: l.else * r }; - if (op === '/') return { test: l.test, then: l.then / r, else: l.else / r }; - if (op === '%') return { test: l.test, then: l.then % r, else: l.else % r }; - if (op === '<') return { test: l.test, then: l.then < r, else: l.else < r }; - if (op === '<=') return { test: l.test, then: l.then <= r, else: l.else <= r }; - if (op === '>') return { test: l.test, then: l.then > r, else: l.else > r }; - if (op === '>=') return { test: l.test, then: l.then >= r, else: l.else >= r }; - if (op === '|') return { test: l.test, then: l.then | r, else: l.else | r }; - if (op === '&') return { test: l.test, then: l.then & r, else: l.else & r }; - if (op === '^') return { test: l.test, then: l.then ^ r, else: l.else ^ r }; - if (op === '&&') return { test: l.test, then: l.then && r, else: l.else && r }; - if (op === '||') return { test: l.test, then: l.then || r, else: l.else || r }; - } - else if ('test' in r) { - l = l.value; - if (op === '==') return { test: r.test, then: l == r.then, else: l == r.else }; - if (op === '===') return { test: r.test, then: l === r.then, else: l === r.else }; - if (op === '!=') return { test: r.test, then: l != r.then, else: l != r.else }; - if (op === '!==') return { test: r.test, then: l !== r.then, else: l !== r.else }; - if (op === '+') return { test: r.test, then: l + r.then, else: l + r.else }; - if (op === '-') return { test: r.test, then: l - r.then, else: l - r.else }; - if (op === '*') return { test: r.test, then: l * r.then, else: l * r.else }; - if (op === '/') return { test: r.test, then: l / r.then, else: l / r.else }; - if (op === '%') return { test: r.test, then: l % r.then, else: l % r.else }; - if (op === '<') return { test: r.test, then: l < r.then, else: l < r.else }; - if (op === '<=') return { test: r.test, then: l <= r.then, else: l <= r.else }; - if (op === '>') return { test: r.test, then: l > r.then, else: l > r.else }; - if (op === '>=') return { test: r.test, then: l >= r.then, else: l >= r.else }; - if (op === '|') return { test: r.test, then: l | r.then, else: l | r.else }; - if (op === '&') return { test: r.test, then: l & r.then, else: l & r.else }; - if (op === '^') return { test: r.test, then: l ^ r.then, else: l ^ r.else }; - if (op === '&&') return { test: r.test, then: l && r.then, else: l && r.else }; - if (op === '||') return { test: r.test, then: l || r.then, else: l || r.else }; - } - else { - l = l.value; - r = r.value; - if (op === '==') return { value: l == r }; - if (op === '===') return { value: l === r }; - if (op === '!=') return { value: l != r }; - if (op === '!==') return { value: l !== r }; - if (op === '+') return { value: l + r }; - if (op === '-') return { value: l - r }; - if (op === '*') return { value: l * r }; - if (op === '/') return { value: l / r }; - if (op === '%') return { value: l % r }; - if (op === '<') return { value: l < r }; - if (op === '<=') return { value: l <= r }; - if (op === '>') return { value: l > r }; - if (op === '>=') return { value: l >= r }; - if (op === '|') return { value: l | r }; - if (op === '&') return { value: l & r }; - if (op === '^') return { value: l ^ r }; - if (op === '&&') return { value: l && r }; - if (op === '||') return { value: l || r }; - } - return; - } - else if (node.type === 'Identifier') { - if (Object.hasOwnProperty.call(vars, node.name)) - return { value: vars[node.name] }; - return; - } - else if (node.type === 'ThisExpression') { - if (Object.hasOwnProperty.call(vars, 'this')) - return { value: vars['this'] }; - return; - } - else if (node.type === 'CallExpression') { - var callee = walk(node.callee); - if (!callee || 'test' in callee) return; - if (typeof callee.value !== 'function') return; - - var ctx = node.callee.object && walk(node.callee.object).value || null; - - var args = []; - for (var i = 0, l = node.arguments.length; i < l; i++) { - var x = walk(node.arguments[i]); - if (!x || 'test' in x) return; - args.push(x.value); - } - try { - return { value: callee.value.apply(ctx, args) }; - } - catch (e) { - return; - } - } - else if (node.type === 'MemberExpression') { - var obj = walk(node.object); - // do not allow access to methods on Function - if (!obj || 'test' in obj || typeof obj.value === 'function') - return; - if (node.property.type === 'Identifier') - return { value: obj.value[node.property.name] }; - var prop = walk(node.property); - if (!prop || 'test' in prop) - return; - return { value: obj.value[prop.value] }; - } - else if (node.type === 'ConditionalExpression') { - var val = walk(node.test); - if (val && 'value' in val) - return val.value ? walk(node.consequent) : walk(node.alternate); - - var thenValue = walk(node.consequent); - if (!thenValue || 'test' in thenValue) - return; - var elseValue = walk(node.alternate); - if (!elseValue || 'test' in elseValue) - return; - - return { - test: node.test, - then: thenValue.value, - else: elseValue.value - }; - } - else if (node.type === 'ExpressionStatement') { - return walk(node.expression); - } - else if (node.type === 'ReturnStatement') { - return walk(node.argument); - } - // disabled for now due to a scope bug in the original implementation - /* else if (node.type === 'FunctionExpression') { - var bodies = node.body.body; - - // Create a "scope" for our arguments - var oldVars = {}; - Object.keys(vars).forEach(function(element){ - oldVars[element] = vars[element]; - }); - - node.params.forEach(function(key) { - if(key.type == 'Identifier'){ - vars[key.name] = null; - } - }); - for(var i in bodies){ - if(walk(bodies[i]) === FAIL){ - return FAIL; - } - } - // restore the vars and scope after we walk - vars = oldVars; - - var keys = Object.keys(vars); - var vals = keys.map(function(key) { - return vars[key]; - }); - return Function(keys.join(', '), 'return ' + unparse(node)).apply(null, vals); - } */ - else if (node.type === 'TemplateLiteral') { - var val = { value: '' }; - for (var i = 0; i < node.expressions.length; i++) { - if ('value' in val) { - val.value += node.quasis[i].value.cooked; - } - else { - val.then += node.quasis[i].value.cooked; - val.else += node.quasis[i].value.cooked; - } - var exprValue = walk(node.expressions[i]); - if (!exprValue) - return; - if ('value' in exprValue) { - if ('value' in val) { - val.value += exprValue.value; - } - else { - val.then += exprValue.value; - val.else += exprValue.value; - } - } - else { - // only support a single branch in a template - if ('value' in val === false) - return; - val = { - test: exprValue.test, - then: val.value + exprValue.then, - else: val.value + exprValue.else - }; - } - } - if ('value' in val) { - val.value += node.quasis[i].value.cooked; - } - else { - val.then += node.quasis[i].value.cooked; - val.else += node.quasis[i].value.cooked; - } - return val; - } - /* else if (node.type === 'TaggedTemplateExpression') { - var tag = walk(node.tag); - var quasi = node.quasi; - var strings = quasi.quasis.map(walk); - var values = quasi.expressions.map(walk); - return tag.apply(null, [strings].concat(values)); - } */ - return; - } -}; diff --git a/src/utils/wrappers.js b/src/utils/wrappers.js deleted file mode 100644 index d8704171..00000000 --- a/src/utils/wrappers.js +++ /dev/null @@ -1,156 +0,0 @@ -// Wrapper detections for require extraction handles: -// -// When.js-style AMD wrapper: -// (function (define) { 'use strict' define(function (require) { ... }) }) -// (typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }) -// -> -// (function (define) { 'use strict' define(function () { ... }) }) -// (typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }) -// -// Browserify-style wrapper -// (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.bugsnag = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i -// (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.bugsnag = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i decl.init === null && decl.id.type === 'Identifier') && - arg.body.body[1].type === 'ReturnStatement' && - arg.body.body[1].argument.type === 'CallExpression' && - arg.body.body[1].argument.callee.type === 'CallExpression' && - arg.body.body[1].argument.arguments.length && - arg.body.body[1].argument.arguments.every(arg => arg.type === 'Literal' && typeof arg.value === 'number') && - arg.body.body[1].argument.callee.callee.type === 'CallExpression' && - arg.body.body[1].argument.callee.callee.callee.type === 'FunctionExpression' && - arg.body.body[1].argument.callee.callee.arguments.length === 0 && - // (dont go deeper into browserify loader internals than this) - arg.body.body[1].argument.callee.arguments.length === 3 && - arg.body.body[1].argument.callee.arguments[0].type === 'ObjectExpression' && - arg.body.body[1].argument.callee.arguments[1].type === 'ObjectExpression' && - arg.body.body[1].argument.callee.arguments[2].type === 'ArrayExpression') { - const modules = arg.body.body[1].argument.callee.arguments[0].properties; - - // verify modules is the expected data structure - // in the process, extract external requires - const externals = {}; - if (modules.every(m => { - if (m.type !== 'Property' || - m.computed !== false || - m.key.type !== 'Literal' || - typeof m.key.value !== 'number' || - m.value.type !== 'ArrayExpression' || - m.value.elements.length !== 2 || - m.value.elements[0].type !== 'FunctionExpression' || - m.value.elements[1].type !== 'ObjectExpression') - return false; - - // detect externals from undefined moduleMap values - const moduleMap = m.value.elements[1].properties; - for (const prop of moduleMap) { - if (prop.type !== 'Property' || - (prop.value.type !== 'Identifier' && prop.value.type !== 'Literal') || - prop.key.type !== 'Literal' || - typeof prop.key.value !== 'string' || - prop.computed) - return false; - if (prop.value.type === 'Identifier' && prop.value.name === 'undefined') - externals[prop.key.value] = true; - } - return true; - })) { - // if we have externals, inline them into the browserify cache for webpack to pick up - const externalIds = Object.keys(externals); - if (externalIds.length) { - const cache = arg.body.body[1].argument.callee.arguments[1]; - const renderedExternals = externalIds.map(ext => `"${ext}": { exports: require("${ext}") }`).join(',\n '); - magicString.appendRight(cache.end - 1, renderedExternals); - transformed = true; - } - } - } - } - return { ast, scope, transformed }; -} - -module.exports = handleWrappers; diff --git a/test/index.test.js b/test/index.test.js index f2de7fe5..cda5b204 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -29,12 +29,6 @@ for (const unitTest of fs.readdirSync(`${__dirname}/unit`)) { fs.writeFileSync(`${testDir}/actual.js`, actual); throw e; } - - // very simple asset validation in unit tests - if (unitTest.startsWith("asset-")) { - expect(Object.keys(assets).length).toBeGreaterThan(0); - expect(assets[Object.keys(assets)[0].source] instanceof Buffer); - } } ); }); diff --git a/test/unit/amd-disable/input.js b/test/unit/amd-disable/input.js deleted file mode 100644 index 700f4ffc..00000000 --- a/test/unit/amd-disable/input.js +++ /dev/null @@ -1,7 +0,0 @@ -if (typeof define === 'function' && define.amd) - define(function (require) { - require('amd'); - require('deps'); - require('shouldnt'); - require('detect'); - }); \ No newline at end of file diff --git a/test/unit/amd-disable/output-coverage.js b/test/unit/amd-disable/output-coverage.js deleted file mode 100644 index fe3f11ea..00000000 --- a/test/unit/amd-disable/output-coverage.js +++ /dev/null @@ -1,58 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(905); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 905: -/***/ (function() { - -if (typeof define === 'function' && define.amd) - define(function (require) { - require('amd'); - require('deps'); - require('shouldnt'); - require('detect'); - }); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/amd-disable/output.js b/test/unit/amd-disable/output.js deleted file mode 100644 index 05748a99..00000000 --- a/test/unit/amd-disable/output.js +++ /dev/null @@ -1,58 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(102); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 102: -/***/ (function() { - -if (typeof define === 'function' && define.amd) - define(function (require) { - require('amd'); - require('deps'); - require('shouldnt'); - require('detect'); - }); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es-2/asset.txt b/test/unit/asset-fs-inline-path-enc-es-2/asset.txt deleted file mode 100644 index 95d09f2b..00000000 --- a/test/unit/asset-fs-inline-path-enc-es-2/asset.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es-2/input.js b/test/unit/asset-fs-inline-path-enc-es-2/input.js deleted file mode 100644 index 1630a294..00000000 --- a/test/unit/asset-fs-inline-path-enc-es-2/input.js +++ /dev/null @@ -1,4 +0,0 @@ -import fs from 'fs'; -import path from 'path'; - -console.log(fs.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8')); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es-2/output-coverage.js b/test/unit/asset-fs-inline-path-enc-es-2/output-coverage.js deleted file mode 100644 index 13380425..00000000 --- a/test/unit/asset-fs-inline-path-enc-es-2/output-coverage.js +++ /dev/null @@ -1,116 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(75); -/******/ }; -/******/ // initialize runtime -/******/ runtime(__webpack_require__); -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 75: -/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(66); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(589); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); - - - -console.log(fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFileSync(__dirname + '/asset.txt', 'utf8')); - -/***/ }), - -/***/ 589: -/***/ (function(module) { - -module.exports = require("path"); - -/***/ }) - -/******/ }, -/******/ function(__webpack_require__) { // webpackRuntimeModules -/******/ "use strict"; -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getter */ -/******/ !function() { -/******/ // define getter function for harmony exports -/******/ var hasOwnProperty = Object.prototype.hasOwnProperty; -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!hasOwnProperty.call(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ } -); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es-2/output.js b/test/unit/asset-fs-inline-path-enc-es-2/output.js deleted file mode 100644 index 763d5c58..00000000 --- a/test/unit/asset-fs-inline-path-enc-es-2/output.js +++ /dev/null @@ -1,116 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(51); -/******/ }; -/******/ // initialize runtime -/******/ runtime(__webpack_require__); -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 51: -/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(66); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(589); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); - - - -console.log(fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFileSync(__dirname + '/asset.txt', 'utf8')); - -/***/ }), - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 589: -/***/ (function(module) { - -module.exports = require("path"); - -/***/ }) - -/******/ }, -/******/ function(__webpack_require__) { // webpackRuntimeModules -/******/ "use strict"; -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getter */ -/******/ !function() { -/******/ // define getter function for harmony exports -/******/ var hasOwnProperty = Object.prototype.hasOwnProperty; -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!hasOwnProperty.call(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ } -); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es-3/asset.txt b/test/unit/asset-fs-inline-path-enc-es-3/asset.txt deleted file mode 100644 index 95d09f2b..00000000 --- a/test/unit/asset-fs-inline-path-enc-es-3/asset.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es-3/input.js b/test/unit/asset-fs-inline-path-enc-es-3/input.js deleted file mode 100644 index 3eb26c35..00000000 --- a/test/unit/asset-fs-inline-path-enc-es-3/input.js +++ /dev/null @@ -1,4 +0,0 @@ -import fs from 'fs'; -import { join } from 'path'; - -console.log(fs.readFileSync(join(__dirname, 'asset.txt'), 'utf8')); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es-3/output-coverage.js b/test/unit/asset-fs-inline-path-enc-es-3/output-coverage.js deleted file mode 100644 index 05a8c7aa..00000000 --- a/test/unit/asset-fs-inline-path-enc-es-3/output-coverage.js +++ /dev/null @@ -1,116 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(609); -/******/ }; -/******/ // initialize runtime -/******/ runtime(__webpack_require__); -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 589: -/***/ (function(module) { - -module.exports = require("path"); - -/***/ }), - -/***/ 609: -/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(66); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(589); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); - - - -console.log(fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFileSync(__dirname + '/asset.txt', 'utf8')); - -/***/ }) - -/******/ }, -/******/ function(__webpack_require__) { // webpackRuntimeModules -/******/ "use strict"; -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getter */ -/******/ !function() { -/******/ // define getter function for harmony exports -/******/ var hasOwnProperty = Object.prototype.hasOwnProperty; -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!hasOwnProperty.call(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ } -); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es-3/output.js b/test/unit/asset-fs-inline-path-enc-es-3/output.js deleted file mode 100644 index a2a2b2ad..00000000 --- a/test/unit/asset-fs-inline-path-enc-es-3/output.js +++ /dev/null @@ -1,116 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(422); -/******/ }; -/******/ // initialize runtime -/******/ runtime(__webpack_require__); -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 422: -/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(66); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(589); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); - - - -console.log(fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFileSync(__dirname + '/asset.txt', 'utf8')); - -/***/ }), - -/***/ 589: -/***/ (function(module) { - -module.exports = require("path"); - -/***/ }) - -/******/ }, -/******/ function(__webpack_require__) { // webpackRuntimeModules -/******/ "use strict"; -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getter */ -/******/ !function() { -/******/ // define getter function for harmony exports -/******/ var hasOwnProperty = Object.prototype.hasOwnProperty; -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!hasOwnProperty.call(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ } -); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es-4/asset.txt b/test/unit/asset-fs-inline-path-enc-es-4/asset.txt deleted file mode 100644 index 95d09f2b..00000000 --- a/test/unit/asset-fs-inline-path-enc-es-4/asset.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es-4/input.js b/test/unit/asset-fs-inline-path-enc-es-4/input.js deleted file mode 100644 index 3c5b9b3d..00000000 --- a/test/unit/asset-fs-inline-path-enc-es-4/input.js +++ /dev/null @@ -1,6 +0,0 @@ -import fs from 'fs'; -import * as path from 'path'; - -const join = path.join; - -console.log(fs.readFileSync(join(__dirname, 'asset.txt'), 'utf8')); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es-4/output-coverage.js b/test/unit/asset-fs-inline-path-enc-es-4/output-coverage.js deleted file mode 100644 index 24fa0a7f..00000000 --- a/test/unit/asset-fs-inline-path-enc-es-4/output-coverage.js +++ /dev/null @@ -1,118 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(160); -/******/ }; -/******/ // initialize runtime -/******/ runtime(__webpack_require__); -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 160: -/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(66); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(589); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); - - - -const join = path__WEBPACK_IMPORTED_MODULE_1__["join"]; - -console.log(fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFileSync(__dirname + '/asset.txt', 'utf8')); - -/***/ }), - -/***/ 589: -/***/ (function(module) { - -module.exports = require("path"); - -/***/ }) - -/******/ }, -/******/ function(__webpack_require__) { // webpackRuntimeModules -/******/ "use strict"; -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getter */ -/******/ !function() { -/******/ // define getter function for harmony exports -/******/ var hasOwnProperty = Object.prototype.hasOwnProperty; -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!hasOwnProperty.call(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ } -); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es-4/output.js b/test/unit/asset-fs-inline-path-enc-es-4/output.js deleted file mode 100644 index 14177cdc..00000000 --- a/test/unit/asset-fs-inline-path-enc-es-4/output.js +++ /dev/null @@ -1,118 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(710); -/******/ }; -/******/ // initialize runtime -/******/ runtime(__webpack_require__); -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 589: -/***/ (function(module) { - -module.exports = require("path"); - -/***/ }), - -/***/ 710: -/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(66); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(589); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); - - - -const join = path__WEBPACK_IMPORTED_MODULE_1__["join"]; - -console.log(fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFileSync(__dirname + '/asset.txt', 'utf8')); - -/***/ }) - -/******/ }, -/******/ function(__webpack_require__) { // webpackRuntimeModules -/******/ "use strict"; -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getter */ -/******/ !function() { -/******/ // define getter function for harmony exports -/******/ var hasOwnProperty = Object.prototype.hasOwnProperty; -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!hasOwnProperty.call(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ } -); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es/asset.txt b/test/unit/asset-fs-inline-path-enc-es/asset.txt deleted file mode 100644 index 95d09f2b..00000000 --- a/test/unit/asset-fs-inline-path-enc-es/asset.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es/input.js b/test/unit/asset-fs-inline-path-enc-es/input.js deleted file mode 100644 index bf68c6dd..00000000 --- a/test/unit/asset-fs-inline-path-enc-es/input.js +++ /dev/null @@ -1,4 +0,0 @@ -import fs from 'fs'; -import * as path from 'path'; - -console.log(fs.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8')); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es/output-coverage.js b/test/unit/asset-fs-inline-path-enc-es/output-coverage.js deleted file mode 100644 index b483a8f9..00000000 --- a/test/unit/asset-fs-inline-path-enc-es/output-coverage.js +++ /dev/null @@ -1,116 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(286); -/******/ }; -/******/ // initialize runtime -/******/ runtime(__webpack_require__); -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 286: -/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(66); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(589); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); - - - -console.log(fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFileSync(__dirname + '/asset.txt', 'utf8')); - -/***/ }), - -/***/ 589: -/***/ (function(module) { - -module.exports = require("path"); - -/***/ }) - -/******/ }, -/******/ function(__webpack_require__) { // webpackRuntimeModules -/******/ "use strict"; -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getter */ -/******/ !function() { -/******/ // define getter function for harmony exports -/******/ var hasOwnProperty = Object.prototype.hasOwnProperty; -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!hasOwnProperty.call(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ } -); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc-es/output.js b/test/unit/asset-fs-inline-path-enc-es/output.js deleted file mode 100644 index df8524da..00000000 --- a/test/unit/asset-fs-inline-path-enc-es/output.js +++ /dev/null @@ -1,116 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(148); -/******/ }; -/******/ // initialize runtime -/******/ runtime(__webpack_require__); -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 148: -/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(66); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(589); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); - - - -console.log(fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFileSync(__dirname + '/asset.txt', 'utf8')); - -/***/ }), - -/***/ 589: -/***/ (function(module) { - -module.exports = require("path"); - -/***/ }) - -/******/ }, -/******/ function(__webpack_require__) { // webpackRuntimeModules -/******/ "use strict"; -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getter */ -/******/ !function() { -/******/ // define getter function for harmony exports -/******/ var hasOwnProperty = Object.prototype.hasOwnProperty; -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!hasOwnProperty.call(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ } -); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc/asset.txt b/test/unit/asset-fs-inline-path-enc/asset.txt deleted file mode 100644 index 95d09f2b..00000000 --- a/test/unit/asset-fs-inline-path-enc/asset.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc/input.js b/test/unit/asset-fs-inline-path-enc/input.js deleted file mode 100644 index 90d44121..00000000 --- a/test/unit/asset-fs-inline-path-enc/input.js +++ /dev/null @@ -1,3 +0,0 @@ -const fs = require('fs'); -const { join } = require('path'); -console.log(fs.readFileSync(join(__dirname, 'asset.txt'), 'utf8')); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc/output-coverage.js b/test/unit/asset-fs-inline-path-enc/output-coverage.js deleted file mode 100644 index 8b34f883..00000000 --- a/test/unit/asset-fs-inline-path-enc/output-coverage.js +++ /dev/null @@ -1,68 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(73); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 73: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { - -const fs = __webpack_require__(66); -const { join } = __webpack_require__(589); -console.log(fs.readFileSync(__dirname + '/asset.txt', 'utf8')); - -/***/ }), - -/***/ 589: -/***/ (function(module) { - -module.exports = require("path"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-enc/output.js b/test/unit/asset-fs-inline-path-enc/output.js deleted file mode 100644 index 633e0685..00000000 --- a/test/unit/asset-fs-inline-path-enc/output.js +++ /dev/null @@ -1,68 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(925); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 589: -/***/ (function(module) { - -module.exports = require("path"); - -/***/ }), - -/***/ 925: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { - -const fs = __webpack_require__(66); -const { join } = __webpack_require__(589); -console.log(fs.readFileSync(__dirname + '/asset.txt', 'utf8')); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-shadow/asset.txt b/test/unit/asset-fs-inline-path-shadow/asset.txt deleted file mode 100644 index 95d09f2b..00000000 --- a/test/unit/asset-fs-inline-path-shadow/asset.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-shadow/input.js b/test/unit/asset-fs-inline-path-shadow/input.js deleted file mode 100644 index eec0423b..00000000 --- a/test/unit/asset-fs-inline-path-shadow/input.js +++ /dev/null @@ -1,9 +0,0 @@ -const fs = require('fs'); -const { join } = require('path'); - -console.log(fs.readFileSync(join(__dirname, 'asset.txt'), 'utf8')); - -(function () { - var join = () => 'nope'; - console.log(fs.readFileSync(join(__dirname, 'asset.txt'), 'utf8')); -})(); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-shadow/output-coverage.js b/test/unit/asset-fs-inline-path-shadow/output-coverage.js deleted file mode 100644 index 373f4a51..00000000 --- a/test/unit/asset-fs-inline-path-shadow/output-coverage.js +++ /dev/null @@ -1,74 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(430); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 430: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { - -const fs = __webpack_require__(66); -const { join } = __webpack_require__(589); - -console.log(fs.readFileSync(__dirname + '/asset.txt', 'utf8')); - -(function () { - var join = () => 'nope'; - console.log(fs.readFileSync(join(__dirname + '/asset-fs-inline-path-shadow', 'asset.txt'), 'utf8')); -})(); - -/***/ }), - -/***/ 589: -/***/ (function(module) { - -module.exports = require("path"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-path-shadow/output.js b/test/unit/asset-fs-inline-path-shadow/output.js deleted file mode 100644 index dfbe2717..00000000 --- a/test/unit/asset-fs-inline-path-shadow/output.js +++ /dev/null @@ -1,74 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(777); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 589: -/***/ (function(module) { - -module.exports = require("path"); - -/***/ }), - -/***/ 777: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { - -const fs = __webpack_require__(66); -const { join } = __webpack_require__(589); - -console.log(fs.readFileSync(__dirname + '/asset.txt', 'utf8')); - -(function () { - var join = () => 'nope'; - console.log(fs.readFileSync(join(__dirname + '/asset-fs-inline-path-shadow', 'asset.txt'), 'utf8')); -})(); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-tpl/asset.txt b/test/unit/asset-fs-inline-tpl/asset.txt deleted file mode 100644 index 95d09f2b..00000000 --- a/test/unit/asset-fs-inline-tpl/asset.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/test/unit/asset-fs-inline-tpl/input.js b/test/unit/asset-fs-inline-tpl/input.js deleted file mode 100644 index 3aabae0a..00000000 --- a/test/unit/asset-fs-inline-tpl/input.js +++ /dev/null @@ -1,2 +0,0 @@ -const fs = require('fs'); -console.log(fs.readFileSync(`${__dirname}/asset.txt`)); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-tpl/output-coverage.js b/test/unit/asset-fs-inline-tpl/output-coverage.js deleted file mode 100644 index fabf843b..00000000 --- a/test/unit/asset-fs-inline-tpl/output-coverage.js +++ /dev/null @@ -1,60 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(499); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 499: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { - -const fs = __webpack_require__(66); -console.log(fs.readFileSync(__dirname + '/asset.txt')); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/asset-fs-inline-tpl/output.js b/test/unit/asset-fs-inline-tpl/output.js deleted file mode 100644 index a95d50b5..00000000 --- a/test/unit/asset-fs-inline-tpl/output.js +++ /dev/null @@ -1,60 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(560); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 560: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { - -const fs = __webpack_require__(66); -console.log(fs.readFileSync(__dirname + '/asset.txt')); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/asset-fs-inlining-multi/asset.txt b/test/unit/asset-fs-inlining-multi/asset.txt deleted file mode 100644 index 95d09f2b..00000000 --- a/test/unit/asset-fs-inlining-multi/asset.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/test/unit/asset-fs-inlining-multi/input.js b/test/unit/asset-fs-inlining-multi/input.js deleted file mode 100644 index 90964cdb..00000000 --- a/test/unit/asset-fs-inlining-multi/input.js +++ /dev/null @@ -1,3 +0,0 @@ -const fs = require('fs'); -console.log(fs.readFileSync(__dirname + '/asset.txt')); -console.log(fs.readFileSync(__dirname + '/sub/asset.txt')); \ No newline at end of file diff --git a/test/unit/asset-fs-inlining-multi/output-coverage.js b/test/unit/asset-fs-inlining-multi/output-coverage.js deleted file mode 100644 index 6f18ed1a..00000000 --- a/test/unit/asset-fs-inlining-multi/output-coverage.js +++ /dev/null @@ -1,61 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(390); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 390: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { - -const fs = __webpack_require__(66); -console.log(fs.readFileSync(__dirname + '/asset.txt')); -console.log(fs.readFileSync(__dirname + '/asset1.txt')); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/asset-fs-inlining-multi/output.js b/test/unit/asset-fs-inlining-multi/output.js deleted file mode 100644 index 39c91793..00000000 --- a/test/unit/asset-fs-inlining-multi/output.js +++ /dev/null @@ -1,61 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(697); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 697: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { - -const fs = __webpack_require__(66); -console.log(fs.readFileSync(__dirname + '/asset.txt')); -console.log(fs.readFileSync(__dirname + '/asset1.txt')); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/asset-fs-inlining-multi/sub/asset.txt b/test/unit/asset-fs-inlining-multi/sub/asset.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/test/unit/asset-fs-inlining/asset.txt b/test/unit/asset-fs-inlining/asset.txt deleted file mode 100644 index 95d09f2b..00000000 --- a/test/unit/asset-fs-inlining/asset.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/test/unit/asset-fs-inlining/input.js b/test/unit/asset-fs-inlining/input.js deleted file mode 100644 index 98de259f..00000000 --- a/test/unit/asset-fs-inlining/input.js +++ /dev/null @@ -1,2 +0,0 @@ -const fs = require('fs'); -console.log(fs.readFileSync(__dirname + '/asset.txt')); \ No newline at end of file diff --git a/test/unit/asset-fs-inlining/output-coverage.js b/test/unit/asset-fs-inlining/output-coverage.js deleted file mode 100644 index cd9308a2..00000000 --- a/test/unit/asset-fs-inlining/output-coverage.js +++ /dev/null @@ -1,60 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(605); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 605: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { - -const fs = __webpack_require__(66); -console.log(fs.readFileSync(__dirname + '/asset.txt')); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/asset-fs-inlining/output.js b/test/unit/asset-fs-inlining/output.js deleted file mode 100644 index a274f3a6..00000000 --- a/test/unit/asset-fs-inlining/output.js +++ /dev/null @@ -1,60 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(164); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 164: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { - -const fs = __webpack_require__(66); -console.log(fs.readFileSync(__dirname + '/asset.txt')); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/asset-fs-logical/asset1.txt b/test/unit/asset-fs-logical/asset1.txt deleted file mode 100644 index 95d09f2b..00000000 --- a/test/unit/asset-fs-logical/asset1.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/test/unit/asset-fs-logical/asset2.txt b/test/unit/asset-fs-logical/asset2.txt deleted file mode 100644 index 95d09f2b..00000000 --- a/test/unit/asset-fs-logical/asset2.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/test/unit/asset-fs-logical/input.js b/test/unit/asset-fs-logical/input.js deleted file mode 100644 index 655c2d22..00000000 --- a/test/unit/asset-fs-logical/input.js +++ /dev/null @@ -1,2 +0,0 @@ -const fs = require('fs'); -console.log(fs.readFileSync(`${__dirname}/asset${unknown ? '1' : '2'}.txt`)); diff --git a/test/unit/asset-fs-logical/output-coverage.js b/test/unit/asset-fs-logical/output-coverage.js deleted file mode 100644 index e4d73bb8..00000000 --- a/test/unit/asset-fs-logical/output-coverage.js +++ /dev/null @@ -1,61 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(3); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 3: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { - -const fs = __webpack_require__(66); -console.log(fs.readFileSync(unknown ? __dirname + '/asset1.txt' : __dirname + '/asset2.txt')); - - -/***/ }), - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/asset-fs-logical/output.js b/test/unit/asset-fs-logical/output.js deleted file mode 100644 index 0ae1baa2..00000000 --- a/test/unit/asset-fs-logical/output.js +++ /dev/null @@ -1,61 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(274); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 66: -/***/ (function(module) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 274: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { - -const fs = __webpack_require__(66); -console.log(fs.readFileSync(unknown ? __dirname + '/asset1.txt' : __dirname + '/asset2.txt')); - - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/asset-package-json/input.js b/test/unit/asset-package-json/input.js deleted file mode 100644 index 7ed9a209..00000000 --- a/test/unit/asset-package-json/input.js +++ /dev/null @@ -1,4 +0,0 @@ -const path = require("path"); - -var binding_path = - binary.find(path.resolve(path.join(__dirname, './package.json'))); \ No newline at end of file diff --git a/test/unit/asset-package-json/output-coverage.js b/test/unit/asset-package-json/output-coverage.js deleted file mode 100644 index 56a439a9..00000000 --- a/test/unit/asset-package-json/output-coverage.js +++ /dev/null @@ -1,62 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(338); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 338: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { - -const path = __webpack_require__(589); - -var binding_path = - binary.find(__dirname + '/package.json'); - -/***/ }), - -/***/ 589: -/***/ (function(module) { - -module.exports = require("path"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/asset-package-json/output.js b/test/unit/asset-package-json/output.js deleted file mode 100644 index 8f7ed3e7..00000000 --- a/test/unit/asset-package-json/output.js +++ /dev/null @@ -1,62 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(704); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 589: -/***/ (function(module) { - -module.exports = require("path"); - -/***/ }), - -/***/ 704: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { - -const path = __webpack_require__(589); - -var binding_path = - binary.find(__dirname + '/package.json'); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/unit/asset-package-json/package.json b/test/unit/asset-package-json/package.json deleted file mode 100644 index 179e067a..00000000 --- a/test/unit/asset-package-json/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "package": "json" -} \ No newline at end of file diff --git a/test/unit/browserify/dep1.js b/test/unit/browserify/dep1.js deleted file mode 100644 index 94c1eecf..00000000 --- a/test/unit/browserify/dep1.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'dep1'; \ No newline at end of file diff --git a/test/unit/browserify/dep2.js b/test/unit/browserify/dep2.js deleted file mode 100644 index 7922a11b..00000000 --- a/test/unit/browserify/dep2.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'dep2'; \ No newline at end of file diff --git a/test/unit/browserify/input.js b/test/unit/browserify/input.js deleted file mode 100644 index 8667f15a..00000000 --- a/test/unit/browserify/input.js +++ /dev/null @@ -1,4 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.bugsnag = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i=0.0.4" -sourcemap-codec@^1.4.1: - version "1.4.4" - resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.4.tgz#c63ea927c029dd6bd9a2b7fa03b3fec02ad56e9f" - integrity sha512-CYAPYdBu34781kLHkaW3m6b/uUSyMOC2R61gcYMWooeuaGtjof86ZA/8T+qVPPt7np1085CR9hmMGrySwEc8Xg== - sparse-bitfield@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz#ff4ae6e68656056ba4b3e792ab3334d38273ca11"