@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,88 @@
|
|
|
1
1
|
# @atlaspack/core
|
|
2
2
|
|
|
3
|
+
## 2.38.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1054](https://github.com/atlassian-labs/atlaspack/pull/1054) [`ffa1e42`](https://github.com/atlassian-labs/atlaspack/commit/ffa1e4276c22cc48b6be45ac81df8adde85f2237) Thanks [@marcins](https://github.com/marcins)! - - Implement plumbing to ensure data flows back out of build request that JS expects
|
|
8
|
+
- Implement a temporary namer to get an end-to-end test working
|
|
9
|
+
|
|
10
|
+
- [#1057](https://github.com/atlassian-labs/atlaspack/pull/1057) [`939d5bd`](https://github.com/atlassian-labs/atlaspack/commit/939d5bd41b3bcb5508f58ca41165d48122762e26) Thanks [@marcins](https://github.com/marcins)! - Set `SyntaxError` as the diagnostic name for parse/syntax errors from the JS and Tokens transformers.
|
|
11
|
+
|
|
12
|
+
Parse and syntax errors from the JS Transformer and Tokens Transformer now set `diagnostic.name` to `"SyntaxError"`, so consumers can reliably detect syntax/parse failures (e.g. for reporting or error handling). The Rust diagnostic type and NAPI `JsDiagnostic` include an optional `name` field; `error_buffer_to_diagnostics` sets it to `"SyntaxError"` for SWC parse errors, and both transformers pass it through to the thrown diagnostic. Integration tests assert that the first diagnostic has `name === 'SyntaxError'` for tokens and JS parse-error cases.
|
|
13
|
+
|
|
14
|
+
- [#1053](https://github.com/atlassian-labs/atlaspack/pull/1053) [`71981ea`](https://github.com/atlassian-labs/atlaspack/commit/71981eac258f7e6dfb40ec4b202d194f71c64ff1) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Add native build progress reporting.
|
|
15
|
+
|
|
16
|
+
Fires `BuildProgressEvent` from Rust requests back to JS reporters via a fire-and-forget
|
|
17
|
+
`ThreadsafeFunction` callback. Works in both `atlaspackV3` and `fullNative` build paths.
|
|
18
|
+
|
|
19
|
+
Events:
|
|
20
|
+
- `building` — per-asset progress from AssetGraphRequest (completeAssets / totalAssets)
|
|
21
|
+
- `bundling` — once from BuildRequest before bundle graph creation
|
|
22
|
+
- `packagingAndOptimizing` — ready for when native packaging is wired up
|
|
23
|
+
|
|
24
|
+
Adds `BuildingProgressEvent` type and CLI reporter handling.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- [#1056](https://github.com/atlassian-labs/atlaspack/pull/1056) [`0bb5830`](https://github.com/atlassian-labs/atlaspack/commit/0bb5830d1a7800e673f21ab020cd86bef873df9c) Thanks [@marcins](https://github.com/marcins)! - Fix native config loader rejecting TypeScript entry points in package.json.
|
|
29
|
+
|
|
30
|
+
The Rust package.json deserializer rejected `.ts` and `.tsx` extensions in builtin target fields
|
|
31
|
+
(`main`, `browser`, `module`), causing builds to fail with "Unexpected file type" errors when a
|
|
32
|
+
package.json uses TypeScript source entry points (e.g. `"main": "index.ts"`).
|
|
33
|
+
|
|
34
|
+
Additionally fixes EntryRequest to resolve the package path using `cwd()` instead of `project_root`,
|
|
35
|
+
matching the JS-side behavior for correct target resolution in monorepo setups.
|
|
36
|
+
|
|
37
|
+
- Updated dependencies [[`ffa1e42`](https://github.com/atlassian-labs/atlaspack/commit/ffa1e4276c22cc48b6be45ac81df8adde85f2237), [`ea9730d`](https://github.com/atlassian-labs/atlaspack/commit/ea9730dd953d0512c2ab97cbba810e7a297a29a6), [`939d5bd`](https://github.com/atlassian-labs/atlaspack/commit/939d5bd41b3bcb5508f58ca41165d48122762e26), [`71981ea`](https://github.com/atlassian-labs/atlaspack/commit/71981eac258f7e6dfb40ec4b202d194f71c64ff1), [`0bb5830`](https://github.com/atlassian-labs/atlaspack/commit/0bb5830d1a7800e673f21ab020cd86bef873df9c), [`cba96b1`](https://github.com/atlassian-labs/atlaspack/commit/cba96b1a15c07703ee104bf2a2888cc715575cbd)]:
|
|
38
|
+
- @atlaspack/rust@3.26.0
|
|
39
|
+
- @atlaspack/utils@3.4.0
|
|
40
|
+
- @atlaspack/cache@3.2.53
|
|
41
|
+
- @atlaspack/fs@2.15.53
|
|
42
|
+
- @atlaspack/logger@2.14.50
|
|
43
|
+
- @atlaspack/source-map@3.3.2
|
|
44
|
+
- @atlaspack/graph@3.6.20
|
|
45
|
+
- @atlaspack/plugin@2.14.58
|
|
46
|
+
- @atlaspack/profiler@2.15.19
|
|
47
|
+
- @atlaspack/types@2.15.48
|
|
48
|
+
- @atlaspack/workers@2.14.58
|
|
49
|
+
- @atlaspack/package-manager@2.14.58
|
|
50
|
+
|
|
51
|
+
## 2.37.0
|
|
52
|
+
|
|
53
|
+
### Minor Changes
|
|
54
|
+
|
|
55
|
+
- [#1050](https://github.com/atlassian-labs/atlaspack/pull/1050) [`c80be61`](https://github.com/atlassian-labs/atlaspack/commit/c80be618e42014208fed60b7a2dccc2e47d53aed) Thanks [@marcins](https://github.com/marcins)! - Add native PackagingRequest, implement temporary JS version for testing.
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- [#1051](https://github.com/atlassian-labs/atlaspack/pull/1051) [`2d3c616`](https://github.com/atlassian-labs/atlaspack/commit/2d3c616bb2ebef55d6850e8ca9eedf13c72f5386) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Add native end-to-end build pipeline via BuildRequest.
|
|
60
|
+
|
|
61
|
+
When the `fullNative` feature flag is enabled, the entire build pipeline (asset graph, bundle graph,
|
|
62
|
+
packaging) runs natively in Rust via a single NAPI call, bypassing the JS request tracker.
|
|
63
|
+
|
|
64
|
+
Key changes:
|
|
65
|
+
- Add `BuildRequest` composing `AssetGraphRequest` and `BundleGraphRequest` with a packaging stub
|
|
66
|
+
- Add `Atlaspack::build()` method and `atlaspack_napi_build` NAPI binding
|
|
67
|
+
- Add `fullNative` feature flag gating the native path in `Atlaspack.ts._build()`
|
|
68
|
+
- Packaging step is a no-op pending PackagingRequest implementation
|
|
69
|
+
|
|
70
|
+
- Updated dependencies [[`c80be61`](https://github.com/atlassian-labs/atlaspack/commit/c80be618e42014208fed60b7a2dccc2e47d53aed), [`2d3c616`](https://github.com/atlassian-labs/atlaspack/commit/2d3c616bb2ebef55d6850e8ca9eedf13c72f5386)]:
|
|
71
|
+
- @atlaspack/feature-flags@2.31.0
|
|
72
|
+
- @atlaspack/rust@3.25.0
|
|
73
|
+
- @atlaspack/build-cache@2.13.14
|
|
74
|
+
- @atlaspack/cache@3.2.52
|
|
75
|
+
- @atlaspack/fs@2.15.52
|
|
76
|
+
- @atlaspack/graph@3.6.19
|
|
77
|
+
- @atlaspack/utils@3.3.9
|
|
78
|
+
- @atlaspack/logger@2.14.49
|
|
79
|
+
- @atlaspack/source-map@3.3.1
|
|
80
|
+
- @atlaspack/package-manager@2.14.57
|
|
81
|
+
- @atlaspack/workers@2.14.57
|
|
82
|
+
- @atlaspack/plugin@2.14.57
|
|
83
|
+
- @atlaspack/profiler@2.15.18
|
|
84
|
+
- @atlaspack/types@2.15.47
|
|
85
|
+
|
|
3
86
|
## 2.36.0
|
|
4
87
|
|
|
5
88
|
### Minor Changes
|
package/dist/Atlaspack.js
CHANGED
|
@@ -85,6 +85,7 @@ const feature_flags_1 = require("@atlaspack/feature-flags");
|
|
|
85
85
|
const atlaspack_v3_1 = require("./atlaspack-v3");
|
|
86
86
|
const AssetGraphRequest_1 = __importDefault(require("./requests/AssetGraphRequest"));
|
|
87
87
|
const AssetGraphRequestRust_1 = require("./requests/AssetGraphRequestRust");
|
|
88
|
+
const BundleGraphRequestRust_1 = require("./requests/BundleGraphRequestRust");
|
|
88
89
|
const rustWorkerThreadDylibHack_1 = require("./rustWorkerThreadDylibHack");
|
|
89
90
|
(0, registerCoreWithSerializer_1.registerCoreWithSerializer)();
|
|
90
91
|
exports.INTERNAL_TRANSFORM = Symbol('internal_transform');
|
|
@@ -158,6 +159,7 @@ class Atlaspack {
|
|
|
158
159
|
__classPrivateFieldSet(this, _Atlaspack_resolvedOptions, resolvedOptions, "f");
|
|
159
160
|
let rustAtlaspack;
|
|
160
161
|
if (resolvedOptions.featureFlags.atlaspackV3 ||
|
|
162
|
+
resolvedOptions.featureFlags.fullNative ||
|
|
161
163
|
resolvedOptions.featureFlags.nativePackager) {
|
|
162
164
|
// eslint-disable-next-line no-unused-vars
|
|
163
165
|
let { entries, inputFS, outputFS, ...options } = __classPrivateFieldGet(this, _Atlaspack_initialOptions, "f");
|
|
@@ -374,12 +376,45 @@ class Atlaspack {
|
|
|
374
376
|
type: 'buildStart',
|
|
375
377
|
});
|
|
376
378
|
__classPrivateFieldGet(this, _Atlaspack_requestTracker, "f").graph.invalidateOnBuildNodes();
|
|
377
|
-
let
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
379
|
+
let bundleGraph;
|
|
380
|
+
let bundleInfo;
|
|
381
|
+
let changedAssets;
|
|
382
|
+
let assetRequests;
|
|
383
|
+
let scopeHoistingStats;
|
|
384
|
+
if ((0, feature_flags_1.getFeatureFlag)('fullNative') && this.rustAtlaspack) {
|
|
385
|
+
let [result, error] = await this.rustAtlaspack.build((eventJson) => {
|
|
386
|
+
let event = JSON.parse(eventJson);
|
|
387
|
+
__classPrivateFieldGet(this, _Atlaspack_reporterRunner, "f").report(event);
|
|
388
|
+
});
|
|
389
|
+
if (error) {
|
|
390
|
+
throw new diagnostic_1.default({ diagnostic: error });
|
|
391
|
+
}
|
|
392
|
+
({ bundleGraph, changedAssets } = (0, BundleGraphRequestRust_1.getBundleGraph)(result));
|
|
393
|
+
bundleInfo = new Map((result.bundleInfo ?? []).map((info) => [
|
|
394
|
+
info.bundleId,
|
|
395
|
+
{
|
|
396
|
+
filePath: (0, projectPath_1.toProjectPath)(options.projectRoot, info.filePath),
|
|
397
|
+
bundleId: info.bundleId,
|
|
398
|
+
type: info.type,
|
|
399
|
+
stats: { size: info.size, time: info.time },
|
|
400
|
+
},
|
|
401
|
+
]));
|
|
402
|
+
assetRequests = result.assetRequests ?? [];
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
let request = (0, AtlaspackBuildRequest_1.default)({
|
|
406
|
+
optionsRef: __classPrivateFieldGet(this, _Atlaspack_optionsRef, "f"),
|
|
407
|
+
requestedAssetIds: __classPrivateFieldGet(this, _Atlaspack_requestedAssetIds, "f"),
|
|
408
|
+
signal,
|
|
409
|
+
});
|
|
410
|
+
({
|
|
411
|
+
bundleGraph,
|
|
412
|
+
bundleInfo,
|
|
413
|
+
changedAssets,
|
|
414
|
+
assetRequests,
|
|
415
|
+
scopeHoistingStats,
|
|
416
|
+
} = await __classPrivateFieldGet(this, _Atlaspack_requestTracker, "f").runRequest(request, { force: true }));
|
|
417
|
+
}
|
|
383
418
|
__classPrivateFieldGet(this, _Atlaspack_requestedAssetIds, "f").clear();
|
|
384
419
|
await (0, dumpGraphToGraphViz_1.default)(
|
|
385
420
|
// @ts-expect-error TS2345
|
|
@@ -48,11 +48,14 @@ class AtlaspackV3 {
|
|
|
48
48
|
this._napiWorkerPool.shutdown();
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
buildAssetGraph() {
|
|
52
|
-
return (0, rust_1.atlaspackNapiBuildAssetGraph)(this._atlaspack_napi);
|
|
51
|
+
buildAssetGraph(progressCallback) {
|
|
52
|
+
return (0, rust_1.atlaspackNapiBuildAssetGraph)(this._atlaspack_napi, progressCallback);
|
|
53
53
|
}
|
|
54
|
-
buildBundleGraph() {
|
|
55
|
-
return (0, rust_1.atlaspackNapiBuildBundleGraph)(this._atlaspack_napi);
|
|
54
|
+
buildBundleGraph(progressCallback) {
|
|
55
|
+
return (0, rust_1.atlaspackNapiBuildBundleGraph)(this._atlaspack_napi, progressCallback);
|
|
56
|
+
}
|
|
57
|
+
build(progressCallback) {
|
|
58
|
+
return (0, rust_1.atlaspackNapiBuild)(this._atlaspack_napi, progressCallback);
|
|
56
59
|
}
|
|
57
60
|
loadBundleGraph(bundleGraph) {
|
|
58
61
|
const { nodesJson, edges, publicIdByAssetId, environmentsJson } = bundleGraph.serializeForNative();
|
package/dist/atlaspack-v3/fs.js
CHANGED
|
@@ -45,6 +45,7 @@ class FileSystemV3 {
|
|
|
45
45
|
return __classPrivateFieldGet(this, _FileSystemV3_fs, "f").readFileSync(path, encoding);
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
+
this.writeFile = (0, jsCallable_1.jsCallable)((path, contents) => __classPrivateFieldGet(this, _FileSystemV3_fs, "f").writeFile(path, Buffer.from(contents)));
|
|
48
49
|
__classPrivateFieldSet(this, _FileSystemV3_fs, fs, "f");
|
|
49
50
|
}
|
|
50
51
|
}
|
|
@@ -157,14 +157,23 @@ class AtlaspackWorker {
|
|
|
157
157
|
resolution: { type: 'excluded' },
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
|
+
// A resolver may return a result without filePath to indicate it didn't
|
|
161
|
+
// resolve the dependency (equivalent to returning null). The JS-side
|
|
162
|
+
// PathRequest treats this as "try the next resolver".
|
|
163
|
+
if (!result.filePath) {
|
|
164
|
+
return {
|
|
165
|
+
invalidations: [],
|
|
166
|
+
resolution: { type: 'unresolved' },
|
|
167
|
+
};
|
|
168
|
+
}
|
|
160
169
|
return {
|
|
161
170
|
invalidations: [],
|
|
162
171
|
resolution: {
|
|
163
172
|
type: 'resolved',
|
|
164
|
-
filePath: result.filePath
|
|
173
|
+
filePath: result.filePath,
|
|
165
174
|
canDefer: result.canDefer || false,
|
|
166
175
|
sideEffects: result.sideEffects ?? true,
|
|
167
|
-
code: result.code
|
|
176
|
+
code: result.code ?? undefined,
|
|
168
177
|
meta: result.meta || undefined,
|
|
169
178
|
pipeline: result.pipeline || undefined,
|
|
170
179
|
priority: compat_1.dependencyPriorityMap.intoNullable(result.priority),
|
|
@@ -43,6 +43,7 @@ const diagnostic_1 = __importDefault(require("@atlaspack/diagnostic"));
|
|
|
43
43
|
const logger_1 = __importStar(require("@atlaspack/logger"));
|
|
44
44
|
const feature_flags_1 = require("@atlaspack/feature-flags");
|
|
45
45
|
const AssetGraph_1 = __importDefault(require("../AssetGraph"));
|
|
46
|
+
const ReporterRunner_1 = require("../ReporterRunner");
|
|
46
47
|
const RequestTracker_1 = require("../RequestTracker");
|
|
47
48
|
const SymbolPropagation_1 = require("../SymbolPropagation");
|
|
48
49
|
const EnvironmentManager_1 = require("../EnvironmentManager");
|
|
@@ -55,7 +56,10 @@ function createAssetGraphRequestRust(rustAtlaspack) {
|
|
|
55
56
|
id: input.name,
|
|
56
57
|
run: async (runInput) => {
|
|
57
58
|
let options = runInput.options;
|
|
58
|
-
let { assetGraphPromise, commitPromise } = await rustAtlaspack.buildAssetGraph()
|
|
59
|
+
let { assetGraphPromise, commitPromise } = await rustAtlaspack.buildAssetGraph((eventJson) => {
|
|
60
|
+
let event = JSON.parse(eventJson);
|
|
61
|
+
(0, ReporterRunner_1.report)(event);
|
|
62
|
+
});
|
|
59
63
|
let [serializedAssetGraph, assetGraphError] = (await assetGraphPromise);
|
|
60
64
|
if (assetGraphError) {
|
|
61
65
|
throw new diagnostic_1.default({
|
|
@@ -18,6 +18,7 @@ const profiler_1 = require("@atlaspack/profiler");
|
|
|
18
18
|
const RequestTracker_1 = require("../RequestTracker");
|
|
19
19
|
const feature_flags_1 = require("@atlaspack/feature-flags");
|
|
20
20
|
const EnvironmentManager_1 = require("../EnvironmentManager");
|
|
21
|
+
const logger_1 = require("@atlaspack/logger");
|
|
21
22
|
function createAtlaspackBuildRequest(input) {
|
|
22
23
|
return {
|
|
23
24
|
type: RequestTracker_1.requestTypes.atlaspack_build_request,
|
|
@@ -78,12 +79,14 @@ async function run({ input, api, options, rustAtlaspack, }) {
|
|
|
78
79
|
])),
|
|
79
80
|
});
|
|
80
81
|
let packagingMeasurement = profiler_1.tracer.createMeasurement('packaging');
|
|
82
|
+
const span = logger_1.tracer.enter('writeBundles');
|
|
81
83
|
let writeBundlesRequest = (0, WriteBundlesRequest_1.default)({
|
|
82
84
|
bundleGraph,
|
|
83
85
|
optionsRef,
|
|
84
86
|
});
|
|
85
87
|
let { bundleInfo, scopeHoistingStats } = await api.runRequest(writeBundlesRequest);
|
|
86
88
|
packagingMeasurement && packagingMeasurement.end();
|
|
89
|
+
logger_1.tracer.exit(span);
|
|
87
90
|
(0, utils_1.assertSignalNotAborted)(signal);
|
|
88
91
|
return {
|
|
89
92
|
bundleGraph,
|
|
@@ -44,6 +44,7 @@ const graph_1 = require("@atlaspack/graph");
|
|
|
44
44
|
const logger_1 = require("@atlaspack/logger");
|
|
45
45
|
const feature_flags_1 = require("@atlaspack/feature-flags");
|
|
46
46
|
const BundleGraph_1 = __importStar(require("../BundleGraph"));
|
|
47
|
+
const ReporterRunner_1 = require("../ReporterRunner");
|
|
47
48
|
const dumpGraphToGraphViz_1 = __importDefault(require("../dumpGraphToGraphViz"));
|
|
48
49
|
const nullthrows_1 = __importDefault(require("nullthrows"));
|
|
49
50
|
const rust_1 = require("@atlaspack/rust");
|
|
@@ -64,7 +65,10 @@ function createBundleGraphRequestRust(input) {
|
|
|
64
65
|
run: async (runInput) => {
|
|
65
66
|
const { api, options, rustAtlaspack } = runInput;
|
|
66
67
|
(0, assert_1.default)(rustAtlaspack, 'BundleGraphRequestRust requires rustAtlaspack');
|
|
67
|
-
let { bundleGraphPromise, commitPromise } = await rustAtlaspack.buildBundleGraph()
|
|
68
|
+
let { bundleGraphPromise, commitPromise } = await rustAtlaspack.buildBundleGraph((eventJson) => {
|
|
69
|
+
let event = JSON.parse(eventJson);
|
|
70
|
+
(0, ReporterRunner_1.report)(event);
|
|
71
|
+
});
|
|
68
72
|
let [serializedBundleGraph, bundleGraphError] = (await bundleGraphPromise);
|
|
69
73
|
if (bundleGraphError) {
|
|
70
74
|
throw new diagnostic_1.default({ diagnostic: bundleGraphError });
|
package/lib/Atlaspack.js
CHANGED
|
@@ -118,6 +118,7 @@ function _featureFlags() {
|
|
|
118
118
|
var _atlaspackV = require("./atlaspack-v3");
|
|
119
119
|
var _AssetGraphRequest = _interopRequireDefault(require("./requests/AssetGraphRequest"));
|
|
120
120
|
var _AssetGraphRequestRust = require("./requests/AssetGraphRequestRust");
|
|
121
|
+
var _BundleGraphRequestRust = require("./requests/BundleGraphRequestRust");
|
|
121
122
|
var _rustWorkerThreadDylibHack = require("./rustWorkerThreadDylibHack");
|
|
122
123
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
123
124
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -197,7 +198,7 @@ class Atlaspack {
|
|
|
197
198
|
});
|
|
198
199
|
this.#resolvedOptions = resolvedOptions;
|
|
199
200
|
let rustAtlaspack;
|
|
200
|
-
if (resolvedOptions.featureFlags.atlaspackV3 || resolvedOptions.featureFlags.nativePackager) {
|
|
201
|
+
if (resolvedOptions.featureFlags.atlaspackV3 || resolvedOptions.featureFlags.fullNative || resolvedOptions.featureFlags.nativePackager) {
|
|
201
202
|
// eslint-disable-next-line no-unused-vars
|
|
202
203
|
let {
|
|
203
204
|
entries,
|
|
@@ -428,20 +429,51 @@ class Atlaspack {
|
|
|
428
429
|
type: 'buildStart'
|
|
429
430
|
});
|
|
430
431
|
this.#requestTracker.graph.invalidateOnBuildNodes();
|
|
431
|
-
let
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
432
|
+
let bundleGraph;
|
|
433
|
+
let bundleInfo;
|
|
434
|
+
let changedAssets;
|
|
435
|
+
let assetRequests;
|
|
436
|
+
let scopeHoistingStats;
|
|
437
|
+
if ((0, _featureFlags().getFeatureFlag)('fullNative') && this.rustAtlaspack) {
|
|
438
|
+
let [result, error] = await this.rustAtlaspack.build(eventJson => {
|
|
439
|
+
let event = JSON.parse(eventJson);
|
|
440
|
+
this.#reporterRunner.report(event);
|
|
441
|
+
});
|
|
442
|
+
if (error) {
|
|
443
|
+
throw new (_diagnostic().default)({
|
|
444
|
+
diagnostic: error
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
({
|
|
448
|
+
bundleGraph,
|
|
449
|
+
changedAssets
|
|
450
|
+
} = (0, _BundleGraphRequestRust.getBundleGraph)(result));
|
|
451
|
+
bundleInfo = new Map((result.bundleInfo ?? []).map(info => [info.bundleId, {
|
|
452
|
+
filePath: (0, _projectPath.toProjectPath)(options.projectRoot, info.filePath),
|
|
453
|
+
bundleId: info.bundleId,
|
|
454
|
+
type: info.type,
|
|
455
|
+
stats: {
|
|
456
|
+
size: info.size,
|
|
457
|
+
time: info.time
|
|
458
|
+
}
|
|
459
|
+
}]));
|
|
460
|
+
assetRequests = result.assetRequests ?? [];
|
|
461
|
+
} else {
|
|
462
|
+
let request = (0, _AtlaspackBuildRequest.default)({
|
|
463
|
+
optionsRef: this.#optionsRef,
|
|
464
|
+
requestedAssetIds: this.#requestedAssetIds,
|
|
465
|
+
signal
|
|
466
|
+
});
|
|
467
|
+
({
|
|
468
|
+
bundleGraph,
|
|
469
|
+
bundleInfo,
|
|
470
|
+
changedAssets,
|
|
471
|
+
assetRequests,
|
|
472
|
+
scopeHoistingStats
|
|
473
|
+
} = await this.#requestTracker.runRequest(request, {
|
|
474
|
+
force: true
|
|
475
|
+
}));
|
|
476
|
+
}
|
|
445
477
|
this.#requestedAssetIds.clear();
|
|
446
478
|
await (0, _dumpGraphToGraphViz.default)(
|
|
447
479
|
// @ts-expect-error TS2345
|
|
@@ -69,11 +69,14 @@ class AtlaspackV3 {
|
|
|
69
69
|
this._napiWorkerPool.shutdown();
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
buildAssetGraph() {
|
|
73
|
-
return (0, _rust().atlaspackNapiBuildAssetGraph)(this._atlaspack_napi);
|
|
72
|
+
buildAssetGraph(progressCallback) {
|
|
73
|
+
return (0, _rust().atlaspackNapiBuildAssetGraph)(this._atlaspack_napi, progressCallback);
|
|
74
74
|
}
|
|
75
|
-
buildBundleGraph() {
|
|
76
|
-
return (0, _rust().atlaspackNapiBuildBundleGraph)(this._atlaspack_napi);
|
|
75
|
+
buildBundleGraph(progressCallback) {
|
|
76
|
+
return (0, _rust().atlaspackNapiBuildBundleGraph)(this._atlaspack_napi, progressCallback);
|
|
77
|
+
}
|
|
78
|
+
build(progressCallback) {
|
|
79
|
+
return (0, _rust().atlaspackNapiBuild)(this._atlaspack_napi, progressCallback);
|
|
77
80
|
}
|
|
78
81
|
loadBundleGraph(bundleGraph) {
|
|
79
82
|
const {
|
package/lib/atlaspack-v3/fs.js
CHANGED
|
@@ -186,14 +186,25 @@ class AtlaspackWorker {
|
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
+
// A resolver may return a result without filePath to indicate it didn't
|
|
190
|
+
// resolve the dependency (equivalent to returning null). The JS-side
|
|
191
|
+
// PathRequest treats this as "try the next resolver".
|
|
192
|
+
if (!result.filePath) {
|
|
193
|
+
return {
|
|
194
|
+
invalidations: [],
|
|
195
|
+
resolution: {
|
|
196
|
+
type: 'unresolved'
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
189
200
|
return {
|
|
190
201
|
invalidations: [],
|
|
191
202
|
resolution: {
|
|
192
203
|
type: 'resolved',
|
|
193
|
-
filePath: result.filePath
|
|
204
|
+
filePath: result.filePath,
|
|
194
205
|
canDefer: result.canDefer || false,
|
|
195
206
|
sideEffects: result.sideEffects ?? true,
|
|
196
|
-
code: result.code
|
|
207
|
+
code: result.code ?? undefined,
|
|
197
208
|
meta: result.meta || undefined,
|
|
198
209
|
pipeline: result.pipeline || undefined,
|
|
199
210
|
priority: _compat.dependencyPriorityMap.intoNullable(result.priority),
|
|
@@ -34,6 +34,7 @@ function _featureFlags() {
|
|
|
34
34
|
return data;
|
|
35
35
|
}
|
|
36
36
|
var _AssetGraph = _interopRequireDefault(require("../AssetGraph"));
|
|
37
|
+
var _ReporterRunner = require("../ReporterRunner");
|
|
37
38
|
var _RequestTracker = require("../RequestTracker");
|
|
38
39
|
var _SymbolPropagation = require("../SymbolPropagation");
|
|
39
40
|
var _EnvironmentManager = require("../EnvironmentManager");
|
|
@@ -51,7 +52,10 @@ function createAssetGraphRequestRust(rustAtlaspack) {
|
|
|
51
52
|
let {
|
|
52
53
|
assetGraphPromise,
|
|
53
54
|
commitPromise
|
|
54
|
-
} = await rustAtlaspack.buildAssetGraph(
|
|
55
|
+
} = await rustAtlaspack.buildAssetGraph(eventJson => {
|
|
56
|
+
let event = JSON.parse(eventJson);
|
|
57
|
+
(0, _ReporterRunner.report)(event);
|
|
58
|
+
});
|
|
55
59
|
let [serializedAssetGraph, assetGraphError] = await assetGraphPromise;
|
|
56
60
|
if (assetGraphError) {
|
|
57
61
|
throw new (_diagnostic().default)({
|
|
@@ -30,6 +30,13 @@ function _featureFlags() {
|
|
|
30
30
|
return data;
|
|
31
31
|
}
|
|
32
32
|
var _EnvironmentManager = require("../EnvironmentManager");
|
|
33
|
+
function _logger() {
|
|
34
|
+
const data = require("@atlaspack/logger");
|
|
35
|
+
_logger = function () {
|
|
36
|
+
return data;
|
|
37
|
+
};
|
|
38
|
+
return data;
|
|
39
|
+
}
|
|
33
40
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
41
|
function createAtlaspackBuildRequest(input) {
|
|
35
42
|
return {
|
|
@@ -96,6 +103,7 @@ async function run({
|
|
|
96
103
|
changedAssets: new Map(Array.from(changedAssets).map(([id, asset]) => [id, (0, _Asset.assetFromValue)(asset, options)]))
|
|
97
104
|
});
|
|
98
105
|
let packagingMeasurement = _profiler().tracer.createMeasurement('packaging');
|
|
106
|
+
const span = _logger().tracer.enter('writeBundles');
|
|
99
107
|
let writeBundlesRequest = (0, _WriteBundlesRequest.default)({
|
|
100
108
|
bundleGraph,
|
|
101
109
|
optionsRef
|
|
@@ -105,6 +113,7 @@ async function run({
|
|
|
105
113
|
scopeHoistingStats
|
|
106
114
|
} = await api.runRequest(writeBundlesRequest);
|
|
107
115
|
packagingMeasurement && packagingMeasurement.end();
|
|
116
|
+
_logger().tracer.exit(span);
|
|
108
117
|
(0, _utils.assertSignalNotAborted)(signal);
|
|
109
118
|
return {
|
|
110
119
|
bundleGraph,
|
|
@@ -41,6 +41,7 @@ function _featureFlags() {
|
|
|
41
41
|
return data;
|
|
42
42
|
}
|
|
43
43
|
var _BundleGraph = _interopRequireWildcard(require("../BundleGraph"));
|
|
44
|
+
var _ReporterRunner = require("../ReporterRunner");
|
|
44
45
|
var _dumpGraphToGraphViz = _interopRequireDefault(require("../dumpGraphToGraphViz"));
|
|
45
46
|
function _nullthrows() {
|
|
46
47
|
const data = _interopRequireDefault(require("nullthrows"));
|
|
@@ -83,7 +84,10 @@ function createBundleGraphRequestRust(input) {
|
|
|
83
84
|
let {
|
|
84
85
|
bundleGraphPromise,
|
|
85
86
|
commitPromise
|
|
86
|
-
} = await rustAtlaspack.buildBundleGraph(
|
|
87
|
+
} = await rustAtlaspack.buildBundleGraph(eventJson => {
|
|
88
|
+
let event = JSON.parse(eventJson);
|
|
89
|
+
(0, _ReporterRunner.report)(event);
|
|
90
|
+
});
|
|
87
91
|
let [serializedBundleGraph, bundleGraphError] = await bundleGraphPromise;
|
|
88
92
|
if (bundleGraphError) {
|
|
89
93
|
throw new (_diagnostic().default)({
|
|
@@ -24,8 +24,9 @@ export declare class AtlaspackV3 {
|
|
|
24
24
|
constructor(atlaspack_napi: AtlaspackNapi, napiWorkerPool: INapiWorkerPool, isDefaultNapiWorkerPool: boolean);
|
|
25
25
|
static create({ fs, packageManager, threads, lmdb, napiWorkerPool, ...options }: AtlaspackV3Options): Promise<AtlaspackV3>;
|
|
26
26
|
end(): void;
|
|
27
|
-
buildAssetGraph(): Promise<any>;
|
|
28
|
-
buildBundleGraph(): Promise<any>;
|
|
27
|
+
buildAssetGraph(progressCallback?: (eventJson: string) => void): Promise<any>;
|
|
28
|
+
buildBundleGraph(progressCallback?: (eventJson: string) => void): Promise<any>;
|
|
29
|
+
build(progressCallback: (eventJson: string) => void): Promise<any>;
|
|
29
30
|
loadBundleGraph(bundleGraph: BundleGraph): Promise<void>;
|
|
30
31
|
updateBundleGraph(bundleGraph: BundleGraph, changedAssetIds: string[]): Promise<void>;
|
|
31
32
|
package(bundleId: string, options?: PackageOptions): Promise<[RunPackagerRunnerResult, Diagnostic | null]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.38.0",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,22 +23,22 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@mischnic/json-sourcemap": "^0.1.0",
|
|
26
|
-
"@atlaspack/build-cache": "2.13.
|
|
27
|
-
"@atlaspack/cache": "3.2.
|
|
26
|
+
"@atlaspack/build-cache": "2.13.14",
|
|
27
|
+
"@atlaspack/cache": "3.2.53",
|
|
28
28
|
"@atlaspack/diagnostic": "2.14.4",
|
|
29
29
|
"@atlaspack/events": "2.14.4",
|
|
30
|
-
"@atlaspack/feature-flags": "2.
|
|
31
|
-
"@atlaspack/fs": "2.15.
|
|
32
|
-
"@atlaspack/graph": "3.6.
|
|
33
|
-
"@atlaspack/logger": "2.14.
|
|
34
|
-
"@atlaspack/package-manager": "2.14.
|
|
35
|
-
"@atlaspack/plugin": "2.14.
|
|
36
|
-
"@atlaspack/profiler": "2.15.
|
|
37
|
-
"@atlaspack/rust": "3.
|
|
38
|
-
"@atlaspack/types": "2.15.
|
|
39
|
-
"@atlaspack/utils": "3.
|
|
40
|
-
"@atlaspack/workers": "2.14.
|
|
41
|
-
"@atlaspack/source-map": "3.3.
|
|
30
|
+
"@atlaspack/feature-flags": "2.31.0",
|
|
31
|
+
"@atlaspack/fs": "2.15.53",
|
|
32
|
+
"@atlaspack/graph": "3.6.20",
|
|
33
|
+
"@atlaspack/logger": "2.14.50",
|
|
34
|
+
"@atlaspack/package-manager": "2.14.58",
|
|
35
|
+
"@atlaspack/plugin": "2.14.58",
|
|
36
|
+
"@atlaspack/profiler": "2.15.19",
|
|
37
|
+
"@atlaspack/rust": "3.26.0",
|
|
38
|
+
"@atlaspack/types": "2.15.48",
|
|
39
|
+
"@atlaspack/utils": "3.4.0",
|
|
40
|
+
"@atlaspack/workers": "2.14.58",
|
|
41
|
+
"@atlaspack/source-map": "3.3.2",
|
|
42
42
|
"base-x": "^3.0.8",
|
|
43
43
|
"browserslist": "^4.6.6",
|
|
44
44
|
"clone": "^2.1.1",
|
package/src/Atlaspack.ts
CHANGED
|
@@ -67,6 +67,7 @@ import {AtlaspackV3, FileSystemV3} from './atlaspack-v3';
|
|
|
67
67
|
import createAssetGraphRequestJS from './requests/AssetGraphRequest';
|
|
68
68
|
import {createAssetGraphRequestRust} from './requests/AssetGraphRequestRust';
|
|
69
69
|
import type {AssetGraphRequestResult} from './requests/AssetGraphRequest';
|
|
70
|
+
import {getBundleGraph} from './requests/BundleGraphRequestRust';
|
|
70
71
|
import {loadRustWorkerThreadDylibHack} from './rustWorkerThreadDylibHack';
|
|
71
72
|
|
|
72
73
|
registerCoreWithSerializer();
|
|
@@ -171,6 +172,7 @@ export default class Atlaspack {
|
|
|
171
172
|
let rustAtlaspack: AtlaspackV3;
|
|
172
173
|
if (
|
|
173
174
|
resolvedOptions.featureFlags.atlaspackV3 ||
|
|
175
|
+
resolvedOptions.featureFlags.fullNative ||
|
|
174
176
|
resolvedOptions.featureFlags.nativePackager
|
|
175
177
|
) {
|
|
176
178
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -433,19 +435,59 @@ export default class Atlaspack {
|
|
|
433
435
|
|
|
434
436
|
this.#requestTracker.graph.invalidateOnBuildNodes();
|
|
435
437
|
|
|
436
|
-
let
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
438
|
+
let bundleGraph: any;
|
|
439
|
+
let bundleInfo: Map<any, any>;
|
|
440
|
+
let changedAssets: Map<any, any>;
|
|
441
|
+
let assetRequests: Array<any>;
|
|
442
|
+
let scopeHoistingStats: any;
|
|
443
|
+
|
|
444
|
+
if (getFeatureFlag('fullNative') && this.rustAtlaspack) {
|
|
445
|
+
let [result, error] = await this.rustAtlaspack.build(
|
|
446
|
+
(eventJson: string) => {
|
|
447
|
+
let event = JSON.parse(eventJson);
|
|
448
|
+
this.#reporterRunner.report(event);
|
|
449
|
+
},
|
|
450
|
+
);
|
|
451
|
+
|
|
452
|
+
if (error) {
|
|
453
|
+
throw new ThrowableDiagnostic({diagnostic: error});
|
|
454
|
+
}
|
|
455
|
+
({bundleGraph, changedAssets} = getBundleGraph(result));
|
|
456
|
+
bundleInfo = new Map(
|
|
457
|
+
(result.bundleInfo ?? []).map(
|
|
458
|
+
(info: {
|
|
459
|
+
bundleId: string;
|
|
460
|
+
filePath: string;
|
|
461
|
+
type: string;
|
|
462
|
+
size: number;
|
|
463
|
+
time: number;
|
|
464
|
+
}) => [
|
|
465
|
+
info.bundleId,
|
|
466
|
+
{
|
|
467
|
+
filePath: toProjectPath(options.projectRoot, info.filePath),
|
|
468
|
+
bundleId: info.bundleId,
|
|
469
|
+
type: info.type,
|
|
470
|
+
stats: {size: info.size, time: info.time},
|
|
471
|
+
},
|
|
472
|
+
],
|
|
473
|
+
),
|
|
474
|
+
);
|
|
475
|
+
assetRequests = result.assetRequests ?? [];
|
|
476
|
+
} else {
|
|
477
|
+
let request = createAtlaspackBuildRequest({
|
|
478
|
+
optionsRef: this.#optionsRef,
|
|
479
|
+
requestedAssetIds: this.#requestedAssetIds,
|
|
480
|
+
signal,
|
|
481
|
+
});
|
|
441
482
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
483
|
+
({
|
|
484
|
+
bundleGraph,
|
|
485
|
+
bundleInfo,
|
|
486
|
+
changedAssets,
|
|
487
|
+
assetRequests,
|
|
488
|
+
scopeHoistingStats,
|
|
489
|
+
} = await this.#requestTracker.runRequest(request, {force: true}));
|
|
490
|
+
}
|
|
449
491
|
|
|
450
492
|
this.#requestedAssetIds.clear();
|
|
451
493
|
|