@modern-js/module-tools 1.6.1 → 1.7.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,64 @@
1
1
  # @modern-js/module-tools
2
2
 
3
+ ## 1.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 33cebd2: chore(plugin-i18n): merge `@modern-js/i18n-cli-language-detector` to `@modern-js/plugin-i18n`
8
+
9
+ chore(plugin-i18n): 合并 `@modern-js/i18n-cli-language-detector` 包到 `@modern-js/plugin-i18n` 包作为子路径
10
+
11
+ ### Patch Changes
12
+
13
+ - 307ce36: fix: ignore cjs and mjs in d.ts bundle
14
+
15
+ fix: 对 d.ts 做 bundle 时忽略 cjs 和 mjs 资源
16
+
17
+ - f6681f2: feat: remove @modern-js/plugin-analyze plugin
18
+ feat: 移除 @modern-js/plugin-analyze 插件
19
+ - Updated dependencies [33cebd2]
20
+ - Updated dependencies [33cebd2]
21
+ - Updated dependencies [33cebd2]
22
+ - Updated dependencies [2e8ea92]
23
+ - Updated dependencies [74e74ee]
24
+ - Updated dependencies [33cebd2]
25
+ - @modern-js/core@1.13.0
26
+ - @modern-js/plugin-changeset@1.4.0
27
+ - @modern-js/plugin-i18n@1.3.0
28
+ - @modern-js/new-action@1.3.12
29
+ - @modern-js/babel-preset-module@1.4.0
30
+ - @modern-js/css-config@1.2.8
31
+ - @modern-js/plugin-jarvis@1.2.14
32
+ - @modern-js/utils@1.7.12
33
+
34
+ ## 1.6.3
35
+
36
+ ### Patch Changes
37
+
38
+ - eeb9273: Add `additionalProperties: false` to the schema of 'output.buildConfig'
39
+
40
+ 为 'output.buildConfig' 的 schema 增加 `additionalProperties: false` 配置
41
+
42
+ - Updated dependencies [dc4676b]
43
+ - Updated dependencies [5b7a5a7]
44
+ - Updated dependencies [4a7f2a2]
45
+ - @modern-js/utils@1.7.12
46
+ - @modern-js/plugin@1.4.2
47
+ - @modern-js/css-config@1.2.8
48
+ - @modern-js/core@1.12.4
49
+ - @modern-js/plugin-analyze@1.4.7
50
+
51
+ ## 1.6.2
52
+
53
+ ### Patch Changes
54
+
55
+ - ff3ba0220: fix(babel-preset-module): babel transform import path of the style file or the static file
56
+
57
+ fix(babel-preset-module): 修复 Babel 在转换导入样式文件或者静态文件的路径出现的问题
58
+
59
+ - Updated dependencies [ff3ba0220]
60
+ - @modern-js/babel-preset-module@1.3.11
61
+
3
62
  ## 1.6.1
4
63
 
5
64
  ### Patch Changes
