@atlaspack/core 2.13.2-dev.3689 → 2.14.1-canary.3710
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 +61 -0
- package/lib/Atlaspack.js +4 -3
- package/lib/atlaspack-v3/AtlaspackV3.js +13 -4
- package/lib/requests/WriteBundlesRequest.js +16 -2
- package/package.json +19 -18
- package/src/Atlaspack.js +3 -2
- package/src/atlaspack-v3/AtlaspackV3.js +25 -9
- package/src/requests/WriteBundlesRequest.js +31 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,66 @@
|
|
|
1
1
|
# @atlaspack/core
|
|
2
2
|
|
|
3
|
+
## 2.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#339](https://github.com/atlassian-labs/atlaspack/pull/339) [`bfe81e5`](https://github.com/atlassian-labs/atlaspack/commit/bfe81e551c4e4bb2cac7fc4745222e66962c1728) Thanks [@yamadapc](https://github.com/yamadapc)! - Update cache invalidation metrics with build type
|
|
8
|
+
|
|
9
|
+
- [#383](https://github.com/atlassian-labs/atlaspack/pull/383) [`8386ca4`](https://github.com/atlassian-labs/atlaspack/commit/8386ca4dc318688fbed1af3bbebf2af3e7d24552) Thanks [@benjervis](https://github.com/benjervis)! - `loadPlugin` no longer returns a `range` field. This field was only set by looking up a package's `parcelDependencies`, which no longer exist.
|
|
10
|
+
|
|
11
|
+
- [#358](https://github.com/atlassian-labs/atlaspack/pull/358) [`7e21377`](https://github.com/atlassian-labs/atlaspack/commit/7e21377914e8091d484f67cb11052a1efd2227e3) Thanks [@benjervis](https://github.com/benjervis)! - Add a step to the BundleGraphRequest that will scan for assets that have a transitive dep on `@confluence/loadable` and marks them as having side effects.
|
|
12
|
+
This allows the inline requires optimizer to be applied to projects that don't necessarily declare side effects correctly.
|
|
13
|
+
|
|
14
|
+
- [#366](https://github.com/atlassian-labs/atlaspack/pull/366) [`4812d0f`](https://github.com/atlassian-labs/atlaspack/commit/4812d0f7400af0f8416f1b7175ecb87700860a68) Thanks [@alshdavid](https://github.com/alshdavid)! - Added NapiWorkerPool
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#401](https://github.com/atlassian-labs/atlaspack/pull/401) [`cd964ee`](https://github.com/atlassian-labs/atlaspack/commit/cd964eed5a330ae63733656ded691d1ea3afe4e3) Thanks [@MonicaOlejniczak](https://github.com/MonicaOlejniczak)! - Fix respondToFsEvents return type
|
|
19
|
+
|
|
20
|
+
- [#413](https://github.com/atlassian-labs/atlaspack/pull/413) [`1953d1b`](https://github.com/atlassian-labs/atlaspack/commit/1953d1bec266a39dc4bfce5f6c7959e77e63411e) Thanks [@pancaspe87](https://github.com/pancaspe87)! - Patch absolute paths
|
|
21
|
+
|
|
22
|
+
- [#416](https://github.com/atlassian-labs/atlaspack/pull/416) [`1de1c81`](https://github.com/atlassian-labs/atlaspack/commit/1de1c8138fbe4d38a64aa1f3c22a70aad59fb5bb) Thanks [@alshdavid](https://github.com/alshdavid)! - Replace require.resolve with path.join
|
|
23
|
+
|
|
24
|
+
- [#362](https://github.com/atlassian-labs/atlaspack/pull/362) [`726b0b0`](https://github.com/atlassian-labs/atlaspack/commit/726b0b02f4ba47426dd38d809036517477b8b1cd) Thanks [@alshdavid](https://github.com/alshdavid)! - Added conditional bundling config to native js transformer
|
|
25
|
+
|
|
26
|
+
- [#404](https://github.com/atlassian-labs/atlaspack/pull/404) [`be88bd9`](https://github.com/atlassian-labs/atlaspack/commit/be88bd9fc4cbc1c579685bf2e5d834b4136a6c7c) Thanks [@benjervis](https://github.com/benjervis)! - Removes the dependency check within the config default `package.json`.
|
|
27
|
+
|
|
28
|
+
Any dependencies that used to be auto-installed from `parcelDependencies` should
|
|
29
|
+
now be installed in the project root.
|
|
30
|
+
|
|
31
|
+
- [#415](https://github.com/atlassian-labs/atlaspack/pull/415) [`43113f8`](https://github.com/atlassian-labs/atlaspack/commit/43113f8f00232c5a52169a3f11f846d6e4d94b0a) Thanks [@yamadapc](https://github.com/yamadapc)! - Add feature-flag to fix supporting source-maps for inline bundles
|
|
32
|
+
|
|
33
|
+
- [#367](https://github.com/atlassian-labs/atlaspack/pull/367) [`3650f7c`](https://github.com/atlassian-labs/atlaspack/commit/3650f7c9ab803b5ae20b223e82b2268a1b614e43) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Add basic incremental build support to V3
|
|
34
|
+
|
|
35
|
+
- [#414](https://github.com/atlassian-labs/atlaspack/pull/414) [`eff9809`](https://github.com/atlassian-labs/atlaspack/commit/eff98093703b9999a511b87a19562f5aaccfcb53) Thanks [@alshdavid](https://github.com/alshdavid)! - Added type:commonjs to package.json files
|
|
36
|
+
|
|
37
|
+
- [#354](https://github.com/atlassian-labs/atlaspack/pull/354) [`a4990f6`](https://github.com/atlassian-labs/atlaspack/commit/a4990f6f32045b95d0e6da97f692269a38e13533) Thanks [@yamadapc](https://github.com/yamadapc)! - Log errors to load the graph including bail-out errors
|
|
38
|
+
|
|
39
|
+
- [#359](https://github.com/atlassian-labs/atlaspack/pull/359) [`c2ef915`](https://github.com/atlassian-labs/atlaspack/commit/c2ef915dc54784ce4b8180025ac1b2e13b375002) Thanks [@alshdavid](https://github.com/alshdavid)! - Added support for string featureflags to native
|
|
40
|
+
|
|
41
|
+
- [#340](https://github.com/atlassian-labs/atlaspack/pull/340) [`1b1ef6e`](https://github.com/atlassian-labs/atlaspack/commit/1b1ef6e64fdfcf1c1c744e90e8c6568b0fd0e072) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Ensure bundle graph request errors show up correctly
|
|
42
|
+
|
|
43
|
+
- [#402](https://github.com/atlassian-labs/atlaspack/pull/402) [`cc66aaa`](https://github.com/atlassian-labs/atlaspack/commit/cc66aaa66d67dd0cb89e083f387a278e74aad3f0) Thanks [@alshdavid](https://github.com/alshdavid)! - Initialize AtlaspackNative async
|
|
44
|
+
|
|
45
|
+
- [#373](https://github.com/atlassian-labs/atlaspack/pull/373) [`a1e3c87`](https://github.com/atlassian-labs/atlaspack/commit/a1e3c87f25c8d108807fb8ea0e91e8effb2c71a7) Thanks [@yamadapc](https://github.com/yamadapc)! - Add config request ID into the identifier registry
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [[`bfe81e5`](https://github.com/atlassian-labs/atlaspack/commit/bfe81e551c4e4bb2cac7fc4745222e66962c1728), [`fa4fcf6`](https://github.com/atlassian-labs/atlaspack/commit/fa4fcf69a82b0a3727066ada6e93a149b259936e), [`cd964ee`](https://github.com/atlassian-labs/atlaspack/commit/cd964eed5a330ae63733656ded691d1ea3afe4e3), [`1953d1b`](https://github.com/atlassian-labs/atlaspack/commit/1953d1bec266a39dc4bfce5f6c7959e77e63411e), [`ce4ce95`](https://github.com/atlassian-labs/atlaspack/commit/ce4ce953914e08991cf58c70c98f758690e5ee21), [`1de1c81`](https://github.com/atlassian-labs/atlaspack/commit/1de1c8138fbe4d38a64aa1f3c22a70aad59fb5bb), [`28dee1d`](https://github.com/atlassian-labs/atlaspack/commit/28dee1db7d9a995161b45f76c1a03b80ccaeab4b), [`a317453`](https://github.com/atlassian-labs/atlaspack/commit/a317453432b7f30e98f2a4cbcafdaa5601bcde63), [`2055adb`](https://github.com/atlassian-labs/atlaspack/commit/2055adbe31de792e2a2a591b94d2f33f50735879), [`8bc3db9`](https://github.com/atlassian-labs/atlaspack/commit/8bc3db94cc7382b22ca8207c92af8f6389c17e2e), [`cfa1c63`](https://github.com/atlassian-labs/atlaspack/commit/cfa1c63d710c5f9c9abc55f34220b70fb517c3b8), [`17427a2`](https://github.com/atlassian-labs/atlaspack/commit/17427a2b2fc9c34ef0b941907c2868edef6d1507), [`e962cd7`](https://github.com/atlassian-labs/atlaspack/commit/e962cd735877f7f16163e60868d70d9c10054ebe), [`104a46a`](https://github.com/atlassian-labs/atlaspack/commit/104a46a5ee1fae176d29fcc6420d6bd9c01b35b1), [`9572aca`](https://github.com/atlassian-labs/atlaspack/commit/9572aca2a2313a3c05551f73e556128e77a37732), [`34b740d`](https://github.com/atlassian-labs/atlaspack/commit/34b740d4e2449fba7b50cb9708c56d8033dca5b9), [`4837b69`](https://github.com/atlassian-labs/atlaspack/commit/4837b6988e56ca842a24797b796160964d3696ce), [`e5fa92d`](https://github.com/atlassian-labs/atlaspack/commit/e5fa92de26c87fb5d4d681af1931451749ba970a), [`f6dbdff`](https://github.com/atlassian-labs/atlaspack/commit/f6dbdff59d843e2a832d206205343178b33bf1f5), [`7e21377`](https://github.com/atlassian-labs/atlaspack/commit/7e21377914e8091d484f67cb11052a1efd2227e3), [`43113f8`](https://github.com/atlassian-labs/atlaspack/commit/43113f8f00232c5a52169a3f11f846d6e4d94b0a), [`e962cd7`](https://github.com/atlassian-labs/atlaspack/commit/e962cd735877f7f16163e60868d70d9c10054ebe), [`3650f7c`](https://github.com/atlassian-labs/atlaspack/commit/3650f7c9ab803b5ae20b223e82b2268a1b614e43), [`eff9809`](https://github.com/atlassian-labs/atlaspack/commit/eff98093703b9999a511b87a19562f5aaccfcb53), [`c2ef915`](https://github.com/atlassian-labs/atlaspack/commit/c2ef915dc54784ce4b8180025ac1b2e13b375002), [`f635123`](https://github.com/atlassian-labs/atlaspack/commit/f635123f9a06961bc5e053e237f1023f10800ea3), [`4812d0f`](https://github.com/atlassian-labs/atlaspack/commit/4812d0f7400af0f8416f1b7175ecb87700860a68), [`80d963e`](https://github.com/atlassian-labs/atlaspack/commit/80d963ed950f5d742ebd78014cf74f3c65cd4474), [`8fae5f3`](https://github.com/atlassian-labs/atlaspack/commit/8fae5f3005bd7c806b175b4df1754abf58922591), [`3005307`](https://github.com/atlassian-labs/atlaspack/commit/30053076dfd20ca62ddbc682f58adb994029ac55), [`cc66aaa`](https://github.com/atlassian-labs/atlaspack/commit/cc66aaa66d67dd0cb89e083f387a278e74aad3f0), [`67df3f1`](https://github.com/atlassian-labs/atlaspack/commit/67df3f1af1432d77ee6b8850010d976d3313693a), [`0c3ad7a`](https://github.com/atlassian-labs/atlaspack/commit/0c3ad7a302330da1d5e3c025963cc583eb5c28ed)]:
|
|
48
|
+
- @atlaspack/diagnostic@2.14.0
|
|
49
|
+
- @atlaspack/feature-flags@2.14.0
|
|
50
|
+
- @atlaspack/fs@2.14.0
|
|
51
|
+
- @atlaspack/graph@3.4.0
|
|
52
|
+
- @atlaspack/logger@2.14.0
|
|
53
|
+
- @atlaspack/package-manager@2.14.0
|
|
54
|
+
- @atlaspack/plugin@2.14.0
|
|
55
|
+
- @atlaspack/profiler@2.14.0
|
|
56
|
+
- @atlaspack/rust@3.0.0
|
|
57
|
+
- @atlaspack/types@2.14.0
|
|
58
|
+
- @atlaspack/utils@2.14.0
|
|
59
|
+
- @atlaspack/workers@2.14.0
|
|
60
|
+
- @atlaspack/events@2.14.0
|
|
61
|
+
- @atlaspack/build-cache@2.13.2
|
|
62
|
+
- @atlaspack/cache@2.13.2
|
|
63
|
+
|
|
3
64
|
## 2.13.1
|
|
4
65
|
|
|
5
66
|
### Patch Changes
|
package/lib/Atlaspack.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.INTERNAL_TRANSFORM = exports.INTERNAL_RESOLVE = exports.BuildError = void 0;
|
|
6
|
+
exports.WORKER_PATH = exports.INTERNAL_TRANSFORM = exports.INTERNAL_RESOLVE = exports.BuildError = void 0;
|
|
7
7
|
exports.createWorkerFarm = createWorkerFarm;
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
function _path() {
|
|
@@ -125,6 +125,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
125
125
|
(0, _registerCoreWithSerializer.registerCoreWithSerializer)();
|
|
126
126
|
const INTERNAL_TRANSFORM = exports.INTERNAL_TRANSFORM = Symbol('internal_transform');
|
|
127
127
|
const INTERNAL_RESOLVE = exports.INTERNAL_RESOLVE = Symbol('internal_resolve');
|
|
128
|
+
const WORKER_PATH = exports.WORKER_PATH = _path().default.join(__dirname, 'worker.js');
|
|
128
129
|
class Atlaspack {
|
|
129
130
|
#requestTracker /*: RequestTracker*/;
|
|
130
131
|
#config /*: AtlaspackConfig*/;
|
|
@@ -204,7 +205,7 @@ class Atlaspack {
|
|
|
204
205
|
// $FlowFixMe
|
|
205
206
|
const version = require('../package.json').version;
|
|
206
207
|
await lmdb.put('current_session_version', Buffer.from(version));
|
|
207
|
-
rustAtlaspack =
|
|
208
|
+
rustAtlaspack = await _atlaspackV.AtlaspackV3.create({
|
|
208
209
|
...options,
|
|
209
210
|
corePath: _path().default.join(__dirname, '..'),
|
|
210
211
|
threads: process.env.NODE_ENV === 'test' ? 2 : undefined,
|
|
@@ -671,6 +672,6 @@ exports.BuildError = BuildError;
|
|
|
671
672
|
function createWorkerFarm(options = {}) {
|
|
672
673
|
return new (_workers().default)({
|
|
673
674
|
...options,
|
|
674
|
-
workerPath:
|
|
675
|
+
workerPath: WORKER_PATH
|
|
675
676
|
});
|
|
676
677
|
}
|
|
@@ -21,7 +21,10 @@ function _diagnostic() {
|
|
|
21
21
|
}
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
class AtlaspackV3 {
|
|
24
|
-
constructor({
|
|
24
|
+
constructor(atlaspack_napi) {
|
|
25
|
+
this._atlaspack_napi = atlaspack_napi;
|
|
26
|
+
}
|
|
27
|
+
static async create({
|
|
25
28
|
fs,
|
|
26
29
|
packageManager,
|
|
27
30
|
threads,
|
|
@@ -33,16 +36,22 @@ class AtlaspackV3 {
|
|
|
33
36
|
options.defaultTargetOptions = options.defaultTargetOptions || {};
|
|
34
37
|
// $FlowFixMe "engines" are readonly
|
|
35
38
|
options.defaultTargetOptions.engines = options.defaultTargetOptions.engines || {};
|
|
36
|
-
|
|
39
|
+
const [internal, error] = await (0, _rust().atlaspackNapiCreate)({
|
|
37
40
|
fs,
|
|
38
41
|
packageManager,
|
|
39
42
|
threads,
|
|
40
43
|
options,
|
|
41
44
|
napiWorkerPool
|
|
42
45
|
}, lmdb);
|
|
46
|
+
if (error !== null) {
|
|
47
|
+
throw new (_diagnostic().default)({
|
|
48
|
+
diagnostic: error
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return new AtlaspackV3(internal);
|
|
43
52
|
}
|
|
44
53
|
async buildAssetGraph() {
|
|
45
|
-
let [graph, error] = await this.
|
|
54
|
+
let [graph, error] = await (0, _rust().atlaspackNapiBuildAssetGraph)(this._atlaspack_napi);
|
|
46
55
|
if (error !== null) {
|
|
47
56
|
throw new (_diagnostic().default)({
|
|
48
57
|
diagnostic: error
|
|
@@ -51,7 +60,7 @@ class AtlaspackV3 {
|
|
|
51
60
|
return graph;
|
|
52
61
|
}
|
|
53
62
|
respondToFsEvents(events) {
|
|
54
|
-
return this.
|
|
63
|
+
return (0, _rust().atlaspackNapiRespondToFsEvents)(this._atlaspack_napi, events);
|
|
55
64
|
}
|
|
56
65
|
}
|
|
57
66
|
exports.AtlaspackV3 = AtlaspackV3;
|
|
@@ -4,6 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = createWriteBundlesRequest;
|
|
7
|
+
function _featureFlags() {
|
|
8
|
+
const data = require("@atlaspack/feature-flags");
|
|
9
|
+
_featureFlags = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
7
14
|
var _RequestTracker = require("../RequestTracker");
|
|
8
15
|
var _constants = require("../constants");
|
|
9
16
|
var _projectPath = require("../projectPath");
|
|
@@ -54,7 +61,13 @@ async function run({
|
|
|
54
61
|
let bundleInfoMap = {};
|
|
55
62
|
let writeEarlyPromises = {};
|
|
56
63
|
let hashRefToNameHash = new Map();
|
|
57
|
-
|
|
64
|
+
|
|
65
|
+
// Include inline bundles so that non-inline bundles referenced from inline bundles are written to
|
|
66
|
+
// separate files. This ensures that source maps are written and work.
|
|
67
|
+
const allBundles = bundleGraph.getBundles({
|
|
68
|
+
includeInline: (0, _featureFlags().getFeatureFlag)('inlineBundlesSourceMapFixes')
|
|
69
|
+
});
|
|
70
|
+
const bundles = allBundles.filter(bundle => bundle.bundleBehavior !== 'inline').filter(bundle => {
|
|
58
71
|
// Do not package and write placeholder bundles to disk. We just
|
|
59
72
|
// need to update the name so other bundles can reference it.
|
|
60
73
|
if (bundle.isPlaceholder) {
|
|
@@ -140,7 +153,8 @@ function assignComplexNameHashes(hashRefToNameHash, bundles, bundleInfoMap, opti
|
|
|
140
153
|
}
|
|
141
154
|
function getBundlesIncludedInHash(bundleId, bundleInfoMap, included = new Set()) {
|
|
142
155
|
included.add(bundleId);
|
|
143
|
-
for (let hashRef of bundleInfoMap[bundleId].hashReferences) {
|
|
156
|
+
for (let hashRef of ((_bundleInfoMap$bundle = bundleInfoMap[bundleId]) === null || _bundleInfoMap$bundle === void 0 ? void 0 : _bundleInfoMap$bundle.hashReferences) ?? []) {
|
|
157
|
+
var _bundleInfoMap$bundle;
|
|
144
158
|
let referencedId = getIdFromHashRef(hashRef);
|
|
145
159
|
if (!included.has(referencedId)) {
|
|
146
160
|
getBundlesIncludedInHash(referencedId, bundleInfoMap, included);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.1-canary.3710+d874396ab",
|
|
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.13.
|
|
24
|
-
"@atlaspack/cache": "2.13.
|
|
25
|
-
"@atlaspack/diagnostic": "2.
|
|
26
|
-
"@atlaspack/events": "2.
|
|
27
|
-
"@atlaspack/feature-flags": "2.
|
|
28
|
-
"@atlaspack/fs": "2.
|
|
29
|
-
"@atlaspack/graph": "3.
|
|
30
|
-
"@atlaspack/logger": "2.
|
|
31
|
-
"@atlaspack/package-manager": "2.
|
|
32
|
-
"@atlaspack/plugin": "2.
|
|
33
|
-
"@atlaspack/profiler": "2.
|
|
34
|
-
"@atlaspack/rust": "
|
|
35
|
-
"@atlaspack/types": "2.
|
|
36
|
-
"@atlaspack/utils": "2.
|
|
37
|
-
"@atlaspack/workers": "2.
|
|
23
|
+
"@atlaspack/build-cache": "2.13.3-canary.3710+d874396ab",
|
|
24
|
+
"@atlaspack/cache": "2.13.3-canary.3710+d874396ab",
|
|
25
|
+
"@atlaspack/diagnostic": "2.14.1-canary.3710+d874396ab",
|
|
26
|
+
"@atlaspack/events": "2.14.1-canary.3710+d874396ab",
|
|
27
|
+
"@atlaspack/feature-flags": "2.14.1-canary.3710+d874396ab",
|
|
28
|
+
"@atlaspack/fs": "2.14.1-canary.3710+d874396ab",
|
|
29
|
+
"@atlaspack/graph": "3.4.1-canary.3710+d874396ab",
|
|
30
|
+
"@atlaspack/logger": "2.14.1-canary.3710+d874396ab",
|
|
31
|
+
"@atlaspack/package-manager": "2.14.1-canary.3710+d874396ab",
|
|
32
|
+
"@atlaspack/plugin": "2.14.1-canary.3710+d874396ab",
|
|
33
|
+
"@atlaspack/profiler": "2.14.1-canary.3710+d874396ab",
|
|
34
|
+
"@atlaspack/rust": "3.0.1-canary.3710+d874396ab",
|
|
35
|
+
"@atlaspack/types": "2.14.1-canary.3710+d874396ab",
|
|
36
|
+
"@atlaspack/utils": "2.14.1-canary.3710+d874396ab",
|
|
37
|
+
"@atlaspack/workers": "2.14.1-canary.3710+d874396ab",
|
|
38
38
|
"@mischnic/json-sourcemap": "^0.1.0",
|
|
39
39
|
"@parcel/source-map": "^2.1.1",
|
|
40
40
|
"base-x": "^3.0.8",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"semver": "^7.5.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@atlaspack/babel-register": "2.
|
|
51
|
+
"@atlaspack/babel-register": "2.14.0",
|
|
52
52
|
"@types/node": ">= 18",
|
|
53
53
|
"graphviz": "^0.0.9",
|
|
54
54
|
"jest-diff": "*",
|
|
@@ -66,5 +66,6 @@
|
|
|
66
66
|
"browser": {
|
|
67
67
|
"./src/serializerCore.js": "./src/serializerCore.browser.js"
|
|
68
68
|
},
|
|
69
|
-
"
|
|
69
|
+
"type": "commonjs",
|
|
70
|
+
"gitHead": "d874396ab648d0d5505d66c7eb73e1748f1eaf68"
|
|
70
71
|
}
|
package/src/Atlaspack.js
CHANGED
|
@@ -68,6 +68,7 @@ registerCoreWithSerializer();
|
|
|
68
68
|
|
|
69
69
|
export const INTERNAL_TRANSFORM: symbol = Symbol('internal_transform');
|
|
70
70
|
export const INTERNAL_RESOLVE: symbol = Symbol('internal_resolve');
|
|
71
|
+
export const WORKER_PATH: string = path.join(__dirname, 'worker.js');
|
|
71
72
|
|
|
72
73
|
export default class Atlaspack {
|
|
73
74
|
#requestTracker /*: RequestTracker*/;
|
|
@@ -161,7 +162,7 @@ export default class Atlaspack {
|
|
|
161
162
|
const version = require('../package.json').version;
|
|
162
163
|
await lmdb.put('current_session_version', Buffer.from(version));
|
|
163
164
|
|
|
164
|
-
rustAtlaspack =
|
|
165
|
+
rustAtlaspack = await AtlaspackV3.create({
|
|
165
166
|
...options,
|
|
166
167
|
corePath: path.join(__dirname, '..'),
|
|
167
168
|
threads: process.env.NODE_ENV === 'test' ? 2 : undefined,
|
|
@@ -728,6 +729,6 @@ export function createWorkerFarm(
|
|
|
728
729
|
): WorkerFarm {
|
|
729
730
|
return new WorkerFarm({
|
|
730
731
|
...options,
|
|
731
|
-
workerPath:
|
|
732
|
+
workerPath: WORKER_PATH,
|
|
732
733
|
});
|
|
733
734
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
atlaspackNapiCreate,
|
|
5
|
+
atlaspackNapiBuildAssetGraph,
|
|
6
|
+
atlaspackNapiRespondToFsEvents,
|
|
7
|
+
type AtlaspackNapi,
|
|
5
8
|
type Lmdb,
|
|
6
9
|
type AtlaspackNapiOptions,
|
|
7
10
|
} from '@atlaspack/rust';
|
|
@@ -24,24 +27,27 @@ export type AtlaspackV3Options = {|
|
|
|
24
27
|
|};
|
|
25
28
|
|
|
26
29
|
export class AtlaspackV3 {
|
|
27
|
-
|
|
28
|
-
_workerIds: any[];
|
|
30
|
+
_atlaspack_napi: AtlaspackNapi;
|
|
29
31
|
|
|
30
|
-
constructor({
|
|
32
|
+
constructor(atlaspack_napi: AtlaspackNapi) {
|
|
33
|
+
this._atlaspack_napi = atlaspack_napi;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static async create({
|
|
31
37
|
fs,
|
|
32
38
|
packageManager,
|
|
33
39
|
threads,
|
|
34
40
|
lmdb,
|
|
35
41
|
napiWorkerPool = new NapiWorkerPool(),
|
|
36
42
|
...options
|
|
37
|
-
}: AtlaspackV3Options) {
|
|
43
|
+
}: AtlaspackV3Options): Promise<AtlaspackV3> {
|
|
38
44
|
options.logLevel = options.logLevel || 'error';
|
|
39
45
|
options.defaultTargetOptions = options.defaultTargetOptions || {};
|
|
40
46
|
// $FlowFixMe "engines" are readonly
|
|
41
47
|
options.defaultTargetOptions.engines =
|
|
42
48
|
options.defaultTargetOptions.engines || {};
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
const [internal, error] = await atlaspackNapiCreate(
|
|
45
51
|
{
|
|
46
52
|
fs,
|
|
47
53
|
packageManager,
|
|
@@ -51,10 +57,20 @@ export class AtlaspackV3 {
|
|
|
51
57
|
},
|
|
52
58
|
lmdb,
|
|
53
59
|
);
|
|
60
|
+
|
|
61
|
+
if (error !== null) {
|
|
62
|
+
throw new ThrowableDiagnostic({
|
|
63
|
+
diagnostic: error,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return new AtlaspackV3(internal);
|
|
54
68
|
}
|
|
55
69
|
|
|
56
70
|
async buildAssetGraph(): Promise<any> {
|
|
57
|
-
let [graph, error] = await
|
|
71
|
+
let [graph, error] = await atlaspackNapiBuildAssetGraph(
|
|
72
|
+
this._atlaspack_napi,
|
|
73
|
+
);
|
|
58
74
|
|
|
59
75
|
if (error !== null) {
|
|
60
76
|
throw new ThrowableDiagnostic({
|
|
@@ -65,7 +81,7 @@ export class AtlaspackV3 {
|
|
|
65
81
|
return graph;
|
|
66
82
|
}
|
|
67
83
|
|
|
68
|
-
respondToFsEvents(events: Array<Event>):
|
|
69
|
-
return this.
|
|
84
|
+
respondToFsEvents(events: Array<Event>): boolean {
|
|
85
|
+
return atlaspackNapiRespondToFsEvents(this._atlaspack_napi, events);
|
|
70
86
|
}
|
|
71
87
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type {ContentKey} from '@atlaspack/graph';
|
|
4
4
|
import type {Async} from '@atlaspack/types';
|
|
5
|
+
import {getFeatureFlag} from '@atlaspack/feature-flags';
|
|
5
6
|
import type {SharedReference} from '@atlaspack/workers';
|
|
6
7
|
import type {StaticRunOpts} from '../RequestTracker';
|
|
7
8
|
import {requestTypes} from '../RequestTracker';
|
|
@@ -63,29 +64,37 @@ async function run({input, api, farm, options}) {
|
|
|
63
64
|
|} = {};
|
|
64
65
|
let writeEarlyPromises = {};
|
|
65
66
|
let hashRefToNameHash = new Map();
|
|
66
|
-
let bundles = bundleGraph.getBundles().filter((bundle) => {
|
|
67
|
-
// Do not package and write placeholder bundles to disk. We just
|
|
68
|
-
// need to update the name so other bundles can reference it.
|
|
69
|
-
if (bundle.isPlaceholder) {
|
|
70
|
-
let hash = bundle.id.slice(-8);
|
|
71
|
-
hashRefToNameHash.set(bundle.hashReference, hash);
|
|
72
|
-
let name = nullthrows(
|
|
73
|
-
bundle.name,
|
|
74
|
-
`Expected ${bundle.type} bundle to have a name`,
|
|
75
|
-
).replace(bundle.hashReference, hash);
|
|
76
|
-
res.set(bundle.id, {
|
|
77
|
-
filePath: joinProjectPath(bundle.target.distDir, name),
|
|
78
|
-
type: bundle.type, // FIXME: this is wrong if the packager changes the type...
|
|
79
|
-
stats: {
|
|
80
|
-
time: 0,
|
|
81
|
-
size: 0,
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
67
|
|
|
87
|
-
|
|
68
|
+
// Include inline bundles so that non-inline bundles referenced from inline bundles are written to
|
|
69
|
+
// separate files. This ensures that source maps are written and work.
|
|
70
|
+
const allBundles = bundleGraph.getBundles({
|
|
71
|
+
includeInline: getFeatureFlag('inlineBundlesSourceMapFixes'),
|
|
88
72
|
});
|
|
73
|
+
const bundles = allBundles
|
|
74
|
+
.filter((bundle) => bundle.bundleBehavior !== 'inline')
|
|
75
|
+
.filter((bundle) => {
|
|
76
|
+
// Do not package and write placeholder bundles to disk. We just
|
|
77
|
+
// need to update the name so other bundles can reference it.
|
|
78
|
+
if (bundle.isPlaceholder) {
|
|
79
|
+
let hash = bundle.id.slice(-8);
|
|
80
|
+
hashRefToNameHash.set(bundle.hashReference, hash);
|
|
81
|
+
let name = nullthrows(
|
|
82
|
+
bundle.name,
|
|
83
|
+
`Expected ${bundle.type} bundle to have a name`,
|
|
84
|
+
).replace(bundle.hashReference, hash);
|
|
85
|
+
res.set(bundle.id, {
|
|
86
|
+
filePath: joinProjectPath(bundle.target.distDir, name),
|
|
87
|
+
type: bundle.type, // FIXME: this is wrong if the packager changes the type...
|
|
88
|
+
stats: {
|
|
89
|
+
time: 0,
|
|
90
|
+
size: 0,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return true;
|
|
97
|
+
});
|
|
89
98
|
|
|
90
99
|
// Package on the main thread if there is only one bundle to package.
|
|
91
100
|
// This avoids the cost of serializing the bundle graph for single file change builds.
|
|
@@ -194,7 +203,7 @@ function getBundlesIncludedInHash(
|
|
|
194
203
|
included = new Set(),
|
|
195
204
|
) {
|
|
196
205
|
included.add(bundleId);
|
|
197
|
-
for (let hashRef of bundleInfoMap[bundleId]
|
|
206
|
+
for (let hashRef of bundleInfoMap[bundleId]?.hashReferences ?? []) {
|
|
198
207
|
let referencedId = getIdFromHashRef(hashRef);
|
|
199
208
|
if (!included.has(referencedId)) {
|
|
200
209
|
getBundlesIncludedInHash(referencedId, bundleInfoMap, included);
|