@modern-js/module-tools 2.10.1-beta.1 → 2.11.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 +35 -0
- package/dist/builder/build.js +7 -4
- package/dist/builder/build.js.map +1 -1
- package/dist/builder/copy.js +5 -4
- package/dist/builder/copy.js.map +1 -1
- package/dist/builder/dts/rollup.d.ts +4 -2
- package/dist/builder/dts/rollup.js +14 -10
- package/dist/builder/dts/rollup.js.map +1 -1
- package/dist/builder/dts/tsc.js +13 -12
- package/dist/builder/dts/tsc.js.map +1 -1
- package/dist/builder/index.js +3 -2
- package/dist/builder/index.js.map +1 -1
- package/dist/builder/platform.js +13 -12
- package/dist/builder/platform.js.map +1 -1
- package/dist/config/schema.d.ts +12 -0
- package/dist/config/schema.js +2 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/constants/build.d.ts +0 -3
- package/dist/constants/build.js +2 -11
- package/dist/constants/build.js.map +1 -1
- package/dist/dev.js +3 -2
- package/dist/dev.js.map +1 -1
- package/dist/locale/en.d.ts +3 -0
- package/dist/locale/en.js +5 -3
- package/dist/locale/en.js.map +1 -1
- package/dist/locale/index.d.ts +6 -0
- package/dist/locale/zh.d.ts +3 -0
- package/dist/locale/zh.js +5 -3
- package/dist/locale/zh.js.map +1 -1
- package/dist/types/config/index.d.ts +1 -0
- package/dist/types/config/index.js.map +1 -1
- package/dist/types/dts.d.ts +1 -0
- package/dist/types/dts.js.map +1 -1
- package/dist/utils/builder.js +2 -1
- package/dist/utils/builder.js.map +1 -1
- package/dist/utils/dts.d.ts +6 -2
- package/dist/utils/dts.js +30 -2
- package/dist/utils/dts.js.map +1 -1
- package/dist/utils/libuildPlugins.js +2 -3
- package/dist/utils/libuildPlugins.js.map +1 -1
- package/dist/utils/log.js +3 -7
- package/dist/utils/log.js.map +1 -1
- package/dist/utils/print.js +7 -9
- package/dist/utils/print.js.map +1 -1
- package/package.json +13 -13
package/dist/utils/print.js
CHANGED
|
@@ -106,9 +106,8 @@ const printFileSize = () => {
|
|
|
106
106
|
printBundleFiles();
|
|
107
107
|
};
|
|
108
108
|
const printSucceed = (totalDuration) => {
|
|
109
|
-
import_utils.
|
|
110
|
-
|
|
111
|
-
);
|
|
109
|
+
const time = import_utils.chalk.cyan(`${totalDuration / 1e3}s`);
|
|
110
|
+
import_utils.logger.info(`${import_log.buildSuccessText} in ${time}`);
|
|
112
111
|
};
|
|
113
112
|
const prettyBytes = (bytes) => {
|
|
114
113
|
if (bytes === 0) {
|
|
@@ -126,10 +125,9 @@ const printBundleFiles = () => {
|
|
|
126
125
|
(max, str) => Math.max(max, str.name.length),
|
|
127
126
|
import_log.reportFile1LineText.length
|
|
128
127
|
);
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
import_utils.logger.info(`Bundle generated ${bundleFiles.length} files
|
|
129
|
+
`);
|
|
131
130
|
const headerRow = import_log.reportFile1LineText + " ".repeat(longestFileLength - 10) + import_log.reportFile2LineText;
|
|
132
|
-
import_utils.logger.info(import_utils.chalk.bold(import_utils.chalk.blue(info)));
|
|
133
131
|
import_utils.logger.log(import_utils.chalk.bold(import_utils.chalk.green(headerRow)));
|
|
134
132
|
bundleFiles.forEach(({ name, size }) => {
|
|
135
133
|
const infoRow = `${name}${" ".repeat(
|
|
@@ -146,10 +144,10 @@ const printBundlelessInfo = () => {
|
|
|
146
144
|
const totalSize = bundlelessFiles.reduce((total, file) => {
|
|
147
145
|
return total + file.size;
|
|
148
146
|
}, 0);
|
|
149
|
-
const info = `Bundleless generated ${count} files, the total size is ${
|
|
150
|
-
totalSize
|
|
147
|
+
const info = `Bundleless generated ${count} files, the total size is ${import_utils.chalk.cyan(
|
|
148
|
+
prettyBytes(totalSize)
|
|
151
149
|
)}`;
|
|
152
|
-
import_utils.logger.info(
|
|
150
|
+
import_utils.logger.info(info);
|
|
153
151
|
};
|
|
154
152
|
// Annotate the CommonJS export names for ESM import in node:
|
|
155
153
|
0 && (module.exports = {
|
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BAAO,IAAI,OAAO;AAAA,EACpB,CAAC;AACH;AAEA,MAAM,sBAAsB,MAAM;AAChC,MAAI,gBAAgB,WAAW,GAAG;AAChC;AAAA,EACF;AAEA,QAAM,QAAQ,gBAAgB;AAC9B,QAAM,YAAY,gBAAgB,OAAO,CAAC,OAAO,SAAS;AACxD,WAAO,QAAQ,KAAK;AAAA,EACtB,GAAG,CAAC;AACJ,QAAM,OAAO,wBAAwB,kCAAkC,mBAAM;AAAA,IAC3E,YAAY,SAAS;AAAA,EACvB;AACA,sBAAO,KAAK,IAAI;AAClB;;;;;;;;;;;","names":[],"sources":["../../src/utils/print.ts"],"sourcesContent":["import { relative, resolve } from 'path';\nimport type { ILibuilder } from '@modern-js/libuild';\nimport { chalk, logger } from '@modern-js/utils';\nimport type {\n RollupOutput,\n OutputChunk,\n} from '../../compiled/rollup/types/rollup';\nimport {\n buildSuccessText,\n reportFile1LineText,\n reportFile2LineText,\n} from '../constants/log';\n\ntype Files = {\n name: string;\n size: number;\n};\n\nexport const bundleFiles: Files[] = [];\n\nexport const bundlelessFiles: Files[] = [];\n\nexport const addOutputChunk = (\n outputChunk: ILibuilder['outputChunk'],\n appDirectory: string,\n isBundle: boolean,\n) => {\n const files = Array.from(outputChunk).map(val => {\n const [path, chunk] = val;\n return {\n name: relative(appDirectory, path),\n size: chunk.contents.length,\n };\n });\n if (isBundle) {\n bundleFiles.push(...files);\n } else {\n bundlelessFiles.push(...files);\n }\n};\n\nexport const addRollupChunk = (\n rollupOutput: RollupOutput,\n appDirectory: string,\n distDir: string,\n) => {\n const { output } = rollupOutput;\n bundleFiles.push(\n ...output.map(o => {\n return {\n name: relative(appDirectory, resolve(distDir, o.fileName)),\n // only d.ts, is outputChunk not outputAsset\n size: (o as OutputChunk).code.length,\n };\n }),\n );\n};\n\nexport const addDtsFiles = async (distDir: string, appDirectory: string) => {\n const { fastGlob, slash } = await import('@modern-js/utils');\n const files = await fastGlob(`${slash(distDir)}**/*.d.ts`, {\n stats: true,\n });\n bundlelessFiles.push(\n ...files.map(file => {\n return {\n name: relative(appDirectory, file.path),\n size: file.stats.size,\n };\n }),\n );\n};\n\nexport const printFileSize = () => {\n printBundlelessInfo();\n printBundleFiles();\n};\n\nexport const printSucceed = (totalDuration: number) => {\n const time = chalk.cyan(`${totalDuration / 1000}s`);\n logger.info(`${buildSuccessText} in ${time}`);\n};\n\nconst prettyBytes = (bytes: number) => {\n if (bytes === 0) {\n return '0 B';\n }\n const unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n const exp = Math.floor(Math.log(bytes) / Math.log(1024));\n return `${(bytes / Math.pow(1024, exp)).toFixed(2)} ${unit[exp]}`;\n};\n\nconst printBundleFiles = () => {\n if (bundleFiles.length === 0) {\n return;\n }\n const longestFileLength = bundleFiles.reduce(\n (max, str) => Math.max(max, str.name.length),\n reportFile1LineText.length,\n );\n\n logger.info(`Bundle generated ${bundleFiles.length} files\\n`);\n\n const headerRow =\n reportFile1LineText +\n ' '.repeat(longestFileLength - 10) +\n reportFile2LineText;\n logger.log(chalk.bold(chalk.green(headerRow)));\n\n bundleFiles.forEach(({ name, size }) => {\n const infoRow = `${name}${' '.repeat(\n longestFileLength - name.length + 2,\n )}${prettyBytes(size)}`;\n logger.log(infoRow);\n });\n};\n\nconst printBundlelessInfo = () => {\n if (bundlelessFiles.length === 0) {\n return;\n }\n\n const count = bundlelessFiles.length;\n const totalSize = bundlelessFiles.reduce((total, file) => {\n return total + file.size;\n }, 0);\n const info = `Bundleless generated ${count} files, the total size is ${chalk.cyan(\n prettyBytes(totalSize),\n )}`;\n logger.info(info);\n};\n"]}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"module-tools",
|
|
12
12
|
"lib-tools"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.11.0",
|
|
15
15
|
"bin": {
|
|
16
16
|
"modern": "./bin/modern.js",
|
|
17
17
|
"modern-module": "./bin/modern.js"
|
|
@@ -39,17 +39,16 @@
|
|
|
39
39
|
"@modern-js/libuild": "~0.11.0",
|
|
40
40
|
"@modern-js/libuild-plugin-svgr": "~0.11.0",
|
|
41
41
|
"@modern-js/libuild-plugin-swc": "~0.11.0",
|
|
42
|
-
"@modern-js/core": "2.
|
|
43
|
-
"@modern-js/new-action": "2.
|
|
44
|
-
"@modern-js/plugin": "2.
|
|
45
|
-
"@modern-js/plugin-changeset": "2.
|
|
46
|
-
"@modern-js/plugin-i18n": "2.
|
|
47
|
-
"@modern-js/plugin-lint": "2.
|
|
48
|
-
"@modern-js/upgrade": "2.
|
|
49
|
-
"@modern-js/utils": "2.
|
|
42
|
+
"@modern-js/core": "2.11.0",
|
|
43
|
+
"@modern-js/new-action": "2.11.0",
|
|
44
|
+
"@modern-js/plugin": "2.11.0",
|
|
45
|
+
"@modern-js/plugin-changeset": "2.11.0",
|
|
46
|
+
"@modern-js/plugin-i18n": "2.11.0",
|
|
47
|
+
"@modern-js/plugin-lint": "2.11.0",
|
|
48
|
+
"@modern-js/upgrade": "2.11.0",
|
|
49
|
+
"@modern-js/utils": "2.11.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@modern-js/self": "npm:@modern-js/module-tools@*",
|
|
53
52
|
"@types/fs-extra": "9.0.13",
|
|
54
53
|
"@types/jest": "^29",
|
|
55
54
|
"@types/node": "^14",
|
|
@@ -61,9 +60,10 @@
|
|
|
61
60
|
"postcss-alias": "2.0.0",
|
|
62
61
|
"react": "17",
|
|
63
62
|
"typescript": "^4",
|
|
64
|
-
"@
|
|
65
|
-
"@modern-js/
|
|
66
|
-
"@scripts/jest-config": "2.
|
|
63
|
+
"@modern-js/builder-webpack-provider": "2.11.0",
|
|
64
|
+
"@modern-js/self": "npm:@modern-js/module-tools@2.11.0",
|
|
65
|
+
"@scripts/jest-config": "2.11.0",
|
|
66
|
+
"@scripts/build": "2.11.0"
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"registry": "https://registry.npmjs.org/",
|