@modern-js/module-tools 1.4.1 → 1.4.2

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,28 @@
1
1
  # @modern-js/module-tools
2
2
 
3
+ ## 1.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 4b5d4bf4: feat: add img resource's inline and url type declaration
8
+ - 969f172f: support tools.styledComponents for module-tools,support close tsc process with disbaleTsChecker
9
+ - 55e18278: chore: remove unused dependencies and devDependencies
10
+ - edc3bd3d: fix: @modern-js/core package not found
11
+ - Updated dependencies [969f172f]
12
+ - Updated dependencies [4c792f68]
13
+ - Updated dependencies [83059b93]
14
+ - Updated dependencies [4b5d4bf4]
15
+ - Updated dependencies [62f5b8c8]
16
+ - Updated dependencies [55e18278]
17
+ - Updated dependencies [4499a674]
18
+ - Updated dependencies [403f5169]
19
+ - Updated dependencies [a7f42f48]
20
+ - Updated dependencies [83059b93]
21
+ - @modern-js/core@1.4.4
22
+ - @modern-js/utils@1.3.3
23
+ - @modern-js/new-action@1.3.3
24
+ - @modern-js/babel-compiler@1.2.2
25
+
3
26
  ## 1.4.1
4
27
 
5
28
  ### Patch Changes
@@ -19,7 +19,7 @@ export const build = async ({
19
19
  const tsconfigPath = path.join(appDirectory, tsconfigName);
20
20
  dotenv.config();
21
21
  const isTsProject = tsConfigutils.existTsConfigFile(tsconfigPath);
22
- const enableTscCompiler = isTsProject && tsc;
22
+ const enableTscCompiler = isTsProject && tsc && !modernConfig.output.disableTsChecker;
23
23
  valid.valideBeforeTask({
24
24
  modernConfig,
25
25
  tsconfigPath
@@ -31,7 +31,8 @@ const runBabelCompiler = async (willCompilerFiles, config, babelConfig = {}) =>
31
31
  enableVirtualDist: true,
32
32
  rootDir: srcRootDir,
33
33
  filenames: willCompilerFiles,
34
- distDir
34
+ distDir,
35
+ ignore: ['*.d.ts']
35
36
  }, babelConfig);
36
37
  };
37
38
 
@@ -66,7 +66,8 @@ const runBabelCompiler = async (config, modernConfig) => {
66
66
  rootDir: config.srcRootDir,
67
67
  distDir: config.distDir,
68
68
  watchDir: config.srcRootDir,
69
- extensions: getExts(isTs)
69
+ extensions: getExts(isTs),
70
+ ignore: ['*.d.ts']
70
71
  }, _objectSpread(_objectSpread({}, babelConfig), {}, {
71
72
  sourceMaps: config.sourceMaps
72
73
  }));
@@ -5,7 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
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
7
  import { getBabelConfig, getModuleBabelChain } from '@modern-js/babel-preset-module';
8
- import { applyOptionsChain, getAlias } from '@modern-js/utils';
8
+ import { applyOptionsChain, getAlias, isUseSSRBundle } from '@modern-js/utils';
9
9
  export const getFinalAlias = (modernConfig, option) => {
10
10
  const aliasConfig = getAlias(modernConfig.source.alias, option); // 排除内部别名,因为不需要处理
11
11
 
@@ -36,7 +36,8 @@ export const resolveBabelConfig = (appDirectory, modernConfig, option) => {
36
36
  importStyle
37
37
  },
38
38
  tools: {
39
- lodash: userLodashOption
39
+ lodash: userLodashOption,
40
+ styledComponents
40
41
  }
41
42
  } = modernConfig; // alias config
42
43
 
