@atlaspack/bundler-default 3.1.3-typescript-b27501580.0 → 3.1.3-typescript-5b4d3ad41.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.
- package/lib/DefaultBundler.d.ts +18 -0
- package/lib/MonolithicBundler.d.ts +2 -0
- package/lib/bundleMerge.d.ts +9 -0
- package/lib/bundlerConfig.d.ts +27 -0
- package/lib/decorateLegacyGraph.d.ts +3 -0
- package/lib/idealGraph.d.ts +39 -0
- package/lib/memoize.d.ts +2 -0
- package/package.json +8 -8
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Bundler } from '@atlaspack/plugin';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* The Bundler works by creating an IdealGraph, which contains a BundleGraph that models bundles
|
|
5
|
+
* connected to other bundles by what references them, and thus models BundleGroups.
|
|
6
|
+
*
|
|
7
|
+
* First, we enter `bundle({bundleGraph, config})`. Here, "bundleGraph" is actually just the
|
|
8
|
+
* assetGraph turned into a type `MutableBundleGraph`, which will then be mutated in decorate,
|
|
9
|
+
* and turned into what we expect the bundleGraph to be as per the old (default) bundler structure
|
|
10
|
+
* & what the rest of Atlaspack expects a BundleGraph to be.
|
|
11
|
+
*
|
|
12
|
+
* `bundle({bundleGraph, config})` First gets a Mapping of target to entries, In most cases there is
|
|
13
|
+
* only one target, and one or more entries. (Targets are pertinent in monorepos or projects where you
|
|
14
|
+
* will have two or more distDirs, or output folders.) Then calls create IdealGraph and Decorate per target.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
declare const _default: Bundler<unknown>;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NodeId } from '@atlaspack/graph';
|
|
2
|
+
import type { IdealBundleGraph } from './idealGraph';
|
|
3
|
+
export type MergeGroup = {
|
|
4
|
+
overlapThreshold?: number;
|
|
5
|
+
maxBundleSize?: number;
|
|
6
|
+
sourceBundles?: Array<NodeId>;
|
|
7
|
+
minBundlesInGroup?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function findMergeCandidates(bundleGraph: IdealBundleGraph, bundles: Array<NodeId>, config: Array<MergeGroup>): Array<Array<NodeId>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Config, PluginOptions, PluginLogger } from '@atlaspack/types';
|
|
2
|
+
type Glob = string;
|
|
3
|
+
type ManualSharedBundles = Array<{
|
|
4
|
+
name: string;
|
|
5
|
+
assets: Array<Glob>;
|
|
6
|
+
types?: Array<string>;
|
|
7
|
+
root?: string;
|
|
8
|
+
split?: number;
|
|
9
|
+
}>;
|
|
10
|
+
export type MergeCandidates = Array<{
|
|
11
|
+
overlapThreshold?: number;
|
|
12
|
+
maxBundleSize?: number;
|
|
13
|
+
sourceBundles?: Array<string>;
|
|
14
|
+
minBundlesInGroup?: number;
|
|
15
|
+
}>;
|
|
16
|
+
export type ResolvedBundlerConfig = {
|
|
17
|
+
minBundles: number;
|
|
18
|
+
minBundleSize: number;
|
|
19
|
+
maxParallelRequests: number;
|
|
20
|
+
projectRoot: string;
|
|
21
|
+
disableSharedBundles: boolean;
|
|
22
|
+
manualSharedBundles: ManualSharedBundles;
|
|
23
|
+
loadConditionalBundlesInParallel?: boolean;
|
|
24
|
+
sharedBundleMerge?: MergeCandidates;
|
|
25
|
+
};
|
|
26
|
+
export declare function loadBundlerConfig(config: Config, options: PluginOptions, logger: PluginLogger): Promise<ResolvedBundlerConfig>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { BitSet, ContentGraph, Graph, NodeId } from '@atlaspack/graph';
|
|
2
|
+
import type { Asset, BundleBehavior, Dependency, Environment, MutableBundleGraph, Target, PluginLogger } from '@atlaspack/types';
|
|
3
|
+
import { DefaultMap } from '@atlaspack/utils';
|
|
4
|
+
import type { ResolvedBundlerConfig } from './bundlerConfig';
|
|
5
|
+
export type Bundle = {
|
|
6
|
+
uniqueKey: string | null | undefined;
|
|
7
|
+
assets: Set<Asset>;
|
|
8
|
+
internalizedAssets?: BitSet;
|
|
9
|
+
bundleBehavior?: BundleBehavior | null | undefined;
|
|
10
|
+
needsStableName: boolean;
|
|
11
|
+
mainEntryAsset: Asset | null | undefined;
|
|
12
|
+
size: number;
|
|
13
|
+
sourceBundles: Set<NodeId>;
|
|
14
|
+
target: Target;
|
|
15
|
+
env: Environment;
|
|
16
|
+
type: string;
|
|
17
|
+
manualSharedBundle: string | null | undefined;
|
|
18
|
+
};
|
|
19
|
+
export type DependencyBundleGraph = ContentGraph<{
|
|
20
|
+
value: Bundle;
|
|
21
|
+
type: 'bundle';
|
|
22
|
+
} | {
|
|
23
|
+
value: Dependency;
|
|
24
|
+
type: 'dependency';
|
|
25
|
+
}, number>;
|
|
26
|
+
export declare const idealBundleGraphEdges: Readonly<{
|
|
27
|
+
default: 1;
|
|
28
|
+
conditional: 2;
|
|
29
|
+
}>;
|
|
30
|
+
export type IdealBundleGraph = Graph<Bundle | 'root', (typeof idealBundleGraphEdges)[keyof typeof idealBundleGraphEdges]>;
|
|
31
|
+
export type IdealGraph = {
|
|
32
|
+
assetReference: DefaultMap<Asset, Array<[Dependency, Bundle]>>;
|
|
33
|
+
assets: Array<Asset>;
|
|
34
|
+
bundleGraph: IdealBundleGraph;
|
|
35
|
+
bundleGroupBundleIds: Set<NodeId>;
|
|
36
|
+
dependencyBundleGraph: DependencyBundleGraph;
|
|
37
|
+
manualAssetToBundle: Map<Asset, NodeId>;
|
|
38
|
+
};
|
|
39
|
+
export declare function createIdealGraph(assetGraph: MutableBundleGraph, config: ResolvedBundlerConfig, entries: Map<Asset, Dependency>, logger: PluginLogger): IdealGraph;
|
package/lib/memoize.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/bundler-default",
|
|
3
|
-
"version": "3.1.3-typescript-
|
|
3
|
+
"version": "3.1.3-typescript-5b4d3ad41.0",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"publishConfig": {
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
"node": ">= 16.0.0"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@atlaspack/diagnostic": "2.14.2-typescript-
|
|
21
|
-
"@atlaspack/feature-flags": "2.19.3-typescript-
|
|
22
|
-
"@atlaspack/graph": "3.5.10-typescript-
|
|
23
|
-
"@atlaspack/plugin": "2.14.21-typescript-
|
|
24
|
-
"@atlaspack/rust": "3.4.2-typescript-
|
|
25
|
-
"@atlaspack/utils": "2.17.3-typescript-
|
|
20
|
+
"@atlaspack/diagnostic": "2.14.2-typescript-5b4d3ad41.0",
|
|
21
|
+
"@atlaspack/feature-flags": "2.19.3-typescript-5b4d3ad41.0",
|
|
22
|
+
"@atlaspack/graph": "3.5.10-typescript-5b4d3ad41.0",
|
|
23
|
+
"@atlaspack/plugin": "2.14.21-typescript-5b4d3ad41.0",
|
|
24
|
+
"@atlaspack/rust": "3.4.2-typescript-5b4d3ad41.0",
|
|
25
|
+
"@atlaspack/utils": "2.17.3-typescript-5b4d3ad41.0",
|
|
26
26
|
"many-keys-map": "^1.0.3",
|
|
27
27
|
"nullthrows": "^1.1.1"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"check-ts": "tsc --emitDeclarationOnly --rootDir src"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "5b4d3ad41ffa002b989ba77271bb3010a1f05b2a"
|
|
33
33
|
}
|