@@ -48,7 +48,7 @@ const getRollupConfig = async (api, options) => {
48
48
  name: 'ignore-files',
49
49
 
50
50
  load(id) {
51
- if (!/\.(js|cjs|mjs|jsx|ts|tsx|mts|json)$/.test(id)) {
51
+ if (!/\.(js|jsx|ts|tsx|json)$/.test(id)) {
52
52
  return '';
53
53
  }
54
54
 
@@ -132,7 +132,8 @@ export const runSpeedy = async (api, config) => {
132
132
  };
133
133
 
134
134
  const plugins = target === 'es5' ? [es5InputPlugin()] : [];
135
- plugins.push(watchPlugin());
135
+ plugins.push(watchPlugin()); // TODO: add speedy plugin about react
136
+
136
137
  const internalSpeedyConfig = {
137
138
  command: 'build',
138
139
  mode: 'production',
@@ -144,6 +144,7 @@ export const getFinalTsconfig = (config, buildFeatOption) => {
144
144
  // Since tsconfig configuration has default values,
145
145
  // compare the two to see if the user is configured with cli tsconfig
146
146
  if (buildFeatOption.tsconfigName !== cliTsConfigDefaultValue) {
147
+ // TODO: transform tsconfig to absPath
147
148
  return buildFeatOption.tsconfigName;
148
149
  }
149
150
 
@@ -1,6 +1,5 @@
1
1
  import { Import } from '@modern-js/utils';
2
2
  import ChangesetPlugin from '@modern-js/plugin-changeset';
3
- import AnalyzePlugin from '@modern-js/plugin-analyze';
4
3
  import LintPlugin from '@modern-js/plugin-jarvis';
5
4
  import { hooks } from "./hooks";
6
5
  export * from "./types";
@@ -14,7 +13,7 @@ export default (() => ({
14
13
  name: '@modern-js/module-tools',
15
14
  post: ['@modern-js/plugin-analyze', '@modern-js/plugin-changeset'],
16
15
  registerHook: hooks,
17
- usePlugins: [ChangesetPlugin(), ...(isBuildMode ? [] : [AnalyzePlugin()]), LintPlugin()],
16
+ usePlugins: isBuildMode ? [] : [ChangesetPlugin(), LintPlugin()],
18
17
  setup: api => {
19
18
  const locale = lang.getLocaleLanguage();
20
19
  local.i18n.changeLanguage({
@@ -95,12 +95,14 @@ export const buildSchema = [{
95
95
  then: {
96
96
  items: [{
97
97
  type: 'object',
98
- properties
98
+ properties,
99
+ additionalProperties: false
99
100
  }]
100
101
  },
101
102
  else: {
102
103
  type: 'object',
103
- properties
104
+ properties,
105
+ additionalProperties: false
104
106
  }
105
107
  }
106
108
  }, {
@@ -4,6 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
+ import path from 'path';
7
8
  import { getBabelConfig, applyUserBabelConfig } from '@modern-js/babel-preset-module';
8
9
  import { applyOptionsChain, getAlias, isUseSSRBundle } from '@modern-js/utils';
9
10
  export const getFinalAlias = (modernConfig, option) => {
@@ -60,6 +61,7 @@ export const resolveBabelConfig = (appDirectory, modernConfig, sourceMap, bundle
60
61
  lodashOptions,
61
62
  jsxTransformRuntime,
62
63
  importStyle,
64
+ sourceDir: path.join(appDirectory, bundlelessOptions.sourceDir),
63
65
  styleDir: bundlelessOptions.style.path,
64
66
  staticDir: bundlelessOptions.static.path,
65
67
  styledComponentsOptions: applyOptionsChain({
@@ -1,5 +1,5 @@
1
1
  import { Import } from '@modern-js/utils';
2
- const i18n = Import.lazy('@modern-js/i18n-cli-language-detector', require);
2
+ const i18n = Import.lazy('@modern-js/plugin-i18n/language-detector', require);
3
3
  export function getLocaleLanguage() {
4
4
  const detector = new i18n.I18CLILanguageDetector();
5
5
  return detector.detect();
@@ -71,7 +71,7 @@ const getRollupConfig = async (api, options) => {
71
71
  name: 'ignore-files',
72
72
 
73
73
  load(id) {
74
- if (!/\.(js|cjs|mjs|jsx|ts|tsx|mts|json)$/.test(id)) {
74
+ if (!/\.(js|jsx|ts|tsx|json)$/.test(id)) {
75
75
  return '';
76
76
  }
77
77
 
@@ -154,7 +154,8 @@ const runSpeedy = async (api, config) => {
154
154
  };
155
155
 
156
156
  const plugins = target === 'es5' ? [(0, _speedyPluginEs.es5InputPlugin)()] : [];
157
- plugins.push(watchPlugin());
157
+ plugins.push(watchPlugin()); // TODO: add speedy plugin about react
158
+
158
159
  const internalSpeedyConfig = {
159
160
  command: 'build',
160
161
  mode: 'production',
@@ -158,6 +158,7 @@ const getFinalTsconfig = (config, buildFeatOption) => {
158
158
  // Since tsconfig configuration has default values,
159
159
  // compare the two to see if the user is configured with cli tsconfig
160
160
  if (buildFeatOption.tsconfigName !== _constants.cliTsConfigDefaultValue) {
161
+ // TODO: transform tsconfig to absPath
161
162
  return buildFeatOption.tsconfigName;
162
163
  }
163
164
 
@@ -18,8 +18,6 @@ var _utils = require("@modern-js/utils");
18
18
 
19
19
  var _pluginChangeset = _interopRequireDefault(require("@modern-js/plugin-changeset"));
20
20
 
21
- var _pluginAnalyze = _interopRequireDefault(require("@modern-js/plugin-analyze"));
22
-
23
21
  var _pluginJarvis = _interopRequireDefault(require("@modern-js/plugin-jarvis"));
24
22
 
25
23
  var _hooks = require("./hooks");
@@ -56,7 +54,7 @@ var _default = () => ({
56
54
  name: '@modern-js/module-tools',
57
55
  post: ['@modern-js/plugin-analyze', '@modern-js/plugin-changeset'],
58
56
  registerHook: _hooks.hooks,
59
- usePlugins: [(0, _pluginChangeset.default)(), ...(isBuildMode ? [] : [(0, _pluginAnalyze.default)()]), (0, _pluginJarvis.default)()],
57
+ usePlugins: isBuildMode ? [] : [(0, _pluginChangeset.default)(), (0, _pluginJarvis.default)()],
60
58
  setup: api => {
61
59
  const locale = lang.getLocaleLanguage();
62
60
  local.i18n.changeLanguage({
@@ -103,12 +103,14 @@ const buildSchema = [{
103
103
  then: {
104
104
  items: [{
105
105
  type: 'object',
106
- properties
106
+ properties,
107
+ additionalProperties: false
107
108
  }]
108
109
  },
109
110
  else: {
110
111
  type: 'object',
111
- properties
112
+ properties,
113
+ additionalProperties: false
112
114
  }
113
115
  }
114
116
  }, {
@@ -5,10 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.resolveBabelConfig = exports.getFinalAlias = void 0;
7
7
 
8
+ var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _babelPresetModule = require("@modern-js/babel-preset-module");
9
11
 
10
12
  var _utils = require("@modern-js/utils");
11
13
 
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
12
16
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
17
 
14
18
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -72,6 +76,7 @@ const resolveBabelConfig = (appDirectory, modernConfig, sourceMap, bundlelessOpt
72
76
  lodashOptions,
73
77
  jsxTransformRuntime,
74
78
  importStyle,
79
+ sourceDir: _path.default.join(appDirectory, bundlelessOptions.sourceDir),
75
80
  styleDir: bundlelessOptions.style.path,
76
81
  staticDir: bundlelessOptions.static.path,
77
82
  styledComponentsOptions: (0, _utils.applyOptionsChain)({
@@ -7,7 +7,7 @@ exports.getLocaleLanguage = getLocaleLanguage;
7
7
 
8
8
  var _utils = require("@modern-js/utils");
9
9
 
10
- const i18n = _utils.Import.lazy('@modern-js/i18n-cli-language-detector', require);
10
+ const i18n = _utils.Import.lazy('@modern-js/plugin-i18n/language-detector', require);
11
11
 
12
12
  function getLocaleLanguage() {
13
13
  const detector = new i18n.I18CLILanguageDetector();
@@ -94,6 +94,7 @@ export declare const buildSchema: ({
94
94
  type: string;
95
95
  };
96
96
  };
97
+ additionalProperties: boolean;
97
98
  }[];
98
99
  };
99
100
  else: {
@@ -183,6 +184,7 @@ export declare const buildSchema: ({
183
184
  type: string;
184
185
  };
185
186
  };
187
+ additionalProperties: boolean;
186
188
  };
187
189
  enum?: undefined;
188
190
  };
@@ -97,6 +97,7 @@ export declare const addSchema: () => ({
97
97
  type: string;
98
98
  };
99
99
  };
100
+ additionalProperties: boolean;
100
101
  }[];
101
102
  };
102
103
  else: {
@@ -186,6 +187,7 @@ export declare const addSchema: () => ({
186
187
  type: string;
187
188
  };
188
189
  };
190
+ additionalProperties: boolean;
189
191
  };
190
192
  enum?: undefined;
191
193
  };
@@ -92,6 +92,7 @@ export declare const outputSchema: ({
92
92
  type: string;
93
93
  };
94
94
  };
95
+ additionalProperties: boolean;
95
96
  }[];
96
97
  };
97
98
  else: {
@@ -181,6 +182,7 @@ export declare const outputSchema: ({
181
182
  type: string;
182
183
  };
183
184
  };
185
+ additionalProperties: boolean;
184
186
  };
185
187
  enum?: undefined;
186
188
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.6.1",
14
+ "version": "1.7.0",
15
15
  "bin": {
16
16
  "modern": "./bin/modern.js"
17
17
  },
@@ -55,18 +55,16 @@
55
55
  "@babel/traverse": "^7.18.0",
56
56
  "@babel/types": "^7.18.0",
57
57
  "@modern-js/babel-compiler": "^1.2.6",
58
- "@modern-js/babel-preset-module": "^1.3.10",
59
- "@modern-js/core": "^1.12.4",
60
- "@modern-js/css-config": "^1.2.7",
61
- "@modern-js/i18n-cli-language-detector": "^1.2.4",
62
- "@modern-js/new-action": "^1.3.11",
63
- "@modern-js/plugin": "^1.4.0",
64
- "@modern-js/plugin-analyze": "^1.4.7",
65
- "@modern-js/plugin-changeset": "^1.3.1",
66
- "@modern-js/plugin-i18n": "^1.2.7",
58
+ "@modern-js/babel-preset-module": "^1.4.0",
59
+ "@modern-js/core": "^1.13.0",
60
+ "@modern-js/css-config": "^1.2.8",
61
+ "@modern-js/new-action": "^1.3.12",
62
+ "@modern-js/plugin": "^1.4.2",
63
+ "@modern-js/plugin-changeset": "^1.4.0",
64
+ "@modern-js/plugin-i18n": "^1.3.0",
67
65
  "@modern-js/plugin-jarvis": "^1.2.14",
68
- "@modern-js/style-compiler": "^1.2.12",
69
- "@modern-js/utils": "^1.7.11",
66
+ "@modern-js/style-compiler": "^1.2.13",
67
+ "@modern-js/utils": "^1.7.12",
70
68
  "@rollup/plugin-json": "~4.1.0",
71
69
  "@speedy-js/speedy-types": "0.13.2-alpha.3",
72
70
  "@speedy-js/speedy-core": "0.13.2-alpha.3",