@atlaspack/core 2.16.2-canary.435 → 2.16.2-canary.438

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/dist/Atlaspack.js CHANGED
@@ -158,6 +158,7 @@ class Atlaspack {
158
158
  __classPrivateFieldSet(this, _Atlaspack_resolvedOptions, resolvedOptions, "f");
159
159
  let rustAtlaspack;
160
160
  if (resolvedOptions.featureFlags.atlaspackV3 ||
161
+ resolvedOptions.featureFlags.fullNative ||
161
162
  resolvedOptions.featureFlags.nativePackager) {
162
163
  // eslint-disable-next-line no-unused-vars
163
164
  let { entries, inputFS, outputFS, ...options } = __classPrivateFieldGet(this, _Atlaspack_initialOptions, "f");
@@ -374,12 +375,35 @@ class Atlaspack {
374
375
  type: 'buildStart',
375
376
  });
376
377
  __classPrivateFieldGet(this, _Atlaspack_requestTracker, "f").graph.invalidateOnBuildNodes();
377
- let request = (0, AtlaspackBuildRequest_1.default)({
378
- optionsRef: __classPrivateFieldGet(this, _Atlaspack_optionsRef, "f"),
379
- requestedAssetIds: __classPrivateFieldGet(this, _Atlaspack_requestedAssetIds, "f"),
380
- signal,
381
- });
382
- let { bundleGraph, bundleInfo, changedAssets, assetRequests, scopeHoistingStats, } = await __classPrivateFieldGet(this, _Atlaspack_requestTracker, "f").runRequest(request, { force: true });
378
+ let bundleGraph;
379
+ let bundleInfo;
380
+ let changedAssets;
381
+ let assetRequests;
382
+ let scopeHoistingStats;
383
+ if ((0, feature_flags_1.getFeatureFlag)('fullNative') && this.rustAtlaspack) {
384
+ let [result, error] = await this.rustAtlaspack.build();
385
+ if (error) {
386
+ throw new diagnostic_1.default({ diagnostic: error });
387
+ }
388
+ bundleGraph = result.bundleGraph;
389
+ bundleInfo = new Map();
390
+ changedAssets = result.changedAssets ?? new Map();
391
+ assetRequests = result.assetRequests ?? [];
392
+ }
393
+ else {
394
+ let request = (0, AtlaspackBuildRequest_1.default)({
395
+ optionsRef: __classPrivateFieldGet(this, _Atlaspack_optionsRef, "f"),
396
+ requestedAssetIds: __classPrivateFieldGet(this, _Atlaspack_requestedAssetIds, "f"),
397
+ signal,
398
+ });
399
+ ({
400
+ bundleGraph,
401
+ bundleInfo,
402
+ changedAssets,
403
+ assetRequests,
404
+ scopeHoistingStats,
405
+ } = await __classPrivateFieldGet(this, _Atlaspack_requestTracker, "f").runRequest(request, { force: true }));
406
+ }
383
407
  __classPrivateFieldGet(this, _Atlaspack_requestedAssetIds, "f").clear();
384
408
  await (0, dumpGraphToGraphViz_1.default)(
385
409
  // @ts-expect-error TS2345
@@ -54,6 +54,9 @@ class AtlaspackV3 {
54
54
  buildBundleGraph() {
55
55
  return (0, rust_1.atlaspackNapiBuildBundleGraph)(this._atlaspack_napi);
56
56
  }
57
+ build() {
58
+ return (0, rust_1.atlaspackNapiBuild)(this._atlaspack_napi);
59
+ }
57
60
  loadBundleGraph(bundleGraph) {
58
61
  const { nodesJson, edges, publicIdByAssetId, environmentsJson } = bundleGraph.serializeForNative();
59
62
  return (0, rust_1.atlaspackNapiLoadBundleGraph)(this._atlaspack_napi, nodesJson, edges, publicIdByAssetId, environmentsJson);
@@ -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
  }
@@ -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,
package/lib/Atlaspack.js CHANGED
@@ -197,7 +197,7 @@ class Atlaspack {
197
197
  });
198
198
  this.#resolvedOptions = resolvedOptions;
199
199
  let rustAtlaspack;
200
- if (resolvedOptions.featureFlags.atlaspackV3 || resolvedOptions.featureFlags.nativePackager) {
200
+ if (resolvedOptions.featureFlags.atlaspackV3 || resolvedOptions.featureFlags.fullNative || resolvedOptions.featureFlags.nativePackager) {
201
201
  // eslint-disable-next-line no-unused-vars
202
202
  let {
203
203
  entries,
@@ -428,20 +428,38 @@ class Atlaspack {
428
428
  type: 'buildStart'
429
429
  });
430
430
  this.#requestTracker.graph.invalidateOnBuildNodes();
431
- let request = (0, _AtlaspackBuildRequest.default)({
432
- optionsRef: this.#optionsRef,
433
- requestedAssetIds: this.#requestedAssetIds,
434
- signal
435
- });
436
- let {
437
- bundleGraph,
438
- bundleInfo,
439
- changedAssets,
440
- assetRequests,
441
- scopeHoistingStats
442
- } = await this.#requestTracker.runRequest(request, {
443
- force: true
444
- });
431
+ let bundleGraph;
432
+ let bundleInfo;
433
+ let changedAssets;
434
+ let assetRequests;
435
+ let scopeHoistingStats;
436
+ if ((0, _featureFlags().getFeatureFlag)('fullNative') && this.rustAtlaspack) {
437
+ let [result, error] = await this.rustAtlaspack.build();
438
+ if (error) {
439
+ throw new (_diagnostic().default)({
440
+ diagnostic: error
441
+ });
442
+ }
443
+ bundleGraph = result.bundleGraph;
444
+ bundleInfo = new Map();
445
+ changedAssets = result.changedAssets ?? new Map();
446
+ assetRequests = result.assetRequests ?? [];
447
+ } else {
448
+ let request = (0, _AtlaspackBuildRequest.default)({
449
+ optionsRef: this.#optionsRef,
450
+ requestedAssetIds: this.#requestedAssetIds,
451
+ signal
452
+ });
453
+ ({
454
+ bundleGraph,
455
+ bundleInfo,
456
+ changedAssets,
457
+ assetRequests,
458
+ scopeHoistingStats
459
+ } = await this.#requestTracker.runRequest(request, {
460
+ force: true
461
+ }));
462
+ }
445
463
  this.#requestedAssetIds.clear();
