@atlaspack/core 2.12.1-canary.3511 → 2.12.1-canary.3513
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 +16 -11
- package/lib/atlaspack-v3/worker/compat/mutable-asset.js +1 -1
- package/lib/atlaspack-v3/worker/worker.js +2 -2
- package/lib/requests/AssetGraphRequestRust.js +0 -4
- package/lib/resolveOptions.js +1 -6
- package/package.json +17 -17
- package/src/Atlaspack.js +11 -7
- package/src/atlaspack-v3/AtlaspackV3.js +1 -1
- package/src/atlaspack-v3/worker/compat/mutable-asset.js +2 -2
- package/src/atlaspack-v3/worker/worker.js +5 -3
- package/src/requests/AssetGraphRequestRust.js +1 -8
- package/src/resolveOptions.js +5 -10
package/lib/Atlaspack.js
CHANGED
|
@@ -86,21 +86,21 @@ function _sourceMap() {
|
|
|
86
86
|
};
|
|
87
87
|
return data;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
const data = require("@atlaspack/
|
|
91
|
-
|
|
89
|
+
function _cache() {
|
|
90
|
+
const data = require("@atlaspack/cache");
|
|
91
|
+
_cache = function () {
|
|
92
92
|
return data;
|
|
93
93
|
};
|
|
94
94
|
return data;
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
_cache = function () {
|
|
96
|
+
function _rust() {
|
|
97
|
+
const data = require("@atlaspack/rust");
|
|
98
|
+
_rust = function () {
|
|
100
99
|
return data;
|
|
101
100
|
};
|
|
102
101
|
return data;
|
|
103
102
|
}
|
|
103
|
+
var _projectPath = require("./projectPath");
|
|
104
104
|
function _profiler() {
|
|
105
105
|
const data = require("@atlaspack/profiler");
|
|
106
106
|
_profiler = function () {
|
|
@@ -189,11 +189,14 @@ class Atlaspack {
|
|
|
189
189
|
outputFS,
|
|
190
190
|
...options
|
|
191
191
|
} = this.#initialOptions;
|
|
192
|
-
|
|
192
|
+
if (!(resolvedOptions.cache instanceof _cache().LMDBLiteCache)) {
|
|
193
|
+
throw new Error('Atlaspack v3 must be run with lmdb lite cache');
|
|
194
|
+
}
|
|
195
|
+
const lmdb = resolvedOptions.cache.getNativeRef();
|
|
193
196
|
|
|
194
197
|
// $FlowFixMe
|
|
195
198
|
const version = require('../package.json').version;
|
|
196
|
-
await
|
|
199
|
+
await lmdb.put('current_session_version', Buffer.from(version));
|
|
197
200
|
rustAtlaspack = new _atlaspackV.AtlaspackV3({
|
|
198
201
|
...options,
|
|
199
202
|
corePath: _path().default.join(__dirname, '..'),
|
|
@@ -211,7 +214,7 @@ class Atlaspack {
|
|
|
211
214
|
shouldOptimize: resolvedOptions.defaultTargetOptions.shouldOptimize,
|
|
212
215
|
shouldScopeHoist: resolvedOptions.defaultTargetOptions.shouldScopeHoist
|
|
213
216
|
},
|
|
214
|
-
lmdb
|
|
217
|
+
lmdb
|
|
215
218
|
});
|
|
216
219
|
}
|
|
217
220
|
this.rustAtlaspack = rustAtlaspack;
|
|
@@ -569,7 +572,9 @@ class Atlaspack {
|
|
|
569
572
|
lazyExcludes: [],
|
|
570
573
|
requestedAssetIds: this.#requestedAssetIds
|
|
571
574
|
};
|
|
572
|
-
const result = await this.#requestTracker.runRequest(this.rustAtlaspack != null ? (0, _AssetGraphRequestRust.createAssetGraphRequestRust)(this.rustAtlaspack)(input) : (0, _AssetGraphRequest.default)(input)
|
|
575
|
+
const result = await this.#requestTracker.runRequest(this.rustAtlaspack != null ? (0, _AssetGraphRequestRust.createAssetGraphRequestRust)(this.rustAtlaspack)(input) : (0, _AssetGraphRequest.default)(input), {
|
|
576
|
+
force: true
|
|
577
|
+
});
|
|
573
578
|
_logger().default.info({
|
|
574
579
|
message: 'Done building asset graph!'
|
|
575
580
|
});
|
|
@@ -26,7 +26,7 @@ class MutableAsset {
|
|
|
26
26
|
set astGenerator(value) {
|
|
27
27
|
throw new Error('set MutableAsset.astGenerator');
|
|
28
28
|
}
|
|
29
|
-
constructor(asset,
|
|
29
|
+
constructor(asset, contents, env, fs) {
|
|
30
30
|
this.#inner = asset;
|
|
31
31
|
this.stats = asset.stats;
|
|
32
32
|
this.id = asset.id;
|
|
@@ -46,8 +46,8 @@ function _module() {
|
|
|
46
46
|
};
|
|
47
47
|
return data;
|
|
48
48
|
}
|
|
49
|
-
var _compat = require("./compat");
|
|
50
49
|
var _jsCallable = require("../jsCallable");
|
|
50
|
+
var _compat = require("./compat");
|
|
51
51
|
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); }
|
|
52
52
|
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; }
|
|
53
53
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -187,7 +187,7 @@ class AtlaspackWorker {
|
|
|
187
187
|
return Promise.resolve(resolvedPath);
|
|
188
188
|
};
|
|
189
189
|
const env = new _compat.Environment(napiEnv);
|
|
190
|
-
const mutableAsset = new _compat.MutableAsset(innerAsset,
|
|
190
|
+
const mutableAsset = new _compat.MutableAsset(innerAsset, contents, env, this.#fs);
|
|
191
191
|
const defaultOptions = {
|
|
192
192
|
logger: new _compat.PluginLogger(),
|
|
193
193
|
tracer: new _compat.PluginTracer(),
|
|
@@ -49,12 +49,8 @@ function createAssetGraphRequestRust(rustAtlaspack) {
|
|
|
49
49
|
}
|
|
50
50
|
let {
|
|
51
51
|
assetGraph,
|
|
52
|
-
cachedAssets,
|
|
53
52
|
changedAssets
|
|
54
53
|
} = getAssetGraph(serializedAssetGraph, options);
|
|
55
|
-
|
|
56
|
-
// TODO: Make it a bulk transaction
|
|
57
|
-
await Promise.all(Array.from(cachedAssets.entries(), ([id, code]) => options.cache.setBlob(id, Buffer.from(code))));
|
|
58
54
|
let changedAssetsPropagation = new Set(changedAssets.keys());
|
|
59
55
|
let errors = (0, _SymbolPropagation.propagateSymbols)({
|
|
60
56
|
options,
|
package/lib/resolveOptions.js
CHANGED
|
@@ -112,12 +112,7 @@ async function resolveOptions(initialOptions) {
|
|
|
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
114
|
const needsRustLmdbCache = (0, _featureFlags().getFeatureFlag)('useLmdbJsLite') || (0, _featureFlags().getFeatureFlag)('atlaspackV3');
|
|
115
|
-
let cache = outputFS instanceof _fs().NodeFS ? (()
|
|
116
|
-
if (needsRustLmdbCache) {
|
|
117
|
-
return new (_cache().LMDBLiteCache)(cacheDir);
|
|
118
|
-
}
|
|
119
|
-
return new (_cache().LMDBCache)(cacheDir);
|
|
120
|
-
})() : new (_cache().FSCache)(outputFS, cacheDir);
|
|
115
|
+
let cache = needsRustLmdbCache ? new (_cache().LMDBLiteCache)(cacheDir) : outputFS instanceof _fs().NodeFS ? new (_cache().LMDBCache)(cacheDir) : new (_cache().FSCache)(outputFS, cacheDir);
|
|
121
116
|
let mode = initialOptions.mode ?? 'development';
|
|
122
117
|
let shouldOptimize = (initialOptions === null || initialOptions === void 0 || (_initialOptions$defau = initialOptions.defaultTargetOptions) === null || _initialOptions$defau === void 0 ? void 0 : _initialOptions$defau.shouldOptimize) ?? mode === 'production';
|
|
123
118
|
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.
|
|
3
|
+
"version": "2.12.1-canary.3513+d6c07e874",
|
|
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.
|
|
24
|
-
"@atlaspack/cache": "2.12.1-canary.
|
|
25
|
-
"@atlaspack/diagnostic": "2.12.1-canary.
|
|
26
|
-
"@atlaspack/events": "2.12.1-canary.
|
|
27
|
-
"@atlaspack/feature-flags": "2.12.1-canary.
|
|
28
|
-
"@atlaspack/fs": "2.12.1-canary.
|
|
29
|
-
"@atlaspack/graph": "3.2.1-canary.
|
|
30
|
-
"@atlaspack/logger": "2.12.1-canary.
|
|
31
|
-
"@atlaspack/package-manager": "2.12.1-canary.
|
|
32
|
-
"@atlaspack/plugin": "2.12.1-canary.
|
|
33
|
-
"@atlaspack/profiler": "2.12.1-canary.
|
|
34
|
-
"@atlaspack/rust": "2.12.1-canary.
|
|
35
|
-
"@atlaspack/types": "2.12.1-canary.
|
|
36
|
-
"@atlaspack/utils": "2.12.1-canary.
|
|
37
|
-
"@atlaspack/workers": "2.12.1-canary.
|
|
23
|
+
"@atlaspack/build-cache": "2.12.1-canary.3513+d6c07e874",
|
|
24
|
+
"@atlaspack/cache": "2.12.1-canary.3513+d6c07e874",
|
|
25
|
+
"@atlaspack/diagnostic": "2.12.1-canary.3513+d6c07e874",
|
|
26
|
+
"@atlaspack/events": "2.12.1-canary.3513+d6c07e874",
|
|
27
|
+
"@atlaspack/feature-flags": "2.12.1-canary.3513+d6c07e874",
|
|
28
|
+
"@atlaspack/fs": "2.12.1-canary.3513+d6c07e874",
|
|
29
|
+
"@atlaspack/graph": "3.2.1-canary.3513+d6c07e874",
|
|
30
|
+
"@atlaspack/logger": "2.12.1-canary.3513+d6c07e874",
|
|
31
|
+
"@atlaspack/package-manager": "2.12.1-canary.3513+d6c07e874",
|
|
32
|
+
"@atlaspack/plugin": "2.12.1-canary.3513+d6c07e874",
|
|
33
|
+
"@atlaspack/profiler": "2.12.1-canary.3513+d6c07e874",
|
|
34
|
+
"@atlaspack/rust": "2.12.1-canary.3513+d6c07e874",
|
|
35
|
+
"@atlaspack/types": "2.12.1-canary.3513+d6c07e874",
|
|
36
|
+
"@atlaspack/utils": "2.12.1-canary.3513+d6c07e874",
|
|
37
|
+
"@atlaspack/workers": "2.12.1-canary.3513+d6c07e874",
|
|
38
38
|
"@mischnic/json-sourcemap": "^0.1.0",
|
|
39
39
|
"@parcel/source-map": "^2.1.1",
|
|
40
40
|
"base-x": "^3.0.8",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"browser": {
|
|
67
67
|
"./src/serializerCore.js": "./src/serializerCore.browser.js"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "d6c07e8745e6c4e28a22d26cd3884f41e4ff15b6"
|
|
70
70
|
}
|
package/src/Atlaspack.js
CHANGED
|
@@ -45,17 +45,18 @@ import {createEnvironment} from './Environment';
|
|
|
45
45
|
import {createDependency} from './Dependency';
|
|
46
46
|
import {Disposable} from '@atlaspack/events';
|
|
47
47
|
import {init as initSourcemaps} from '@parcel/source-map';
|
|
48
|
+
import {LMDBLiteCache} from '@atlaspack/cache';
|
|
48
49
|
import {
|
|
49
50
|
init as initRust,
|
|
50
51
|
initializeMonitoring,
|
|
51
52
|
closeMonitoring,
|
|
53
|
+
type Lmdb,
|
|
52
54
|
} from '@atlaspack/rust';
|
|
53
55
|
import {
|
|
54
56
|
fromProjectPath,
|
|
55
57
|
toProjectPath,
|
|
56
58
|
fromProjectPathRelative,
|
|
57
59
|
} from './projectPath';
|
|
58
|
-
import {LMDBLiteCache} from '@atlaspack/cache';
|
|
59
60
|
import {tracer} from '@atlaspack/profiler';
|
|
60
61
|
import {setFeatureFlags, DEFAULT_FEATURE_FLAGS} from '@atlaspack/feature-flags';
|
|
61
62
|
import {AtlaspackV3, FileSystemV3} from './atlaspack-v3';
|
|
@@ -138,14 +139,15 @@ export default class Atlaspack {
|
|
|
138
139
|
// eslint-disable-next-line no-unused-vars
|
|
139
140
|
let {entries, inputFS, outputFS, ...options} = this.#initialOptions;
|
|
140
141
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
if (!(resolvedOptions.cache instanceof LMDBLiteCache)) {
|
|
143
|
+
throw new Error('Atlaspack v3 must be run with lmdb lite cache');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const lmdb: Lmdb = resolvedOptions.cache.getNativeRef();
|
|
145
147
|
|
|
146
148
|
// $FlowFixMe
|
|
147
149
|
const version = require('../package.json').version;
|
|
148
|
-
await lmdb
|
|
150
|
+
await lmdb.put('current_session_version', Buffer.from(version));
|
|
149
151
|
|
|
150
152
|
rustAtlaspack = new AtlaspackV3({
|
|
151
153
|
...options,
|
|
@@ -169,7 +171,7 @@ export default class Atlaspack {
|
|
|
169
171
|
shouldScopeHoist:
|
|
170
172
|
resolvedOptions.defaultTargetOptions.shouldScopeHoist,
|
|
171
173
|
},
|
|
172
|
-
lmdb
|
|
174
|
+
lmdb,
|
|
173
175
|
});
|
|
174
176
|
}
|
|
175
177
|
this.rustAtlaspack = rustAtlaspack;
|
|
@@ -596,7 +598,9 @@ export default class Atlaspack {
|
|
|
596
598
|
this.rustAtlaspack != null
|
|
597
599
|
? createAssetGraphRequestRust(this.rustAtlaspack)(input)
|
|
598
600
|
: createAssetGraphRequestJS(input),
|
|
601
|
+
{force: true},
|
|
599
602
|
);
|
|
603
|
+
|
|
600
604
|
logger.info({message: 'Done building asset graph!'});
|
|
601
605
|
|
|
602
606
|
if (writeToCache) {
|
|
@@ -55,9 +55,9 @@ export class MutableAsset implements IMutableAsset {
|
|
|
55
55
|
|
|
56
56
|
constructor(
|
|
57
57
|
asset: InnerAsset,
|
|
58
|
-
fs: FileSystem,
|
|
59
|
-
env: Environment,
|
|
60
58
|
contents: Buffer,
|
|
59
|
+
env: Environment,
|
|
60
|
+
fs: FileSystem,
|
|
61
61
|
) {
|
|
62
62
|
this.#inner = asset;
|
|
63
63
|
this.stats = asset.stats;
|
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
import {parentPort} from 'worker_threads';
|
|
14
14
|
import * as module from 'module';
|
|
15
15
|
|
|
16
|
+
import {jsCallable} from '../jsCallable';
|
|
16
17
|
import {
|
|
17
18
|
Environment,
|
|
18
19
|
Dependency,
|
|
@@ -24,7 +25,6 @@ import {
|
|
|
24
25
|
bundleBehaviorMap,
|
|
25
26
|
dependencyPriorityMap,
|
|
26
27
|
} from './compat';
|
|
27
|
-
import {jsCallable} from '../jsCallable';
|
|
28
28
|
|
|
29
29
|
const CONFIG = Symbol.for('parcel-plugin-config');
|
|
30
30
|
|
|
@@ -181,13 +181,15 @@ export class AtlaspackWorker {
|
|
|
181
181
|
|
|
182
182
|
return Promise.resolve(resolvedPath);
|
|
183
183
|
};
|
|
184
|
+
|
|
184
185
|
const env = new Environment(napiEnv);
|
|
185
186
|
const mutableAsset = new MutableAsset(
|
|
186
187
|
innerAsset,
|
|
187
|
-
this.#fs,
|
|
188
|
-
env,
|
|
189
188
|
contents,
|
|
189
|
+
env,
|
|
190
|
+
this.#fs,
|
|
190
191
|
);
|
|
192
|
+
|
|
191
193
|
const defaultOptions = {
|
|
192
194
|
logger: new PluginLogger(),
|
|
193
195
|
tracer: new PluginTracer(),
|
|
@@ -48,18 +48,11 @@ export function createAssetGraphRequestRust(
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
let {assetGraph,
|
|
51
|
+
let {assetGraph, changedAssets} = getAssetGraph(
|
|
52
52
|
serializedAssetGraph,
|
|
53
53
|
options,
|
|
54
54
|
);
|
|
55
55
|
|
|
56
|
-
// TODO: Make it a bulk transaction
|
|
57
|
-
await Promise.all(
|
|
58
|
-
Array.from(cachedAssets.entries(), ([id, code]) =>
|
|
59
|
-
options.cache.setBlob(id, Buffer.from(code)),
|
|
60
|
-
),
|
|
61
|
-
);
|
|
62
|
-
|
|
63
56
|
let changedAssetsPropagation = new Set(changedAssets.keys());
|
|
64
57
|
let errors = propagateSymbols({
|
|
65
58
|
options,
|
package/src/resolveOptions.js
CHANGED
|
@@ -111,17 +111,12 @@ export default async function resolveOptions(
|
|
|
111
111
|
|
|
112
112
|
const needsRustLmdbCache =
|
|
113
113
|
getFeatureFlag('useLmdbJsLite') || getFeatureFlag('atlaspackV3');
|
|
114
|
-
const makeLMDBCache = () => {
|
|
115
|
-
if (needsRustLmdbCache) {
|
|
116
|
-
return new LMDBLiteCache(cacheDir);
|
|
117
|
-
}
|
|
118
|
-
return new LMDBCache(cacheDir);
|
|
119
|
-
};
|
|
120
114
|
|
|
121
|
-
let cache =
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
115
|
+
let cache = needsRustLmdbCache
|
|
116
|
+
? new LMDBLiteCache(cacheDir)
|
|
117
|
+
: outputFS instanceof NodeFS
|
|
118
|
+
? new LMDBCache(cacheDir)
|
|
119
|
+
: new FSCache(outputFS, cacheDir);
|
|
125
120
|
|
|
126
121
|
let mode = initialOptions.mode ?? 'development';
|
|
127
122
|
let shouldOptimize =
|