@atlaspack/core 2.16.2-canary.181 → 2.16.2-canary.183
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.
|
@@ -12,6 +12,7 @@ function _featureFlags() {
|
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
14
|
var _RequestTracker = require("../RequestTracker");
|
|
15
|
+
var _types = require("../types");
|
|
15
16
|
var _ReporterRunner = require("../ReporterRunner");
|
|
16
17
|
var _constants = require("../constants");
|
|
17
18
|
var _projectPath = require("../projectPath");
|
|
@@ -55,8 +56,6 @@ function createWriteBundlesRequest(input) {
|
|
|
55
56
|
input
|
|
56
57
|
};
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
// @ts-expect-error TS7031
|
|
60
59
|
async function run({
|
|
61
60
|
input,
|
|
62
61
|
api,
|
|
@@ -82,11 +81,7 @@ async function run({
|
|
|
82
81
|
const allBundles = bundleGraph.getBundles({
|
|
83
82
|
includeInline: (0, _featureFlags().getFeatureFlag)('inlineBundlesSourceMapFixes')
|
|
84
83
|
});
|
|
85
|
-
const bundles = allBundles.filter(
|
|
86
|
-
// @ts-expect-error TS7006
|
|
87
|
-
bundle => bundle.bundleBehavior !== 'inline' && bundle.bundleBehavior !== 'inline-isolated')
|
|
88
|
-
// @ts-expect-error TS7006
|
|
89
|
-
.filter(bundle => {
|
|
84
|
+
const bundles = allBundles.filter(bundle => bundle.bundleBehavior !== _types.BundleBehavior.inline && bundle.bundleBehavior !== _types.BundleBehavior.inlineIsolated).filter(bundle => {
|
|
90
85
|
// Do not package and write placeholder bundles to disk. We just
|
|
91
86
|
// need to update the name so other bundles can reference it.
|
|
92
87
|
if (bundle.isPlaceholder) {
|
|
@@ -107,9 +102,7 @@ async function run({
|
|
|
107
102
|
}
|
|
108
103
|
return true;
|
|
109
104
|
});
|
|
110
|
-
let cachedBundles = new Set(
|
|
111
|
-
// @ts-expect-error TS7006
|
|
112
|
-
bundles.filter(b => api.canSkipSubrequest(bundleGraph.getHash(b))));
|
|
105
|
+
let cachedBundles = new Set(bundles.filter(b => api.canSkipSubrequest(bundleGraph.getHash(b))));
|
|
113
106
|
|
|
114
107
|
// Package on the main thread if there is only one bundle to package.
|
|
115
108
|
// This avoids the cost of serializing the bundle graph for single file change builds.
|
|
@@ -117,9 +110,7 @@ async function run({
|
|
|
117
110
|
try {
|
|
118
111
|
let completeBundles = cachedBundles.size;
|
|
119
112
|
reportPackagingProgress(completeBundles, bundles.length);
|
|
120
|
-
await Promise.all(
|
|
121
|
-
// @ts-expect-error TS7006
|
|
122
|
-
bundles.map(async bundle => {
|
|
113
|
+
await Promise.all(bundles.map(async bundle => {
|
|
123
114
|
let request = (0, _PackageRequest.createPackageRequest)({
|
|
124
115
|
bundle,
|
|
125
116
|
bundleGraph,
|
|
@@ -159,17 +150,13 @@ async function run({
|
|
|
159
150
|
}
|
|
160
151
|
}));
|
|
161
152
|
assignComplexNameHashes(hashRefToNameHash, bundles, bundleInfoMap, options);
|
|
162
|
-
await Promise.all(
|
|
163
|
-
// @ts-expect-error TS7006
|
|
164
|
-
bundles.map(bundle => {
|
|
153
|
+
await Promise.all(bundles.map(bundle => {
|
|
165
154
|
let promise = writeEarlyPromises[bundle.id] ?? api.runRequest((0, _WriteBundleRequest.default)({
|
|
166
155
|
bundle,
|
|
167
156
|
info: bundleInfoMap[bundle.id],
|
|
168
157
|
hashRefToNameHash,
|
|
169
158
|
bundleGraph
|
|
170
159
|
}));
|
|
171
|
-
|
|
172
|
-
// @ts-expect-error TS7006
|
|
173
160
|
return promise.then(r => res.set(bundle.id, r));
|
|
174
161
|
}));
|
|
175
162
|
api.storeResult(res);
|
|
@@ -178,18 +165,12 @@ async function run({
|
|
|
178
165
|
await dispose();
|
|
179
166
|
}
|
|
180
167
|
}
|
|
181
|
-
function assignComplexNameHashes(hashRefToNameHash,
|
|
182
|
-
// @ts-expect-error TS2304
|
|
183
|
-
bundles, bundleInfoMap,
|
|
184
|
-
// @ts-expect-error TS2304
|
|
185
|
-
options) {
|
|
168
|
+
function assignComplexNameHashes(hashRefToNameHash, bundles, bundleInfoMap, options) {
|
|
186
169
|
for (let bundle of bundles) {
|
|
187
170
|
if (hashRefToNameHash.get(bundle.hashReference) != null) {
|
|
188
171
|
continue;
|
|
189
172
|
}
|
|
190
|
-
hashRefToNameHash.set(bundle.hashReference, options.shouldContentHash ? (0, _rust().hashString)([...getBundlesIncludedInHash(bundle.id, bundleInfoMap)]
|
|
191
|
-
// @ts-expect-error TS2538
|
|
192
|
-
.map(bundleId => bundleInfoMap[bundleId].hash).join(':')).slice(-8) : bundle.id.slice(-8));
|
|
173
|
+
hashRefToNameHash.set(bundle.hashReference, options.shouldContentHash ? (0, _rust().hashString)([...getBundlesIncludedInHash(bundle.id, bundleInfoMap)].map(bundleId => bundleInfoMap[bundleId].hash).join(':')).slice(-8) : bundle.id.slice(-8));
|
|
193
174
|
}
|
|
194
175
|
}
|
|
195
176
|
function getBundlesIncludedInHash(bundleId, bundleInfoMap, included = new Set()) {
|
|
@@ -3,7 +3,7 @@ import type { Async } from '@atlaspack/types';
|
|
|
3
3
|
import type { SharedReference } from '@atlaspack/workers';
|
|
4
4
|
import type { StaticRunOpts } from '../RequestTracker';
|
|
5
5
|
import { requestTypes } from '../RequestTracker';
|
|
6
|
-
import type
|
|
6
|
+
import { type PackagedBundleInfo } from '../types';
|
|
7
7
|
import type BundleGraph from '../BundleGraph';
|
|
8
8
|
type WriteBundlesRequestInput = {
|
|
9
9
|
bundleGraph: BundleGraph;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/core",
|
|
3
|
-
"version": "2.16.2-canary.
|
|
3
|
+
"version": "2.16.2-canary.183+8604d2a49",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"main": "./lib/index.js",
|
|
13
13
|
"source": "./src/index.ts",
|
|
14
|
-
"types": "./lib/
|
|
14
|
+
"types": "./lib/index.d.ts",
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">= 16.0.0"
|
|
17
17
|
},
|
|
@@ -23,21 +23,21 @@
|
|
|
23
23
|
"build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@atlaspack/build-cache": "2.13.3-canary.
|
|
27
|
-
"@atlaspack/cache": "3.1.1-canary.
|
|
28
|
-
"@atlaspack/diagnostic": "2.14.1-canary.
|
|
29
|
-
"@atlaspack/events": "2.14.1-canary.
|
|
30
|
-
"@atlaspack/feature-flags": "2.14.1-canary.
|
|
31
|
-
"@atlaspack/fs": "2.14.5-canary.
|
|
32
|
-
"@atlaspack/graph": "3.4.1-canary.
|
|
33
|
-
"@atlaspack/logger": "2.14.5-canary.
|
|
34
|
-
"@atlaspack/package-manager": "2.14.5-canary.
|
|
35
|
-
"@atlaspack/plugin": "2.14.5-canary.
|
|
36
|
-
"@atlaspack/profiler": "2.14.1-canary.
|
|
37
|
-
"@atlaspack/rust": "3.2.1-canary.
|
|
38
|
-
"@atlaspack/types": "2.14.5-canary.
|
|
39
|
-
"@atlaspack/utils": "2.14.5-canary.
|
|
40
|
-
"@atlaspack/workers": "2.14.5-canary.
|
|
26
|
+
"@atlaspack/build-cache": "2.13.3-canary.251+8604d2a49",
|
|
27
|
+
"@atlaspack/cache": "3.1.1-canary.183+8604d2a49",
|
|
28
|
+
"@atlaspack/diagnostic": "2.14.1-canary.251+8604d2a49",
|
|
29
|
+
"@atlaspack/events": "2.14.1-canary.251+8604d2a49",
|
|
30
|
+
"@atlaspack/feature-flags": "2.14.1-canary.251+8604d2a49",
|
|
31
|
+
"@atlaspack/fs": "2.14.5-canary.183+8604d2a49",
|
|
32
|
+
"@atlaspack/graph": "3.4.1-canary.251+8604d2a49",
|
|
33
|
+
"@atlaspack/logger": "2.14.5-canary.183+8604d2a49",
|
|
34
|
+
"@atlaspack/package-manager": "2.14.5-canary.183+8604d2a49",
|
|
35
|
+
"@atlaspack/plugin": "2.14.5-canary.183+8604d2a49",
|
|
36
|
+
"@atlaspack/profiler": "2.14.1-canary.251+8604d2a49",
|
|
37
|
+
"@atlaspack/rust": "3.2.1-canary.183+8604d2a49",
|
|
38
|
+
"@atlaspack/types": "2.14.5-canary.183+8604d2a49",
|
|
39
|
+
"@atlaspack/utils": "2.14.5-canary.183+8604d2a49",
|
|
40
|
+
"@atlaspack/workers": "2.14.5-canary.183+8604d2a49",
|
|
41
41
|
"@mischnic/json-sourcemap": "^0.1.0",
|
|
42
42
|
"@parcel/source-map": "^2.1.1",
|
|
43
43
|
"base-x": "^3.0.8",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"./src/serializerCore.js": "./src/serializerCore.browser.js"
|
|
63
63
|
},
|
|
64
64
|
"type": "commonjs",
|
|
65
|
-
"gitHead": "
|
|
66
|
-
}
|
|
65
|
+
"gitHead": "8604d2a49ace5e9194ec4f76e71f06b93610f6b4"
|
|
66
|
+
}
|
|
@@ -4,7 +4,12 @@ import {getFeatureFlag} from '@atlaspack/feature-flags';
|
|
|
4
4
|
import type {SharedReference} from '@atlaspack/workers';
|
|
5
5
|
import type {StaticRunOpts} from '../RequestTracker';
|
|
6
6
|
import {requestTypes} from '../RequestTracker';
|
|
7
|
-
import
|
|
7
|
+
import {
|
|
8
|
+
BundleBehavior,
|
|
9
|
+
type PackagedBundleInfo,
|
|
10
|
+
type Bundle,
|
|
11
|
+
type AtlaspackOptions,
|
|
12
|
+
} from '../types';
|
|
8
13
|
import type BundleGraph from '../BundleGraph';
|
|
9
14
|
import type {BundleInfo} from '../PackagerRunner';
|
|
10
15
|
import {report} from '../ReporterRunner';
|
|
@@ -66,8 +71,12 @@ export default function createWriteBundlesRequest(
|
|
|
66
71
|
};
|
|
67
72
|
}
|
|
68
73
|
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
async function run({
|
|
75
|
+
input,
|
|
76
|
+
api,
|
|
77
|
+
farm,
|
|
78
|
+
options,
|
|
79
|
+
}: RunInput<WriteBundlesRequestResult>) {
|
|
71
80
|
let {bundleGraph, optionsRef} = input;
|
|
72
81
|
let {ref, dispose} = await farm.createSharedReference(bundleGraph);
|
|
73
82
|
|
|
@@ -77,7 +86,7 @@ async function run({input, api, farm, options}) {
|
|
|
77
86
|
let bundleInfoMap: {
|
|
78
87
|
[key: string]: BundleInfo;
|
|
79
88
|
} = {};
|
|
80
|
-
let writeEarlyPromises: Record<string,
|
|
89
|
+
let writeEarlyPromises: Record<string, Promise<PackagedBundleInfo>> = {};
|
|
81
90
|
let hashRefToNameHash = new Map();
|
|
82
91
|
|
|
83
92
|
// Include inline bundles so that non-inline bundles referenced from inline bundles are written to
|
|
@@ -87,12 +96,10 @@ async function run({input, api, farm, options}) {
|
|
|
87
96
|
});
|
|
88
97
|
const bundles = allBundles
|
|
89
98
|
.filter(
|
|
90
|
-
// @ts-expect-error TS7006
|
|
91
99
|
(bundle) =>
|
|
92
|
-
bundle.bundleBehavior !==
|
|
93
|
-
bundle.bundleBehavior !==
|
|
100
|
+
bundle.bundleBehavior !== BundleBehavior.inline &&
|
|
101
|
+
bundle.bundleBehavior !== BundleBehavior.inlineIsolated,
|
|
94
102
|
)
|
|
95
|
-
// @ts-expect-error TS7006
|
|
96
103
|
.filter((bundle) => {
|
|
97
104
|
// Do not package and write placeholder bundles to disk. We just
|
|
98
105
|
// need to update the name so other bundles can reference it.
|
|
@@ -119,7 +126,6 @@ async function run({input, api, farm, options}) {
|
|
|
119
126
|
});
|
|
120
127
|
|
|
121
128
|
let cachedBundles = new Set(
|
|
122
|
-
// @ts-expect-error TS7006
|
|
123
129
|
bundles.filter((b) => api.canSkipSubrequest(bundleGraph.getHash(b))),
|
|
124
130
|
);
|
|
125
131
|
|
|
@@ -133,7 +139,6 @@ async function run({input, api, farm, options}) {
|
|
|
133
139
|
reportPackagingProgress(completeBundles, bundles.length);
|
|
134
140
|
|
|
135
141
|
await Promise.all(
|
|
136
|
-
// @ts-expect-error TS7006
|
|
137
142
|
bundles.map(async (bundle) => {
|
|
138
143
|
let request = createPackageRequest({
|
|
139
144
|
bundle,
|
|
@@ -185,7 +190,6 @@ async function run({input, api, farm, options}) {
|
|
|
185
190
|
);
|
|
186
191
|
assignComplexNameHashes(hashRefToNameHash, bundles, bundleInfoMap, options);
|
|
187
192
|
await Promise.all(
|
|
188
|
-
// @ts-expect-error TS7006
|
|
189
193
|
bundles.map((bundle) => {
|
|
190
194
|
let promise =
|
|
191
195
|
writeEarlyPromises[bundle.id] ??
|
|
@@ -198,7 +202,6 @@ async function run({input, api, farm, options}) {
|
|
|
198
202
|
}),
|
|
199
203
|
);
|
|
200
204
|
|
|
201
|
-
// @ts-expect-error TS7006
|
|
202
205
|
return promise.then((r) => res.set(bundle.id, r));
|
|
203
206
|
}),
|
|
204
207
|
);
|
|
@@ -212,12 +215,10 @@ async function run({input, api, farm, options}) {
|
|
|
212
215
|
|
|
213
216
|
function assignComplexNameHashes(
|
|
214
217
|
hashRefToNameHash: Map<string, string>,
|
|
215
|
-
// @ts-expect-error TS2304
|
|
216
218
|
bundles: Array<Bundle>,
|
|
217
219
|
bundleInfoMap: {
|
|
218
220
|
[key: string]: BundleInfo;
|
|
219
221
|
},
|
|
220
|
-
// @ts-expect-error TS2304
|
|
221
222
|
options: AtlaspackOptions,
|
|
222
223
|
) {
|
|
223
224
|
for (let bundle of bundles) {
|
|
@@ -229,7 +230,6 @@ function assignComplexNameHashes(
|
|
|
229
230
|
options.shouldContentHash
|
|
230
231
|
? hashString(
|
|
231
232
|
[...getBundlesIncludedInHash(bundle.id, bundleInfoMap)]
|
|
232
|
-
// @ts-expect-error TS2538
|
|
233
233
|
.map((bundleId) => bundleInfoMap[bundleId].hash)
|
|
234
234
|
.join(':'),
|
|
235
235
|
).slice(-8)
|
|
@@ -243,7 +243,7 @@ function getBundlesIncludedInHash(
|
|
|
243
243
|
bundleInfoMap: {
|
|
244
244
|
[key: string]: BundleInfo;
|
|
245
245
|
},
|
|
246
|
-
included = new Set(),
|
|
246
|
+
included = new Set<string>(),
|
|
247
247
|
) {
|
|
248
248
|
included.add(bundleId);
|
|
249
249
|
for (let hashRef of bundleInfoMap[bundleId]?.hashReferences ?? []) {
|