Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v10.0.0 #91

Merged
merged 9 commits into from
Dec 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.10
10.13
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "8.11"
- "10.15"
- "10.18"
- "12.14"
after_success:
- 'cat ./coverage/lcov.info | ./node_modules/.bin/coveralls'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Allows [projext](https://yarnpkg.com/en/package/projext) to use [webpack](https:
|--------------|-------------------------------------------------------------------------------|
| Package | projext-plugin-webpack |
| Description | Allows projext to use webpack as a build engine. |
| Node Version | >= v8.0.0 |
| Node Version | >= v10.13.0 |

## Usage

Expand Down
62 changes: 29 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,70 @@
"name": "projext-plugin-webpack",
"description": "Allows projext to use webpack as a build engine.",
"homepage": "https://homer0.github.io/projext-plugin-webpack/",
"version": "9.2.2",
"version": "10.0.0",
"repository": "homer0/projext-plugin-webpack",
"author": "Leonardo Apiwan (@homer0) <me@homer0.com>",
"license": "MIT",
"dependencies": {
"projext": "^7.2.0",
"wootils": "^2.6.5",
"projext": "^8.0.0",
"wootils": "^3.0.1",
"jimple": "^1.5.0",
"fs-extra": "^8.1.0",
"extend": "^3.0.2",

"core-js": "^3.3.3",
"regenerator-runtime": "0.13.3",

"webpack": "^4.41.2",
"webpack-cli": "^3.3.9",
"webpack-dev-server": "^3.9.0",
"mini-css-extract-plugin": "0.8.0",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.1",
"mini-css-extract-plugin": "0.9.0",
"html-webpack-plugin": "^3.2.0",
"script-ext-html-webpack-plugin": "^2.1.4",
"compression-webpack-plugin": "^3.0.0",
"terser-webpack-plugin": "^2.2.1",
"compression-webpack-plugin": "^3.0.1",
"terser-webpack-plugin": "^2.3.1",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"copy-webpack-plugin": "^5.0.4",
"copy-webpack-plugin": "^5.1.1",
"extra-watch-webpack-plugin": "^1.0.3",

"@babel/core": "7.6.4",
"node-sass": "^4.12.0",
"@babel/core": "7.7.7",
"node-sass": "^4.13.0",

"babel-loader": "^8.0.6",
"css-loader": "^3.2.0",
"css-loader": "^3.4.0",
"sass-loader": "^8.0.0",
"style-loader": "^1.0.0",
"raw-loader": "^3.1.0",
"file-loader": "^4.2.0",
"url-loader": "^2.2.0",
"resolve-url-loader": "^3.1.0",
"style-loader": "^1.1.2",
"raw-loader": "^4.0.0",
"file-loader": "^5.0.2",
"url-loader": "^3.0.0",
"resolve-url-loader": "^3.1.1",
"source-map-loader": "0.2.4",

"webpack-dev-middleware": "^3.7.2",
"webpack-hot-middleware": "^2.25.0",

"webpack-bundle-analyzer": "^3.6.0",

"terser": "^4.3.9",
"terser": "^4.4.3",

"opener": "^1.5.1"
},
"devDependencies": {
"eslint": "^6.5.1",
"eslint-plugin-homer0": "^2.0.1",
"@babel/preset-env": "7.6.3",
"@babel/plugin-transform-runtime": "7.6.2",
"jest-ex": "^6.1.1",
"eslint": "^6.8.0",
"eslint-plugin-homer0": "^3.0.0",
"@babel/preset-env": "7.7.7",
"@babel/plugin-transform-runtime": "7.7.6",
"jest-ex": "^7.0.1",
"jest-cli": "^24.9.0",
"jasmine-expect": "^4.0.3",
"jimpex": "^4.0.3",
"jimpex": "^5.0.0",
"esdoc": "^1.1.0",
"esdoc-standard-plugin": "^1.0.0",
"esdoc-node": "1.0.4",
"leasot": "^8.3.0",
"coveralls": "^3.0.7",
"husky": "^3.0.9"
"leasot": "^9.3.1",
"coveralls": "^3.0.9",
"husky": "^3.1.0"
},
"engine-strict": true,
"engines": {
"node": ">=8.10.0",
"npm": ">=3.0.0"
"node": ">=10.13.0"
},
"main": "src/index.js",
"husky": {
Expand Down
3 changes: 0 additions & 3 deletions polyfill.js

This file was deleted.

1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const loadPlugin = (app) => {
'express',
'jimpex',
],
babelPolyfill: 'polyfill.js',
}));
// Register the main services of the build engine.
app.register(webpackConfiguration);
Expand Down
21 changes: 3 additions & 18 deletions src/services/building/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@ class WebpackConfiguration {
* configuration for the target.
* @param {WebpackConfigurations} webpackConfigurations A dictionary of configurations
* for target type and build type.
* @param {WebpackPluginInfo} webpackPluginInfo To get the path to the Babel
* polyfill.
*/
constructor(
buildVersion,
pathUtils,
targets,
targetsFileRules,
targetConfiguration,
webpackConfigurations,
webpackPluginInfo
webpackConfigurations
) {
/**
* A local reference for the `buildVersion` service.
Expand Down Expand Up @@ -58,11 +55,6 @@ class WebpackConfiguration {
* @type {WebpackConfigurations}
*/
this.webpackConfigurations = webpackConfigurations;
/**
* A local reference for the plugin information.
* @type {WebpackPluginInfo}
*/
this.webpackPluginInfo = webpackPluginInfo;
}
/**
* This method generates a complete webpack configuration for a target.
Expand All @@ -86,12 +78,6 @@ class WebpackConfiguration {
throw new Error(`There's no configuration for the selected build type: ${buildType}`);
}

const entryFile = path.join(target.paths.source, target.entry[buildType]);
const entries = [entryFile];
if (target.babel.polyfill) {
entries.unshift(`${this.webpackPluginInfo.name}/${this.webpackPluginInfo.babelPolyfill}`);
}

const copy = [];
if (target.is.browser || target.bundle) {
copy.push(...this.targets.getFilesToCopy(target, buildType));
Expand All @@ -109,7 +95,7 @@ class WebpackConfiguration {
target,
targetRules: this.targetsFileRules.getRulesForTarget(target),
entry: {
[target.name]: entries,
[target.name]: [path.join(target.paths.source, target.entry[buildType])],
},
definitions,
output,
Expand Down Expand Up @@ -288,8 +274,7 @@ const webpackConfiguration = provider((app) => {
app.get('targets'),
app.get('targetsFileRules'),
app.get('targetConfiguration'),
webpackConfigurations,
app.get('webpackPluginInfo')
webpackConfigurations
);
});
});
Expand Down
13 changes: 2 additions & 11 deletions src/services/configurations/browserDevelopmentConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,8 @@ class WebpackBrowserDevelopmentConfiguration extends ConfigurationFile {
const [entryName] = Object.keys(entry);
// Get the list of entries for the target.
const entries = config.entry[entryName];
// Check if the Babel polyfill is present, since it always needs to be first.
const polyfillIndex = entries
.indexOf(`${this.webpackPluginInfo.name}/${this.webpackPluginInfo.babelPolyfill}`);
// If the `babel-polyfill` is present...
if (polyfillIndex > -1) {
// ...push all the _"hot entries"_ after it.
entries.splice(polyfillIndex + 1, 0, ...hotEntries);
} else {
// ...push all the _"hot entries"_ on top of the existing entries.
entries.unshift(...hotEntries);
}
// and push all the _"hot entries"_ on top of the existing entries.
entries.unshift(...hotEntries);
}

// Reduce the configuration
Expand Down
2 changes: 0 additions & 2 deletions src/typedef.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@
* @property {Array} external The list of subpaths the plugin exposes and that should be
* handled as external dependencies, in order to avoid bundling
* them.
* @property {string} babelPolyfill The name of the file that imports the required modules to
* act as the old Babel polyfill.
*/

/**
Expand Down
1 change: 0 additions & 1 deletion tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ describe('plugin:projextWebpack', () => {
'express',
'jimpex',
],
babelPolyfill: 'polyfill.js',
});
expect(app.set).toHaveBeenCalledTimes(1);
expect(app.set).toHaveBeenCalledWith('webpackPluginInfo', expect.any(Function));
Expand Down