@atlaspack/core 2.12.1-canary.3491 → 2.12.1-canary.3493

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/Atlaspack.js CHANGED
@@ -116,6 +116,8 @@ function _featureFlags() {
116
116
  return data;
117
117
  }
118
118
  var _atlaspackV = require("./atlaspack-v3");
119
+ var _AssetGraphRequest = _interopRequireDefault(require("./requests/AssetGraphRequest"));
120
+ var _AssetGraphRequestRust = require("./requests/AssetGraphRequestRust");
119
121
  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); }
120
122
  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; }
121
123
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -130,7 +132,6 @@ class Atlaspack {
130
132
  #initialized /*: boolean*/ = false;
131
133
  #disposable /*: Disposable */;
132
134
  #initialOptions /*: InitialAtlaspackOptions */;
133
- #atlaspackV3;
134
135
  #reporterRunner /*: ReporterRunner*/;
135
136
  #resolvedOptions /*: ?AtlaspackOptions*/ = null;
136
137
  #optionsRef /*: SharedReference */;
@@ -213,6 +214,7 @@ class Atlaspack {
213
214
  lmdb: lmdb ?? null
214
215
  });
215
216
  }
217
+ this.rustAtlaspack = rustAtlaspack;
216
218
  let {
217
219
  config
218
220
  } = await (0, _AtlaspackConfigRequest.loadAtlaspackConfig)(resolvedOptions);
