@modern-js/module-tools 1.0.0-rc.2 → 1.0.0-rc.3

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 ADDED
@@ -0,0 +1,21 @@
1
+ # @modern-js/module-tools
2
+
3
+ ## 1.0.0-rc.3
4
+ ### Patch Changes
5
+
6
+ - feat: initial
7
+ - Updated dependencies [undefined]
8
+ - @modern-js/babel-preset-module@1.0.0-rc.3
9
+ - @modern-js/core@1.0.0-rc.3
10
+ - @modern-js/css-config@1.0.0-rc.3
11
+ - @modern-js/i18n-cli-language-detector@1.0.0-rc.3
12
+ - @modern-js/plugin-analyze@1.0.0-rc.3
13
+ - @modern-js/plugin-changeset@1.0.0-rc.3
14
+ - @modern-js/plugin-fast-refresh@1.0.0-rc.3
15
+ - @modern-js/plugin-i18n@1.0.0-rc.3
16
+ - @modern-js/new-action@1.0.0-rc.3
17
+ - @modern-js/babel-compiler@1.0.0-rc.3
18
+ - @modern-js/style-compiler@1.0.0-rc.3
19
+ - @modern-js/module-tools-hooks@1.0.0-rc.3
20
+ - @modern-js/plugin@1.0.0-rc.3
21
+ - @modern-js/utils@1.0.0-rc.3
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  <p align="center">
3
- <a href="https://modernjs.dev" target="blank"><img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs.png" width="300" alt="Modern.js Logo" /></a>
3
+ <a href="https://modernjs.dev" target="blank"><img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png" width="300" alt="Modern.js Logo" /></a>
4
4
  </p>
5
5
 
6
6
  <p align="center">现代 Web 工程体系</p>
@@ -21,9 +21,11 @@ export const copyTask = async option => {
21
21
  const {
22
22
  output: {
23
23
  copy,
24
- path: outputPath = 'dist'
24
+ path: outputPath = 'dist',
25
+ jsPath = 'js'
25
26
  }
26
27
  } = modernConfig;
28
+ const copyDistDir = path.join(outputPath, jsPath);
27
29
 
28
30
  if (!copy) {
29
31
  return;
@@ -70,7 +72,7 @@ export const copyTask = async option => {
70
72
  const relativeFrom = path.relative(context, item); // 如果 to 是目录,通过相对路径计算完整的产物路径;如果 to 是文件,直接作为最终产物路径
71
73
 
72
74
  const fileName = isToDirectory ? path.join(to, relativeFrom) : to;
73
- const finalToPath = path.resolve(outputPath, fileName);
75
+ const finalToPath = path.resolve(copyDistDir, fileName);
74
76
  fs.copySync(item, finalToPath);
75
77
  });
76
78
  }
@@ -3,16 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "dev", {
6
+ Object.defineProperty(exports, "build", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _dev.dev;
9
+ return _build.build;
10
10
  }
11
11
  });
12
- Object.defineProperty(exports, "build", {
12
+ Object.defineProperty(exports, "dev", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _build.build;
15
+ return _dev.dev;
16
16
  }
17
17
  });
18
18
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.clearFlag = exports.runStyleCompilerTitle = exports.runTscTitle = exports.runTscWatchTitle = exports.runBabelCompilerTitle = exports.PACKAGE_MODES = exports.DEFAULT_PACKAGE_MODE = void 0;
6
+ exports.runTscWatchTitle = exports.runTscTitle = exports.runStyleCompilerTitle = exports.runBabelCompilerTitle = exports.clearFlag = exports.PACKAGE_MODES = exports.DEFAULT_PACKAGE_MODE = void 0;
7
7
  // Universal JS 的默认选择,三份构建产物,支持 Node.js,对现代浏览器有优化
