@modern-js/module-tools 0.0.0-nightly-20231205170638 → 0.0.0-nightly-20231206170639

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.
Files changed (93) hide show
  1. package/dist/build.d.ts +1 -1
  2. package/dist/builder/build.d.ts +7 -7
  3. package/dist/builder/clear.d.ts +1 -1
  4. package/dist/builder/copy.d.ts +9 -9
  5. package/dist/builder/dts/index.d.ts +1 -1
  6. package/dist/builder/dts/rollup.d.ts +1 -13
  7. package/dist/builder/dts/tsc.d.ts +1 -1
  8. package/dist/builder/dts/tsc.js +2 -6
  9. package/dist/builder/esbuild/adapter.d.ts +1 -1
  10. package/dist/builder/esbuild/hook.d.ts +1 -1
  11. package/dist/builder/esbuild/index.d.ts +28 -28
  12. package/dist/builder/esbuild/resolve.d.ts +9 -9
  13. package/dist/builder/esbuild/sourcemap.d.ts +14 -14
  14. package/dist/builder/esbuild/transform.d.ts +4 -4
  15. package/dist/builder/esbuild/watch.d.ts +1 -1
  16. package/dist/builder/esbuild/write-file.d.ts +1 -1
  17. package/dist/builder/feature/asset.d.ts +5 -5
  18. package/dist/builder/feature/format-cjs.d.ts +3 -3
  19. package/dist/builder/feature/index.d.ts +1 -1
  20. package/dist/builder/feature/json.d.ts +3 -3
  21. package/dist/builder/feature/redirect.d.ts +3 -3
  22. package/dist/builder/feature/style/index.d.ts +3 -3
  23. package/dist/builder/feature/style/lessAliasPlugin.d.ts +7 -7
  24. package/dist/builder/feature/style/lessRender.d.ts +1 -1
  25. package/dist/builder/feature/style/postcssTransformer.d.ts +3 -3
  26. package/dist/builder/feature/style/postcssUrlPlugin.d.ts +3 -3
  27. package/dist/builder/feature/style/sassRender.d.ts +1 -1
  28. package/dist/builder/feature/style/transformStyle.d.ts +7 -7
  29. package/dist/builder/feature/style/utils.d.ts +3 -3
  30. package/dist/builder/feature/swc.d.ts +5 -5
  31. package/dist/builder/feature/terser.d.ts +3 -3
  32. package/dist/builder/index.d.ts +4 -4
  33. package/dist/builder/platform.d.ts +1 -1
  34. package/dist/cli.d.ts +1 -1
  35. package/dist/command.d.ts +1 -1
  36. package/dist/config/defineConfig.d.ts +1 -1
  37. package/dist/config/merge.d.ts +4 -4
  38. package/dist/config/normalize.d.ts +3 -3
  39. package/dist/config/transformLegacyConfig.d.ts +1 -1
  40. package/dist/config/valid.d.ts +1 -1
  41. package/dist/constants/build.d.ts +1 -1
  42. package/dist/constants/color.d.ts +1 -1
  43. package/dist/constants/dts.d.ts +1 -1
  44. package/dist/constants/file.d.ts +1 -1
  45. package/dist/constants/legacy-preset.d.ts +11 -11
  46. package/dist/constants/loader.d.ts +1 -1
  47. package/dist/constants/log.d.ts +1 -1
  48. package/dist/constants/preset.d.ts +5 -5
  49. package/dist/debug.d.ts +1 -1
  50. package/dist/dev.d.ts +1 -1
  51. package/dist/error.d.ts +19 -19
  52. package/dist/hooks/build.d.ts +16 -16
  53. package/dist/hooks/dev.d.ts +11 -11
  54. package/dist/hooks/index.d.ts +29 -29
  55. package/dist/hooks/misc.d.ts +11 -11
  56. package/dist/index.d.ts +1 -1
  57. package/dist/locale/en.d.ts +40 -40
  58. package/dist/locale/index.d.ts +79 -79
  59. package/dist/locale/zh.d.ts +40 -40
  60. package/dist/plugins.d.ts +1 -1
  61. package/dist/types/color.d.ts +1 -1
  62. package/dist/types/command.d.ts +9 -9
  63. package/dist/types/config/copy.d.ts +10 -10
  64. package/dist/types/config/dev.d.ts +4 -4
  65. package/dist/types/config/index.d.ts +106 -106
  66. package/dist/types/config/style.d.ts +37 -37
  67. package/dist/types/context.d.ts +4 -4
  68. package/dist/types/dts.d.ts +39 -39
  69. package/dist/types/esbuild.d.ts +77 -77
  70. package/dist/types/hooks.d.ts +14 -14
  71. package/dist/types/index.d.ts +7 -7
  72. package/dist/types/legacyConfig/index.d.ts +8 -8
  73. package/dist/types/legacyConfig/output.d.ts +44 -44
  74. package/dist/types/legacyConfig/source.d.ts +10 -10
  75. package/dist/types/legacyConfig/tools.d.ts +39 -39
  76. package/dist/utils/assert.d.ts +1 -1
  77. package/dist/utils/builder.d.ts +9 -9
  78. package/dist/utils/common.d.ts +1 -1
  79. package/dist/utils/dts.d.ts +4 -18
  80. package/dist/utils/dts.js +69 -44
  81. package/dist/utils/hash.d.ts +1 -1
  82. package/dist/utils/index.d.ts +1 -2
  83. package/dist/utils/index.js +0 -2
  84. package/dist/utils/input.d.ts +5 -8
  85. package/dist/utils/log.d.ts +1 -1
  86. package/dist/utils/map.d.ts +5 -5
  87. package/dist/utils/onExit.d.ts +1 -1
  88. package/dist/utils/outExtension.d.ts +6 -6
  89. package/dist/utils/print.d.ts +3 -3
  90. package/dist/utils/style.d.ts +7 -7
  91. package/package.json +14 -20
  92. package/dist/utils/tspath.d.ts +0 -15
  93. package/dist/utils/tspath.js +0 -114
