@modern-js/module-tools 2.5.0-beta.1 → 2.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,34 @@
1
1
  # @modern-js/module-tools
2
2
 
3
+ ## 2.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0bbc91a: support sideEffects config and change log level to info
8
+ 支持 sideEffects 配置并将日志级别改为 info
9
+
10
+ ### Patch Changes
11
+
12
+ - 59172e9: feat: report size and info after build
13
+ feat: 构建后报告文件大小和信息
14
+ - 138a6b5: chore: update README and description of module-tools packages
15
+
16
+ chore: 更新 module-tools 相关包的 README 和 description
17
+
18
+ - Updated dependencies [89ca6cc]
19
+ - Updated dependencies [30614fa]
20
+ - Updated dependencies [1b0ce87]
21
+ - Updated dependencies [11c053b]
22
+ - Updated dependencies [577084d]
23
+ - @modern-js/plugin-changeset@2.5.0
24
+ - @modern-js/plugin-i18n@2.5.0
25
+ - @modern-js/plugin-lint@2.5.0
26
+ - @modern-js/new-action@2.5.0
27
+ - @modern-js/plugin@2.5.0
28
+ - @modern-js/core@2.5.0
29
+ - @modern-js/utils@2.5.0
30
+ - @modern-js/upgrade@2.5.0
31
+
3
32
  ## 2.4.0
4
33
 
5
34
  ### Patch Changes
package/README.md CHANGED
@@ -2,20 +2,20 @@
2
2
  <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>
3
3
  </p>
4
4
 
5
- <h1 align="center">Modern.js</h1>
5
+ <h1 align="center">Modern.js Module Tools</h1>
6
6
 
7
7
  <p align="center">
8
- A Progressive React Framework for modern web development.
8
+ Simple, powerful, high-performance modern npm package development solution.
9
9
  </p>
10
10
 
11
11
  ## Getting Started
12
12
 
