prebundle 1.0.0 → 1.0.1
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 +12 -0
- package/dist/helper.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/prebundle.d.ts +1 -1
- package/dist/prebundle.js +2 -1
- package/dist/types.d.ts +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,6 +58,18 @@ export default {
|
|
|
58
58
|
};
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
You can also configure `externals` for all packages like this:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
// prebundle.config.mjs
|
|
65
|
+
export default {
|
|
66
|
+
externals: {
|
|
67
|
+
webpack: '../webpack',
|
|
68
|
+
},
|
|
69
|
+
dependencies: [{ name: 'foo' }, { name: 'foo' }],
|
|
70
|
+
};
|
|
71
|
+
```
|
|
72
|
+
|
|
61
73
|
### minify
|
|
62
74
|
|
|
63
75
|
Whether to minify the code, default `true`.
|
package/dist/helper.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DependencyConfig, ParsedTask } from './types.js';
|
|
1
|
+
import type { Config, DependencyConfig, ParsedTask } from './types.js';
|
|
2
2
|
export declare function findDepPath(name: string): string;
|
|
3
|
-
export declare const resolveConfig: () => Promise<
|
|
3
|
+
export declare const resolveConfig: () => Promise<Config>;
|
|
4
4
|
export declare function parseTasks(dependencies: Array<string | DependencyConfig>): ParsedTask[];
|
|
5
5
|
export declare function pick<T, U extends keyof T>(obj: T, keys: ReadonlyArray<U>): Pick<T, U>;
|
|
6
6
|
export declare function replaceFileContent(filePath: string, replaceFn: (content: string) => string): void;
|
package/dist/index.js
CHANGED
package/dist/prebundle.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ParsedTask } from './types.js';
|
|
2
|
-
export declare function prebundle(task: ParsedTask): Promise<void>;
|
|
2
|
+
export declare function prebundle(task: ParsedTask, commonExternals: Record<string, string>): Promise<void>;
|
package/dist/prebundle.js
CHANGED
|
@@ -112,7 +112,7 @@ function renameDistFolder(task) {
|
|
|
112
112
|
fs.writeJSONSync(pkgPath, pkgJson);
|
|
113
113
|
}
|
|
114
114
|
const pkgName = process.argv[2];
|
|
115
|
-
export async function prebundle(task) {
|
|
115
|
+
export async function prebundle(task, commonExternals) {
|
|
116
116
|
if (pkgName && task.depName !== pkgName) {
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
@@ -126,6 +126,7 @@ export async function prebundle(task) {
|
|
|
126
126
|
target: 'es2019',
|
|
127
127
|
externals: {
|
|
128
128
|
...DEFAULT_EXTERNALS,
|
|
129
|
+
...commonExternals,
|
|
129
130
|
...task.externals,
|
|
130
131
|
},
|
|
131
132
|
assetBuilds: false,
|
package/dist/types.d.ts
CHANGED
|
@@ -19,6 +19,11 @@ export type DependencyConfig = {
|
|
|
19
19
|
afterBundle?: (task: ParsedTask) => void | Promise<void>;
|
|
20
20
|
};
|
|
21
21
|
export type Config = {
|
|
22
|
+
/**
|
|
23
|
+
* Configure externals for all packages,
|
|
24
|
+
* will be merged with dependencies[i].externals.
|
|
25
|
+
*/
|
|
26
|
+
externals: Record<string, string>;
|
|
22
27
|
dependencies: Array<string | DependencyConfig>;
|
|
23
28
|
};
|
|
24
29
|
export type ParsedTask = {
|