prebundle 1.1.0-beta.5 → 1.1.0-beta.7
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/constant.d.ts +1 -0
- package/dist/constant.js +40 -0
- package/dist/helper.js +2 -0
- package/dist/prebundle.js +7 -3
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
package/dist/constant.d.ts
CHANGED
package/dist/constant.js
CHANGED
|
@@ -5,4 +5,44 @@ export const DEFAULT_EXTERNALS = {
|
|
|
5
5
|
'../package.json': './package.json',
|
|
6
6
|
'../../package.json': './package.json',
|
|
7
7
|
};
|
|
8
|
+
export const NODE_BUILTINS = [
|
|
9
|
+
'_stream_duplex',
|
|
10
|
+
'_stream_passthrough',
|
|
11
|
+
'_stream_readable',
|
|
12
|
+
'_stream_transform',
|
|
13
|
+
'_stream_writable',
|
|
14
|
+
'assert',
|
|
15
|
+
'buffer',
|
|
16
|
+
'child_process',
|
|
17
|
+
'cluster',
|
|
18
|
+
'console',
|
|
19
|
+
'constants',
|
|
20
|
+
'crypto',
|
|
21
|
+
'dgram',
|
|
22
|
+
'dns',
|
|
23
|
+
'domain',
|
|
24
|
+
'events',
|
|
25
|
+
'fs',
|
|
26
|
+
'http',
|
|
27
|
+
'https',
|
|
28
|
+
'module',
|
|
29
|
+
'net',
|
|
30
|
+
'os',
|
|
31
|
+
'path',
|
|
32
|
+
'process',
|
|
33
|
+
'punycode',
|
|
34
|
+
'querystring',
|
|
35
|
+
'readline',
|
|
36
|
+
'repl',
|
|
37
|
+
'stream',
|
|
38
|
+
'string_decoder',
|
|
39
|
+
'sys',
|
|
40
|
+
'timers',
|
|
41
|
+
'tls',
|
|
42
|
+
'tty',
|
|
43
|
+
'url',
|
|
44
|
+
'util',
|
|
45
|
+
'vm',
|
|
46
|
+
'zlib',
|
|
47
|
+
];
|
|
8
48
|
export const cwd = process.cwd();
|
package/dist/helper.js
CHANGED
|
@@ -47,6 +47,7 @@ export function parseTasks(dependencies) {
|
|
|
47
47
|
minify: false,
|
|
48
48
|
target: 'es2019',
|
|
49
49
|
externals: {},
|
|
50
|
+
dtsExternals: [],
|
|
50
51
|
emitFiles: [],
|
|
51
52
|
packageJsonField: [],
|
|
52
53
|
...info,
|
|
@@ -58,6 +59,7 @@ export function parseTasks(dependencies) {
|
|
|
58
59
|
target: dep.target ?? 'es2019',
|
|
59
60
|
ignoreDts: dep.ignoreDts,
|
|
60
61
|
externals: dep.externals ?? {},
|
|
62
|
+
dtsExternals: dep.dtsExternals ?? [],
|
|
61
63
|
emitFiles: dep.emitFiles ?? [],
|
|
62
64
|
afterBundle: dep.afterBundle,
|
|
63
65
|
beforeBundle: dep.beforeBundle,
|
package/dist/prebundle.js
CHANGED
|
@@ -3,7 +3,7 @@ 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';
|
|
5
5
|
import rslog from '../compiled/rslog/index.js';
|
|
6
|
-
import { DEFAULT_EXTERNALS } from './constant.js';
|
|
6
|
+
import { DEFAULT_EXTERNALS, NODE_BUILTINS } from './constant.js';
|
|
7
7
|
import { findDepPath, pick } from './helper.js';
|
|
8
8
|
import { dts } from 'rollup-plugin-dts';
|
|
9
9
|
import { rollup } from 'rollup';
|
|
@@ -50,7 +50,11 @@ async function emitDts(task, externals) {
|
|
|
50
50
|
try {
|
|
51
51
|
const inputConfig = {
|
|
52
52
|
input,
|
|
53
|
-
external:
|
|
53
|
+
external: [
|
|
54
|
+
...Object.keys(externals),
|
|
55
|
+
...task.dtsExternals,
|
|
56
|
+
...NODE_BUILTINS,
|
|
57
|
+
],
|
|
54
58
|
plugins: [
|
|
55
59
|
dts({
|
|
56
60
|
respectExternal: true,
|
|
@@ -152,7 +156,7 @@ export async function prebundle(task, commonExternals = {}) {
|
|
|
152
156
|
if (pkgName && task.depName !== pkgName) {
|
|
153
157
|
return;
|
|
154
158
|
}
|
|
155
|
-
logger.
|
|
159
|
+
logger.start(`prebundle: ${task.depName}`);
|
|
156
160
|
fs.removeSync(task.distPath);
|
|
157
161
|
if (task.beforeBundle) {
|
|
158
162
|
await task.beforeBundle(task);
|
package/dist/types.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export type DependencyConfig = {
|
|
|
9
9
|
minify?: boolean;
|
|
10
10
|
/** Externals to leave as requires of the build. */
|
|
11
11
|
externals?: Record<string, string>;
|
|
12
|
+
/** Externals types */
|
|
13
|
+
dtsExternals?: Array<string | RegExp>;
|
|
12
14
|
/** Emit extra entry files to map imports. */
|
|
13
15
|
emitFiles?: ImportMap[];
|
|
14
16
|
/** Copy extra fields from original package.json to target package.json. */
|
|
@@ -38,6 +40,7 @@ export type ParsedTask = {
|
|
|
38
40
|
minify: NonNullable<DependencyConfig['minify']>;
|
|
39
41
|
depName: NonNullable<DependencyConfig['name']>;
|
|
40
42
|
externals: NonNullable<DependencyConfig['externals']>;
|
|
43
|
+
dtsExternals: NonNullable<DependencyConfig['dtsExternals']>;
|
|
41
44
|
emitFiles: NonNullable<DependencyConfig['emitFiles']>;
|
|
42
45
|
afterBundle?: NonNullable<DependencyConfig['afterBundle']>;
|
|
43
46
|
beforeBundle?: NonNullable<DependencyConfig['beforeBundle']>;
|