@atlaspack/core 2.36.0 → 2.38.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/CHANGELOG.md +83 -0
- package/dist/Atlaspack.js +41 -6
- package/dist/atlaspack-v3/AtlaspackV3.js +7 -4
- package/dist/atlaspack-v3/fs.js +1 -0
- package/dist/atlaspack-v3/worker/worker.js +11 -2
- package/dist/requests/AssetGraphRequestRust.js +5 -1
- package/dist/requests/AtlaspackBuildRequest.js +3 -0
- package/dist/requests/BundleGraphRequestRust.js +5 -1
- package/lib/Atlaspack.js +47 -15
- package/lib/atlaspack-v3/AtlaspackV3.js +7 -4
- package/lib/atlaspack-v3/fs.js +1 -0
- package/lib/atlaspack-v3/worker/worker.js +13 -2
- package/lib/requests/AssetGraphRequestRust.js +5 -1
- package/lib/requests/AtlaspackBuildRequest.js +9 -0
- package/lib/requests/BundleGraphRequestRust.js +5 -1
- package/lib/types/atlaspack-v3/AtlaspackV3.d.ts +3 -2
- package/lib/types/atlaspack-v3/fs.d.ts +1 -0
- package/package.json +15 -15
- package/src/Atlaspack.ts +54 -12
- package/src/atlaspack-v3/AtlaspackV3.ts +22 -4
- package/src/atlaspack-v3/fs.ts +5 -0
- package/src/atlaspack-v3/worker/worker.ts +11 -2
- package/src/requests/AssetGraphRequestRust.ts +5 -1
- package/src/requests/AtlaspackBuildRequest.ts +4 -0
- package/src/requests/BundleGraphRequestRust.ts +5 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
atlaspackNapiCreate,
|
|
3
|
+
atlaspackNapiBuild,
|
|
3
4
|
atlaspackNapiBuildAssetGraph,
|
|
4
5
|
atlaspackNapiBuildBundleGraph,
|
|
5
6
|
atlaspackNapiRespondToFsEvents,
|
|
@@ -100,12 +101,29 @@ export class AtlaspackV3 {
|
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
buildAssetGraph(
|
|
104
|
-
|
|
104
|
+
buildAssetGraph(
|
|
105
|
+
progressCallback?: (eventJson: string) => void,
|
|
106
|
+
): Promise<any> {
|
|
107
|
+
return atlaspackNapiBuildAssetGraph(
|
|
108
|
+
this._atlaspack_napi,
|
|
109
|
+
progressCallback,
|
|
110
|
+
) as Promise<any>;
|
|
105
111
|
}
|
|
106
112
|
|
|
107
|
-
buildBundleGraph(
|
|
108
|
-
|
|
113
|
+
buildBundleGraph(
|
|
114
|
+
progressCallback?: (eventJson: string) => void,
|
|
115
|
+
): Promise<any> {
|
|
116
|
+
return atlaspackNapiBuildBundleGraph(
|
|
117
|
+
this._atlaspack_napi,
|
|
118
|
+
progressCallback,
|
|
119
|
+
) as Promise<any>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
build(progressCallback: (eventJson: string) => void): Promise<any> {
|
|
123
|
+
return atlaspackNapiBuild(
|
|
124
|
+
this._atlaspack_napi,
|
|
125
|
+
progressCallback,
|
|
126
|
+
) as Promise<any>;
|
|
109
127
|
}
|
|
110
128
|
|
|
111
129
|
loadBundleGraph(bundleGraph: BundleGraph): Promise<void> {
|
package/src/atlaspack-v3/fs.ts
CHANGED
|
@@ -173,15 +173,24 @@ export class AtlaspackWorker {
|
|
|
173
173
|
resolution: {type: 'excluded'},
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
|
+
// A resolver may return a result without filePath to indicate it didn't
|
|
177
|
+
// resolve the dependency (equivalent to returning null). The JS-side
|
|
178
|
+
// PathRequest treats this as "try the next resolver".
|
|
179
|
+
if (!result.filePath) {
|
|
180
|
+
return {
|
|
181
|
+
invalidations: [],
|
|
182
|
+
resolution: {type: 'unresolved'},
|
|
183
|
+
};
|
|
184
|
+
}
|
|
176
185
|
|
|
177
186
|
return {
|
|
178
187
|
invalidations: [],
|
|
179
188
|
resolution: {
|
|
180
189
|
type: 'resolved',
|
|
181
|
-
filePath: result.filePath
|
|
190
|
+
filePath: result.filePath,
|
|
182
191
|
canDefer: result.canDefer || false,
|
|
183
192
|
sideEffects: result.sideEffects ?? true,
|
|
184
|
-
code: result.code
|
|
193
|
+
code: result.code ?? undefined,
|
|
185
194
|
meta: result.meta || undefined,
|
|
186
195
|
pipeline: result.pipeline || undefined,
|
|
187
196
|
priority: dependencyPriorityMap.intoNullable(result.priority),
|
|
@@ -7,6 +7,7 @@ import {getFeatureFlag} from '@atlaspack/feature-flags';
|
|
|
7
7
|
|
|
8
8
|
import AssetGraph from '../AssetGraph';
|
|
9
9
|
import type {AtlaspackV3} from '../atlaspack-v3';
|
|
10
|
+
import {report} from '../ReporterRunner';
|
|
10
11
|
import {requestTypes, StaticRunOpts} from '../RequestTracker';
|
|
11
12
|
import {propagateSymbols} from '../SymbolPropagation';
|
|
12
13
|
import type {
|
|
@@ -54,7 +55,10 @@ export function createAssetGraphRequestRust(
|
|
|
54
55
|
run: async (runInput) => {
|
|
55
56
|
let options = runInput.options;
|
|
56
57
|
let {assetGraphPromise, commitPromise} =
|
|
57
|
-
await rustAtlaspack.buildAssetGraph()
|
|
58
|
+
await rustAtlaspack.buildAssetGraph((eventJson: string) => {
|
|
59
|
+
let event = JSON.parse(eventJson);
|
|
60
|
+
report(event);
|
|
61
|
+
});
|
|
58
62
|
|
|
59
63
|
let [serializedAssetGraph, assetGraphError] =
|
|
60
64
|
(await assetGraphPromise) as [SerializedAssetGraphDelta, Error | null];
|
|
@@ -23,6 +23,7 @@ import {tracer} from '@atlaspack/profiler';
|
|
|
23
23
|
import {requestTypes} from '../RequestTracker';
|
|
24
24
|
import {getFeatureFlag} from '@atlaspack/feature-flags';
|
|
25
25
|
import {fromEnvironmentId} from '../EnvironmentManager';
|
|
26
|
+
import {tracer as atlaspackTracer} from '@atlaspack/logger';
|
|
26
27
|
|
|
27
28
|
type AtlaspackBuildRequestInput = {
|
|
28
29
|
optionsRef: SharedReference;
|
|
@@ -144,6 +145,8 @@ async function run({
|
|
|
144
145
|
});
|
|
145
146
|
|
|
146
147
|
let packagingMeasurement = tracer.createMeasurement('packaging');
|
|
148
|
+
const span = atlaspackTracer.enter('writeBundles');
|
|
149
|
+
|
|
147
150
|
let writeBundlesRequest = createWriteBundlesRequest({
|
|
148
151
|
bundleGraph,
|
|
149
152
|
optionsRef,
|
|
@@ -152,6 +155,7 @@ async function run({
|
|
|
152
155
|
let {bundleInfo, scopeHoistingStats} =
|
|
153
156
|
await api.runRequest(writeBundlesRequest);
|
|
154
157
|
packagingMeasurement && packagingMeasurement.end();
|
|
158
|
+
atlaspackTracer.exit(span);
|
|
155
159
|
assertSignalNotAborted(signal);
|
|
156
160
|
|
|
157
161
|
return {
|
|
@@ -7,6 +7,7 @@ import {instrument, instrumentAsync, PluginLogger} from '@atlaspack/logger';
|
|
|
7
7
|
import {getFeatureFlag} from '@atlaspack/feature-flags';
|
|
8
8
|
|
|
9
9
|
import InternalBundleGraph, {bundleGraphEdgeTypes} from '../BundleGraph';
|
|
10
|
+
import {report} from '../ReporterRunner';
|
|
10
11
|
import dumpGraphToGraphViz from '../dumpGraphToGraphViz';
|
|
11
12
|
import nullthrows from 'nullthrows';
|
|
12
13
|
import {hashString} from '@atlaspack/rust';
|
|
@@ -96,7 +97,10 @@ export default function createBundleGraphRequestRust(
|
|
|
96
97
|
invariant(rustAtlaspack, 'BundleGraphRequestRust requires rustAtlaspack');
|
|
97
98
|
|
|
98
99
|
let {bundleGraphPromise, commitPromise} =
|
|
99
|
-
await rustAtlaspack.buildBundleGraph()
|
|
100
|
+
await rustAtlaspack.buildBundleGraph((eventJson: string) => {
|
|
101
|
+
let event = JSON.parse(eventJson);
|
|
102
|
+
report(event);
|
|
103
|
+
});
|
|
100
104
|
let [serializedBundleGraph, bundleGraphError] =
|
|
101
105
|
(await bundleGraphPromise) as [SerializedBundleGraph, Error | null];
|
|
102
106
|
|