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

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
@@ -94,6 +94,13 @@ function _rust() {
94
94
  return data;
95
95
  }
96
96
  var _projectPath = require("./projectPath");
97
+ function _cache() {
98
+ const data = require("@atlaspack/cache");
99
+ _cache = function () {
100
+ return data;
101
+ };
102
+ return data;
103
+ }
97
104
  function _profiler() {
98
105
  const data = require("@atlaspack/profiler");
99
106
  _profiler = function () {
@@ -181,6 +188,11 @@ class Atlaspack {
181
188
  outputFS,
182
189
  ...options
183
190
  } = this.#initialOptions;
191
+ const lmdb = resolvedOptions.cache instanceof _cache().LMDBLiteCache ? resolvedOptions.cache.getNativeRef() : null;
192
+
193
+ // $FlowFixMe
194
+ const version = require('../package.json').version;
195
+ await (lmdb === null || lmdb === void 0 ? void 0 : lmdb.put('current_session_version', Buffer.from(version)));
184
196
  rustAtlaspack = new _atlaspackV.AtlaspackV3({
185
197
  ...options,
186
198
  corePath: _path().default.join(__dirname, '..'),
@@ -197,7 +209,8 @@ class Atlaspack {
197
209
  sourceMaps: resolvedOptions.defaultTargetOptions.sourceMaps,
198
210
  shouldOptimize: resolvedOptions.defaultTargetOptions.shouldOptimize,
199
211
  shouldScopeHoist: resolvedOptions.defaultTargetOptions.shouldScopeHoist
200
- }
212
+ },
213
+ lmdb: lmdb ?? null
201
214
  });
202
215
  }
