diff --git a/.babelrc b/.babelrc index fd49b83..7a53a58 100644 --- a/.babelrc +++ b/.babelrc @@ -1,7 +1,9 @@ { - "plugins": [ - "transform-function-bind", - "transform-object-rest-spread", - "transform-es2015-modules-commonjs" + "presets": [ + ["@babel/preset-env", { + "targets": { + "node": "10" + } + }] ] } diff --git a/README.md b/README.md index 8812d4f..0edb7dc 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ the processed file available via a static route. 'client_js': { 'babel': {}, // Babel specific options. Defaults to the project .babelrc file options 'watchify': true, // Whether to have webpack watch for changes - add your js to .nxusrc 'ignore' if so - 'minify': true, // Whether to have webpack minify output + 'minify': undefined, // Whether to have webpack minify output 'sourceMap': 'cheap-module-eval-source-map', // Sourcemap devtool option for webpack 'webpackConfig': {}, // Additional webpack config, merged with default. 'appendRulesConfig': false, // should webpack config rules be merged or replace the default @@ -32,6 +32,14 @@ the processed file available via a static route. 'buildSeries': false // Whether to run bundle builds in series instead of parallel, for deploy scripts } +## Version Compatibilities + +ClientJS works with Webpack v5, Babel v7 and Node.js v16. + +It should be possible to get it to work with Node.js >=14.15.0 +(a `babel-loader` requirement) and npm v7 (there's an npm v6 bug +that causes problems with Webpack). + ## Usage ClientJS currently supports bundling scripts from a JS file entry point or Polymer web components @@ -73,49 +81,44 @@ You will need to install the necessary Babel presets and plugins in your application, and add Babel configuration options to the `clientjs` section of your `.nxusrc` file. For example: -```javascript - npm install --save babel-preset-es2015 \ - babel-plugin-transform-function-bind \ - babel-plugin-transform-object-rest-spread -``` - - "client_js": { - ... - "babel": { - "presets": [ "es2015" ], - "plugins": [ - "transform-function-bind", - "transform-object-rest-spread" - ] - } - } + npm install --save @babel/preset-env + npm install --save @babel/plugin-proposal-function-bind + + "client_js": { + ... + "babel": { + "presets": [ "@babel/preset-env" ], + "plugins": [ "@babel/plugin-proposal-function-bind" ] + } + } ### includeScript Injects the passed script entry into to the specified template after webpack/babel -**Parameters** +#### Parameters -- `templateName` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the name of the template to include the script into -- `script` **\[type]** the path of the script file to include +* `templateName` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the name of the template to include the script into +* `script` **\[type]** the path of the script file to include ### includeComponent -**Parameters** +#### Parameters -- `templateName` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the name of the template to include the script into -- `script` **\[type]** the path of the component file to include +* `templateName` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the name of the template to include the script into +* `script` **\[type]** the path of the component file to include **Meta** -- **deprecated**: (Deprecated, includeScript now handles this.) Injects the passed web component entry into to the specified template after bundling/babel - +* **deprecated**: (Deprecated, includeScript now handles this.) Injects the passed web component entry into to the specified template after bundling/babel ### bundle Create a clientjs bundle that can be injected into a rendered page. -**Parameters** +#### Parameters + +* `entry` **\[type]** the source file to bundle +* `output` **\[type]** the output path to use in the browser to access the bundled source -- `entry` **\[type]** the source file to bundle -- `output` **\[type]** the output path to use in the browser to access the bundled source +Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** promise that resolves when bundling is completed diff --git a/package.json b/package.json index e71cd6b..8d4b342 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,19 @@ "name": "nxus-clientjs", "version": "4.2.0", "description": "Client JS compilation for Nxus applications", - "main": "lib/", + "main": "lib/index.js", + "engines": { + "node": ">=16.0.0" + }, "scripts": { "preversion": "npm test", "postversion": "npm run build-docs && git push && git push --tags", - "test": "NODE_ENV=test mocha --compilers js:babel-register -R spec src/test", + "test": "NODE_ENV=test mocha --require @babel/register --reporter spec src/test", "compile": "rm -rf lib/; babel src --ignore src/test --out-dir lib", + "prepare": "npm run compile", "prepublish": "npm run compile", "postpublish": "npm run build-docs && npm run publish-docs", - "build-docs": "export NAME=`npm view . name`; export VERSION=`npm view . version`; documentation readme ./src/index.js --name $NAME --project-version $VERSION --readme-file ./README.md -s $NAME", + "build-docs": "NAME=\"${NAME:-$npm_package_name}\" VERSION=\"${VERSION:-$npm_package_version}\" && documentation readme ./src/index.js --project-name ${NAME} --project-version ${VERSION} --section ${NAME} --format md --markdown-toc false", "publish-docs": "npm run build-docs && git add ./README.md && git commit -m 'Updated README API Docs' && git push" }, "repository": { @@ -29,37 +33,27 @@ }, "homepage": "https://github.com/nxus/clientjs", "dependencies": { - "babel-core": "^6.24.1", - "babel-loader": "^7.1.2", - "babel-preset-env": "^1.6.0", - "bluebird": "^3.0.6", + "@babel/core": "^7.21.3", + "babel-loader": "^9.1.2", "css-loader": "^3.2.0", - "fs-extra": "^3.0.1", - "imports-loader": "^0.7.1", - "morph": "^0.2.0", "nxus-core": "^4.0.0", "nxus-router": "^4.0.0", "nxus-templater": "^4.0.0", - "only-if-changed-webpack-plugin": "https://github.com/vhadianto/only-if-changed-webpack-plugin.git", - "polymer-webpack-loader": "^2.0.0", + "polymer-webpack-loader": "github:Banno/polymer-webpack-loader#c89f4a4", "rc": "^1.1.6", - "script-loader": "^0.7.1", "style-loader": "^1.0.0", "traverse": "^0.6.6", - "uglifyjs-webpack-plugin": "^1.0.0-beta.2", "underscore": "^1.8.3", - "webpack": "^4", - "webpack-combine-loaders": "^2.0.4" + "webpack": "^5" }, "devDependencies": { - "babel-cli": "^6.9.0", - "babel-core": "^6.9.0", - "babel-plugin-transform-class-properties": "^6.11.5", - "babel-plugin-transform-function-bind": "^6.8.0", - "babel-preset-es2015": "^6.9.0", + "@babel/cli": "^7.21.0", + "@babel/preset-env": "^7.20.2", + "@babel/register": "^7.21.0", + "bluebird": "^3.0.6", "chai": "^3.4.1", "chai-as-promised": "^5.1.0", - "documentation": "^4.0.0-beta9", + "documentation": "^13.2.5", "mocha": "^3.2.0", "should": "^7.0.2", "sinon": "^1.17.2" diff --git a/src/index.js b/src/index.js index 8e88ac9..2b2ed71 100755 --- a/src/index.js +++ b/src/index.js @@ -1,23 +1,16 @@ 'use strict' -import Promise from 'bluebird' import webpack from 'webpack' -import UglifyJsPlugin from 'uglifyjs-webpack-plugin' import path from 'path' -import fs from 'fs-extra' +import fs from 'fs' import _ from 'underscore' -import morph from 'morph' import traverse from 'traverse' -import combineLoaders from 'webpack-combine-loaders' -import OnlyIfChangedPlugin from 'only-if-changed-webpack-plugin' import {router} from 'nxus-router' import {templater} from 'nxus-templater' import {application as app, NxusModule} from 'nxus-core' -import mkdirp from 'mkdirp' - /** * * [![Build Status](https://travis-ci.org/nxus/clientjs.svg?branch=master)](https://travis-ci.org/nxus/clientjs) @@ -35,7 +28,7 @@ import mkdirp from 'mkdirp' * 'client_js': { * 'babel': {}, // Babel specific options. Defaults to the project .babelrc file options * 'watchify': true, // Whether to have webpack watch for changes - add your js to .nxusrc 'ignore' if so - * 'minify': true, // Whether to have webpack minify output + * 'minify': undefined, // Whether to have webpack minify output * 'sourceMap': 'cheap-module-eval-source-map', // Sourcemap devtool option for webpack * 'webpackConfig': {}, // Additional webpack config, merged with default. * 'appendRulesConfig': false, // should webpack config rules be merged or replace the default @@ -47,6 +40,14 @@ import mkdirp from 'mkdirp' * 'buildSeries': false // Whether to run bundle builds in series instead of parallel, for deploy scripts * } * + * ## Version Compatibilities + * + * ClientJS works with Webpack v5, Babel v7 and Node.js v16. + * + * It should be possible to get it to work with Node.js >=14.15.0 + * (a `babel-loader` requirement) and npm v7 (there's an npm v6 bug + * that causes problems with Webpack). + * * ## Usage * * ClientJS currently supports bundling scripts from a JS file entry point or Polymer web components @@ -89,24 +90,17 @@ import mkdirp from 'mkdirp' * in your application, and add Babel configuration options to the * `clientjs` section of your `.nxusrc` file. For example: * - * ```javascript - * npm install --save babel-preset-es2015 \ - * babel-plugin-transform-function-bind \ - * babel-plugin-transform-object-rest-spread - * ``` + * npm install --save @babel/preset-env + * npm install --save @babel/plugin-proposal-function-bind * - * ``` * "client_js": { - * ... + * ... * "babel": { - * "presets": [ "es2015" ], - * "plugins": [ - * "transform-function-bind", - * "transform-object-rest-spread" - * ] + * "presets": [ "@babel/preset-env" ], + * "plugins": [ "@babel/plugin-proposal-function-bind" ] * } * } - * ``` + * */ class ClientJS extends NxusModule { constructor () { @@ -114,7 +108,7 @@ class ClientJS extends NxusModule { this._outputPaths = {} this._establishedRoutes = {} - if(_.isEmpty(this.config.babel)) + if (_.isEmpty(this.config.babel)) this.config.babel = _.omit(require('rc')('babel', {}, {}), '_', 'config', 'configs') this.config.babel.cacheDirectory = true this._fromConfigBundles(app) @@ -124,10 +118,11 @@ class ClientJS extends NxusModule { app.on('launch', () => { resolve() }) - }).then(::this._buildingWhenReady) + }).then(this._buildingWhenReady.bind(this)) if (this.config.buildOnly) { - this.readyToBuild.then(::app.stop).then(::process.exit) - } else { + this.readyToBuild.then(app.stop.bind(app)).then(process.exit.bind(process)) + } + else { this._establishRoute(this.config.routePrefix, this.config.assetFolder) } } @@ -135,14 +130,14 @@ class ClientJS extends NxusModule { _defaultConfig() { return { watchify: true, - minify: app.config.NODE_ENV == 'production', + minify: undefined, webpackConfig: {}, appendRulesConfig: false, routePrefix: '/assets/clientjs', assetFolder: '.tmp/clientjs', webcomponentsURL: '/js/webcomponentsjs/webcomponents-lite.min.js', entries: {}, - sourceMap: app.config.NODE_ENV != 'production' ? 'cheap-module-eval-source-map' : false, + sourceMap: app.config.NODE_ENV != 'production' ? 'eval-cheap-module-source-map' : false, buildSeries: false, buildOnly: false, buildNone: false @@ -190,7 +185,7 @@ class ClientJS extends NxusModule { ] } - let scripts = [path.join(this.config.routePrefix,outputPath)] + let scripts = [path.join(this.config.routePrefix, outputPath)] templater.on('renderContext.'+templateName, () => { return { @@ -217,22 +212,22 @@ class ClientJS extends NxusModule { _establishRoute(route, path) { if (!(route in this._establishedRoutes)) { - fs.ensureDirSync(path) //create directory if it doesn't exist + fs.mkdirSync(path, {recursive: true}) // create directory if it doesn't exist router.staticRoute(route, path) this._establishedRoutes[route] = path } } _webpackConfig(entry, outputPath, outputFilename) { + const modes = ['development', 'production', 'none'] - var opts = { + let opts = { rootDir: process.cwd(), devBuild: process.env.NODE_ENV !== 'production', outputFilename - }; + } - mkdirp(path.join(opts.rootDir, '.tmp/cache')) - var sourceMap = this.config.sourceMap + fs.mkdirSync(path.join(opts.rootDir, '.tmp/cache'), {recursive: true}) let polymerLoader = { loader: 'polymer-webpack-loader', @@ -243,20 +238,13 @@ class ClientJS extends NxusModule { } } - var options = { - entry: path.resolve(entry), + let options = { + entry: Array.isArray(entry) ? entry.map(e => path.resolve(e)) : path.resolve(entry), output: { filename: outputFilename, path: outputPath }, - mode: app.config.NODE_ENV, - plugins: [ - new OnlyIfChangedPlugin({ - cacheDirectory: path.join(opts.rootDir, '.tmp/cache'), - cacheIdentifier: opts, // all variable opts/environment should be used in cache key - }) - ], - devtool: sourceMap ? sourceMap : false, + mode: modes.find(mode => mode.startsWith(app.config.NODE_ENV)) || 'none', watch: this.config.watchify, resolve: { modules: [ @@ -284,7 +272,7 @@ class ClientJS extends NxusModule { }, { test: /\.css$/, - use:['style-loader','css-loader'] + use:['style-loader', 'css-loader'] }, // web components that do not need babel { @@ -305,18 +293,15 @@ class ClientJS extends NxusModule { ] } } - if (this.config.minify) { - options.plugins.unshift( - new UglifyJsPlugin({ - sourceMap: sourceMap ? true : false - }) - ) - } + if (this.config.sourceMap) + options.devtool = this.config.sourceMap + if (this.config.minify !== undefined) // default is to use default Webpack behavior + options.optimization = { minimize: this.config.minify } if (this.config.webpackConfig) { let localConfig = Object.assign({}, this.config.webpackConfig) // hydrate regexps from json config traverse(localConfig).forEach(function(n) { - if (_.isString(n) && n.substring(0,1) == "/" && n.substring(-1, 1) == "/") { + if ((typeof n === 'string') && n.substring(0, 1) == "/" && n.substring(-1, 1) == "/") { this.update(new RegExp(n.substring(1, n.length-1))) } }) @@ -335,6 +320,7 @@ class ClientJS extends NxusModule { * Create a clientjs bundle that can be injected into a rendered page. * @param {[type]} entry the source file to bundle * @param {[type]} output the output path to use in the browser to access the bundled source + * @return {Promise} promise that resolves when bundling is completed */ bundle(entry, output) { this.log.debug('Bundling', entry, "to", output) @@ -344,16 +330,16 @@ class ClientJS extends NxusModule { outputDir = '' } - if(output && output[0] != '/') output = '/'+output //add prepending slash if not set - var outputRoute = this.config.routePrefix+path.dirname(output) //combine the routePrefix with output path - var outputPath = path.resolve(this.config.assetFolder+path.dirname(output)) - var outputFile = this.config.assetFolder+output - var outputFilename = path.basename(outputFile) + if (output && output[0] != '/') output = '/'+output // add prepending slash if not set + let outputRoute = this.config.routePrefix+path.dirname(output) // combine the routePrefix with output path + let outputPath = path.resolve(this.config.assetFolder+path.dirname(output)) + let outputFile = this.config.assetFolder+output + let outputFilename = path.basename(outputFile) let promise = this._outputPaths[outputFile] if (!promise) { promise = new Promise((resolve, reject) => { - var options = this._webpackConfig(entry, outputPath, outputFilename) + let options = this._webpackConfig(entry, outputPath, outputFilename) webpack(options, (err, stats) => { if (err) { this.log.error(`Bundle error for ${entry}`, err) @@ -366,7 +352,8 @@ class ClientJS extends NxusModule { try { let fstat = fs.lstatSync(outputFile) if (fstat.isFile()) fs.unlinkSync(outputFile) - } catch (e) { + } + catch (e) { if (e.code !== 'ENOENT') throw e } reject(new Error(info.errors.toString())) @@ -388,6 +375,6 @@ class ClientJS extends NxusModule { } -var clientjs = ClientJS.getProxy() +let clientjs = ClientJS.getProxy() export {ClientJS as default, clientjs} diff --git a/src/test/data/bundle/one-bundled.js b/src/test/data/bundle/one-bundled.js index c92a8e1..bf8026a 100644 --- a/src/test/data/bundle/one-bundled.js +++ b/src/test/data/bundle/one-bundled.js @@ -1,2 +1,93 @@ -!function(e){var t={};function r(n){if(t[n])return t[n].exports;var u=t[n]={i:n,l:!1,exports:{}};return e[n].call(u.exports,u,u.exports,r),u.l=!0,u.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var u in e)r.d(n,u,function(t){return e[t]}.bind(null,u));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e*(0,o.default)(e)};var n,u=r(1),o=(n=u)&&n.__esModule?n:{default:n}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return 3*e}}]); +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ([ +/* 0 */, +/* 1 */ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +var test = 'two'; +/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(n) { + return n * 3; +} +; + +/***/ }) +/******/ ]); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _two__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); + +var test = 'one'; +/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(n) { + return n * (0,_two__WEBPACK_IMPORTED_MODULE_0__["default"])(n); +} +; +})(); + +/******/ })() +; //# sourceMappingURL=one-bundled.js.map \ No newline at end of file diff --git a/src/test/data/bundle/one-bundled.js.map b/src/test/data/bundle/one-bundled.js.map index bf183ef..5230365 100644 --- a/src/test/data/bundle/one-bundled.js.map +++ b/src/test/data/bundle/one-bundled.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/test/apps/one.js","webpack:///./src/test/apps/two.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAAoBU,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRzB,EAAoB6B,EAAI,SAAS1B,GAChC,IAAIS,EAAST,GAAUA,EAAOqB,WAC7B,WAAwB,OAAOrB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBU,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRZ,EAAoBa,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG/B,EAAoBkC,EAAI,GAIjBlC,EAAoBA,EAAoBmC,EAAI,G,0FC9EtC,SAAUN,GACrB,OAAOA,GAAI,aAAIA,IALnB,I,EAAA,O,6HCEe,SAAUA,GAAK,OAAW,EAAJA","file":"one-bundled.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","import two from './two'\n\nlet test = 'one';\n\nexport default function (n) {\n return n * two(n);\n};\n","let test = 'two';\n\nexport default function (n) { return n * 3 };\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"one-bundled.js","mappings":";;;;;;;;;;;AAAA,IAAIA,IAAI,GAAG,KAAK;AAEhB,6BAAe,oCAAUC,CAAC,EAAE;EAAE,OAAOA,CAAC,GAAG,CAAC;AAAC;AAAC;;;;;UCF5C;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;ACNuB;AAEvB,IAAID,IAAI,GAAG,KAAK;AAEhB,6BAAe,oCAAUC,CAAC,EAAE;EACxB,OAAOA,CAAC,GAAGC,gDAAG,CAACD,CAAC,CAAC;AACrB;AAAC,C","sources":["webpack://nxus-clientjs/./src/test/apps/two.js","webpack://nxus-clientjs/webpack/bootstrap","webpack://nxus-clientjs/webpack/runtime/define property getters","webpack://nxus-clientjs/webpack/runtime/hasOwnProperty shorthand","webpack://nxus-clientjs/webpack/runtime/make namespace object","webpack://nxus-clientjs/./src/test/apps/one.js"],"sourcesContent":["let test = 'two';\n\nexport default function (n) { return n * 3 };\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import two from './two'\n\nlet test = 'one';\n\nexport default function (n) {\n return n * two(n);\n};\n"],"names":["test","n","two"],"sourceRoot":""} \ No newline at end of file diff --git a/src/test/data/bundle/two-bundled.js b/src/test/data/bundle/two-bundled.js index 15a5dab..86024de 100644 --- a/src/test/data/bundle/two-bundled.js +++ b/src/test/data/bundle/two-bundled.js @@ -1,2 +1,48 @@ -!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return 3*e}}]); +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ // The require scope +/******/ var __webpack_require__ = {}; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +var test = 'two'; +/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(n) { + return n * 3; +} +; +/******/ })() +; //# sourceMappingURL=two-bundled.js.map \ No newline at end of file diff --git a/src/test/data/bundle/two-bundled.js.map b/src/test/data/bundle/two-bundled.js.map index 317b2f9..d81cd08 100644 --- a/src/test/data/bundle/two-bundled.js.map +++ b/src/test/data/bundle/two-bundled.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/test/apps/two.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAAoBU,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRzB,EAAoB6B,EAAI,SAAS1B,GAChC,IAAIS,EAAST,GAAUA,EAAOqB,WAC7B,WAAwB,OAAOrB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBU,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRZ,EAAoBa,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG/B,EAAoBkC,EAAI,GAIjBlC,EAAoBA,EAAoBmC,EAAI,G,0FChFtC,SAAUN,GAAK,OAAW,EAAJA","file":"two-bundled.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","let test = 'two';\n\nexport default function (n) { return n * 3 };\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"two-bundled.js","mappings":";;UAAA;UACA;;;;;WCDA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;ACNA,IAAIA,IAAI,GAAG,KAAK;AAEhB,6BAAe,oCAAUC,CAAC,EAAE;EAAE,OAAOA,CAAC,GAAG,CAAC;AAAC;AAAC,C","sources":["webpack://nxus-clientjs/webpack/bootstrap","webpack://nxus-clientjs/webpack/runtime/define property getters","webpack://nxus-clientjs/webpack/runtime/hasOwnProperty shorthand","webpack://nxus-clientjs/webpack/runtime/make namespace object","webpack://nxus-clientjs/./src/test/apps/two.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","let test = 'two';\n\nexport default function (n) { return n * 3 };\n"],"names":["test","n"],"sourceRoot":""} \ No newline at end of file diff --git a/src/test/data/script/one.js b/src/test/data/script/one.js index 4dfdb9d..20b5d30 100644 --- a/src/test/data/script/one.js +++ b/src/test/data/script/one.js @@ -1,2 +1,93 @@ -!function(e){var t={};function r(n){if(t[n])return t[n].exports;var u=t[n]={i:n,l:!1,exports:{}};return e[n].call(u.exports,u,u.exports,r),u.l=!0,u.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var u in e)r.d(n,u,function(t){return e[t]}.bind(null,u));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e*(0,o.default)(e)};var n,u=r(1),o=(n=u)&&n.__esModule?n:{default:n}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return 3*e}}]); +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ([ +/* 0 */, +/* 1 */ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +var test = 'two'; +/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(n) { + return n * 3; +} +; + +/***/ }) +/******/ ]); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _two__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); + +var test = 'one'; +/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(n) { + return n * (0,_two__WEBPACK_IMPORTED_MODULE_0__["default"])(n); +} +; +})(); + +/******/ })() +; //# sourceMappingURL=one.js.map \ No newline at end of file diff --git a/src/test/data/script/one.js.map b/src/test/data/script/one.js.map index 91f7a2a..7002a38 100644 --- a/src/test/data/script/one.js.map +++ b/src/test/data/script/one.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///one-bundled.js"],"names":["modules","installedModules","__webpack_require__","moduleId","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","default","_two2","obj","_two"],"mappings":"CAAS,SAAUA,GAET,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAJ,EAAQG,GAAUK,KAAKH,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBO,EAAIT,EAGxBE,EAAoBQ,EAAIT,EAGxBC,EAAoBS,EAAI,SAASP,EAASQ,EAAMC,GAC3CX,EAAoBY,EAAEV,EAASQ,IAClCG,OAAOC,eAAeZ,EAASQ,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEX,EAAoBiB,EAAI,SAASf,GACX,oBAAXgB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeZ,EAASgB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeZ,EAAS,aAAc,CAAEkB,OAAO,KAQvDpB,EAAoBqB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQpB,EAAoBoB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFAzB,EAAoBiB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOpB,EAAoBS,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRxB,EAAoB4B,EAAI,SAASzB,GAChC,IAAIQ,EAASR,GAAUA,EAAOoB,WAC7B,WAAwB,OAAOpB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBS,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRX,EAAoBY,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG9B,EAAoBiC,EAAI,GAIjBjC,EAAoBA,EAAoBkC,EAAI,GAnFpD,CAsFC,CAEJ,SAAU/B,EAAQD,EAASF,GAEjC,aAGAa,OAAOC,eAAeZ,EAAS,aAAc,CACzCkB,OAAO,IAGXlB,EAAQiC,QAAU,SAAUP,GACxB,OAAOA,GAAI,EAAIQ,EAAMD,SAASP,IAGlC,IAIgCS,EAJ5BC,EAAOtC,EAAoB,GAE3BoC,GAE4BC,EAFGC,IAEkBD,EAAId,WAAac,EAAM,CAAEF,QAASE,IAQjF,SAAUlC,EAAQD,EAASF,GAEjC,aAGAa,OAAOC,eAAeZ,EAAS,aAAc,CAC3CkB,OAAO,IAGTlB,EAAQiC,QAAU,SAAUP,GAC1B,OAAW,EAAJA","file":"one.js","sourceRoot":""} \ No newline at end of file +{"version":3,"file":"one.js","mappings":";;;;;;;;;;;AAAA,IAAIA,IAAI,GAAG,KAAK;AAEhB,6BAAe,oCAAUC,CAAC,EAAE;EAAE,OAAOA,CAAC,GAAG,CAAC;AAAC;AAAC;;;;;UCF5C;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;ACNuB;AAEvB,IAAID,IAAI,GAAG,KAAK;AAEhB,6BAAe,oCAAUC,CAAC,EAAE;EACxB,OAAOA,CAAC,GAAGC,gDAAG,CAACD,CAAC,CAAC;AACrB;AAAC,C","sources":["webpack://nxus-clientjs/./src/test/apps/two.js","webpack://nxus-clientjs/webpack/bootstrap","webpack://nxus-clientjs/webpack/runtime/define property getters","webpack://nxus-clientjs/webpack/runtime/hasOwnProperty shorthand","webpack://nxus-clientjs/webpack/runtime/make namespace object","webpack://nxus-clientjs/./src/test/apps/one.js"],"sourcesContent":["let test = 'two';\n\nexport default function (n) { return n * 3 };\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import two from './two'\n\nlet test = 'one';\n\nexport default function (n) {\n return n * two(n);\n};\n"],"names":["test","n","two"],"sourceRoot":""} \ No newline at end of file diff --git a/src/test/index.js b/src/test/index.js index 67a6be0..9f5624d 100644 --- a/src/test/index.js +++ b/src/test/index.js @@ -14,7 +14,7 @@ import {application as app} from 'nxus-core' import {router} from 'nxus-router' import {templater} from 'nxus-templater' -const configBabel = { presets: [ 'es2015' ] } +const configBabel = { presets: [ '@babel/preset-env' ] } const configEntries = { 'src/test/apps/one.js': 'test/apps/one-bundled.js', // (in .tmp/clientjs/) 'src/test/apps/two.js': 'test/apps/two-bundled.js' // (in .tmp/clientjs/)