@@ -1,8 +1,8 @@
1
1
  import type { RollupOutput } from '../../compiled/rollup/types/rollup';
2
2
  import { Chunk } from '../types';
3
3
  type Files = {
4
- name: string;
5
- size: number;
4
+ name: string;
5
+ size: number;
6
6
  };
7
7
  export declare const bundleFiles: Files[];
8
8
  export declare const bundlelessFiles: Files[];
@@ -11,4 +11,4 @@ export declare const addRollupChunk: (rollupOutput: RollupOutput, appDirectory:
11
11
  export declare const addDtsFiles: (distDir: string, appDirectory: string) => Promise<void>;
12
12
  export declare const printFileSize: () => void;
13
13
  export declare const printSucceed: (totalDuration: number) => void;
14
- export {};
14
+ export {};
@@ -2,12 +2,12 @@ import type { PartialBaseBuildConfig, PostcssOptions, LessOptions, SassOptions }
2
2
  export declare const getLessConfig: (config: PartialBaseBuildConfig) => Promise<LessOptions>;
3
3
  export declare const getSassConfig: (config: PartialBaseBuildConfig) => Promise<SassOptions>;
4
4
  export declare const getPostcssConfig: (config: PartialBaseBuildConfig) => Promise<PostcssOptions & {
5
- $$tools?: string | undefined;
5
+ $$tools?: string | undefined;
6
6
  }>;
7
7
  export declare const getStyleConfig: (config: PartialBaseBuildConfig) => Promise<{
8
- less: LessOptions;
9
- sass: SassOptions;
10
- postcss: PostcssOptions & {
11
- $$tools?: string | undefined;
12
- };
13
- }>;
8
+ less: LessOptions;
9
+ sass: SassOptions;
10
+ postcss: PostcssOptions & {
11
+ $$tools?: string | undefined;
12
+ };
13
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/module-tools",
3
- "version": "0.0.0-nightly-20231205170638",
3
+ "version": "0.0.0-nightly-20231206170639",
4
4
  "description": "Simple, powerful, high-performance modern npm package development solution.",
5
5
  "keywords": [
6
6
  "modern",
@@ -48,10 +48,6 @@
48
48
  "dependencies": {
49
49
  "@ampproject/remapping": "1.0.2",
50
50
  "@ast-grep/napi": "0.12.0",
51
- "@babel/generator": "^7.22.15",
52
- "@babel/parser": "^7.22.15",
53
- "@babel/traverse": "^7.23.2",
54
- "@babel/types": "^7.22.15",
55
51
  "@modern-js/swc-plugins": "0.6.5",
56
52
  "@rollup/pluginutils": "4.1.1",
57
53
  "@svgr/core": "8.0.0",
@@ -71,26 +67,24 @@
71
67
  "tapable": "2.2.1",
72
68
  "terser": "5.19.2",
73
69
  "tsconfig-paths-webpack-plugin": "4.1.0",
74
- "@modern-js/core": "0.0.0-nightly-20231205170638",
75
- "@modern-js/plugin": "0.0.0-nightly-20231205170638",
76
- "@modern-js/new-action": "0.0.0-nightly-20231205170638",
77
- "@modern-js/plugin-changeset": "0.0.0-nightly-20231205170638",
78
- "@modern-js/plugin-i18n": "0.0.0-nightly-20231205170638",
79
- "@modern-js/types": "0.0.0-nightly-20231205170638",
80
- "@modern-js/plugin-lint": "0.0.0-nightly-20231205170638",
81
- "@modern-js/upgrade": "0.0.0-nightly-20231205170638",
82
- "@modern-js/utils": "0.0.0-nightly-20231205170638"
70
+ "@modern-js/core": "0.0.0-nightly-20231206170639",
71
+ "@modern-js/new-action": "0.0.0-nightly-20231206170639",
72
+ "@modern-js/plugin": "0.0.0-nightly-20231206170639",
73
+ "@modern-js/plugin-changeset": "0.0.0-nightly-20231206170639",
74
+ "@modern-js/plugin-lint": "0.0.0-nightly-20231206170639",
75
+ "@modern-js/types": "0.0.0-nightly-20231206170639",
76
+ "@modern-js/utils": "0.0.0-nightly-20231206170639",
77
+ "@modern-js/upgrade": "0.0.0-nightly-20231206170639",
78
+ "@modern-js/plugin-i18n": "0.0.0-nightly-20231206170639"
83
79
  },
84
80
  "devDependencies": {
85
- "@types/babel__generator": "7.6.4",
86
- "@types/babel__traverse": "7.18.5",
87
81
  "@types/convert-source-map": "1.5.2",
88
82
  "@types/node": "^14",
89
83
  "typescript": "^5",
90
- "@modern-js/builder-webpack-provider": "0.0.0-nightly-20231205170638",
91
- "@modern-js/self": "npm:@modern-js/module-tools@0.0.0-nightly-20231205170638",
92
- "@scripts/build": "0.0.0-nightly-20231205170638",
93
- "@scripts/vitest-config": "0.0.0-nightly-20231205170638"
84
+ "@modern-js/builder-webpack-provider": "0.0.0-nightly-20231206170639",
85
+ "@modern-js/self": "npm:@modern-js/module-tools@0.0.0-nightly-20231206170639",
86
+ "@scripts/build": "0.0.0-nightly-20231206170639",
87
+ "@scripts/vitest-config": "0.0.0-nightly-20231206170639"
94
88
  },
95
89
  "peerDependencies": {
96
90
  "typescript": "^4 || ^5"
@@ -1,15 +0,0 @@
1
- export interface TransformOption {
2
- filename: string;
3
- baseUrl: string;
4
- paths: Record<string, string[] | string>;
5
- }
6
- interface TransformDtsAliasOption {
7
- filenames?: string[];
8
- baseUrl: string;
9
- paths: Record<string, string[] | string>;
10
- }
11
- export declare const transformDtsAlias: (option: TransformDtsAliasOption) => {
12
- path: string;
13
- content: string;
14
- }[];
15
- export {};
@@ -1,114 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var tspath_exports = {};
30
- __export(tspath_exports, {
31
- transformDtsAlias: () => transformDtsAlias
32
- });
33
- module.exports = __toCommonJS(tspath_exports);
34
- var path = __toESM(require("path"));
35
- var import_tsconfig_paths = require("@modern-js/utils/tsconfig-paths");
36
- var import_utils = require("@modern-js/utils");
37
- var parser = __toESM(require("@babel/parser"));
38
- var import_generator = __toESM(require("@babel/generator"));
39
- var t = __toESM(require("@babel/types"));
40
- var import_traverse = __toESM(require("@babel/traverse"));
41
- var import_file = require("../constants/file");
42
- function mapPathString(nodePath, { filename, baseUrl, paths }) {
43
- if (!t.isStringLiteral(nodePath)) {
44
- return;
45
- }
46
- const sourcePath = nodePath.node.value;
47
- const currentFile = filename;
48
- const matchPath = (0, import_tsconfig_paths.createMatchPath)(baseUrl, paths, [
49
- "index"
50
- ]);
51
- const result = matchPath(sourcePath, (packageJsonPath) => {
52
- if (!import_utils.fs.existsSync(packageJsonPath)) {
53
- return void 0;
54
- }
55
- return import_utils.fs.readJSONSync(packageJsonPath);
56
- }, (filePath) => import_utils.fs.existsSync(filePath), import_file.dtsAliasExts);
57
- if (result) {
58
- const relativePath = path.relative(path.dirname(currentFile), path.dirname(result));
59
- const fileName = path.basename(result);
60
- const filePath = path.normalize(`${relativePath.length === 0 ? "." : relativePath}/${fileName}`);
61
- const replaceString = filePath.startsWith(".") ? filePath : `./${filePath}`;
62
- nodePath.replaceWith(t.stringLiteral(replaceString));
63
- }
64
- }
65
- const transformImport = (option) => (nodePath) => {
66
- mapPathString(nodePath.get("source"), option);
67
- };
68
- const transformExport = (option) => (nodePath) => {
69
- mapPathString(nodePath.get("source"), option);
70
- };
71
- const transformSingleFileAlias = ({ filename, baseUrl, paths }) => {
72
- const sourceCode = import_utils.fs.readFileSync(filename, "utf-8");
73
- const ast = parser.parse(sourceCode, {
74
- sourceType: "module",
75
- errorRecovery: true,
76
- plugins: [
77
- "typescript"
78
- ]
79
- });
80
- (0, import_traverse.default)(ast, {
81
- // d.ts file content not have callExpression which can be parsed;
82
- // CallExpression: transformCall({ filename, baseUrl, paths }) as any,
83
- ImportDeclaration: transformImport({
84
- filename,
85
- baseUrl,
86
- paths
87
- }),
88
- ExportDeclaration: transformExport({
89
- filename,
90
- baseUrl,
91
- paths
92
- })
93
- });
94
- return (0, import_generator.default)(ast).code;
95
- };
96
- const transformDtsAlias = (option) => {
97
- const { filenames = [], baseUrl, paths } = option;
98
- const transformResult = [];
99
- for (const filename of filenames) {
100
- transformResult.push({
101
- path: filename,
102
- content: transformSingleFileAlias({
103
- filename,
104
- baseUrl,
105
- paths
106
- })
107
- });
108
- }
109
- return transformResult;
110
- };
111
- // Annotate the CommonJS export names for ESM import in node:
112
- 0 && (module.exports = {
113
- transformDtsAlias
114
- });