@atlaspack/types-internal 2.12.1-dev.3401 → 2.12.1-dev.3450
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/index.d.ts +23 -3
- package/package.json +5 -5
- package/src/index.js +30 -3
package/lib/index.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ export type ResolvedParcelConfigFile = ResolvedAtlaspackConfigFile;
|
|
|
72
72
|
|
|
73
73
|
/** Corresponds to <code>pkg#engines</code> */
|
|
74
74
|
export type Engines = {
|
|
75
|
+
readonly atlaspack?: SemverRange;
|
|
75
76
|
readonly browsers?: string | Array<string>;
|
|
76
77
|
readonly electron?: SemverRange;
|
|
77
78
|
readonly node?: SemverRange;
|
|
@@ -431,7 +432,7 @@ extends Iterable<[Symbol, {
|
|
|
431
432
|
set(exportSymbol: Symbol, local: Symbol, loc: SourceLocation | null | undefined, isWeak: boolean | null | undefined): void;
|
|
432
433
|
delete(exportSymbol: Symbol): void;
|
|
433
434
|
}
|
|
434
|
-
export type DependencyPriority = "sync" | "parallel" | "lazy";
|
|
435
|
+
export type DependencyPriority = "sync" | "parallel" | "lazy" | "conditional";
|
|
435
436
|
export type SpecifierType = "commonjs" | "esm" | "url" | "custom";
|
|
436
437
|
|
|
437
438
|
/**
|
|
@@ -1271,6 +1272,7 @@ export type CreateBundleOpts = // If an entryAsset is provided, a bundle id, typ
|
|
|
1271
1272
|
|
|
1272
1273
|
/** Name of the manual shared bundle config that caused this bundle to be created */
|
|
1273
1274
|
readonly manualSharedBundle?: string | null | undefined;
|
|
1275
|
+
readonly conditions?: Array<string>;
|
|
1274
1276
|
} // If an entryAsset is not provided, a bundle id, type, and environment must
|
|
1275
1277
|
// be provided.
|
|
1276
1278
|
| {
|
|
@@ -1313,6 +1315,7 @@ export type CreateBundleOpts = // If an entryAsset is provided, a bundle id, typ
|
|
|
1313
1315
|
|
|
1314
1316
|
/** Name of the manual shared bundle config that caused this bundle to be created */
|
|
1315
1317
|
readonly manualSharedBundle?: string | null | undefined;
|
|
1318
|
+
readonly conditions?: Array<string>;
|
|
1316
1319
|
};
|
|
1317
1320
|
|
|
1318
1321
|
/**
|
|
@@ -1628,13 +1631,25 @@ export interface BundleGraph<TBundle extends Bundle> {
|
|
|
1628
1631
|
|
|
1629
1632
|
/** Returns the common root directory for the entry assets of a target. */
|
|
1630
1633
|
getEntryRoot(target: Target): FilePath;
|
|
1634
|
+
getConditionalBundleMapping(): Map<TBundle, Map<string, {
|
|
1635
|
+
ifTrueBundles: Array<TBundle>;
|
|
1636
|
+
ifFalseBundles: Array<TBundle>;
|
|
1637
|
+
}>>;
|
|
1638
|
+
getConditionsForDependencies(deps: Array<Dependency>): Set<{
|
|
1639
|
+
publicId: string;
|
|
1640
|
+
key: string;
|
|
1641
|
+
ifTrueDependency: Dependency;
|
|
1642
|
+
ifFalseDependency: Dependency;
|
|
1643
|
+
ifTrueAssetId: string;
|
|
1644
|
+
ifFalseAssetId: string;
|
|
1645
|
+
}>;
|
|
1631
1646
|
}
|
|
1632
1647
|
|
|
1633
1648
|
/**
|
|
1634
1649
|
* @section bundler
|
|
1635
1650
|
*/
|
|
1636
1651
|
export type BundleResult = {
|
|
1637
|
-
readonly contents:
|
|
1652
|
+
readonly contents: Buffer | string;
|
|
1638
1653
|
readonly ast?: AST;
|
|
1639
1654
|
readonly map?: SourceMap | null | undefined;
|
|
1640
1655
|
readonly type?: string;
|
|
@@ -1822,7 +1837,7 @@ export type Optimizer<ConfigType, BundleConfigType> = {
|
|
|
1822
1837
|
optimize(arg0: {
|
|
1823
1838
|
bundle: NamedBundle;
|
|
1824
1839
|
bundleGraph: BundleGraph<NamedBundle>;
|
|
1825
|
-
contents:
|
|
1840
|
+
contents: Buffer | string;
|
|
1826
1841
|
map: SourceMap | null | undefined;
|
|
1827
1842
|
options: PluginOptions;
|
|
1828
1843
|
logger: PluginLogger;
|
|
@@ -2095,3 +2110,8 @@ export interface PluginTracer {
|
|
|
2095
2110
|
*/
|
|
2096
2111
|
createMeasurement(name: string, category?: string, argumentName?: string, otherArgs?: Record<string, unknown>): TraceMeasurement | null;
|
|
2097
2112
|
}
|
|
2113
|
+
export type ConditionMeta = {
|
|
2114
|
+
key: string;
|
|
2115
|
+
ifTruePlaceholder: string;
|
|
2116
|
+
ifFalsePlaceholder: string;
|
|
2117
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/types-internal",
|
|
3
|
-
"version": "2.12.1-dev.
|
|
4
|
-
"license": "MIT",
|
|
3
|
+
"version": "2.12.1-dev.3450+58845ef87",
|
|
4
|
+
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"repository": {
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"check-ts": "tsc --noEmit lib/index.d.ts"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@atlaspack/diagnostic": "2.12.1-dev.
|
|
20
|
-
"@atlaspack/feature-flags": "2.12.1-dev.
|
|
19
|
+
"@atlaspack/diagnostic": "2.12.1-dev.3450+58845ef87",
|
|
20
|
+
"@atlaspack/feature-flags": "2.12.1-dev.3450+58845ef87",
|
|
21
21
|
"@parcel/source-map": "^2.1.1",
|
|
22
22
|
"utility-types": "^3.10.0"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "58845ef87446fcedb7d7d8876440c64184645cbb"
|
|
25
25
|
}
|
package/src/index.js
CHANGED
|
@@ -133,6 +133,7 @@ export type ResolvedParcelConfigFile = ResolvedAtlaspackConfigFile;
|
|
|
133
133
|
|
|
134
134
|
/** Corresponds to <code>pkg#engines</code> */
|
|
135
135
|
export type Engines = {
|
|
136
|
+
+atlaspack?: SemverRange,
|
|
136
137
|
+browsers?: string | Array<string>,
|
|
137
138
|
+electron?: SemverRange,
|
|
138
139
|
+node?: SemverRange,
|
|
@@ -539,7 +540,7 @@ export interface MutableDependencySymbols // eslint-disable-next-line no-undef
|
|
|
539
540
|
delete(exportSymbol: Symbol): void;
|
|
540
541
|
}
|
|
541
542
|
|
|
542
|
-
export type DependencyPriority = 'sync' | 'parallel' | 'lazy';
|
|
543
|
+
export type DependencyPriority = 'sync' | 'parallel' | 'lazy' | 'conditional';
|
|
543
544
|
export type SpecifierType = 'commonjs' | 'esm' | 'url' | 'custom';
|
|
544
545
|
|
|
545
546
|
/**
|
|
@@ -1307,6 +1308,7 @@ export type CreateBundleOpts =
|
|
|
1307
1308
|
+bundleBehavior?: ?BundleBehavior,
|
|
1308
1309
|
/** Name of the manual shared bundle config that caused this bundle to be created */
|
|
1309
1310
|
+manualSharedBundle?: ?string,
|
|
1311
|
+
+conditions?: Array<string>,
|
|
1310
1312
|
|}
|
|
1311
1313
|
// If an entryAsset is not provided, a bundle id, type, and environment must
|
|
1312
1314
|
// be provided.
|
|
@@ -1342,6 +1344,7 @@ export type CreateBundleOpts =
|
|
|
1342
1344
|
+pipeline?: ?string,
|
|
1343
1345
|
/** Name of the manual shared bundle config that caused this bundle to be created */
|
|
1344
1346
|
+manualSharedBundle?: ?string,
|
|
1347
|
+
+conditions?: Array<string>,
|
|
1345
1348
|
|};
|
|
1346
1349
|
|
|
1347
1350
|
/**
|
|
@@ -1626,13 +1629,31 @@ export interface BundleGraph<TBundle: Bundle> {
|
|
|
1626
1629
|
getUsedSymbols(Asset | Dependency): ?$ReadOnlySet<Symbol>;
|
|
1627
1630
|
/** Returns the common root directory for the entry assets of a target. */
|
|
1628
1631
|
getEntryRoot(target: Target): FilePath;
|
|
1632
|
+
getConditionalBundleMapping(): Map<
|
|
1633
|
+
TBundle,
|
|
1634
|
+
Map<
|
|
1635
|
+
string,
|
|
1636
|
+
{|
|
|
1637
|
+
ifTrueBundles: Array<TBundle>,
|
|
1638
|
+
ifFalseBundles: Array<TBundle>,
|
|
1639
|
+
|},
|
|
1640
|
+
>,
|
|
1641
|
+
>;
|
|
1642
|
+
getConditionsForDependencies(deps: Array<Dependency>): Set<{|
|
|
1643
|
+
publicId: string,
|
|
1644
|
+
key: string,
|
|
1645
|
+
ifTrueDependency: Dependency,
|
|
1646
|
+
ifFalseDependency: Dependency,
|
|
1647
|
+
ifTrueAssetId: string,
|
|
1648
|
+
ifFalseAssetId: string,
|
|
1649
|
+
|}>;
|
|
1629
1650
|
}
|
|
1630
1651
|
|
|
1631
1652
|
/**
|
|
1632
1653
|
* @section bundler
|
|
1633
1654
|
*/
|
|
1634
1655
|
export type BundleResult = {|
|
|
1635
|
-
+contents:
|
|
1656
|
+
+contents: Buffer | string,
|
|
1636
1657
|
+ast?: AST,
|
|
1637
1658
|
+map?: ?SourceMap,
|
|
1638
1659
|
+type?: string,
|
|
@@ -1809,7 +1830,7 @@ export type Optimizer<ConfigType, BundleConfigType> = {|
|
|
|
1809
1830
|
optimize({|
|
|
1810
1831
|
bundle: NamedBundle,
|
|
1811
1832
|
bundleGraph: BundleGraph<NamedBundle>,
|
|
1812
|
-
contents:
|
|
1833
|
+
contents: Buffer | string,
|
|
1813
1834
|
map: ?SourceMap,
|
|
1814
1835
|
options: PluginOptions,
|
|
1815
1836
|
logger: PluginLogger,
|
|
@@ -2109,3 +2130,9 @@ export interface PluginTracer {
|
|
|
2109
2130
|
otherArgs?: {[key: string]: mixed},
|
|
2110
2131
|
): TraceMeasurement | null;
|
|
2111
2132
|
}
|
|
2133
|
+
|
|
2134
|
+
export type ConditionMeta = {|
|
|
2135
|
+
key: string,
|
|
2136
|
+
ifTruePlaceholder: string,
|
|
2137
|
+
ifFalsePlaceholder: string,
|
|
2138
|
+
|};
|