@@ -58,7 +59,13 @@ export const resolveBabelConfig = (appDirectory, modernConfig, option) => {
58
59
  globalVars,
59
60
  lodashOptions,
60
61
  jsxTransformRuntime,
61
- importStyle
62
+ importStyle,
63
+ styledComponentsOptions: applyOptionsChain({
64
+ pure: true,
65
+ displayName: true,
66
+ ssr: isUseSSRBundle(modernConfig),
67
+ transpileTemplateLiterals: true
68
+ }, styledComponents)
62
69
  }, {
63
70
  type: option.type,
64
71
  syntax: option.syntax
@@ -37,7 +37,7 @@ const build = async ({
37
37
  const tsconfigPath = path.join(appDirectory, tsconfigName);
38
38
  dotenv.config();
39
39
  const isTsProject = tsConfigutils.existTsConfigFile(tsconfigPath);
40
- const enableTscCompiler = isTsProject && tsc;
40
+ const enableTscCompiler = isTsProject && tsc && !modernConfig.output.disableTsChecker;
41
41
  valid.valideBeforeTask({
42
42
  modernConfig,
43
43
  tsconfigPath
@@ -47,7 +47,8 @@ const runBabelCompiler = async (willCompilerFiles, config, babelConfig = {}) =>
47
47
  enableVirtualDist: true,
48
48
  rootDir: srcRootDir,
49
49
  filenames: willCompilerFiles,
50
- distDir
50
+ distDir,
51
+ ignore: ['*.d.ts']
51
52
  }, babelConfig);
52
53
  };
53
54
 
@@ -78,7 +78,8 @@ const runBabelCompiler = async (config, modernConfig) => {
78
78
  rootDir: config.srcRootDir,
79
79
  distDir: config.distDir,
80
80
  watchDir: config.srcRootDir,
81
- extensions: getExts(isTs)
81
+ extensions: getExts(isTs),
82
+ ignore: ['*.d.ts']
82
83
  }, _objectSpread(_objectSpread({}, babelConfig), {}, {
83
84
  sourceMaps: config.sourceMaps
84
85
  }));
@@ -48,7 +48,8 @@ const resolveBabelConfig = (appDirectory, modernConfig, option) => {
48
48
  importStyle
49
49
  },
50
50
  tools: {
51
- lodash: userLodashOption
51
+ lodash: userLodashOption,
52
+ styledComponents
52
53
  }
53
54
  } = modernConfig; // alias config
54
55
 