446
464
  await (0, _dumpGraphToGraphViz.default)(
447
465
  // @ts-expect-error TS2345
@@ -75,6 +75,9 @@ class AtlaspackV3 {
75
75
  buildBundleGraph() {
76
76
  return (0, _rust().atlaspackNapiBuildBundleGraph)(this._atlaspack_napi);
77
77
  }
78
+ build() {
79
+ return (0, _rust().atlaspackNapiBuild)(this._atlaspack_napi);
80
+ }
78
81
  loadBundleGraph(bundleGraph) {
79
82
  const {
80
83
  nodesJson,
@@ -37,5 +37,6 @@ class FileSystemV3 {
37
37
  return this.#fs.readFileSync(path, encoding);
38
38
  }
39
39
  });
40
+ writeFile = (0, _jsCallable.jsCallable)((path, contents) => this.#fs.writeFile(path, Buffer.from(contents)));
40
41
  }
41
42
  exports.FileSystemV3 = FileSystemV3;
@@ -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,
@@ -26,6 +26,7 @@ export declare class AtlaspackV3 {
26
26
  end(): void;
27
27
  buildAssetGraph(): Promise<any>;
28
28
  buildBundleGraph(): Promise<any>;
29
+ build(): 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]>;
@@ -9,4 +9,5 @@ export declare class FileSystemV3 implements FileSystem {
9
9
  isFile: JsCallable<[FilePath], boolean>;
10
10
  isDir: JsCallable<[FilePath], boolean>;
11
11
  readFile: JsCallable<[FilePath, Encoding], string>;
12
+ writeFile: JsCallable<[FilePath, number[]], Promise<void>>;
12
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.16.2-canary.435+b7b60dbe9",
3
+ "version": "2.16.2-canary.438+cba96b1a1",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -22,22 +22,22 @@
22
22
  "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
23
23
  },
24
24
  "dependencies": {
25
- "@atlaspack/build-cache": "2.13.3-canary.503+b7b60dbe9",
26
- "@atlaspack/cache": "3.1.1-canary.435+b7b60dbe9",
27
- "@atlaspack/diagnostic": "2.14.1-canary.503+b7b60dbe9",
28
- "@atlaspack/events": "2.14.1-canary.503+b7b60dbe9",
29
- "@atlaspack/feature-flags": "2.14.1-canary.503+b7b60dbe9",
30
- "@atlaspack/fs": "2.14.5-canary.435+b7b60dbe9",
31
- "@atlaspack/graph": "3.4.1-canary.503+b7b60dbe9",
32
- "@atlaspack/logger": "2.14.5-canary.435+b7b60dbe9",
33
- "@atlaspack/package-manager": "2.14.5-canary.435+b7b60dbe9",
34
- "@atlaspack/plugin": "2.14.5-canary.435+b7b60dbe9",
35
- "@atlaspack/profiler": "2.14.1-canary.503+b7b60dbe9",
36
- "@atlaspack/rust": "3.2.1-canary.435+b7b60dbe9",
37
- "@atlaspack/source-map": "3.3.1-canary.4214+b7b60dbe9",
38
- "@atlaspack/types": "2.14.5-canary.435+b7b60dbe9",
39
- "@atlaspack/utils": "2.14.5-canary.435+b7b60dbe9",
40
- "@atlaspack/workers": "2.14.5-canary.435+b7b60dbe9",
25
+ "@atlaspack/build-cache": "2.13.3-canary.506+cba96b1a1",
26
+ "@atlaspack/cache": "3.1.1-canary.438+cba96b1a1",
27
+ "@atlaspack/diagnostic": "2.14.1-canary.506+cba96b1a1",
28
+ "@atlaspack/events": "2.14.1-canary.506+cba96b1a1",
29
+ "@atlaspack/feature-flags": "2.14.1-canary.506+cba96b1a1",
30
+ "@atlaspack/fs": "2.14.5-canary.438+cba96b1a1",
31
+ "@atlaspack/graph": "3.4.1-canary.506+cba96b1a1",
32
+ "@atlaspack/logger": "2.14.5-canary.438+cba96b1a1",
33
+ "@atlaspack/package-manager": "2.14.5-canary.438+cba96b1a1",
34
+ "@atlaspack/plugin": "2.14.5-canary.438+cba96b1a1",
35
+ "@atlaspack/profiler": "2.14.1-canary.506+cba96b1a1",
36
+ "@atlaspack/rust": "3.2.1-canary.438+cba96b1a1",
37
+ "@atlaspack/source-map": "3.3.1-canary.4217+cba96b1a1",
38
+ "@atlaspack/types": "2.14.5-canary.438+cba96b1a1",
39
+ "@atlaspack/utils": "2.14.5-canary.438+cba96b1a1",
40
+ "@atlaspack/workers": "2.14.5-canary.438+cba96b1a1",
41
41
  "@mischnic/json-sourcemap": "^0.1.0",
42
42
  "base-x": "^3.0.8",
43
43
  "browserslist": "^4.6.6",
@@ -61,5 +61,5 @@
61
61
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
62
62
  },
63
63
  "type": "commonjs",
64
- "gitHead": "b7b60dbe90b275adfc24de429cdb86bf9d64936e"
64
+ "gitHead": "cba96b1a15c07703ee104bf2a2888cc715575cbd"
65
65
  }
package/src/Atlaspack.ts CHANGED
@@ -171,6 +171,7 @@ export default class Atlaspack {
171
171
  let rustAtlaspack: AtlaspackV3;
172
172
  if (
173
173
  resolvedOptions.featureFlags.atlaspackV3 ||
174
+ resolvedOptions.featureFlags.fullNative ||
174
175
  resolvedOptions.featureFlags.nativePackager
175
176
  ) {
176
177
  // eslint-disable-next-line no-unused-vars
@@ -433,19 +434,38 @@ export default class Atlaspack {
433
434
 
434
435
  this.#requestTracker.graph.invalidateOnBuildNodes();
435
436
 
436
- let request = createAtlaspackBuildRequest({
437
- optionsRef: this.#optionsRef,
438
- requestedAssetIds: this.#requestedAssetIds,
439
- signal,
440
- });
437
+ let bundleGraph: any;
438
+ let bundleInfo: Map<any, any>;
439
+ let changedAssets: Map<any, any>;
440
+ let assetRequests: Array<any>;
441
+ let scopeHoistingStats: any;
441
442
 
442
- let {
443
- bundleGraph,
444
- bundleInfo,
445
- changedAssets,
446
- assetRequests,
447
- scopeHoistingStats,
448
- } = await this.#requestTracker.runRequest(request, {force: true});
443
+ if (getFeatureFlag('fullNative') && this.rustAtlaspack) {
444
+ let [result, error] = await this.rustAtlaspack.build();
445
+
446
+ if (error) {
447
+ throw new ThrowableDiagnostic({diagnostic: error});
448
+ }
449
+
450
+ bundleGraph = result.bundleGraph;
451
+ bundleInfo = new Map();
452
+ changedAssets = result.changedAssets ?? new Map();
453
+ assetRequests = result.assetRequests ?? [];
454
+ } else {
455
+ let request = createAtlaspackBuildRequest({
456
+ optionsRef: this.#optionsRef,
457
+ requestedAssetIds: this.#requestedAssetIds,
458
+ signal,
459
+ });
460
+
461
+ ({
462
+ bundleGraph,
463
+ bundleInfo,
464
+ changedAssets,
465
+ assetRequests,
466
+ scopeHoistingStats,
467
+ } = await this.#requestTracker.runRequest(request, {force: true}));
468
+ }
449
469
 
450
470
  this.#requestedAssetIds.clear();
451
471
 
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  atlaspackNapiCreate,
3
+ atlaspackNapiBuild,
3
4
  atlaspackNapiBuildAssetGraph,
4
5
  atlaspackNapiBuildBundleGraph,
5
6
  atlaspackNapiRespondToFsEvents,
@@ -108,6 +109,10 @@ export class AtlaspackV3 {
108
109
  return atlaspackNapiBuildBundleGraph(this._atlaspack_napi) as Promise<any>;
109
110
  }
110
111
 
112
+ build(): Promise<any> {
113
+ return atlaspackNapiBuild(this._atlaspack_napi) as Promise<any>;
114
+ }
115
+
111
116
  loadBundleGraph(bundleGraph: BundleGraph): Promise<void> {
112
117
  const {nodesJson, edges, publicIdByAssetId, environmentsJson} =
113
118
  bundleGraph.serializeForNative();
@@ -51,4 +51,9 @@ export class FileSystemV3 implements FileSystem {
51
51
  }
52
52
  },
53
53
  );
54
+
55
+ writeFile: JsCallable<[FilePath, number[]], Promise<void>> = jsCallable(
56
+ (path: FilePath, contents: number[]) =>
57
+ this.#fs.writeFile(path, Buffer.from(contents)),
58
+ );
54
59
  }
@@ -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 {