@modern-js/plugin-garfish 1.4.13 → 1.5.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @modern-js/plugin-garfish
2
2
 
3
+ ## 1.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f66fa0e98: feat: support tools.webpackChain config
8
+
9
+ ### Patch Changes
10
+
11
+ - 1dfe08fcd: feat(webpack): add CHAIN_ID constants for webpack chain
12
+ - Updated dependencies [33de0f7ec]
13
+ - @modern-js/utils@1.7.5
14
+ - @modern-js/plugin-router@1.2.14
15
+
3
16
  ## 1.4.13
4
17
 
5
18
  ### Patch Changes
@@ -112,10 +112,10 @@ export default (({
112
112
  'Access-Control-Allow-Origin': '*'
113
113
  }
114
114
  },
115
- webpack: (webpackConfig, {
116
- chain,
115
+ webpackChain: (chain, {
117
116
  webpack,
118
- env: _env = process.env.NODE_ENV || 'development'
117
+ env: _env = process.env.NODE_ENV || 'development',
118
+ CHAIN_ID
119
119
  }) => {
120
120
  var _resolveOptions$deplo, _resolveWebpackConfig;
121
121
 
@@ -127,13 +127,13 @@ export default (({
127
127
 
128
128
  chain.output.libraryTarget('umd');
129
129
 
130
- if (resolveOptions !== null && resolveOptions !== void 0 && (_resolveOptions$serve = resolveOptions.server) !== null && _resolveOptions$serve !== void 0 && _resolveOptions$serve.port) {
131
- chain.output.publicPath(_env === 'development' ? `//localhost:${resolveOptions.server.port}/` : webpackConfig.output.publicPath);
130
+ if (resolveOptions !== null && resolveOptions !== void 0 && (_resolveOptions$serve = resolveOptions.server) !== null && _resolveOptions$serve !== void 0 && _resolveOptions$serve.port && _env === 'development') {
131
+ chain.output.publicPath(`//localhost:${resolveOptions.server.port}/`);
132
132
  } // add comments avoid sourcemap abnormal
133
133
 
134
134
 
135
135
  if (webpack.BannerPlugin) {
136
- chain.plugin('banner').use(webpack.BannerPlugin, [{
136
+ chain.plugin(CHAIN_ID.PLUGIN.BANNER).use(webpack.BannerPlugin, [{
137
137
  banner: 'Micro front-end'
138
138
  }]);
139
139
  }
@@ -129,10 +129,10 @@ var _default = ({
129
129
  'Access-Control-Allow-Origin': '*'
130
130
  }
131
131
  },
132
- webpack: (webpackConfig, {
133
- chain,
132
+ webpackChain: (chain, {
134
133
  webpack,
135
- env: _env = process.env.NODE_ENV || 'development'
134
+ env: _env = process.env.NODE_ENV || 'development',
135
+ CHAIN_ID
136
136
  }) => {
137
137
  var _resolveOptions$deplo, _resolveWebpackConfig;
138
138
 
@@ -144,13 +144,13 @@ var _default = ({
144
144
 
145
145
  chain.output.libraryTarget('umd');
146
146
 
147
- if (resolveOptions !== null && resolveOptions !== void 0 && (_resolveOptions$serve = resolveOptions.server) !== null && _resolveOptions$serve !== void 0 && _resolveOptions$serve.port) {
148
- chain.output.publicPath(_env === 'development' ? `//localhost:${resolveOptions.server.port}/` : webpackConfig.output.publicPath);
147
+ if (resolveOptions !== null && resolveOptions !== void 0 && (_resolveOptions$serve = resolveOptions.server) !== null && _resolveOptions$serve !== void 0 && _resolveOptions$serve.port && _env === 'development') {
148
+ chain.output.publicPath(`//localhost:${resolveOptions.server.port}/`);
149
149
  } // add comments avoid sourcemap abnormal
150
150
 
151
151
 
152
152
  if (webpack.BannerPlugin) {
153
- chain.plugin('banner').use(webpack.BannerPlugin, [{
153
+ chain.plugin(CHAIN_ID.PLUGIN.BANNER).use(webpack.BannerPlugin, [{
154
154
  banner: 'Micro front-end'
155
155
  }]);
156
156
  }
@@ -124,13 +124,13 @@ export default (function () {
124
124
  'Access-Control-Allow-Origin': '*'
125
125
  }
126
126
  },
127
- webpack: function webpack(webpackConfig, _ref3) {
127
+ webpackChain: function webpackChain(chain, _ref3) {
128
128
  var _resolveOptions$deplo, _resolveWebpackConfig;
129
129
 
130
- var chain = _ref3.chain,
131
- _webpack = _ref3.webpack,
130
+ var webpack = _ref3.webpack,
132
131
  _ref3$env = _ref3.env,
133
- env = _ref3$env === void 0 ? process.env.NODE_ENV || 'development' : _ref3$env;
132
+ env = _ref3$env === void 0 ? process.env.NODE_ENV || 'development' : _ref3$env,
133
+ CHAIN_ID = _ref3.CHAIN_ID;
134
134
  // eslint-disable-next-line react-hooks/rules-of-hooks
135
135
  var resolveOptions = useResolvedConfigContext();
136
136
 
@@ -139,13 +139,13 @@ export default (function () {
139
139
 
140
140
  chain.output.libraryTarget('umd');
141
141
 
142
- if (resolveOptions !== null && resolveOptions !== void 0 && (_resolveOptions$serve = resolveOptions.server) !== null && _resolveOptions$serve !== void 0 && _resolveOptions$serve.port) {
143
- chain.output.publicPath(env === 'development' ? "//localhost:".concat(resolveOptions.server.port, "/") : webpackConfig.output.publicPath);
142
+ if (resolveOptions !== null && resolveOptions !== void 0 && (_resolveOptions$serve = resolveOptions.server) !== null && _resolveOptions$serve !== void 0 && _resolveOptions$serve.port && env === 'development') {
143
+ chain.output.publicPath("//localhost:".concat(resolveOptions.server.port, "/"));
144
144
  } // add comments avoid sourcemap abnormal
145
145
 
146
146
 
147
- if (_webpack.BannerPlugin) {
148
- chain.plugin('banner').use(_webpack.BannerPlugin, [{
147
+ if (webpack.BannerPlugin) {
148
+ chain.plugin(CHAIN_ID.PLUGIN.BANNER).use(webpack.BannerPlugin, [{
149
149
  banner: 'Micro front-end'
150
150
  }]);
151
151
  }
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  export declare type Options = typeof garfish.options;
4
4
  export declare type ModuleInfo = GarfishInterfaces.AppInfo & {
5
5
  Component?: React.ComponentType | React.ElementType;
6
+ path?: string;
6
7
  originInfo?: Record<string, unknown>;
7
8
  };
8
9
  export declare type ModulesInfo = Array<ModuleInfo>;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.4.13",
14
+ "version": "1.5.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/runtime/index.d.ts",
17
17
  "typesVersions": {
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@babel/runtime": "^7",
53
- "@modern-js/utils": "^1.7.4",
53
+ "@modern-js/utils": "^1.7.5",
54
54
  "@types/debug": "^4.1.7",
55
55
  "@types/react-loadable": "^5.5.6",
56
56
  "debug": "^4.3.2",
@@ -59,7 +59,7 @@
59
59
  "react-loadable": "^5.5.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@modern-js/core": "1.10.3",
62
+ "@modern-js/core": "1.11.0",
63
63
  "@modern-js/plugin-router": "1.2.14",
64
64
  "@modern-js/runtime-core": "1.4.6",
65
65
  "@modern-js/types": "1.5.3",
@@ -91,8 +91,7 @@
91
91
  "modernConfig": {},
92
92
  "publishConfig": {
93
93
  "registry": "https://registry.npmjs.org/",
94
- "access": "public",
95
- "types": "./dist/types/runtime/index.d.ts"
94
+ "access": "public"
96
95
  },
97
96
  "wireit": {
98
97
  "build": {