@@ -70,7 +71,13 @@ const resolveBabelConfig = (appDirectory, modernConfig, option) => {
70
71
  globalVars,
71
72
  lodashOptions,
72
73
  jsxTransformRuntime,
73
- importStyle
74
+ importStyle,
75
+ styledComponentsOptions: (0, _utils.applyOptionsChain)({
76
+ pure: true,
77
+ displayName: true,
78
+ ssr: (0, _utils.isUseSSRBundle)(modernConfig),
79
+ transpileTemplateLiterals: true
80
+ }, styledComponents)
74
81
  }, {
75
82
  type: option.type,
76
83
  syntax: option.syntax
package/lib/types.d.ts CHANGED
@@ -55,6 +55,98 @@ declare module '*.svg' {
55
55
  export default src;
56
56
  }
57
57
 
58
+ declare module '*.bmp?inline' {
59
+ const src: string;
60
+ export default src;
61
+ }
62
+
63
+ declare module '*.gif?inline' {
64
+ const src: string;
65
+ export default src;
66
+ }
67
+
68
+ declare module '*.jpg?inline' {
69
+ const src: string;
70
+ export default src;
71
+ }
72
+
73
+ declare module '*.jpeg?inline' {
74
+ const src: string;
75
+ export default src;
76
+ }
77
+
78
+ declare module '*.png?inline' {
79
+ const src: string;
80
+ export default src;
81
+ }
82
+
83
+ declare module '*.ico?inline' {
84
+ const src: string;
85
+ export default src;
86
+ }
87
+
88
+ declare module '*.webp?inline' {
89
+ const src: string;
90
+ export default src;
91
+ }
92
+
93
+ declare module '*.svg?inline' {
94
+ import * as React from 'react';
95
+
96
+ export const ReactComponent: React.FunctionComponent<
97
+ React.SVGProps<SVGSVGElement>
98
+ >;
99
+
100
+ const src: string;
101
+ export default src;
102
+ }
103
+
104
+ declare module '*.bmp?url' {
105
+ const src: string;
106
+ export default src;
107
+ }
108
+
109
+ declare module '*.gif?url' {
110
+ const src: string;
111
+ export default src;
112
+ }
113
+
114
+ declare module '*.jpg?url' {
115
+ const src: string;
116
+ export default src;
117
+ }
118
+
119
+ declare module '*.jpeg?url' {
120
+ const src: string;
121
+ export default src;
122
+ }
123
+
124
+ declare module '*.png?url' {
125
+ const src: string;
126
+ export default src;
127
+ }
128
+
129
+ declare module '*.ico?url' {
130
+ const src: string;
131
+ export default src;
132
+ }
133
+
134
+ declare module '*.webp?url' {
135
+ const src: string;
136
+ export default src;
137
+ }
138
+
139
+ declare module '*.svg?url' {
140
+ import * as React from 'react';
141
+
142
+ export const ReactComponent: React.FunctionComponent<
143
+ React.SVGProps<SVGSVGElement>
144
+ >;
145
+
146
+ const src: string;
147
+ export default src;
148
+ }
149
+
58
150
  declare module '*.css' {
59
151
  const classes: { readonly [key: string]: string };
60
152
  export default classes;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.4.1",
14
+ "version": "1.4.2",
15
15
  "bin": {
16
16
  "modern": "./bin/modern.js"
17
17
  },
@@ -46,25 +46,25 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
+ "@modern-js/core": "^1.4.4",
49
50
  "@babel/generator": "^7.15.0",
50
51
  "@babel/parser": "^7.15.2",
51
52
  "@babel/runtime": "^7",
52
53
  "@babel/traverse": "^7.15.0",
53
54
  "@babel/types": "^7.15.0",
54
- "@modern-js/babel-compiler": "^1.2.1",
55
+ "@modern-js/babel-compiler": "^1.2.2",
55
56
  "@modern-js/babel-preset-module": "^1.3.1",
56
57
  "@modern-js/css-config": "^1.2.2",
57
58
  "@modern-js/i18n-cli-language-detector": "^1.2.1",
58
59
  "@modern-js/module-tools-hooks": "^1.2.2",
59
- "@modern-js/new-action": "^1.3.2",
60
+ "@modern-js/new-action": "^1.3.3",
60
61
  "@modern-js/plugin-analyze": "^1.3.3",
61
62
  "@modern-js/plugin-changeset": "^1.2.2",
62
63
  "@modern-js/plugin-fast-refresh": "^1.2.1",
63
64
  "@modern-js/plugin-i18n": "^1.2.1",
64
65
  "@modern-js/style-compiler": "^1.2.2",
65
- "@modern-js/utils": "^1.3.2",
66
+ "@modern-js/utils": "^1.3.3",
66
67
  "chalk": "^4.1.2",
67
- "chokidar": "^3.5.2",
68
68
  "dotenv": "^10.0.0",
69
69
  "execa": "^5.1.1",
70
70
  "fast-glob": "^3.2.5",
@@ -76,14 +76,9 @@
76
76
  "normalize-path": "^3.0.0",
77
77
  "p-map": "^4",
78
78
  "process.argv": "^0.6.0",
79
- "signale": "^1.4.0",
80
79
  "tsconfig-paths": "^3.10.1"
81
80
  },
82
- "peerDependencies": {
83
- "@modern-js/core": "^1.4.3"
84
- },
85
81
  "devDependencies": {
86
- "@modern-js/core": "^1.4.3",
87
82
  "@babel/preset-typescript": "^7.15.0",
88
83
  "@modern-js/babel-chain": "^1.2.1",
89
84
  "@types/babel__core": "^7.1.15",
@@ -95,11 +90,12 @@
95
90
  "@types/lodash.merge": "^4.6.6",
96
91
  "@types/node": "^14",
97
92
  "@types/normalize-path": "^3.0.0",
98
- "@types/signale": "^1.4.2",
99
93
  "commander": "^8.1.0",
100
94
  "typescript": "^4",
101
95
  "@scripts/build": "0.0.0",
102
96
  "jest": "^27",
97
+ "@types/react": "^17",
98
+ "@types/react-dom": "^17",
103
99
  "@scripts/jest-config": "0.0.0"
104
100
  },
105
101
  "sideEffects": false,