@atlaspack/core 2.12.1-canary.3354
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/LICENSE +201 -0
- package/index.d.ts +22 -0
- package/lib/AssetGraph.js +518 -0
- package/lib/Atlaspack.js +587 -0
- package/lib/AtlaspackConfig.js +298 -0
- package/lib/AtlaspackConfig.schema.js +125 -0
- package/lib/BundleGraph.js +1445 -0
- package/lib/CommittedAsset.js +133 -0
- package/lib/Dependency.js +88 -0
- package/lib/Environment.js +128 -0
- package/lib/InternalConfig.js +48 -0
- package/lib/PackagerRunner.js +519 -0
- package/lib/ReporterRunner.js +151 -0
- package/lib/RequestTracker.js +1089 -0
- package/lib/SymbolPropagation.js +625 -0
- package/lib/TargetDescriptor.schema.js +115 -0
- package/lib/Transformation.js +536 -0
- package/lib/UncommittedAsset.js +342 -0
- package/lib/Validation.js +215 -0
- package/lib/applyRuntimes.js +279 -0
- package/lib/assetUtils.js +189 -0
- package/lib/atlaspack-v3/AtlaspackV3.js +74 -0
- package/lib/atlaspack-v3/fs.js +30 -0
- package/lib/atlaspack-v3/index.js +19 -0
- package/lib/atlaspack-v3/jsCallable.js +15 -0
- package/lib/atlaspack-v3/plugins/Resolver.js +12 -0
- package/lib/atlaspack-v3/plugins/index.js +16 -0
- package/lib/atlaspack-v3/worker/index.js +3 -0
- package/lib/atlaspack-v3/worker/worker.js +30 -0
- package/lib/buildCache.js +18 -0
- package/lib/constants.js +21 -0
- package/lib/dumpGraphToGraphViz.js +206 -0
- package/lib/index.js +106 -0
- package/lib/loadAtlaspackPlugin.js +148 -0
- package/lib/loadDotEnv.js +54 -0
- package/lib/projectPath.js +86 -0
- package/lib/public/Asset.js +259 -0
- package/lib/public/Bundle.js +231 -0
- package/lib/public/BundleGraph.js +193 -0
- package/lib/public/BundleGroup.js +44 -0
- package/lib/public/Config.js +202 -0
- package/lib/public/Dependency.js +131 -0
- package/lib/public/Environment.js +244 -0
- package/lib/public/MutableBundleGraph.js +184 -0
- package/lib/public/PluginOptions.js +71 -0
- package/lib/public/Symbols.js +247 -0
- package/lib/public/Target.js +64 -0
- package/lib/registerCoreWithSerializer.js +45 -0
- package/lib/requests/AssetGraphRequest.js +427 -0
- package/lib/requests/AssetGraphRequestRust.js +187 -0
- package/lib/requests/AssetRequest.js +137 -0
- package/lib/requests/AtlaspackBuildRequest.js +78 -0
- package/lib/requests/AtlaspackConfigRequest.js +473 -0
- package/lib/requests/BundleGraphRequest.js +419 -0
- package/lib/requests/ConfigRequest.js +198 -0
- package/lib/requests/DevDepRequest.js +166 -0
- package/lib/requests/EntryRequest.js +295 -0
- package/lib/requests/PackageRequest.js +88 -0
- package/lib/requests/PathRequest.js +349 -0
- package/lib/requests/TargetRequest.js +1177 -0
- package/lib/requests/ValidationRequest.js +66 -0
- package/lib/requests/WriteBundleRequest.js +252 -0
- package/lib/requests/WriteBundlesRequest.js +153 -0
- package/lib/resolveOptions.js +234 -0
- package/lib/serializer.js +216 -0
- package/lib/serializerCore.browser.js +29 -0
- package/lib/serializerCore.js +16 -0
- package/lib/summarizeRequest.js +55 -0
- package/lib/types.js +35 -0
- package/lib/utils.js +160 -0
- package/lib/worker.js +170 -0
- package/package.json +59 -0
- package/src/AssetGraph.js +646 -0
- package/src/Atlaspack.js +632 -0
- package/src/AtlaspackConfig.js +490 -0
- package/src/AtlaspackConfig.schema.js +141 -0
- package/src/BundleGraph.js +2193 -0
- package/src/CommittedAsset.js +143 -0
- package/src/Dependency.js +142 -0
- package/src/Environment.js +151 -0
- package/src/InternalConfig.js +72 -0
- package/src/PackagerRunner.js +790 -0
- package/src/ReporterRunner.js +158 -0
- package/src/RequestTracker.js +1697 -0
- package/src/SymbolPropagation.js +794 -0
- package/src/TargetDescriptor.schema.js +136 -0
- package/src/Transformation.js +752 -0
- package/src/UncommittedAsset.js +426 -0
- package/src/Validation.js +223 -0
- package/src/applyRuntimes.js +341 -0
- package/src/assetUtils.js +254 -0
- package/src/atlaspack-v3/AtlaspackV3.js +73 -0
- package/src/atlaspack-v3/fs.js +36 -0
- package/src/atlaspack-v3/index.js +5 -0
- package/src/atlaspack-v3/jsCallable.js +13 -0
- package/src/atlaspack-v3/plugins/Resolver.js +9 -0
- package/src/atlaspack-v3/plugins/index.js +3 -0
- package/src/atlaspack-v3/worker/index.js +8 -0
- package/src/atlaspack-v3/worker/worker.js +14 -0
- package/src/buildCache.js +15 -0
- package/src/constants.js +22 -0
- package/src/dumpGraphToGraphViz.js +244 -0
- package/src/index.js +22 -0
- package/src/loadAtlaspackPlugin.js +239 -0
- package/src/loadDotEnv.js +56 -0
- package/src/projectPath.js +87 -0
- package/src/public/Asset.js +359 -0
- package/src/public/Bundle.js +337 -0
- package/src/public/BundleGraph.js +335 -0
- package/src/public/BundleGroup.js +55 -0
- package/src/public/Config.js +261 -0
- package/src/public/Dependency.js +176 -0
- package/src/public/Environment.js +316 -0
- package/src/public/MutableBundleGraph.js +320 -0
- package/src/public/PluginOptions.js +99 -0
- package/src/public/Symbols.js +315 -0
- package/src/public/Target.js +71 -0
- package/src/registerCoreWithSerializer.js +34 -0
- package/src/requests/AssetGraphRequest.js +577 -0
- package/src/requests/AssetGraphRequestRust.js +222 -0
- package/src/requests/AssetRequest.js +179 -0
- package/src/requests/AtlaspackBuildRequest.js +109 -0
- package/src/requests/AtlaspackConfigRequest.js +709 -0
- package/src/requests/BundleGraphRequest.js +547 -0
- package/src/requests/ConfigRequest.js +287 -0
- package/src/requests/DevDepRequest.js +246 -0
- package/src/requests/EntryRequest.js +385 -0
- package/src/requests/PackageRequest.js +105 -0
- package/src/requests/PathRequest.js +454 -0
- package/src/requests/TargetRequest.js +1632 -0
- package/src/requests/ValidationRequest.js +79 -0
- package/src/requests/WriteBundleRequest.js +362 -0
- package/src/requests/WriteBundlesRequest.js +209 -0
- package/src/resolveOptions.js +278 -0
- package/src/serializer.js +255 -0
- package/src/serializerCore.browser.js +8 -0
- package/src/serializerCore.js +5 -0
- package/src/summarizeRequest.js +47 -0
- package/src/types.js +581 -0
- package/src/utils.js +211 -0
- package/src/worker.js +189 -0
- package/test/AssetGraph.test.js +679 -0
- package/test/Atlaspack.test.js +142 -0
- package/test/AtlaspackConfig.test.js +405 -0
- package/test/AtlaspackConfigRequest.test.js +993 -0
- package/test/BundleGraph.test.js +121 -0
- package/test/EntryRequest.test.js +215 -0
- package/test/Environment.test.js +99 -0
- package/test/InternalAsset.test.js +76 -0
- package/test/PackagerRunner.test.js +27 -0
- package/test/PublicAsset.test.js +40 -0
- package/test/PublicBundle.test.js +68 -0
- package/test/PublicDependency.test.js +22 -0
- package/test/PublicEnvironment.test.js +27 -0
- package/test/PublicMutableBundleGraph.test.js +192 -0
- package/test/RequestTracker.test.js +448 -0
- package/test/SymbolPropagation.test.js +716 -0
- package/test/TargetRequest.test.js +1715 -0
- package/test/fixtures/application-targets/package.json +3 -0
- package/test/fixtures/atlaspack/index.js +1 -0
- package/test/fixtures/atlaspack/other.js +3 -0
- package/test/fixtures/atlaspack/package.json +1 -0
- package/test/fixtures/atlaspack/yarn.lock +0 -0
- package/test/fixtures/bundle.js +10 -0
- package/test/fixtures/common-targets/package.json +24 -0
- package/test/fixtures/common-targets-ignore/package.json +13 -0
- package/test/fixtures/config/.atlaspackrc +6 -0
- package/test/fixtures/config/subfolder/.atlaspackrc +6 -0
- package/test/fixtures/config-extends-not-found/.atlaspackrc +3 -0
- package/test/fixtures/config-extends-not-found/.atlaspackrc-json5 +3 -0
- package/test/fixtures/config-extends-not-found/.atlaspackrc-multiple +3 -0
- package/test/fixtures/config-extends-not-found/.atlaspackrc-node-modules +3 -0
- package/test/fixtures/config-malformed/.atlaspackrc +3 -0
- package/test/fixtures/config-node-pipeline/.atlaspackrc +6 -0
- package/test/fixtures/config-plugin-not-found/.atlaspackrc +6 -0
- package/test/fixtures/context/package.json +8 -0
- package/test/fixtures/custom-format-infer-ext/package.json +6 -0
- package/test/fixtures/custom-format-infer-type/package.json +7 -0
- package/test/fixtures/custom-format-mismatch/package.json +8 -0
- package/test/fixtures/custom-targets/package.json +20 -0
- package/test/fixtures/custom-targets-distdir/package.json +11 -0
- package/test/fixtures/duplicate-targets/package.json +4 -0
- package/test/fixtures/glob-like/[entry].js +0 -0
- package/test/fixtures/invalid-distpath/package.json +11 -0
- package/test/fixtures/invalid-engines/package.json +12 -0
- package/test/fixtures/invalid-source-missing/package.json +5 -0
- package/test/fixtures/invalid-source-not-file/package.json +5 -0
- package/test/fixtures/invalid-source-not-file/src/index.js +1 -0
- package/test/fixtures/invalid-target-source-missing/package.json +9 -0
- package/test/fixtures/invalid-target-source-not-file/package.json +9 -0
- package/test/fixtures/invalid-target-source-not-file/src/index.js +1 -0
- package/test/fixtures/invalid-targets/package.json +19 -0
- package/test/fixtures/library-custom-scopehoist/package.json +9 -0
- package/test/fixtures/library-scopehoist/package.json +8 -0
- package/test/fixtures/local-plugin-config-pkg/.atlaspackrc +3 -0
- package/test/fixtures/local-plugin-config-pkg/node_modules/atlaspack-config-local/index.json +8 -0
- package/test/fixtures/local-plugin-config-pkg/node_modules/atlaspack-config-local/local-plugin.js +7 -0
- package/test/fixtures/local-plugin-config-pkg/node_modules/atlaspack-config-local/package.json +7 -0
- package/test/fixtures/main-format-mismatch/package.json +8 -0
- package/test/fixtures/main-global/package.json +8 -0
- package/test/fixtures/main-mjs/package.json +8 -0
- package/test/fixtures/module-a.js +1 -0
- package/test/fixtures/module-b.js +1 -0
- package/test/fixtures/plugins/local-plugin.js +7 -0
- package/test/fixtures/plugins/node_modules/atlaspack-transformer-bad-engines/index.js +7 -0
- package/test/fixtures/plugins/node_modules/atlaspack-transformer-bad-engines/package.json +7 -0
- package/test/fixtures/plugins/node_modules/atlaspack-transformer-no-engines/index.js +7 -0
- package/test/fixtures/plugins/node_modules/atlaspack-transformer-no-engines/package.json +4 -0
- package/test/fixtures/targets-default-distdir-none/package.json +5 -0
- package/test/fixtures/targets-default-distdir-one/package.json +8 -0
- package/test/fixtures/targets-default-distdir-two/package.json +18 -0
- package/test/requests/ConfigRequest.test.js +254 -0
- package/test/serializer.test.js +302 -0
- package/test/test-utils.js +80 -0
- package/test/utils.test.js +43 -0
package/src/types.js
ADDED
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
|
|
3
|
+
import type {ContentKey} from '@atlaspack/graph';
|
|
4
|
+
import type {
|
|
5
|
+
ASTGenerator,
|
|
6
|
+
BuildMode,
|
|
7
|
+
Engines,
|
|
8
|
+
EnvironmentContext,
|
|
9
|
+
EnvMap,
|
|
10
|
+
FilePath,
|
|
11
|
+
Glob,
|
|
12
|
+
LogLevel,
|
|
13
|
+
Meta,
|
|
14
|
+
DependencySpecifier,
|
|
15
|
+
PackageName,
|
|
16
|
+
ReporterEvent,
|
|
17
|
+
SemverRange,
|
|
18
|
+
ServerOptions,
|
|
19
|
+
SourceType,
|
|
20
|
+
Stats,
|
|
21
|
+
Symbol,
|
|
22
|
+
TargetSourceMapOptions,
|
|
23
|
+
ConfigResult,
|
|
24
|
+
OutputFormat,
|
|
25
|
+
TargetDescriptor,
|
|
26
|
+
HMROptions,
|
|
27
|
+
DetailedReportOptions,
|
|
28
|
+
} from '@atlaspack/types';
|
|
29
|
+
import type {SharedReference} from '@atlaspack/workers';
|
|
30
|
+
import type {FileSystem} from '@atlaspack/fs';
|
|
31
|
+
import type {Cache} from '@atlaspack/cache';
|
|
32
|
+
import type {PackageManager} from '@atlaspack/package-manager';
|
|
33
|
+
import type {ProjectPath} from './projectPath';
|
|
34
|
+
import type {Event} from '@parcel/watcher';
|
|
35
|
+
import type {FeatureFlags} from '@atlaspack/feature-flags';
|
|
36
|
+
import type {BackendType} from '@parcel/watcher';
|
|
37
|
+
|
|
38
|
+
export type AtlaspackPluginNode = {|
|
|
39
|
+
packageName: PackageName,
|
|
40
|
+
resolveFrom: ProjectPath,
|
|
41
|
+
keyPath?: string,
|
|
42
|
+
|};
|
|
43
|
+
|
|
44
|
+
export type PureAtlaspackConfigPipeline = $ReadOnlyArray<AtlaspackPluginNode>;
|
|
45
|
+
export type ExtendableAtlaspackConfigPipeline = $ReadOnlyArray<
|
|
46
|
+
AtlaspackPluginNode | '...',
|
|
47
|
+
>;
|
|
48
|
+
|
|
49
|
+
export type ProcessedAtlaspackConfig = {|
|
|
50
|
+
resolvers?: PureAtlaspackConfigPipeline,
|
|
51
|
+
transformers?: {[Glob]: ExtendableAtlaspackConfigPipeline, ...},
|
|
52
|
+
bundler: ?AtlaspackPluginNode,
|
|
53
|
+
namers?: PureAtlaspackConfigPipeline,
|
|
54
|
+
runtimes?: PureAtlaspackConfigPipeline,
|
|
55
|
+
packagers?: {[Glob]: AtlaspackPluginNode, ...},
|
|
56
|
+
optimizers?: {[Glob]: ExtendableAtlaspackConfigPipeline, ...},
|
|
57
|
+
compressors?: {[Glob]: ExtendableAtlaspackConfigPipeline, ...},
|
|
58
|
+
reporters?: PureAtlaspackConfigPipeline,
|
|
59
|
+
validators?: {[Glob]: ExtendableAtlaspackConfigPipeline, ...},
|
|
60
|
+
filePath: ProjectPath,
|
|
61
|
+
resolveFrom?: ProjectPath,
|
|
62
|
+
|};
|
|
63
|
+
|
|
64
|
+
export type Environment = {|
|
|
65
|
+
id: string,
|
|
66
|
+
context: EnvironmentContext,
|
|
67
|
+
engines: Engines,
|
|
68
|
+
includeNodeModules:
|
|
69
|
+
| boolean
|
|
70
|
+
| Array<PackageName>
|
|
71
|
+
| {[PackageName]: boolean, ...},
|
|
72
|
+
outputFormat: OutputFormat,
|
|
73
|
+
sourceType: SourceType,
|
|
74
|
+
isLibrary: boolean,
|
|
75
|
+
shouldOptimize: boolean,
|
|
76
|
+
shouldScopeHoist: boolean,
|
|
77
|
+
sourceMap: ?TargetSourceMapOptions,
|
|
78
|
+
loc: ?InternalSourceLocation,
|
|
79
|
+
|};
|
|
80
|
+
|
|
81
|
+
export type InternalSourceLocation = {|
|
|
82
|
+
+filePath: ProjectPath,
|
|
83
|
+
/** inclusive */
|
|
84
|
+
+start: {|
|
|
85
|
+
+line: number,
|
|
86
|
+
+column: number,
|
|
87
|
+
|},
|
|
88
|
+
/** exclusive */
|
|
89
|
+
+end: {|
|
|
90
|
+
+line: number,
|
|
91
|
+
+column: number,
|
|
92
|
+
|},
|
|
93
|
+
|};
|
|
94
|
+
|
|
95
|
+
export type Target = {|
|
|
96
|
+
distEntry?: ?FilePath,
|
|
97
|
+
distDir: ProjectPath,
|
|
98
|
+
env: Environment,
|
|
99
|
+
name: string,
|
|
100
|
+
publicUrl: string,
|
|
101
|
+
loc?: ?InternalSourceLocation,
|
|
102
|
+
pipeline?: string,
|
|
103
|
+
source?: FilePath | Array<FilePath>,
|
|
104
|
+
|};
|
|
105
|
+
|
|
106
|
+
export const SpecifierType = {
|
|
107
|
+
esm: 0,
|
|
108
|
+
commonjs: 1,
|
|
109
|
+
url: 2,
|
|
110
|
+
custom: 3,
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const Priority = {
|
|
114
|
+
sync: 0,
|
|
115
|
+
parallel: 1,
|
|
116
|
+
lazy: 2,
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// Must match package_json.rs in node-resolver-rs.
|
|
120
|
+
export const ExportsCondition = {
|
|
121
|
+
import: 1 << 0,
|
|
122
|
+
require: 1 << 1,
|
|
123
|
+
module: 1 << 2,
|
|
124
|
+
style: 1 << 12,
|
|
125
|
+
sass: 1 << 13,
|
|
126
|
+
less: 1 << 14,
|
|
127
|
+
stylus: 1 << 15,
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export type Dependency = {|
|
|
131
|
+
id: string,
|
|
132
|
+
specifier: DependencySpecifier,
|
|
133
|
+
specifierType: $Values<typeof SpecifierType>,
|
|
134
|
+
priority: $Values<typeof Priority>,
|
|
135
|
+
needsStableName: boolean,
|
|
136
|
+
bundleBehavior: ?$Values<typeof BundleBehavior>,
|
|
137
|
+
isEntry: boolean,
|
|
138
|
+
isOptional: boolean,
|
|
139
|
+
loc: ?InternalSourceLocation,
|
|
140
|
+
env: Environment,
|
|
141
|
+
packageConditions?: number,
|
|
142
|
+
customPackageConditions?: Array<string>,
|
|
143
|
+
meta: Meta,
|
|
144
|
+
resolverMeta?: ?Meta,
|
|
145
|
+
target: ?Target,
|
|
146
|
+
sourceAssetId: ?string,
|
|
147
|
+
sourcePath: ?ProjectPath,
|
|
148
|
+
sourceAssetType?: ?string,
|
|
149
|
+
resolveFrom: ?ProjectPath,
|
|
150
|
+
range: ?SemverRange,
|
|
151
|
+
symbols: ?Map<
|
|
152
|
+
Symbol,
|
|
153
|
+
{|
|
|
154
|
+
local: Symbol,
|
|
155
|
+
loc: ?InternalSourceLocation,
|
|
156
|
+
isWeak: boolean,
|
|
157
|
+
meta?: ?Meta,
|
|
158
|
+
|},
|
|
159
|
+
>,
|
|
160
|
+
pipeline?: ?string,
|
|
161
|
+
|};
|
|
162
|
+
|
|
163
|
+
export const BundleBehavior = {
|
|
164
|
+
inline: 0,
|
|
165
|
+
isolated: 1,
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export const BundleBehaviorNames: Array<$Keys<typeof BundleBehavior>> =
|
|
169
|
+
Object.keys(BundleBehavior);
|
|
170
|
+
|
|
171
|
+
export type Asset = {|
|
|
172
|
+
id: ContentKey,
|
|
173
|
+
committed: boolean,
|
|
174
|
+
filePath: ProjectPath,
|
|
175
|
+
query: ?string,
|
|
176
|
+
type: string,
|
|
177
|
+
dependencies: Map<string, Dependency>,
|
|
178
|
+
bundleBehavior: ?$Values<typeof BundleBehavior>,
|
|
179
|
+
isBundleSplittable: boolean,
|
|
180
|
+
isSource: boolean,
|
|
181
|
+
env: Environment,
|
|
182
|
+
meta: Meta,
|
|
183
|
+
stats: Stats,
|
|
184
|
+
contentKey: ?string,
|
|
185
|
+
mapKey: ?string,
|
|
186
|
+
outputHash: ?string,
|
|
187
|
+
pipeline: ?string,
|
|
188
|
+
astKey: ?string,
|
|
189
|
+
astGenerator: ?ASTGenerator,
|
|
190
|
+
symbols: ?Map<
|
|
191
|
+
Symbol,
|
|
192
|
+
{|local: Symbol, loc: ?InternalSourceLocation, meta?: ?Meta|},
|
|
193
|
+
>,
|
|
194
|
+
sideEffects: boolean,
|
|
195
|
+
uniqueKey: ?string,
|
|
196
|
+
configPath?: ProjectPath,
|
|
197
|
+
plugin: ?PackageName,
|
|
198
|
+
configKeyPath?: string,
|
|
199
|
+
isLargeBlob?: boolean,
|
|
200
|
+
|};
|
|
201
|
+
|
|
202
|
+
export type InternalGlob = ProjectPath;
|
|
203
|
+
|
|
204
|
+
export type InternalFile = {|
|
|
205
|
+
+filePath: ProjectPath,
|
|
206
|
+
+hash?: string,
|
|
207
|
+
|};
|
|
208
|
+
|
|
209
|
+
export type FileInvalidation = {|
|
|
210
|
+
type: 'file',
|
|
211
|
+
filePath: ProjectPath,
|
|
212
|
+
|};
|
|
213
|
+
|
|
214
|
+
export type EnvInvalidation = {|
|
|
215
|
+
type: 'env',
|
|
216
|
+
key: string,
|
|
217
|
+
|};
|
|
218
|
+
|
|
219
|
+
export type OptionInvalidation = {|
|
|
220
|
+
type: 'option',
|
|
221
|
+
key: string,
|
|
222
|
+
|};
|
|
223
|
+
|
|
224
|
+
export type RequestInvalidation =
|
|
225
|
+
| FileInvalidation
|
|
226
|
+
| EnvInvalidation
|
|
227
|
+
| OptionInvalidation;
|
|
228
|
+
|
|
229
|
+
export type InternalFileInvalidation = {|
|
|
230
|
+
filePath: ProjectPath,
|
|
231
|
+
|};
|
|
232
|
+
|
|
233
|
+
export type InternalGlobInvalidation = {|
|
|
234
|
+
glob: InternalGlob,
|
|
235
|
+
|};
|
|
236
|
+
|
|
237
|
+
export type InternalFileAboveInvalidation = {|
|
|
238
|
+
fileName: string,
|
|
239
|
+
aboveFilePath: ProjectPath,
|
|
240
|
+
|};
|
|
241
|
+
|
|
242
|
+
export type InternalFileCreateInvalidation =
|
|
243
|
+
| InternalFileInvalidation
|
|
244
|
+
| InternalGlobInvalidation
|
|
245
|
+
| InternalFileAboveInvalidation;
|
|
246
|
+
|
|
247
|
+
export type Invalidations = {|
|
|
248
|
+
invalidateOnFileChange: Set<ProjectPath>,
|
|
249
|
+
invalidateOnFileCreate: Array<InternalFileCreateInvalidation>,
|
|
250
|
+
invalidateOnEnvChange: Set<string>,
|
|
251
|
+
invalidateOnOptionChange: Set<string>,
|
|
252
|
+
invalidateOnStartup: boolean,
|
|
253
|
+
invalidateOnBuild: boolean,
|
|
254
|
+
|};
|
|
255
|
+
|
|
256
|
+
export type DevDepRequest = {|
|
|
257
|
+
specifier: DependencySpecifier,
|
|
258
|
+
resolveFrom: ProjectPath,
|
|
259
|
+
hash: string,
|
|
260
|
+
invalidateOnFileCreate?: Array<InternalFileCreateInvalidation>,
|
|
261
|
+
invalidateOnFileChange?: Set<ProjectPath>,
|
|
262
|
+
invalidateOnStartup?: boolean,
|
|
263
|
+
additionalInvalidations?: Array<{|
|
|
264
|
+
specifier: DependencySpecifier,
|
|
265
|
+
resolveFrom: ProjectPath,
|
|
266
|
+
range?: ?SemverRange,
|
|
267
|
+
|}>,
|
|
268
|
+
|};
|
|
269
|
+
|
|
270
|
+
declare type GlobPattern = string;
|
|
271
|
+
|
|
272
|
+
export type AtlaspackOptions = {|
|
|
273
|
+
entries: Array<ProjectPath>,
|
|
274
|
+
config?: DependencySpecifier,
|
|
275
|
+
defaultConfig?: DependencySpecifier,
|
|
276
|
+
env: EnvMap,
|
|
277
|
+
atlaspackVersion: string,
|
|
278
|
+
targets: ?(Array<string> | {+[string]: TargetDescriptor, ...}),
|
|
279
|
+
shouldDisableCache: boolean,
|
|
280
|
+
cacheDir: FilePath,
|
|
281
|
+
watchDir: FilePath,
|
|
282
|
+
watchIgnore?: Array<FilePath | GlobPattern>,
|
|
283
|
+
watchBackend?: BackendType,
|
|
284
|
+
mode: BuildMode,
|
|
285
|
+
hmrOptions: ?HMROptions,
|
|
286
|
+
shouldContentHash: boolean,
|
|
287
|
+
serveOptions: ServerOptions | false,
|
|
288
|
+
shouldBuildLazily: boolean,
|
|
289
|
+
lazyIncludes: RegExp[],
|
|
290
|
+
lazyExcludes: RegExp[],
|
|
291
|
+
shouldBundleIncrementally: boolean,
|
|
292
|
+
shouldAutoInstall: boolean,
|
|
293
|
+
logLevel: LogLevel,
|
|
294
|
+
projectRoot: FilePath,
|
|
295
|
+
shouldProfile: boolean,
|
|
296
|
+
shouldTrace: boolean,
|
|
297
|
+
shouldPatchConsole: boolean,
|
|
298
|
+
detailedReport?: ?DetailedReportOptions,
|
|
299
|
+
unstableFileInvalidations?: Array<Event>,
|
|
300
|
+
|
|
301
|
+
inputFS: FileSystem,
|
|
302
|
+
outputFS: FileSystem,
|
|
303
|
+
cache: Cache,
|
|
304
|
+
packageManager: PackageManager,
|
|
305
|
+
additionalReporters: Array<{|
|
|
306
|
+
packageName: DependencySpecifier,
|
|
307
|
+
resolveFrom: ProjectPath,
|
|
308
|
+
|}>,
|
|
309
|
+
|
|
310
|
+
instanceId: string,
|
|
311
|
+
|
|
312
|
+
+defaultTargetOptions: {|
|
|
313
|
+
+shouldOptimize: boolean,
|
|
314
|
+
+shouldScopeHoist?: boolean,
|
|
315
|
+
+sourceMaps: boolean,
|
|
316
|
+
+publicUrl: string,
|
|
317
|
+
+distDir?: ProjectPath,
|
|
318
|
+
+engines?: Engines,
|
|
319
|
+
+outputFormat?: OutputFormat,
|
|
320
|
+
+isLibrary?: boolean,
|
|
321
|
+
|},
|
|
322
|
+
|
|
323
|
+
+featureFlags: FeatureFlags,
|
|
324
|
+
|};
|
|
325
|
+
|
|
326
|
+
export type AssetNode = {|
|
|
327
|
+
id: ContentKey,
|
|
328
|
+
+type: 'asset',
|
|
329
|
+
value: Asset,
|
|
330
|
+
usedSymbols: Set<Symbol>,
|
|
331
|
+
hasDeferred?: boolean,
|
|
332
|
+
usedSymbolsDownDirty: boolean,
|
|
333
|
+
usedSymbolsUpDirty: boolean,
|
|
334
|
+
requested?: boolean,
|
|
335
|
+
|};
|
|
336
|
+
|
|
337
|
+
export type DependencyNode = {|
|
|
338
|
+
id: ContentKey,
|
|
339
|
+
type: 'dependency',
|
|
340
|
+
value: Dependency,
|
|
341
|
+
complete?: boolean,
|
|
342
|
+
correspondingRequest?: string,
|
|
343
|
+
deferred: boolean,
|
|
344
|
+
/** dependency was deferred (= no used symbols (in immediate parents) & side-effect free) */
|
|
345
|
+
hasDeferred?: boolean,
|
|
346
|
+
usedSymbolsDown: Set<Symbol>,
|
|
347
|
+
/**
|
|
348
|
+
* a requested symbol -> either
|
|
349
|
+
* - if ambiguous (e.g. dependency to asset group with both CSS modules and JS asset): undefined
|
|
350
|
+
* - if external: null
|
|
351
|
+
* - the asset it resolved to, and the potentially renamed export name
|
|
352
|
+
*/
|
|
353
|
+
usedSymbolsUp: Map<
|
|
354
|
+
Symbol,
|
|
355
|
+
{|asset: ContentKey, symbol: ?Symbol|} | void | null,
|
|
356
|
+
>,
|
|
357
|
+
/*
|
|
358
|
+
* For the "down" pass, the resolutionAsset needs to be updated.
|
|
359
|
+
* This is set when the AssetGraphBuilder adds/removes/updates nodes.
|
|
360
|
+
*/
|
|
361
|
+
usedSymbolsDownDirty: boolean,
|
|
362
|
+
/**
|
|
363
|
+
* In the down pass, `usedSymbolsDown` changed. This needs to be propagated to the resolutionAsset
|
|
364
|
+
* in the up pass.
|
|
365
|
+
*/
|
|
366
|
+
usedSymbolsUpDirtyDown: boolean,
|
|
367
|
+
/**
|
|
368
|
+
* In the up pass, `usedSymbolsUp` changed. This needs to be propagated to the sourceAsset in the
|
|
369
|
+
* up pass.
|
|
370
|
+
*/
|
|
371
|
+
usedSymbolsUpDirtyUp: boolean,
|
|
372
|
+
/** dependency was excluded (= no used symbols (globally) & side-effect free) */
|
|
373
|
+
excluded: boolean,
|
|
374
|
+
|};
|
|
375
|
+
|
|
376
|
+
export type RootNode = {|id: ContentKey, +type: 'root', value: string | null|};
|
|
377
|
+
|
|
378
|
+
export type AssetRequestInput = {|
|
|
379
|
+
name?: string, // AssetGraph name, needed so that different graphs can isolated requests since the results are not stored
|
|
380
|
+
filePath: ProjectPath,
|
|
381
|
+
env: Environment,
|
|
382
|
+
isSource?: boolean,
|
|
383
|
+
canDefer?: boolean,
|
|
384
|
+
sideEffects?: boolean,
|
|
385
|
+
code?: string,
|
|
386
|
+
pipeline?: ?string,
|
|
387
|
+
optionsRef: SharedReference,
|
|
388
|
+
isURL?: boolean,
|
|
389
|
+
query?: ?string,
|
|
390
|
+
isSingleChangeRebuild?: boolean,
|
|
391
|
+
|};
|
|
392
|
+
|
|
393
|
+
export type AssetRequestResult = Array<Asset>;
|
|
394
|
+
// Asset group nodes are essentially used as placeholders for the results of an asset request
|
|
395
|
+
export type AssetGroup = $Rest<
|
|
396
|
+
AssetRequestInput,
|
|
397
|
+
{|optionsRef: SharedReference|},
|
|
398
|
+
>;
|
|
399
|
+
export type AssetGroupNode = {|
|
|
400
|
+
id: ContentKey,
|
|
401
|
+
+type: 'asset_group',
|
|
402
|
+
value: AssetGroup,
|
|
403
|
+
correspondingRequest?: string,
|
|
404
|
+
/** this node was deferred (= no used symbols (in immediate parents) & side-effect free) */
|
|
405
|
+
deferred?: boolean,
|
|
406
|
+
hasDeferred?: boolean,
|
|
407
|
+
usedSymbolsDownDirty: boolean,
|
|
408
|
+
|};
|
|
409
|
+
|
|
410
|
+
export type TransformationRequest = {|
|
|
411
|
+
...AssetGroup,
|
|
412
|
+
invalidateReason: number,
|
|
413
|
+
devDeps: Map<PackageName, string>,
|
|
414
|
+
invalidDevDeps: Array<{|
|
|
415
|
+
specifier: DependencySpecifier,
|
|
416
|
+
resolveFrom: ProjectPath,
|
|
417
|
+
|}>,
|
|
418
|
+
|};
|
|
419
|
+
|
|
420
|
+
export type DepPathRequestNode = {|
|
|
421
|
+
id: ContentKey,
|
|
422
|
+
+type: 'dep_path_request',
|
|
423
|
+
value: Dependency,
|
|
424
|
+
|};
|
|
425
|
+
|
|
426
|
+
export type AssetRequestNode = {|
|
|
427
|
+
id: ContentKey,
|
|
428
|
+
+type: 'asset_request',
|
|
429
|
+
value: AssetRequestInput,
|
|
430
|
+
|};
|
|
431
|
+
|
|
432
|
+
export type EntrySpecifierNode = {|
|
|
433
|
+
id: ContentKey,
|
|
434
|
+
+type: 'entry_specifier',
|
|
435
|
+
value: ProjectPath,
|
|
436
|
+
correspondingRequest?: string,
|
|
437
|
+
|};
|
|
438
|
+
|
|
439
|
+
export type Entry = {|
|
|
440
|
+
filePath: ProjectPath,
|
|
441
|
+
packagePath: ProjectPath,
|
|
442
|
+
target?: string,
|
|
443
|
+
loc?: ?InternalSourceLocation,
|
|
444
|
+
|};
|
|
445
|
+
|
|
446
|
+
export type EntryFileNode = {|
|
|
447
|
+
id: ContentKey,
|
|
448
|
+
+type: 'entry_file',
|
|
449
|
+
value: Entry,
|
|
450
|
+
correspondingRequest?: string,
|
|
451
|
+
|};
|
|
452
|
+
|
|
453
|
+
export type AssetGraphNode =
|
|
454
|
+
| AssetGroupNode
|
|
455
|
+
| AssetNode
|
|
456
|
+
| DependencyNode
|
|
457
|
+
| EntrySpecifierNode
|
|
458
|
+
| EntryFileNode
|
|
459
|
+
| RootNode;
|
|
460
|
+
|
|
461
|
+
export type BundleGraphNode =
|
|
462
|
+
| AssetNode
|
|
463
|
+
| DependencyNode
|
|
464
|
+
| EntrySpecifierNode
|
|
465
|
+
| EntryFileNode
|
|
466
|
+
| RootNode
|
|
467
|
+
| BundleGroupNode
|
|
468
|
+
| BundleNode;
|
|
469
|
+
|
|
470
|
+
export type InternalDevDepOptions = {|
|
|
471
|
+
specifier: DependencySpecifier,
|
|
472
|
+
resolveFrom: ProjectPath,
|
|
473
|
+
range?: ?SemverRange,
|
|
474
|
+
additionalInvalidations?: Array<{|
|
|
475
|
+
specifier: DependencySpecifier,
|
|
476
|
+
resolveFrom: ProjectPath,
|
|
477
|
+
range?: ?SemverRange,
|
|
478
|
+
|}>,
|
|
479
|
+
|};
|
|
480
|
+
|
|
481
|
+
export type Config = {|
|
|
482
|
+
id: string,
|
|
483
|
+
isSource: boolean,
|
|
484
|
+
searchPath: ProjectPath,
|
|
485
|
+
env: Environment,
|
|
486
|
+
cacheKey: ?string,
|
|
487
|
+
result: ConfigResult,
|
|
488
|
+
invalidateOnFileChange: Set<ProjectPath>,
|
|
489
|
+
invalidateOnConfigKeyChange: Array<{|
|
|
490
|
+
filePath: ProjectPath,
|
|
491
|
+
configKey: string,
|
|
492
|
+
|}>,
|
|
493
|
+
invalidateOnFileCreate: Array<InternalFileCreateInvalidation>,
|
|
494
|
+
invalidateOnEnvChange: Set<string>,
|
|
495
|
+
invalidateOnOptionChange: Set<string>,
|
|
496
|
+
devDeps: Array<InternalDevDepOptions>,
|
|
497
|
+
invalidateOnStartup: boolean,
|
|
498
|
+
invalidateOnBuild: boolean,
|
|
499
|
+
|};
|
|
500
|
+
|
|
501
|
+
export type EntryRequest = {|
|
|
502
|
+
specifier: DependencySpecifier,
|
|
503
|
+
result?: ProjectPath,
|
|
504
|
+
|};
|
|
505
|
+
|
|
506
|
+
export type EntryRequestNode = {|
|
|
507
|
+
id: ContentKey,
|
|
508
|
+
+type: 'entry_request',
|
|
509
|
+
value: string,
|
|
510
|
+
|};
|
|
511
|
+
|
|
512
|
+
export type TargetRequestNode = {|
|
|
513
|
+
id: ContentKey,
|
|
514
|
+
+type: 'target_request',
|
|
515
|
+
value: ProjectPath,
|
|
516
|
+
|};
|
|
517
|
+
|
|
518
|
+
export type CacheEntry = {|
|
|
519
|
+
filePath: ProjectPath,
|
|
520
|
+
env: Environment,
|
|
521
|
+
hash: string,
|
|
522
|
+
assets: Array<Asset>,
|
|
523
|
+
// Initial assets, pre-post processing
|
|
524
|
+
initialAssets: ?Array<Asset>,
|
|
525
|
+
|};
|
|
526
|
+
|
|
527
|
+
export type Bundle = {|
|
|
528
|
+
id: ContentKey,
|
|
529
|
+
publicId: ?string,
|
|
530
|
+
hashReference: string,
|
|
531
|
+
type: string,
|
|
532
|
+
env: Environment,
|
|
533
|
+
entryAssetIds: Array<ContentKey>,
|
|
534
|
+
mainEntryId: ?ContentKey,
|
|
535
|
+
needsStableName: ?boolean,
|
|
536
|
+
bundleBehavior: ?$Values<typeof BundleBehavior>,
|
|
537
|
+
isSplittable: ?boolean,
|
|
538
|
+
isPlaceholder?: boolean,
|
|
539
|
+
target: Target,
|
|
540
|
+
name: ?string,
|
|
541
|
+
displayName: ?string,
|
|
542
|
+
pipeline: ?string,
|
|
543
|
+
manualSharedBundle?: ?string,
|
|
544
|
+
|};
|
|
545
|
+
|
|
546
|
+
export type BundleNode = {|
|
|
547
|
+
id: ContentKey,
|
|
548
|
+
+type: 'bundle',
|
|
549
|
+
value: Bundle,
|
|
550
|
+
|};
|
|
551
|
+
|
|
552
|
+
export type BundleGroup = {|
|
|
553
|
+
target: Target,
|
|
554
|
+
entryAssetId: string,
|
|
555
|
+
|};
|
|
556
|
+
|
|
557
|
+
export type BundleGroupNode = {|
|
|
558
|
+
id: ContentKey,
|
|
559
|
+
+type: 'bundle_group',
|
|
560
|
+
value: BundleGroup,
|
|
561
|
+
|};
|
|
562
|
+
|
|
563
|
+
export type PackagedBundleInfo = {|
|
|
564
|
+
filePath: ProjectPath,
|
|
565
|
+
type: string,
|
|
566
|
+
stats: Stats,
|
|
567
|
+
|};
|
|
568
|
+
|
|
569
|
+
export type TransformationOpts = {|
|
|
570
|
+
request: AssetGroup,
|
|
571
|
+
optionsRef: SharedReference,
|
|
572
|
+
configCachePath: string,
|
|
573
|
+
|};
|
|
574
|
+
|
|
575
|
+
export type ValidationOpts = {|
|
|
576
|
+
requests: AssetGroup[],
|
|
577
|
+
optionsRef: SharedReference,
|
|
578
|
+
configCachePath: string,
|
|
579
|
+
|};
|
|
580
|
+
|
|
581
|
+
export type ReportFn = (event: ReporterEvent) => void | Promise<void>;
|