13
- Please follow [Quick Start](https://modernjs.dev/en/guides/get-started/quick-start) to get started with Modern.js.
13
+ Please follow [Quick Start](https://modernjs.dev/module-tools/en/guide/intro/getting-started.html) to get started with Modern.js Module Tools.
14
14
 
15
15
  ## Documentation
16
16
 
17
- - [English Documentation](https://modernjs.dev/en/)
18
- - [中文文档](https://modernjs.dev)
17
+ - [English Documentation](https://modernjs.dev/module-tools/en)
18
+ - [中文文档](https://modernjs.dev/module-tools/)
19
19
 
20
20
  ## Contributing
21
21
 
@@ -104,8 +104,7 @@ const runRollup = (_0, _1) => __async(void 0, [_0, _1], function* (api, { distDi
104
104
  noEmitOnError: true,
105
105
  checkJs: false,
106
106
  target: ts.ScriptTarget.ESNext
107
- }),
108
- tsconfigPath
107
+ })
109
108
  })
110
109
  ].filter(Boolean)
111
110
  };
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAwBV,MAAM,YAAY,CACvB,IACA,OACG,iBAFH,IACA,KACG,WAFH,KACA,EAAE,SAAS,cAAc,WAAW,OAAO,MAAM,GAC9C;AACH,QAAM,cAAsB;AAAA,IAC1B,MAAM;AAAA,IACN,KAAK,IAAI;AACP,UAAI,CAAC,kCAAkC,KAAK,EAAE,GAAG;AAC/C,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACA,QAAM,KAAK,MAAM,6CAAO;AACxB,QAAM,aAAa,GAAG,eAAe,cAAc,GAAG,IAAI,QAAQ;AAClE,QAAM,EAAE,QAAQ,IAAI,GAAG;AAAA,IACrB,WAAW;AAAA,IACX,GAAG;AAAA,IACH;AAAA,EACF;AAEA,QAAM,EAAE,SAAS,WAAW,IAAI,MAAM,6CACpC;AAEF,QAAM,EAAE,SAAS,UAAU,IAAI,MAAM,6CACnC;AAEF,QAAM,UAAU,oBAAK,WAAW,QAAQ,WAAW,GAAG,IAClD,QAAQ,UACR,oBAAK,KAAK,oBAAK,QA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ACT,OAAO;AACL,QAAI;AACF,YAAM,EAAE,OAAO,IAAI,MAAM,6CAAO;AAChC,YAAM,EAAE,eAAe,IAAI,MAAM,6CAAO;AACxC,YAAM,SAAS,MAAM,OAAO,WAAW;AACvC,YAAM,eAAe,MAAM,OAAO,MAAM,YAAY;AACpD,YAAM,EAAE,aAAa,IAAI,IAAI,cAAc;AAC3C,qBAAe,cAAc,cAAc,aAAa,GAAI;AAC5D,aAAO;AAAA,IACT,SAAS,GAAP;AACA,UAAI,aAAa,OAAO;AACtB,cAAM,EAAE,iBAAiB,IAAI,MAAM,6CAAO;AAC1C,cAAM,IAAI,iBAAiB,GAAG;AAAA,UAC5B,WAAW;AAAA,QACb,CAAC;AAAA,MACH;AACA,YAAM;AAAA,IACR;AAAA,EACF;AACF;;;;;","names":["watch"],"sources":["../../../src/builder/dts/rollup.ts"],"sourcesContent":["import path from 'path';\nimport type {\n InputOptions,\n OutputOptions,\n Plugin,\n RollupWatcher,\n} from '../../../compiled/rollup';\nimport type {\n BaseBuildConfig,\n Input,\n PluginAPI,\n ModuleTools,\n} from '../../types';\n\nexport type { RollupWatcher };\n\ntype Config = {\n distDir: string;\n tsconfigPath: string;\n externals: BaseBuildConfig['externals'];\n input: Input;\n watch: boolean;\n};\n\nexport const runRollup = async (\n api: PluginAPI<ModuleTools>,\n { distDir, tsconfigPath, externals, input, watch }: Config,\n) => {\n const ignoreFiles: Plugin = {\n name: 'ignore-files',\n load(id) {\n if (!/\\.(js|jsx|ts|tsx|json|cts|mts)$/.test(id)) {\n return '';\n }\n return null;\n },\n };\n const ts = await import('typescript');\n const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile);\n const { options } = ts.parseJsonConfigFileContent(\n configFile.config,\n ts.sys,\n './',\n );\n\n const { default: jsonPlugin } = await import(\n '../../../compiled/@rollup/plugin-json'\n );\n const { default: dtsPlugin } = await import(\n '../../../compiled/rollup-plugin-dts'\n );\n const baseUrl = path.isAbsolute(options.baseUrl || '.')\n ? options.baseUrl\n : path.join(path.dirname(tsconfigPath), options.baseUrl || '.');\n const inputConfig: InputOptions = {\n input,\n external: externals,\n plugins: [\n jsonPlugin(),\n ignoreFiles,\n dtsPlugin({\n // use external to prevent them which come from node_modules from be bundled.\n respectExternal: true,\n compilerOptions: {\n declarationMap: false,\n skipLibCheck: true,\n // https://github.com/Swatinem/rollup-plugin-dts/issues/143,\n // but it will cause error when bundle ts which import another ts file.\n preserveSymlinks: false,\n ...options,\n // isAbsolute\n baseUrl,\n // Ensure \".d.ts\" modules are generated\n declaration: true,\n // Skip \".js\" generation\n noEmit: false,\n emitDeclarationOnly: true,\n // Skip code generation when error occurs\n noEmitOnError: true,\n // Avoid extra work\n checkJs: false,\n // Ensure we can parse the latest code\n target: ts.ScriptTarget.ESNext,\n },\n tsconfigPath,\n }),\n ].filter(Boolean),\n };\n const outputConfig: OutputOptions = {\n dir: distDir,\n format: 'esm',\n exports: 'named',\n };\n if (watch) {\n const { watch } = await import('../../../compiled/rollup');\n const { watchSectionTitle } = await import('../../utils/log');\n const { SectionTitleStatus, BundleDtsLogPrefix } = await import(\n '../../constants/log'\n );\n const runner = api.useHookRunners();\n const watcher = watch({\n ...inputConfig,\n plugins: inputConfig.plugins,\n output: outputConfig,\n }).on('event', async event => {\n if (event.code === 'START') {\n console.info(\n await watchSectionTitle(BundleDtsLogPrefix, SectionTitleStatus.Log),\n );\n } else if (event.code === 'BUNDLE_END') {\n console.info(\n await watchSectionTitle(\n BundleDtsLogPrefix,\n SectionTitleStatus.Success,\n ),\n );\n runner.buildWatchDts({ buildType: 'bundle' });\n } else if (event.code === 'ERROR') {\n // this is dts rollup plugin bug, error not complete message\n }\n });\n return watcher;\n } else {\n try {\n const { rollup } = await import('../../../compiled/rollup');\n const { addRollupChunk } = await import('../../utils/print');\n const bundle = await rollup(inputConfig);\n const rollupOutput = await bundle.write(outputConfig);\n const { appDirectory } = api.useAppContext();\n addRollupChunk(rollupOutput, appDirectory, outputConfig.dir!);\n return bundle;\n } catch (e) {\n if (e instanceof Error) {\n const { InternalDTSError } = await import('../../error');\n throw new InternalDTSError(e, {\n buildType: 'bundle',\n });\n }\n throw e;\n }\n }\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAwBV,MAAM,YAAY,CACvB,IACA,OACG,iBAFH,IACA,KACG,WAFH,KACA,EAAE,SAAS,cAAc,WAAW,OAAO,MAAM,GAC9C;AACH,QAAM,cAAsB;AAAA,IAC1B,MAAM;AAAA,IACN,KAAK,IAAI;AACP,UAAI,CAAC,kCAAkC,KAAK,EAAE,GAAG;AAC/C,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACA,QAAM,KAAK,MAAM,6CAAO;AACxB,QAAM,aAAa,GAAG,eAAe,cAAc,GAAG,IAAI,QAAQ;AAClE,QAAM,EAAE,QAAQ,IAAI,GAAG;AAAA,IACrB,WAAW;AAAA,IACX,GAAG;AAAA,IACH;AAAA,EACF;AAEA,QAAM,EAAE,SAAS,WAAW,IAAI,MAAM,6CACpC;AAEF,QAAM,EAAE,SAAS,UAAU,IAAI,MAAM,6CACnC;AAEF,QAAM,UAAU,oBAAK,WAAW,QAAQ,WAAW,GAAG,IAClD,QAAQ,UACR,oBAAK,KAAK,oBAAK,QAAQ,YAAY,GAAG,QAAQ,WAAW,GAAG;AAChE,QAAM,cAA4B;AAAA,IAChC;AAAA,IACA,UAAU;AAAA,IACV,SAAS;AAAA,MACP,WAAW;AAAA,MACX;AAAA,MACA,UAAU;AAAA,QAER,iBAAiB;AAAA,QACjB,iBAAiB;AAAA,UACf,gBAAgB;AAAA,UAChB,cAAc;AAAA,UAGd,kBAAkB;AAAA,WACf,UANY;AAAA,UAQf;AAAA,UAEA,aAAa;AAAA,UAEb,QAAQ;AAAA,UACR,qBAAqB;AAAA,UAErB,eAAe;A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AAM,6CAAO;AAC1C,cAAM,IAAI,iBAAiB,GAAG;AAAA,UAC5B,WAAW;AAAA,QACb,CAAC;AAAA,MACH;AACA,YAAM;AAAA,IACR;AAAA,EACF;AACF;;;;;","names":["watch"],"sources":["../../../src/builder/dts/rollup.ts"],"sourcesContent":["import path from 'path';\nimport type {\n InputOptions,\n OutputOptions,\n Plugin,\n RollupWatcher,\n} from '../../../compiled/rollup';\nimport type {\n BaseBuildConfig,\n Input,\n PluginAPI,\n ModuleTools,\n} from '../../types';\n\nexport type { RollupWatcher };\n\ntype Config = {\n distDir: string;\n tsconfigPath: string;\n externals: BaseBuildConfig['externals'];\n input: Input;\n watch: boolean;\n};\n\nexport const runRollup = async (\n api: PluginAPI<ModuleTools>,\n { distDir, tsconfigPath, externals, input, watch }: Config,\n) => {\n const ignoreFiles: Plugin = {\n name: 'ignore-files',\n load(id) {\n if (!/\\.(js|jsx|ts|tsx|json|cts|mts)$/.test(id)) {\n return '';\n }\n return null;\n },\n };\n const ts = await import('typescript');\n const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile);\n const { options } = ts.parseJsonConfigFileContent(\n configFile.config,\n ts.sys,\n './',\n );\n\n const { default: jsonPlugin } = await import(\n '../../../compiled/@rollup/plugin-json'\n );\n const { default: dtsPlugin } = await import(\n '../../../compiled/rollup-plugin-dts'\n );\n const baseUrl = path.isAbsolute(options.baseUrl || '.')\n ? options.baseUrl\n : path.join(path.dirname(tsconfigPath), options.baseUrl || '.');\n const inputConfig: InputOptions = {\n input,\n external: externals,\n plugins: [\n jsonPlugin(),\n ignoreFiles,\n dtsPlugin({\n // use external to prevent them which come from node_modules from be bundled.\n respectExternal: true,\n compilerOptions: {\n declarationMap: false,\n skipLibCheck: true,\n // https://github.com/Swatinem/rollup-plugin-dts/issues/143,\n // but it will cause error when bundle ts which import another ts file.\n preserveSymlinks: false,\n ...options,\n // isAbsolute\n baseUrl,\n // Ensure \".d.ts\" modules are generated\n declaration: true,\n // Skip \".js\" generation\n noEmit: false,\n emitDeclarationOnly: true,\n // Skip code generation when error occurs\n noEmitOnError: true,\n // Avoid extra work\n checkJs: false,\n // Ensure we can parse the latest code\n target: ts.ScriptTarget.ESNext,\n },\n }),\n ].filter(Boolean),\n };\n const outputConfig: OutputOptions = {\n dir: distDir,\n format: 'esm',\n exports: 'named',\n };\n if (watch) {\n const { watch } = await import('../../../compiled/rollup');\n const { watchSectionTitle } = await import('../../utils/log');\n const { SectionTitleStatus, BundleDtsLogPrefix } = await import(\n '../../constants/log'\n );\n const runner = api.useHookRunners();\n const watcher = watch({\n ...inputConfig,\n plugins: inputConfig.plugins,\n output: outputConfig,\n }).on('event', async event => {\n if (event.code === 'START') {\n console.info(\n await watchSectionTitle(BundleDtsLogPrefix, SectionTitleStatus.Log),\n );\n } else if (event.code === 'BUNDLE_END') {\n console.info(\n await watchSectionTitle(\n BundleDtsLogPrefix,\n SectionTitleStatus.Success,\n ),\n );\n runner.buildWatchDts({ buildType: 'bundle' });\n } else if (event.code === 'ERROR') {\n // this is dts rollup plugin bug, error not complete message\n }\n });\n return watcher;\n } else {\n try {\n const { rollup } = await import('../../../compiled/rollup');\n const { addRollupChunk } = await import('../../utils/print');\n const bundle = await rollup(inputConfig);\n const rollupOutput = await bundle.write(outputConfig);\n const { appDirectory } = api.useAppContext();\n addRollupChunk(rollupOutput, appDirectory, outputConfig.dir!);\n return bundle;\n } catch (e) {\n if (e instanceof Error) {\n const { InternalDTSError } = await import('../../error');\n throw new InternalDTSError(e, {\n buildType: 'bundle',\n });\n }\n throw e;\n }\n }\n};\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@modern-js/module-tools",
3
- "description": "A Progressive React Framework for modern web development.",
4
- "homepage": "https://modernjs.dev",
3
+ "description": "Simple, powerful, high-performance modern npm package development solution.",
4
+ "homepage": "https://modernjs.dev/module-tools",
5
5
  "bugs": "https://github.com/modern-js-dev/modern.js/issues",
6
6
  "repository": "modern-js-dev/modern.js",
7
7
  "license": "MIT",
@@ -11,7 +11,7 @@
11
11
  "module-tools",
12
12
  "lib-tools"
13
13
  ],
14
- "version": "2.5.0-beta.1",
14
+ "version": "2.5.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.10.0",
40
40
  "@modern-js/libuild-plugin-svgr": "~0.10.0",
41
41
  "@modern-js/libuild-plugin-swc": "~0.10.0",
42
- "@modern-js/core": "2.4.0",
43
- "@modern-js/new-action": "2.4.0",
44
- "@modern-js/plugin": "2.4.0",
45
- "@modern-js/plugin-i18n": "2.4.0",
46
- "@modern-js/upgrade": "2.4.0",
47
- "@modern-js/plugin-changeset": "2.4.0",
48
- "@modern-js/utils": "2.4.0",
49
- "@modern-js/plugin-lint": "2.4.0"
42
+ "@modern-js/core": "2.5.0",
43
+ "@modern-js/new-action": "2.5.0",
44
+ "@modern-js/plugin": "2.5.0",
45
+ "@modern-js/plugin-i18n": "2.5.0",
46
+ "@modern-js/upgrade": "2.5.0",
47
+ "@modern-js/utils": "2.5.0",
48
+ "@modern-js/plugin-changeset": "2.5.0",
49
+ "@modern-js/plugin-lint": "2.5.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@modern-js/self": "npm:@modern-js/module-tools@*",
53
52
  "@types/jest": "^27",
54
53
  "@types/node": "^14",
55
54
  "@types/fs-extra": "9.0.13",
@@ -60,9 +59,10 @@
60
59
  "postcss-alias": "2.0.0",
61
60
  "react": "17",
62
61
  "typescript": "^4",
63
- "@modern-js/builder-webpack-provider": "2.4.0",
64
- "@scripts/build": "2.4.0",
65
- "@scripts/jest-config": "2.4.0"
62
+ "@modern-js/self": "npm:@modern-js/module-tools@2.5.0",
63
+ "@modern-js/builder-webpack-provider": "2.5.0",
64
+ "@scripts/jest-config": "2.5.0",
65
+ "@scripts/build": "2.5.0"
66
66
  },
67
67
  "publishConfig": {
68
68
  "registry": "https://registry.npmjs.org/",