prebundle 1.6.3 → 1.6.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/dist/index.js +13 -8
- package/package.json +24 -23
package/dist/index.js
CHANGED
|
@@ -68,7 +68,7 @@ function findDepPath(name) {
|
|
|
68
68
|
while(!dirname(entry).endsWith('node_modules'))entry = dirname(entry);
|
|
69
69
|
if (name.includes('/')) return join(dirname(entry), name);
|
|
70
70
|
return entry;
|
|
71
|
-
} catch
|
|
71
|
+
} catch {
|
|
72
72
|
return null;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -92,19 +92,18 @@ function parseTasks(dependencies, globalPrettier) {
|
|
|
92
92
|
const result = [];
|
|
93
93
|
for (const dep of dependencies){
|
|
94
94
|
const depName = 'string' == typeof dep ? dep : dep.name;
|
|
95
|
-
const dtsOnly = 'string' == typeof dep ? false : dep.dtsOnly ?? false;
|
|
96
95
|
const importPath = join(cwd, DIST_DIR, depName);
|
|
97
96
|
const distPath = join(cwd, DIST_DIR, depName);
|
|
98
|
-
const depPath =
|
|
99
|
-
if (!depPath
|
|
100
|
-
const depEntry =
|
|
97
|
+
const depPath = findDepPath(depName);
|
|
98
|
+
if (!depPath) throw new Error(`Failed to resolve dependency: ${depName}`);
|
|
99
|
+
const depEntry = helper_require.resolve(depName, {
|
|
101
100
|
paths: [
|
|
102
101
|
cwd
|
|
103
102
|
]
|
|
104
103
|
});
|
|
105
104
|
const info = {
|
|
106
105
|
depName,
|
|
107
|
-
depPath
|
|
106
|
+
depPath,
|
|
108
107
|
depEntry,
|
|
109
108
|
distPath,
|
|
110
109
|
importPath
|
|
@@ -158,7 +157,9 @@ function findDirectTypeFile(filepath) {
|
|
|
158
157
|
cwd
|
|
159
158
|
]
|
|
160
159
|
});
|
|
161
|
-
} catch {
|
|
160
|
+
} catch {
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
162
163
|
};
|
|
163
164
|
switch(ext){
|
|
164
165
|
case '.js':
|
|
@@ -203,7 +204,11 @@ async function emitIndex(code, distPath, prettier) {
|
|
|
203
204
|
await fs_extra.outputFile(distIndex, formatted);
|
|
204
205
|
} else await fs_extra.outputFile(distIndex, code);
|
|
205
206
|
}
|
|
206
|
-
const
|
|
207
|
+
const getPackageJsonField = (json, key)=>{
|
|
208
|
+
const value = json[key];
|
|
209
|
+
return 'string' == typeof value ? value : null;
|
|
210
|
+
};
|
|
211
|
+
const getTypes = (json)=>json && (getPackageJsonField(json, 'types') || getPackageJsonField(json, 'typing') || getPackageJsonField(json, 'typings') || getTypes(json.exports?.['.'])) || null;
|
|
207
212
|
async function emitDts(task, externals) {
|
|
208
213
|
const outputDefaultDts = ()=>{
|
|
209
214
|
fs_extra.outputFileSync(join(task.distPath, 'index.d.ts'), 'export = any;\n');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prebundle",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/rstackjs/prebundle"
|
|
@@ -15,38 +15,39 @@
|
|
|
15
15
|
"bin.js",
|
|
16
16
|
"compiled"
|
|
17
17
|
],
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "rslib build",
|
|
20
|
-
"dev": "rslib build --watch",
|
|
21
|
-
"prebundle": "node ./bin.js",
|
|
22
|
-
"prepare": "npm run build",
|
|
23
|
-
"bump": "npx bumpp",
|
|
24
|
-
"test": "rstest"
|
|
25
|
-
},
|
|
26
18
|
"dependencies": {
|
|
27
|
-
"cac": "^
|
|
19
|
+
"cac": "^7.0.0",
|
|
28
20
|
"@vercel/ncc": "0.38.4",
|
|
29
|
-
"prettier": "^3.8.
|
|
30
|
-
"rollup": "^4.
|
|
31
|
-
"rollup-plugin-dts": "^6.
|
|
32
|
-
"terser": "^5.
|
|
21
|
+
"prettier": "^3.8.3",
|
|
22
|
+
"rollup": "^4.60.4",
|
|
23
|
+
"rollup-plugin-dts": "^6.4.1",
|
|
24
|
+
"terser": "^5.48.0"
|
|
33
25
|
},
|
|
34
26
|
"devDependencies": {
|
|
35
|
-
"@astrojs/sitemap": "^3.7.
|
|
36
|
-
"@rslib/core": "0.
|
|
37
|
-
"@
|
|
27
|
+
"@astrojs/sitemap": "^3.7.2",
|
|
28
|
+
"@rslib/core": "0.21.5",
|
|
29
|
+
"@rslint/core": "^0.5.3",
|
|
30
|
+
"@rstest/core": "^0.10.2",
|
|
38
31
|
"@types/fs-extra": "^11.0.4",
|
|
39
|
-
"@types/node": "24.
|
|
32
|
+
"@types/node": "24.12.4",
|
|
40
33
|
"chalk": "^5.6.2",
|
|
41
34
|
"fast-glob": "^3.3.3",
|
|
42
|
-
"fs-extra": "^11.3.
|
|
43
|
-
"rslog": "^1.
|
|
44
|
-
"typescript": "^
|
|
35
|
+
"fs-extra": "^11.3.5",
|
|
36
|
+
"rslog": "^2.1.1",
|
|
37
|
+
"typescript": "^6.0.3"
|
|
45
38
|
},
|
|
46
|
-
"packageManager": "pnpm@10.28.2",
|
|
47
39
|
"publishConfig": {
|
|
48
40
|
"access": "public",
|
|
49
41
|
"registry": "https://registry.npmjs.org/",
|
|
50
42
|
"provenance": true
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "rslib",
|
|
46
|
+
"dev": "rslib -w",
|
|
47
|
+
"lint": "rslint",
|
|
48
|
+
"lint:write": "rslint --fix",
|
|
49
|
+
"prebundle": "node ./bin.js",
|
|
50
|
+
"bump": "npx bumpp",
|
|
51
|
+
"test": "rstest"
|
|
51
52
|
}
|
|
52
|
-
}
|
|
53
|
+
}
|