prebundle 1.1.0-beta.4 → 1.1.0-beta.5

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Prebundle 3rd party dependencies, output a single js file, a package.json file and the dts files.
4
4
 
5
- Based on [ncc](https://github.com/vercel/ncc) and `dts-packer`.
5
+ Based on [ncc](https://github.com/vercel/ncc) and [rollup-plugin-dts](https://www.npmjs.com/package/rollup-plugin-dts).
6
6
 
7
7
  <p>
8
8
  <a href="https://npmjs.com/package/prebundle">
package/dist/helper.js CHANGED
@@ -2,6 +2,7 @@ import { dirname, join } from 'node:path';
2
2
  import fs from '../compiled/fs-extra/index.js';
3
3
  import { cwd, DIST_DIR } from './constant.js';
4
4
  import { createRequire } from 'node:module';
5
+ import { pathToFileURL } from 'node:url';
5
6
  const require = createRequire(import.meta.url);
6
7
  export function findDepPath(name) {
7
8
  try {
@@ -20,7 +21,7 @@ export function findDepPath(name) {
20
21
  }
21
22
  export const resolveConfig = async () => {
22
23
  const configPath = join(cwd, 'prebundle.config.mjs');
23
- const config = await import(configPath);
24
+ const config = await import(pathToFileURL(configPath).href);
24
25
  return config.default;
25
26
  };
26
27
  export function parseTasks(dependencies) {
package/dist/prebundle.js CHANGED
@@ -1,4 +1,4 @@
1
- import { join } from 'node:path';
1
+ import { dirname, join } from 'node:path';
2
2
  import ncc from '@vercel/ncc';
3
3
  import fastGlob from '../compiled/fast-glob/index.js';
4
4
  import fs from '../compiled/fs-extra/index.js';
@@ -34,16 +34,13 @@ async function emitDts(task, externals) {
34
34
  if (types) {
35
35
  return join(task.depPath, types);
36
36
  }
37
- const depTypesPath = findDepPath(`@types/${task.depName}`);
37
+ const depTypesPath = findDepPath(`@types/${task.depName}/package.json`);
38
38
  if (!depTypesPath) {
39
39
  return null;
40
40
  }
41
- const depTypesPkgPath = join(depTypesPath, 'package.json');
42
- if (fs.existsSync(depTypesPkgPath)) {
43
- const depTypesPkg = fs.readJsonSync(depTypesPkgPath, 'utf-8');
44
- return getTypes(depTypesPkg);
45
- }
46
- return null;
41
+ const depTypesPkg = fs.readJsonSync(depTypesPath, 'utf-8');
42
+ const depTypes = getTypes(depTypesPkg);
43
+ return depTypes ? join(dirname(depTypesPath), depTypes) : null;
47
44
  };
48
45
  const input = getInput();
49
46
  if (!input) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prebundle",
3
- "version": "1.1.0-beta.4",
3
+ "version": "1.1.0-beta.5",
4
4
  "main": "./dist/index.js",
5
5
  "type": "module",
6
6
  "repository": {