ko 5.3.6 → 5.3.9

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.
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const webpack_1 = __importDefault(require("webpack"));
7
- const esbuild_loader_1 = require("esbuild-loader");
8
7
  const creator_1 = require("./creator");
9
8
  const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
10
9
  class Build extends creator_1.WebpackCreator {
@@ -12,17 +11,11 @@ class Build extends creator_1.WebpackCreator {
12
11
  super(opts);
13
12
  }
14
13
  config() {
15
- const { esbuild } = this.opts;
14
+ // const { esbuild } = this.opts;
16
15
  const conf = {
17
16
  optimization: {
18
- minimizer: [
19
- !esbuild && new CssMinimizerPlugin(),
20
- esbuild &&
21
- new esbuild_loader_1.ESBuildMinifyPlugin({
22
- target: 'es2015',
23
- css: true,
24
- }),
25
- ].filter(Boolean),
17
+ minimize: true,
18
+ minimizer: ['...', new CssMinimizerPlugin()],
26
19
  },
27
20
  plugins: [
28
21
  new webpack_1.default.optimize.SplitChunksPlugin({
@@ -30,13 +23,18 @@ class Build extends creator_1.WebpackCreator {
30
23
  minSize: 30000,
31
24
  maxSize: 600000,
32
25
  minChunks: 1,
33
- maxAsyncRequests: 5,
34
- maxInitialRequests: 3,
35
26
  automaticNameDelimiter: '_',
36
27
  cacheGroups: {
37
28
  baseCommon: {
38
- test: new RegExp(`[\\\/]node_modules[\\\/](${['react', 'react-router', 'react-dom', 'react-redux', 'redux', 'react-router-redux', 'lodash'].join('|')})`),
39
- priority: 1
29
+ test: new RegExp(`[\\/]node_modules[\\/](${[
30
+ 'react',
31
+ 'react-router',
32
+ 'react-dom',
33
+ 'react-redux',
34
+ 'redux',
35
+ 'react-router-redux',
36
+ ].join('|')})`),
37
+ priority: 1,
40
38
  },
41
39
  antd: {
42
40
  name: 'antd',
@@ -7,10 +7,11 @@ const getCacheIdentifier_1 = __importDefault(require("react-dev-utils/getCacheId
7
7
  const config_1 = __importDefault(require("../../utils/config"));
8
8
  const THREAD_LOADER = require.resolve('thread-loader');
9
9
  const BABEL_LOADER = require.resolve('babel-loader');
10
+ const WORKER_LOADER = require.resolve('worker-loader');
10
11
  const scriptLoader = [
11
12
  {
12
13
  test: /\.worker.[jt]s$/,
13
- loader: 'worker-loader',
14
+ loader: WORKER_LOADER,
14
15
  options: {
15
16
  inline: 'fallback',
16
17
  },
@@ -18,6 +19,7 @@ const scriptLoader = [
18
19
  {
19
20
  test: /\.(t|j)sx?$/,
20
21
  include: (input) => {
22
+ // internal modules dt-common compatible
21
23
  if (input.includes('node_modules/dt-common/src/')) {
22
24
  return true;
23
25
  }
@@ -3,12 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ const fs_1 = require("fs");
6
8
  const mini_css_extract_plugin_1 = require("mini-css-extract-plugin");
7
9
  const autoprefixer_1 = __importDefault(require("autoprefixer"));
8
10
  const CSS_LOADER = require.resolve('css-loader');
9
11
  const LESS_LOADER = require.resolve('less-loader');
10
12
  const SASS_LOADER = require.resolve('sass-loader');
11
13
  const POSTCSS_LOADER = require.resolve('postcss-loader');
14
+ const antdV4Path = path_1.default.join(process.cwd(), 'node_modules/antd-v4');
15
+ const antdV4RealPath = (0, fs_1.realpathSync)(antdV4Path);
12
16
  const styleLoader = {
13
17
  loader: mini_css_extract_plugin_1.loader,
14
18
  };
@@ -49,6 +53,7 @@ const styleLoaders = [
49
53
  },
50
54
  {
51
55
  test: /\.less$/,
56
+ exclude: [antdV4RealPath],
52
57
  use: [
53
58
  styleLoader,
54
59
  cssLoader,
@@ -64,5 +69,29 @@ const styleLoaders = [
64
69
  },
65
70
  ],
66
71
  },
72
+ {
73
+ test: /\.less$/,
74
+ include: [antdV4RealPath],
75
+ use: [
76
+ styleLoader,
77
+ cssLoader,
78
+ postcssLoader,
79
+ {
80
+ loader: LESS_LOADER,
81
+ options: {
82
+ sourceMap: true,
83
+ lessOptions: {
84
+ modifyVars: {
85
+ '@ant-prefix': 'ant-v4',
86
+ '@font-size-base': '12px',
87
+ '@border-color-base': '#ddd',
88
+ '@font-family': "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",
89
+ },
90
+ javascriptEnabled: true,
91
+ },
92
+ },
93
+ },
94
+ ],
95
+ },
67
96
  ];
68
97
  exports.default = styleLoaders;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ko",
3
- "version": "5.3.6",
3
+ "version": "5.3.9",
4
4
  "description": "build & lint library",
5
5
  "keywords": [
6
6
  "ko",
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const config_1 = __importDefault(require("./config"));
7
- console.log(typeof config_1.default.getFileRealPath);
8
- describe('config instance', () => {
9
- it('getFileRealPath should return absolute path', () => {
10
- const absolutePath = '/foo/bar';
11
- expect(config_1.default.getFileRealPath(absolutePath)).toBe(absolutePath);
12
- const relativePath = 'ko.config.js';
13
- expect(config_1.default.getFileRealPath(relativePath)).toBe(process.cwd() + '/' + relativePath);
14
- });
15
- it('userConf should throw', () => {
16
- expect(() => {
17
- config_1.default.userConf;
18
- }).toThrow();
19
- });
20
- it('defaultPaths should ', () => {
21
- const cwd = process.cwd();
22
- expect(config_1.default.defaultPaths).toEqual({
23
- src: cwd + '/src',
24
- dist: cwd + '/dist',
25
- public: cwd + '/public',
26
- html: cwd + '/public/index.html',
27
- tsconfig: cwd + '/tsconfig.json',
28
- });
29
- });
30
- });