@@ -543,6 +545,30 @@ class Atlaspack {
543
545
  async unstable_invalidate() {
544
546
  await this._init();
545
547
  }
548
+
549
+ /**
550
+ * Build the asset graph
551
+ */
552
+ async unstable_buildAssetGraph() {
553
+ await this._init();
554
+ const input = {
555
+ optionsRef: this.#optionsRef,
556
+ name: 'Main',
557
+ entries: this.#config.options.entries,
558
+ shouldBuildLazily: false,
559
+ lazyIncludes: [],
560
+ lazyExcludes: [],
561
+ requestedAssetIds: this.#requestedAssetIds
562
+ };
563
+ await this.#requestTracker.runRequest(this.rustAtlaspack != null ? (0, _AssetGraphRequestRust.createAssetGraphRequestRust)(this.rustAtlaspack)(input) : (0, _AssetGraphRequest.default)(input));
564
+ // eslint-disable-next-line no-console
565
+ console.log('Done building asset graph!');
566
+ // eslint-disable-next-line no-console
567
+ console.log('Write request tracker to cache');
568
+ await this.writeRequestTrackerToCache();
569
+ // eslint-disable-next-line no-console
570
+ console.log('Done writing request tracker to cache');
571
+ }
546
572
  async unstable_transform(options) {
547
573
  var _options$env;
548
574
  if (!this.#initialized) {
@@ -42,11 +42,6 @@ function createAssetRequest(input) {
42
42
  }
43
43
  const type = 'asset_request';
44
44
  function getId(input) {
45
- // eslint-disable-next-line no-unused-vars
46
- let {
47
- optionsRef,
48
- ...hashInput
49
- } = input;
50
45
  return (0, _rust().hashString)(type + (0, _projectPath.fromProjectPathRelative)(input.filePath) + input.env.id + String(input.isSource) + String(input.sideEffects) + (input.code ?? '') + ':' + (input.pipeline ?? '') + ':' + (input.query ?? ''));
51
46
  }
52
47
  async function run({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.12.1-canary.3491+a99ff5d2c",
3
+ "version": "2.12.1-canary.3493+952f98b95",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,21 +20,21 @@
20
20
  "check-ts": "tsc --noEmit index.d.ts"
21
21
  },
22
22
  "dependencies": {
23
- "@atlaspack/build-cache": "2.12.1-canary.3491+a99ff5d2c",
24
- "@atlaspack/cache": "2.12.1-canary.3491+a99ff5d2c",
25
- "@atlaspack/diagnostic": "2.12.1-canary.3491+a99ff5d2c",
26
- "@atlaspack/events": "2.12.1-canary.3491+a99ff5d2c",
27
- "@atlaspack/feature-flags": "2.12.1-canary.3491+a99ff5d2c",
28
- "@atlaspack/fs": "2.12.1-canary.3491+a99ff5d2c",
29
- "@atlaspack/graph": "3.2.1-canary.3491+a99ff5d2c",
30
- "@atlaspack/logger": "2.12.1-canary.3491+a99ff5d2c",
31
- "@atlaspack/package-manager": "2.12.1-canary.3491+a99ff5d2c",
32
- "@atlaspack/plugin": "2.12.1-canary.3491+a99ff5d2c",
33
- "@atlaspack/profiler": "2.12.1-canary.3491+a99ff5d2c",
34
- "@atlaspack/rust": "2.12.1-canary.3491+a99ff5d2c",
35
- "@atlaspack/types": "2.12.1-canary.3491+a99ff5d2c",
36
- "@atlaspack/utils": "2.12.1-canary.3491+a99ff5d2c",
37
- "@atlaspack/workers": "2.12.1-canary.3491+a99ff5d2c",
23
+ "@atlaspack/build-cache": "2.12.1-canary.3493+952f98b95",
24
+ "@atlaspack/cache": "2.12.1-canary.3493+952f98b95",
25
+ "@atlaspack/diagnostic": "2.12.1-canary.3493+952f98b95",
26
+ "@atlaspack/events": "2.12.1-canary.3493+952f98b95",
27
+ "@atlaspack/feature-flags": "2.12.1-canary.3493+952f98b95",
28
+ "@atlaspack/fs": "2.12.1-canary.3493+952f98b95",
29
+ "@atlaspack/graph": "3.2.1-canary.3493+952f98b95",
30
+ "@atlaspack/logger": "2.12.1-canary.3493+952f98b95",
31
+ "@atlaspack/package-manager": "2.12.1-canary.3493+952f98b95",
32
+ "@atlaspack/plugin": "2.12.1-canary.3493+952f98b95",
33
+ "@atlaspack/profiler": "2.12.1-canary.3493+952f98b95",
34
+ "@atlaspack/rust": "2.12.1-canary.3493+952f98b95",
35
+ "@atlaspack/types": "2.12.1-canary.3493+952f98b95",
36
+ "@atlaspack/utils": "2.12.1-canary.3493+952f98b95",
37
+ "@atlaspack/workers": "2.12.1-canary.3493+952f98b95",
38
38
  "@mischnic/json-sourcemap": "^0.1.0",
39
39
  "@parcel/source-map": "^2.1.1",
40
40
  "base-x": "^3.0.8",
@@ -65,5 +65,5 @@
65
65
  "browser": {
66
66
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
67
67
  },
68
- "gitHead": "a99ff5d2c9aaeea8d96463c920ab0e86059dfbe7"
68
+ "gitHead": "952f98b95d68792f7bb29e77e55a2070ef5a3b10"
69
69
  }
package/src/Atlaspack.js CHANGED
@@ -59,6 +59,8 @@ import {LMDBLiteCache} from '@atlaspack/cache';
59
59
  import {tracer} from '@atlaspack/profiler';
60
60
  import {setFeatureFlags, DEFAULT_FEATURE_FLAGS} from '@atlaspack/feature-flags';
61
61
  import {AtlaspackV3, FileSystemV3} from './atlaspack-v3';
62
+ import createAssetGraphRequestJS from './requests/AssetGraphRequest';
63
+ import {createAssetGraphRequestRust} from './requests/AssetGraphRequestRust';
62
64
 
63
65
  registerCoreWithSerializer();
64
66
 
@@ -72,7 +74,6 @@ export default class Atlaspack {
72
74
  #initialized /*: boolean*/ = false;
73
75
  #disposable /*: Disposable */;
74
76
  #initialOptions /*: InitialAtlaspackOptions */;
75
- #atlaspackV3: AtlaspackV3;
76
77
  #reporterRunner /*: ReporterRunner*/;
77
78
  #resolvedOptions /*: ?AtlaspackOptions*/ = null;
78
79
  #optionsRef /*: SharedReference */;
@@ -94,6 +95,8 @@ export default class Atlaspack {
94
95
  #watcherCount /*: number*/ = 0;
95
96
  #requestedAssetIds /*: Set<string>*/ = new Set();
96
97
 
98
+ rustAtlaspack: AtlaspackV3 | null | void;
99
+
97
100
  isProfiling /*: boolean */;
98
101
 
99
102
  constructor(options: InitialAtlaspackOptions) {
@@ -168,6 +171,7 @@ export default class Atlaspack {
168
171
  lmdb: lmdb ?? null,
169
172
  });
170
173
  }
174
+ this.rustAtlaspack = rustAtlaspack;
171
175
 
172
176
  let {config} = await loadAtlaspackConfig(resolvedOptions);
173
177
  this.#config = new AtlaspackConfig(config, resolvedOptions);
@@ -563,6 +567,34 @@ export default class Atlaspack {
563
567
  await this._init();
564
568
  }
565
569
 
570
+ /**
571
+ * Build the asset graph
572
+ */
573
+ async unstable_buildAssetGraph(): Promise<void> {
574
+ await this._init();
575
+ const input = {
576
+ optionsRef: this.#optionsRef,
577
+ name: 'Main',
578
+ entries: this.#config.options.entries,
579
+ shouldBuildLazily: false,
580
+ lazyIncludes: [],
581
+ lazyExcludes: [],
582
+ requestedAssetIds: this.#requestedAssetIds,
583
+ };
584
+ await this.#requestTracker.runRequest(
585
+ this.rustAtlaspack != null
586
+ ? createAssetGraphRequestRust(this.rustAtlaspack)(input)
587
+ : createAssetGraphRequestJS(input),
588
+ );
589
+ // eslint-disable-next-line no-console
590
+ console.log('Done building asset graph!');
591
+ // eslint-disable-next-line no-console
592
+ console.log('Write request tracker to cache');
593
+ await this.writeRequestTrackerToCache();
594
+ // eslint-disable-next-line no-console
595
+ console.log('Done writing request tracker to cache');
596
+ }
597
+
566
598
  async unstable_transform(
567
599
  options: AtlaspackTransformOptions,
568
600
  ): Promise<Array<Asset>> {
@@ -48,8 +48,6 @@ export default function createAssetRequest(
48
48
  const type = 'asset_request';
49
49
 
50
50
  function getId(input: AssetRequestInput) {
51
- // eslint-disable-next-line no-unused-vars
52
- let {optionsRef, ...hashInput} = input;
53
51
  return hashString(
54
52
  type +
55
53
  fromProjectPathRelative(input.filePath) +