8
8
  const universalJs = [{
9
9
  type: 'module',
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.LoggerText = exports.logTemplate = exports.clearFlag = exports.colors = void 0;
6
+ exports.logTemplate = exports.colors = exports.clearFlag = exports.LoggerText = void 0;
7
7
 
8
8
  var _utils = require("@modern-js/utils");
9
9
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TimeCounter = exports.logTemplate = exports.LogStack = exports.getDtsMapper = exports.getCodeMapper = exports.getCodeInitMapper = void 0;
6
+ exports.logTemplate = exports.getDtsMapper = exports.getCodeMapper = exports.getCodeInitMapper = exports.TimeCounter = exports.LogStack = void 0;
7
7
 
8
8
  var path = _interopRequireWildcard(require("path"));
9
9
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.devStorybook = exports.showMenu = void 0;
6
+ exports.showMenu = exports.devStorybook = void 0;
7
7
 
8
8
  var _utils = require("@modern-js/utils");
9
9
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.defineConfig = void 0;
6
+ exports.defineConfig = exports.default = void 0;
7
7
 
8
8
  var _utils = require("@modern-js/utils");
9
9
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.initEnv = exports.buildSourceCode = exports.getWillCompilerCode = exports.Compiler = void 0;
6
+ exports.initEnv = exports.getWillCompilerCode = exports.buildSourceCode = exports.Compiler = void 0;
7
7
 
8
8
  var _utils = require("@modern-js/utils");
9
9
 
@@ -37,9 +37,11 @@ const copyTask = async option => {
37
37
  const {
38
38
  output: {
39
39
  copy,
40
- path: outputPath = 'dist'
40
+ path: outputPath = 'dist',
41
+ jsPath = 'js'
41
42
  }
42
43
  } = modernConfig;
44
+ const copyDistDir = path.join(outputPath, jsPath);
43
45
 
44
46
  if (!copy) {
45
47
  return;
@@ -86,7 +88,7 @@ const copyTask = async option => {
86
88
  const relativeFrom = path.relative(context, item); // 如果 to 是目录,通过相对路径计算完整的产物路径;如果 to 是文件,直接作为最终产物路径
87
89
 
88
90
  const fileName = isToDirectory ? path.join(to, relativeFrom) : to;
89
- const finalToPath = path.resolve(outputPath, fileName);
91
+ const finalToPath = path.resolve(copyDistDir, fileName);
90
92
 
91
93
  _utils.fs.copySync(item, finalToPath);
92
94
  });
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.LoggerManager = exports.LoggerText = exports.logTemplate = exports.clearFlag = void 0;
6
+ exports.logTemplate = exports.clearFlag = exports.LoggerText = exports.LoggerManager = void 0;
7
7
 
8
8
  var _events = _interopRequireDefault(require("events"));
9
9
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.existTsConfigFile = exports.readTsConfig = void 0;
6
+ exports.readTsConfig = exports.existTsConfigFile = void 0;
7
7
 
8
8
  var _utils = require("@modern-js/utils");
9
9
 
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.matchesPattern = matchesPattern;
7
6
  exports.isImportCall = isImportCall;
7
+ exports.matchesPattern = matchesPattern;
8
8
 
9
9
  var _utils = require("@modern-js/utils");
10
10
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.modernConfigValid = exports.valideBeforeTask = void 0;
6
+ exports.valideBeforeTask = exports.modernConfigValid = void 0;
7
7
 
8
8
  var _utils = require("@modern-js/utils");
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/module-tools",
3
- "version": "1.0.0-rc.2",
3
+ "version": "1.0.0-rc.3",
4
4
  "bin": {
5
5
  "modern": "./bin/modern.js"
6
6
  },
@@ -33,20 +33,20 @@
33
33
  "@babel/runtime": "^7",
34
34
  "@babel/traverse": "^7.15.0",
35
35
  "@babel/types": "^7.15.0",
36
- "@modern-js/babel-compiler": "^1.0.0-rc.2",
37
- "@modern-js/babel-preset-module": "^1.0.0-rc.2",
38
- "@modern-js/core": "^1.0.0-rc.2",
39
- "@modern-js/css-config": "^1.0.0-rc.2",
40
- "@modern-js/i18n-cli-language-detector": "^1.0.0-rc.2",
41
- "@modern-js/module-tools-hooks": "^1.0.0-rc.2",
42
- "@modern-js/new-action": "^1.0.0-rc.2",
43
- "@modern-js/plugin": "^1.0.0-rc.2",
44
- "@modern-js/plugin-analyze": "^1.0.0-rc.2",
45
- "@modern-js/plugin-changeset": "^1.0.0-rc.2",
46
- "@modern-js/plugin-fast-refresh": "^1.0.0-rc.2",
47
- "@modern-js/plugin-i18n": "^1.0.0-rc.2",
48
- "@modern-js/style-compiler": "^1.0.0-rc.2",
49
- "@modern-js/utils": "^1.0.0-rc.2",
36
+ "@modern-js/babel-compiler": "^1.0.0-rc.3",
37
+ "@modern-js/babel-preset-module": "^1.0.0-rc.3",
38
+ "@modern-js/core": "^1.0.0-rc.3",
39
+ "@modern-js/css-config": "^1.0.0-rc.3",
40
+ "@modern-js/i18n-cli-language-detector": "^1.0.0-rc.3",
41
+ "@modern-js/module-tools-hooks": "^1.0.0-rc.3",
42
+ "@modern-js/new-action": "^1.0.0-rc.3",
43
+ "@modern-js/plugin": "^1.0.0-rc.3",
44
+ "@modern-js/plugin-analyze": "^1.0.0-rc.3",
45
+ "@modern-js/plugin-changeset": "^1.0.0-rc.3",
46
+ "@modern-js/plugin-fast-refresh": "^1.0.0-rc.3",
47
+ "@modern-js/plugin-i18n": "^1.0.0-rc.3",
48
+ "@modern-js/style-compiler": "^1.0.0-rc.3",
49
+ "@modern-js/utils": "^1.0.0-rc.3",
50
50
  "chalk": "^4.1.2",
51
51
  "chokidar": "^3.5.2",
52
52
  "dotenv": "^10.0.0",
@@ -65,7 +65,7 @@
65
65
  },
66
66
  "devDependencies": {
67
67
  "@babel/preset-typescript": "^7.15.0",
68
- "@modern-js/babel-chain": "^1.0.0-rc.2",
68
+ "@modern-js/babel-chain": "^1.0.0-rc.3",
69
69
  "@types/babel__core": "^7.1.15",
70
70
  "@types/babel__generator": "^7.6.3",
71
71
  "@types/babel__traverse": "^7.14.2",
@@ -78,8 +78,8 @@
78
78
  "@types/signale": "^1.4.2",
79
79
  "commander": "^8.1.0",
80
80
  "typescript": "^4",
81
- "@modern-js/plugin-testing": "^1.0.0-rc.2",
82
- "@modern-js/module-tools": "^1.0.0-rc.2"
81
+ "@modern-js/plugin-testing": "^1.0.0-rc.3",
82
+ "@modern-js/module-tools": "^1.0.0-rc.3"
83
83
  },
84
84
  "sideEffects": false,
85
85
  "modernConfig": {
@@ -87,6 +87,10 @@
87
87
  "packageMode": "node-js"
88
88
  }
89
89
  },
90
+ "publicCnfig": {
91
+ "registry": "https://registry.npmjs.org/",
92
+ "access": "public"
93
+ },
90
94
  "scripts": {
91
95
  "new": "modern new",
92
96
  "build": "modern build",
package/src/utils/copy.ts CHANGED
@@ -17,8 +17,9 @@ export const copyTask = async (option: {
17
17
  const { modernConfig, appContext } = option;
18
18
  const { appDirectory } = appContext;
19
19
  const {
20
- output: { copy, path: outputPath = 'dist' },
20
+ output: { copy, path: outputPath = 'dist', jsPath = 'js' },
21
21
  } = modernConfig;
22
+ const copyDistDir = path.join(outputPath, jsPath);
22
23
 
23
24
  if (!copy) {
24
25
  return;
@@ -60,7 +61,7 @@ export const copyTask = async (option: {
60
61
  const relativeFrom = path.relative(context, item);
61
62
  // 如果 to 是目录,通过相对路径计算完整的产物路径;如果 to 是文件,直接作为最终产物路径
62
63
  const fileName = isToDirectory ? path.join(to, relativeFrom) : to;
63
- const finalToPath = path.resolve(outputPath, fileName);
64
+ const finalToPath = path.resolve(copyDistDir, fileName);
64
65
  fs.copySync(item, finalToPath);
65
66
  });
66
67
  }