@modern-js/module-tools 2.38.0-beta.0 → 2.39.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.
@@ -157,8 +157,9 @@ const adapterPlugin = (compiler) => {
157
157
  if (resultPath === false) {
158
158
  (0, import_debug.debugResolve)("resolve false:", args);
159
159
  return {
160
- path: "/empty-stub",
161
- sideEffects: false
160
+ path: `${import_path.sep}empty-stub`,
161
+ sideEffects: false,
162
+ namespace: "resolve-false"
162
163
  };
163
164
  }
164
165
  const sideEffects = await getSideEffects(resultPath, isExternal);
@@ -182,17 +183,17 @@ const adapterPlugin = (compiler) => {
182
183
  contents: `module.exports = (typeof globalThis !== "undefined" ? globalThis : (typeof global !== "undefined" ? global : self || Function('return this')()))[${JSON.stringify(value)}]`
183
184
  };
184
185
  }
186
+ if (args.namespace === "resolve-false") {
187
+ return {
188
+ contents: "module.exports = {}"
189
+ };
190
+ }
185
191
  if (args.suffix) {
186
192
  args.path += args.suffix;
187
193
  }
188
194
  if (args.namespace !== "file") {
189
195
  return;
190
196
  }
191
- if (args.path === "/empty-stub") {
192
- return {
193
- contents: "module.exports = {}"
194
- };
195
- }
196
197
  compiler.addWatchFile(args.path);
197
198
  let result = await compiler.hooks.load.promise(args);
198
199
  if (!result) {
package/dist/utils/dts.js CHANGED
@@ -129,7 +129,15 @@ const writeDtsFiles = async (config, options, result) => {
129
129
  const { tempDistAbsSrcPath } = options;
130
130
  await Promise.all(result.map(({ path, content }) => {
131
131
  const relativePath = (0, import_path.relative)(tempDistAbsSrcPath, path);
132
- const filepath = (0, import_path.join)(distPath, relativePath.replace(/\.d\.ts/, dtsExtension));
132
+ const filepath = (0, import_path.join)(
133
+ distPath,
134
+ // We confirm that users will not mix ts and c(m)ts files in their projects.
135
+ // If a mix is required, please configure separate buildConfig to handle different inputs.
136
+ // So we don't replace .d.(c|m)ts that generated by tsc directly, this can confirm that
137
+ // users can use c(m)ts directly rather than enable autoExtension, in this condition,
138
+ // users need to set esbuild out-extensions like { '.js': '.mjs' }
139
+ relativePath.replace(/\.d\.ts/, dtsExtension)
140
+ );
133
141
  import_utils.fs.ensureFileSync(filepath);
134
142
  return import_utils.fs.writeFile(
135
143
  // only replace .d.ts, if tsc generate .d.m(c)ts, keep.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/module-tools",
3
- "version": "2.38.0-beta.0",
3
+ "version": "2.39.0",
4
4
  "description": "Simple, powerful, high-performance modern npm package development solution.",
5
5
  "keywords": [
6
6
  "modern",
@@ -71,15 +71,15 @@
71
71
  "tapable": "2.2.1",
72
72
  "terser": "5.19.2",
73
73
  "tsconfig-paths-webpack-plugin": "4.1.0",
74
- "@modern-js/plugin-changeset": "2.37.1",
75
- "@modern-js/core": "2.37.1",
76
- "@modern-js/new-action": "2.37.1",
77
- "@modern-js/plugin": "2.37.1",
78
- "@modern-js/plugin-i18n": "2.37.1",
79
- "@modern-js/plugin-lint": "2.37.1",
80
- "@modern-js/upgrade": "2.37.1",
81
- "@modern-js/types": "2.37.1",
82
- "@modern-js/utils": "2.37.1"
74
+ "@modern-js/new-action": "2.39.0",
75
+ "@modern-js/core": "2.39.0",
76
+ "@modern-js/plugin": "2.39.0",
77
+ "@modern-js/plugin-changeset": "2.39.0",
78
+ "@modern-js/plugin-i18n": "2.39.0",
79
+ "@modern-js/plugin-lint": "2.39.0",
80
+ "@modern-js/types": "2.39.0",
81
+ "@modern-js/upgrade": "2.39.0",
82
+ "@modern-js/utils": "2.39.0"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@types/babel__generator": "7.6.4",
@@ -87,10 +87,10 @@
87
87
  "@types/convert-source-map": "1.5.2",
88
88
  "@types/node": "^14",
89
89
  "typescript": "^5",
90
- "@modern-js/builder-webpack-provider": "2.37.1",
91
- "@scripts/build": "2.37.1",
92
- "@modern-js/self": "npm:@modern-js/module-tools@2.38.0-beta.0",
93
- "@scripts/vitest-config": "2.37.1"
90
+ "@modern-js/builder-webpack-provider": "2.39.0",
91
+ "@modern-js/self": "npm:@modern-js/module-tools@2.39.0",
92
+ "@scripts/build": "2.39.0",
93
+ "@scripts/vitest-config": "2.39.0"
94
94
  },
95
95
  "peerDependencies": {
96
96
  "typescript": "^4 || ^5"