203
216
  let {
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.AtlaspackV3 = void 0;
7
- var _WorkerPool = require("./WorkerPool");
8
7
  function _rust() {
9
8
  const data = require("@atlaspack/rust");
10
9
  _rust = function () {
@@ -12,12 +11,14 @@ function _rust() {
12
11
  };
13
12
  return data;
14
13
  }
14
+ var _WorkerPool = require("./WorkerPool");
15
15
  class AtlaspackV3 {
16
16
  constructor({
17
17
  fs,
18
18
  nodeWorkers,
19
19
  packageManager,
20
20
  threads,
21
+ lmdb,
21
22
  ...options
22
23
  }) {
23
24
  options.logLevel = options.logLevel || 'error';
@@ -26,13 +27,13 @@ class AtlaspackV3 {
26
27
  options.defaultTargetOptions.engines = options.defaultTargetOptions.engines || {
27
28
  browsers: []
28
29
  };
29
- this._internal = new (_rust().AtlaspackNapi)({
30
+ this._internal = _rust().AtlaspackNapi.create({
30
31
  fs,
31
32
  nodeWorkers,
32
33
  packageManager,
33
34
  threads,
34
35
  options
35
- });
36
+ }, lmdb);
36
37
  }
37
38
  async buildAssetGraph() {
38
39
  const workerIds = [];
@@ -111,12 +111,13 @@ async function resolveOptions(initialOptions) {
111
111
  // where symlinked dependencies outside the project root need to trigger HMR
112
112
  // updates. Default to the project root if not provided.
113
113
  let watchDir = initialOptions.watchDir != null ? _path().default.resolve(initialOptions.watchDir) : projectRoot;
114
- let cache = initialOptions.cache ?? (outputFS instanceof _fs().NodeFS ? (() => {
115
- if ((0, _featureFlags().getFeatureFlag)('useLmdbJsLite')) {
114
+ const needsRustLmdbCache = (0, _featureFlags().getFeatureFlag)('useLmdbJsLite') || (0, _featureFlags().getFeatureFlag)('atlaspackV3');
115
+ let cache = outputFS instanceof _fs().NodeFS ? (() => {
116
+ if (needsRustLmdbCache) {
116
117
  return new (_cache().LMDBLiteCache)(cacheDir);
117
118
  }
118
119
  return new (_cache().LMDBCache)(cacheDir);
119
- })() : new (_cache().FSCache)(outputFS, cacheDir));
120
+ })() : new (_cache().FSCache)(outputFS, cacheDir);
120
121
  let mode = initialOptions.mode ?? 'development';
121
122
  let shouldOptimize = (initialOptions === null || initialOptions === void 0 || (_initialOptions$defau = initialOptions.defaultTargetOptions) === null || _initialOptions$defau === void 0 ? void 0 : _initialOptions$defau.shouldOptimize) ?? mode === 'production';
122
123
  let publicUrl = (initialOptions === null || initialOptions === void 0 || (_initialOptions$defau2 = initialOptions.defaultTargetOptions) === null || _initialOptions$defau2 === void 0 ? void 0 : _initialOptions$defau2.publicUrl) ?? '/';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.12.1-canary.3489+4f4afe411",
3
+ "version": "2.12.1-canary.3491+a99ff5d2c",
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.3489+4f4afe411",
24
- "@atlaspack/cache": "2.12.1-canary.3489+4f4afe411",
25
- "@atlaspack/diagnostic": "2.12.1-canary.3489+4f4afe411",
26
- "@atlaspack/events": "2.12.1-canary.3489+4f4afe411",
27
- "@atlaspack/feature-flags": "2.12.1-canary.3489+4f4afe411",
28
- "@atlaspack/fs": "2.12.1-canary.3489+4f4afe411",
29
- "@atlaspack/graph": "3.2.1-canary.3489+4f4afe411",
30
- "@atlaspack/logger": "2.12.1-canary.3489+4f4afe411",
31
- "@atlaspack/package-manager": "2.12.1-canary.3489+4f4afe411",
32
- "@atlaspack/plugin": "2.12.1-canary.3489+4f4afe411",
33
- "@atlaspack/profiler": "2.12.1-canary.3489+4f4afe411",
34
- "@atlaspack/rust": "2.12.1-canary.3489+4f4afe411",
35
- "@atlaspack/types": "2.12.1-canary.3489+4f4afe411",
36
- "@atlaspack/utils": "2.12.1-canary.3489+4f4afe411",
37
- "@atlaspack/workers": "2.12.1-canary.3489+4f4afe411",
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",
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": "4f4afe411f74d3a3b3c2d74ef77f4e5c2fc40dcf"
68
+ "gitHead": "a99ff5d2c9aaeea8d96463c920ab0e86059dfbe7"
69
69
  }
package/src/Atlaspack.js CHANGED
@@ -55,6 +55,7 @@ import {
55
55
  toProjectPath,
56
56
  fromProjectPathRelative,
57
57
  } from './projectPath';
58
+ import {LMDBLiteCache} from '@atlaspack/cache';
58
59
  import {tracer} from '@atlaspack/profiler';
59
60
  import {setFeatureFlags, DEFAULT_FEATURE_FLAGS} from '@atlaspack/feature-flags';
60
61
  import {AtlaspackV3, FileSystemV3} from './atlaspack-v3';
@@ -133,6 +134,15 @@ export default class Atlaspack {
133
134
  // eslint-disable-next-line no-unused-vars
134
135
  let {entries, inputFS, outputFS, ...options} = this.#initialOptions;
135
136
 
137
+ const lmdb =
138
+ resolvedOptions.cache instanceof LMDBLiteCache
139
+ ? resolvedOptions.cache.getNativeRef()
140
+ : null;
141
+
142
+ // $FlowFixMe
143
+ const version = require('../package.json').version;
144
+ await lmdb?.put('current_session_version', Buffer.from(version));
145
+
136
146
  rustAtlaspack = new AtlaspackV3({
137
147
  ...options,
138
148
  corePath: path.join(__dirname, '..'),
@@ -155,6 +165,7 @@ export default class Atlaspack {
155
165
  shouldScopeHoist:
156
166
  resolvedOptions.defaultTargetOptions.shouldScopeHoist,
157
167
  },
168
+ lmdb: lmdb ?? null,
158
169
  });
159
170
  }
160
171
 
@@ -1,13 +1,21 @@
1
1
  // @flow
2
2
 
3
+ import {
4
+ AtlaspackNapi,
5
+ type Lmdb,
6
+ type AtlaspackNapiOptions,
7
+ } from '@atlaspack/rust';
3
8
  import {workerPool} from './WorkerPool';
4
- import {AtlaspackNapi, type AtlaspackNapiOptions} from '@atlaspack/rust';
5
9
 
6
10
  export type AtlaspackV3Options = {|
7
11
  fs?: AtlaspackNapiOptions['fs'],
8
12
  nodeWorkers?: number,
9
13
  packageManager?: AtlaspackNapiOptions['packageManager'],
10
14
  threads?: number,
15
+ /**
16
+ * A reference to LMDB lite's rust object
17
+ */
18
+ lmdb: Lmdb | null,
11
19
  ...AtlaspackNapiOptions['options'],
12
20
  |};
13
21
 
@@ -19,6 +27,7 @@ export class AtlaspackV3 {
19
27
  nodeWorkers,
20
28
  packageManager,
21
29
  threads,
30
+ lmdb,
22
31
  ...options
23
32
  }: AtlaspackV3Options) {
24
33
  options.logLevel = options.logLevel || 'error';
@@ -29,13 +38,16 @@ export class AtlaspackV3 {
29
38
  browsers: [],
30
39
  };
31
40
 
32
- this._internal = new AtlaspackNapi({
33
- fs,
34
- nodeWorkers,
35
- packageManager,
36
- threads,
37
- options,
38
- });
41
+ this._internal = AtlaspackNapi.create(
42
+ {
43
+ fs,
44
+ nodeWorkers,
45
+ packageManager,
46
+ threads,
47
+ options,
48
+ },
49
+ lmdb,
50
+ );
39
51
  }
40
52
 
41
53
  async buildAssetGraph(): Promise<any> {
@@ -109,18 +109,19 @@ export default async function resolveOptions(
109
109
  ? path.resolve(initialOptions.watchDir)
110
110
  : projectRoot;
111
111
 
112
+ const needsRustLmdbCache =
113
+ getFeatureFlag('useLmdbJsLite') || getFeatureFlag('atlaspackV3');
112
114
  const makeLMDBCache = () => {
113
- if (getFeatureFlag('useLmdbJsLite')) {
115
+ if (needsRustLmdbCache) {
114
116
  return new LMDBLiteCache(cacheDir);
115
117
  }
116
118
  return new LMDBCache(cacheDir);
117
119
  };
118
120
 
119
121
  let cache =
120
- initialOptions.cache ??
121
- (outputFS instanceof NodeFS
122
+ outputFS instanceof NodeFS
122
123
  ? makeLMDBCache()
123
- : new FSCache(outputFS, cacheDir));
124
+ : new FSCache(outputFS, cacheDir);
124
125
 
125
126
  let mode = initialOptions.mode ?? 'development';
126
127
  let shouldOptimize =