@oroinc/oro-webpack-config-builder 6.1.0-lts14 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,54 +2,11 @@
|
|
|
2
2
|
"name": "inject-loader",
|
|
3
3
|
"version": "4.0.1",
|
|
4
4
|
"description": "A Webpack loader for injecting code into modules via their dependencies",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "webpack --config config/webpack.config.js",
|
|
8
|
-
"build:test": "webpack --config config/webpack.test.config.js",
|
|
9
|
-
"build:release": "yarn run build && mkdir -p ./dist && cp -f ./tmp/index.js ./dist/index.js && cp -f ./tmp/index.js.map ./dist/index.js.map",
|
|
10
|
-
"pretest:unit": "yarn build && yarn build:test",
|
|
11
|
-
"test:unit": "mocha tmp/testBundle.js --require source-map-support/register",
|
|
12
|
-
"test:integration": "./script/integration_test",
|
|
13
|
-
"test": "flow && yarn test:unit && yarn test:integration",
|
|
14
|
-
"precommit": "pretty-quick --staged"
|
|
15
|
-
},
|
|
16
|
-
"files": [
|
|
17
|
-
"*.md",
|
|
18
|
-
"dist"
|
|
19
|
-
],
|
|
20
5
|
"author": "Justin Morris <desk@pixelbloom.com> (http://pixelbloom.com)",
|
|
21
6
|
"repository": {
|
|
22
7
|
"type": "git",
|
|
23
8
|
"url": "git@github.com:plasticine/inject-loader.git"
|
|
24
9
|
},
|
|
25
10
|
"license": "MIT",
|
|
26
|
-
"
|
|
27
|
-
"babel-core": "~6"
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"babel-loader": "^7.1.4",
|
|
31
|
-
"babel-plugin-add-module-exports": "^0.2.1",
|
|
32
|
-
"babel-plugin-transform-flow-strip-types": "^6.22.0",
|
|
33
|
-
"babel-preset-es2015": "^6.22.0",
|
|
34
|
-
"flow-bin": "^0.69.0",
|
|
35
|
-
"husky": "^0.14.3",
|
|
36
|
-
"mocha": "^5.0.5",
|
|
37
|
-
"prettier": "^1.11.1",
|
|
38
|
-
"pretty-quick": "^1.4.1",
|
|
39
|
-
"source-map-support": "^0.5.4",
|
|
40
|
-
"webpack": "^4.35.0",
|
|
41
|
-
"webpack-cli": "^3.3.5"
|
|
42
|
-
},
|
|
43
|
-
"peerDependencies": {
|
|
44
|
-
"webpack": "^1 || ^2 || ^3 || ^4"
|
|
45
|
-
},
|
|
46
|
-
"keywords": [
|
|
47
|
-
"webpack",
|
|
48
|
-
"testing",
|
|
49
|
-
"loader",
|
|
50
|
-
"webpack-loader",
|
|
51
|
-
"inject",
|
|
52
|
-
"mock",
|
|
53
|
-
"mocking"
|
|
54
|
-
]
|
|
11
|
+
"private": true
|
|
55
12
|
}
|
package/oro-webpack-config.js
CHANGED
|
@@ -31,6 +31,8 @@ const ErrorHandler = require('./error-handler');
|
|
|
31
31
|
const SVGSprite = require('./svg-sprite');
|
|
32
32
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
33
33
|
const jsToSCSS = require('./js-to-scss');
|
|
34
|
+
const oroPostcssCleanup = require('./postcss/oro-postcss-cleanup');
|
|
35
|
+
const cleanupPostcssConfig = require('./postcss/cleanup-postcss-config');
|
|
34
36
|
require('resolve-url-loader');
|
|
35
37
|
require('lezer-loader');
|
|
36
38
|
|
|
@@ -565,7 +567,10 @@ class ConfigBuilder {
|
|
|
565
567
|
sourceMap: true,
|
|
566
568
|
postcssOptions: {
|
|
567
569
|
plugins: [
|
|
568
|
-
require('autoprefixer')
|
|
570
|
+
require('autoprefixer'),
|
|
571
|
+
this._isProduction
|
|
572
|
+
? oroPostcssCleanup(cleanupPostcssConfig)
|
|
573
|
+
: null
|
|
569
574
|
]
|
|
570
575
|
}
|
|
571
576
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module.exports = ({declarations = {}} = {}) => {
|
|
2
|
+
const props = Object.keys(declarations);
|
|
3
|
+
|
|
4
|
+
return {
|
|
5
|
+
postcssPlugin: 'oro-postcss-cleanup',
|
|
6
|
+
|
|
7
|
+
Declaration(decl, {result}) {
|
|
8
|
+
for (let i = 0; i < props.length; i++) {
|
|
9
|
+
const prop = props[i];
|
|
10
|
+
if (decl.prop === prop) {
|
|
11
|
+
declarationParserHelper({declConfig: declarations[prop], decl: decl, result: result});
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function declarationParserHelper({declConfig, decl, result}) {
|
|
19
|
+
if (typeof declConfig === 'object' && declConfig.task === 'remove') {
|
|
20
|
+
if (declConfig.whenValueEquals !== undefined && declConfig.whenValueEquals === decl.value) {
|
|
21
|
+
decl.remove();
|
|
22
|
+
}
|
|
23
|
+
} else if (declConfig.task) {
|
|
24
|
+
result.warn(`Unknown task: [${declConfig.task}]`, { node: decl });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
module.exports.postcss = true;
|