@atlaspack/core 2.26.3-dev-compiled-hash-e5f8a1735.0 → 2.28.0
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/dist/Atlaspack.js +5 -1
- package/dist/BundleGraph.js +105 -0
- package/dist/CommittedAsset.js +1 -1
- package/dist/Transformation.js +3 -2
- package/dist/UncommittedAsset.js +3 -3
- package/dist/assetUtils.js +2 -1
- package/dist/atlaspack-v3/worker/compat/bitflags.js +24 -20
- package/dist/atlaspack-v3/worker/compat/dependency.js +1 -1
- package/dist/atlaspack-v3/worker/compat/mutable-asset.js +1 -1
- package/dist/atlaspack-v3/worker/worker.js +14 -7
- package/dist/public/BundleGraph.js +12 -0
- package/dist/requests/AssetGraphRequest.js +1 -1
- package/dist/requests/AssetGraphRequestRust.js +99 -36
- package/dist/requests/AtlaspackConfigRequest.js +10 -21
- package/dist/requests/BundleGraphRequest.js +5 -3
- package/dist/resolveOptions.js +1 -0
- package/dist/worker.js +1 -1
- package/lib/Atlaspack.js +5 -1
- package/lib/BundleGraph.js +107 -0
- package/lib/CommittedAsset.js +1 -1
- package/lib/Transformation.js +9 -4
- package/lib/UncommittedAsset.js +3 -3
- package/lib/assetUtils.js +8 -1
- package/lib/atlaspack-v3/worker/compat/bitflags.js +25 -20
- package/lib/atlaspack-v3/worker/compat/dependency.js +1 -1
- package/lib/atlaspack-v3/worker/compat/mutable-asset.js +1 -1
- package/lib/atlaspack-v3/worker/worker.js +13 -5
- package/lib/public/BundleGraph.js +13 -0
- package/lib/requests/AssetGraphRequest.js +1 -1
- package/lib/requests/AssetGraphRequestRust.js +96 -35
- package/lib/requests/AtlaspackConfigRequest.js +14 -24
- package/lib/requests/BundleGraphRequest.js +4 -2
- package/lib/resolveOptions.js +1 -0
- package/lib/types/BundleGraph.d.ts +2 -0
- package/lib/types/CommittedAsset.d.ts +1 -1
- package/lib/types/PackagerRunner.d.ts +1 -1
- package/lib/types/UncommittedAsset.d.ts +1 -1
- package/lib/types/atlaspack-v3/worker/compat/bitflags.d.ts +11 -12
- package/lib/types/atlaspack-v3/worker/compat/mutable-asset.d.ts +1 -1
- package/lib/types/public/Asset.d.ts +1 -1
- package/lib/types/public/BundleGraph.d.ts +2 -0
- package/lib/types/requests/AssetGraphRequestRust.d.ts +1 -1
- package/lib/types/types.d.ts +1 -0
- package/lib/worker.js +1 -1
- package/package.json +21 -22
- package/src/Atlaspack.ts +6 -2
- package/src/BundleGraph.ts +152 -0
- package/src/CommittedAsset.ts +1 -1
- package/src/PackagerRunner.ts +1 -1
- package/src/Transformation.ts +3 -2
- package/src/UncommittedAsset.ts +3 -3
- package/src/assetUtils.ts +2 -1
- package/src/atlaspack-v3/worker/compat/bitflags.ts +44 -41
- package/src/atlaspack-v3/worker/compat/dependency.ts +1 -1
- package/src/atlaspack-v3/worker/compat/mutable-asset.ts +1 -1
- package/src/atlaspack-v3/worker/worker.ts +15 -5
- package/src/public/Asset.ts +1 -1
- package/src/public/BundleGraph.ts +21 -0
- package/src/requests/AssetGraphRequest.ts +1 -1
- package/src/requests/AssetGraphRequestRust.ts +138 -40
- package/src/requests/AtlaspackConfigRequest.ts +10 -20
- package/src/requests/BundleGraphRequest.ts +9 -7
- package/src/resolveOptions.ts +1 -0
- package/src/types.ts +1 -0
- package/src/worker.ts +1 -1
- package/test/requests/AssetGraphRequestRust.test.ts +1 -0
- package/tsconfig.json +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/LICENSE +0 -201
|
@@ -114,6 +114,19 @@ class BundleGraph {
|
|
|
114
114
|
isAssetReferenced(bundle, asset) {
|
|
115
115
|
return this.#graph.isAssetReferenced((0, _Bundle.bundleToInternalBundle)(bundle), (0, _Asset.assetToAssetValue)(asset));
|
|
116
116
|
}
|
|
117
|
+
isAssetReferencedFastCheck(bundle, asset) {
|
|
118
|
+
return this.#graph.isAssetReferencedFastCheck((0, _Bundle.bundleToInternalBundle)(bundle), (0, _Asset.assetToAssetValue)(asset));
|
|
119
|
+
}
|
|
120
|
+
getReferencedAssets(bundle) {
|
|
121
|
+
let internalReferencedAssets = this.#graph.getReferencedAssets((0, _Bundle.bundleToInternalBundle)(bundle));
|
|
122
|
+
|
|
123
|
+
// Convert internal assets to public assets
|
|
124
|
+
let publicReferencedAssets = new Set();
|
|
125
|
+
for (let internalAsset of internalReferencedAssets) {
|
|
126
|
+
publicReferencedAssets.add((0, _Asset.assetFromValue)(internalAsset, this.#options));
|
|
127
|
+
}
|
|
128
|
+
return publicReferencedAssets;
|
|
129
|
+
}
|
|
117
130
|
hasParentBundleOfType(bundle, type) {
|
|
118
131
|
return this.#graph.hasParentBundleOfType((0, _Bundle.bundleToInternalBundle)(bundle), type);
|
|
119
132
|
}
|
|
@@ -73,7 +73,7 @@ function createAssetGraphRequest(requestInput) {
|
|
|
73
73
|
run: async input => {
|
|
74
74
|
let prevResult = await input.api.getPreviousResult();
|
|
75
75
|
let builder = new AssetGraphBuilder(input, prevResult);
|
|
76
|
-
let assetGraphRequest = await
|
|
76
|
+
let assetGraphRequest = await builder.build();
|
|
77
77
|
|
|
78
78
|
// early break for incremental bundling if production or flag is off;
|
|
79
79
|
assetGraphRequest.assetGraph.setDisableIncrementalBundling(!input.options.shouldBundleIncrementally || input.options.mode === 'production');
|
|
@@ -38,6 +38,7 @@ var _RequestTracker = require("../RequestTracker");
|
|
|
38
38
|
var _SymbolPropagation = require("../SymbolPropagation");
|
|
39
39
|
var _EnvironmentManager = require("../EnvironmentManager");
|
|
40
40
|
var _Environment = require("../Environment");
|
|
41
|
+
var _dumpGraphToGraphViz = _interopRequireDefault(require("../dumpGraphToGraphViz"));
|
|
41
42
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
42
43
|
function createAssetGraphRequestRust(rustAtlaspack) {
|
|
43
44
|
return input => ({
|
|
@@ -47,12 +48,24 @@ function createAssetGraphRequestRust(rustAtlaspack) {
|
|
|
47
48
|
let options = input.options;
|
|
48
49
|
let serializedAssetGraph = await rustAtlaspack.buildAssetGraph();
|
|
49
50
|
|
|
50
|
-
//
|
|
51
|
+
// Newly created nodes
|
|
51
52
|
serializedAssetGraph.nodes = serializedAssetGraph.nodes.map(node => JSON.parse(node));
|
|
53
|
+
|
|
54
|
+
// Updated existing nodes
|
|
55
|
+
serializedAssetGraph.updates = serializedAssetGraph.updates.map(node => JSON.parse(node));
|
|
56
|
+
|
|
57
|
+
// Don't reuse a previous asset graph result if Rust didn't have one too
|
|
58
|
+
let prevResult = null;
|
|
59
|
+
if (serializedAssetGraph.hadPreviousGraph) {
|
|
60
|
+
prevResult = await input.api.getPreviousResult();
|
|
61
|
+
}
|
|
52
62
|
let {
|
|
53
63
|
assetGraph,
|
|
54
64
|
changedAssets
|
|
55
|
-
} = (0, _logger().instrument)('atlaspack_v3_getAssetGraph', () =>
|
|
65
|
+
} = (0, _logger().instrument)('atlaspack_v3_getAssetGraph', () => {
|
|
66
|
+
var _prevResult;
|
|
67
|
+
return getAssetGraph(serializedAssetGraph, (_prevResult = prevResult) === null || _prevResult === void 0 ? void 0 : _prevResult.assetGraph);
|
|
68
|
+
});
|
|
56
69
|
let changedAssetsPropagation = new Set(changedAssets.keys());
|
|
57
70
|
let errors = (0, _SymbolPropagation.propagateSymbols)({
|
|
58
71
|
options,
|
|
@@ -69,7 +82,8 @@ function createAssetGraphRequestRust(rustAtlaspack) {
|
|
|
69
82
|
diagnostic: [...errors.values()][0]
|
|
70
83
|
});
|
|
71
84
|
}
|
|
72
|
-
|
|
85
|
+
await (0, _dumpGraphToGraphViz.default)(assetGraph, 'AssetGraphV3');
|
|
86
|
+
let result = {
|
|
73
87
|
assetGraph,
|
|
74
88
|
assetRequests: [],
|
|
75
89
|
assetGroupsWithRemovedParents: new Set(),
|
|
@@ -77,17 +91,54 @@ function createAssetGraphRequestRust(rustAtlaspack) {
|
|
|
77
91
|
changedAssetsPropagation,
|
|
78
92
|
previousSymbolPropagationErrors: undefined
|
|
79
93
|
};
|
|
94
|
+
await input.api.storeResult(result);
|
|
95
|
+
input.api.invalidateOnBuild();
|
|
96
|
+
return result;
|
|
80
97
|
},
|
|
81
98
|
input
|
|
82
99
|
});
|
|
83
100
|
}
|
|
84
|
-
function getAssetGraph(serializedGraph) {
|
|
85
|
-
let graph
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
101
|
+
function getAssetGraph(serializedGraph, prevAssetGraph) {
|
|
102
|
+
let graph;
|
|
103
|
+
let reuseEdges = false;
|
|
104
|
+
if (prevAssetGraph && serializedGraph.safeToSkipBundling) {
|
|
105
|
+
graph = new _AssetGraph.default({
|
|
106
|
+
_contentKeyToNodeId: prevAssetGraph._contentKeyToNodeId,
|
|
107
|
+
_nodeIdToContentKey: prevAssetGraph._nodeIdToContentKey,
|
|
108
|
+
nodes: prevAssetGraph.nodes,
|
|
109
|
+
rootNodeId: prevAssetGraph.rootNodeId,
|
|
110
|
+
adjacencyList: prevAssetGraph.adjacencyList
|
|
111
|
+
});
|
|
112
|
+
reuseEdges = true;
|
|
113
|
+
} else if (prevAssetGraph && (serializedGraph.updates.length > 0 || serializedGraph.nodes.length > 0)) {
|
|
114
|
+
graph = new _AssetGraph.default({
|
|
115
|
+
_contentKeyToNodeId: prevAssetGraph._contentKeyToNodeId,
|
|
116
|
+
_nodeIdToContentKey: prevAssetGraph._nodeIdToContentKey,
|
|
117
|
+
nodes: prevAssetGraph.nodes,
|
|
118
|
+
initialCapacity: serializedGraph.edges.length,
|
|
119
|
+
// Accomodate the root node
|
|
120
|
+
initialNodeCapacity: prevAssetGraph.nodes.length + 1,
|
|
121
|
+
rootNodeId: prevAssetGraph.rootNodeId
|
|
122
|
+
});
|
|
123
|
+
graph.safeToIncrementallyBundle = false;
|
|
124
|
+
} else {
|
|
125
|
+
graph = new _AssetGraph.default({
|
|
126
|
+
_contentKeyToNodeId: new Map(),
|
|
127
|
+
_nodeIdToContentKey: new Map(),
|
|
128
|
+
initialCapacity: serializedGraph.edges.length,
|
|
129
|
+
// Accomodate the root node
|
|
130
|
+
initialNodeCapacity: serializedGraph.nodes.length + 1
|
|
131
|
+
});
|
|
132
|
+
let rootNodeId = graph.addNodeByContentKey('@@root', {
|
|
133
|
+
id: '@@root',
|
|
134
|
+
type: 'root',
|
|
135
|
+
value: null
|
|
136
|
+
});
|
|
137
|
+
graph.setRootNodeId(rootNodeId);
|
|
138
|
+
graph.safeToIncrementallyBundle = false;
|
|
139
|
+
}
|
|
140
|
+
(0, _assert().default)(graph, 'Asset graph not initialized');
|
|
141
|
+
(0, _assert().default)(graph.rootNodeId != null, 'Asset graph has no root node');
|
|
91
142
|
|
|
92
143
|
// @ts-expect-error TS7031
|
|
93
144
|
function mapSymbols({
|
|
@@ -118,20 +169,26 @@ function getAssetGraph(serializedGraph) {
|
|
|
118
169
|
let envKey = [env.context, env.engines.atlaspack, env.engines.browsers, env.engines.electron, env.engines.node, env.includeNodeModules, env.isLibrary, env.outputFormat, env.shouldScopeHoist, env.shouldOptimize, env.sourceType].join(':');
|
|
119
170
|
let envId = envs.get(envKey);
|
|
120
171
|
if (envId == null) {
|
|
121
|
-
envId =
|
|
172
|
+
envId = envs.size.toString();
|
|
122
173
|
envs.set(envKey, envId);
|
|
123
174
|
}
|
|
124
175
|
return envId;
|
|
125
176
|
};
|
|
126
|
-
|
|
127
|
-
if (
|
|
128
|
-
let
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
177
|
+
function updateNode(newNode, isUpdateNode) {
|
|
178
|
+
if (isUpdateNode) {
|
|
179
|
+
let existingNode = graph.getNodeByContentKey(newNode.id);
|
|
180
|
+
(0, _assert().default)(existingNode && existingNode.type === newNode.type);
|
|
181
|
+
Object.assign(existingNode, newNode);
|
|
182
|
+
} else {
|
|
183
|
+
graph.addNodeByContentKey(newNode.id, newNode);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
let nodeTypeSwitchoverIndex = serializedGraph.nodes.length;
|
|
187
|
+
let nodesCount = serializedGraph.nodes.length + serializedGraph.updates.length;
|
|
188
|
+
for (let index = 0; index < nodesCount; index++) {
|
|
189
|
+
let isUpdateNode = index >= nodeTypeSwitchoverIndex;
|
|
190
|
+
let node = isUpdateNode ? serializedGraph.updates[index - nodeTypeSwitchoverIndex] : serializedGraph.nodes[index];
|
|
191
|
+
if (node.type === 'entry') {
|
|
135
192
|
let id = 'entry:' + ++entry;
|
|
136
193
|
graph.addNodeByContentKey(id, {
|
|
137
194
|
id: id,
|
|
@@ -159,14 +216,15 @@ function getAssetGraph(serializedGraph) {
|
|
|
159
216
|
asset.symbols = new Map(asset.symbols.map(mapSymbols));
|
|
160
217
|
}
|
|
161
218
|
changedAssets.set(id, asset);
|
|
162
|
-
|
|
219
|
+
let assetNode = {
|
|
163
220
|
id,
|
|
164
221
|
type: 'asset',
|
|
165
222
|
usedSymbols: new Set(),
|
|
166
223
|
usedSymbolsDownDirty: true,
|
|
167
224
|
usedSymbolsUpDirty: true,
|
|
168
225
|
value: asset
|
|
169
|
-
}
|
|
226
|
+
};
|
|
227
|
+
updateNode(assetNode, isUpdateNode);
|
|
170
228
|
} else if (node.type === 'dependency') {
|
|
171
229
|
let {
|
|
172
230
|
dependency,
|
|
@@ -187,7 +245,7 @@ function getAssetGraph(serializedGraph) {
|
|
|
187
245
|
usedSymbolsDown.add('*');
|
|
188
246
|
usedSymbolsUp.set('*', undefined);
|
|
189
247
|
}
|
|
190
|
-
|
|
248
|
+
let depNode = {
|
|
191
249
|
id,
|
|
192
250
|
type: 'dependency',
|
|
193
251
|
deferred: false,
|
|
@@ -200,21 +258,24 @@ function getAssetGraph(serializedGraph) {
|
|
|
200
258
|
usedSymbolsUpDirtyDown: true,
|
|
201
259
|
usedSymbolsUpDirtyUp: true,
|
|
202
260
|
value: dependency
|
|
203
|
-
}
|
|
261
|
+
};
|
|
262
|
+
updateNode(depNode, isUpdateNode);
|
|
204
263
|
}
|
|
205
264
|
}
|
|
206
|
-
|
|
207
|
-
let
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
fromNode.
|
|
265
|
+
if (!reuseEdges) {
|
|
266
|
+
for (let i = 0; i < serializedGraph.edges.length; i += 2) {
|
|
267
|
+
let from = serializedGraph.edges[i];
|
|
268
|
+
let to = serializedGraph.edges[i + 1];
|
|
269
|
+
let fromNode = graph.getNode(from);
|
|
270
|
+
let toNode = graph.getNode(to);
|
|
271
|
+
if ((fromNode === null || fromNode === void 0 ? void 0 : fromNode.type) === 'dependency') {
|
|
272
|
+
(0, _assert().default)((toNode === null || toNode === void 0 ? void 0 : toNode.type) === 'asset');
|
|
273
|
+
}
|
|
274
|
+
if ((fromNode === null || fromNode === void 0 ? void 0 : fromNode.type) === 'asset' && (toNode === null || toNode === void 0 ? void 0 : toNode.type) === 'dependency') {
|
|
275
|
+
fromNode.value.dependencies.set(toNode.value.id, toNode.value);
|
|
276
|
+
}
|
|
277
|
+
graph.addEdge(from, to);
|
|
216
278
|
}
|
|
217
|
-
graph.addEdge(from, to);
|
|
218
279
|
}
|
|
219
280
|
return {
|
|
220
281
|
assetGraph: graph,
|
|
@@ -161,33 +161,23 @@ async function resolveAtlaspackConfig(options) {
|
|
|
161
161
|
extendedFiles
|
|
162
162
|
} = await parseAndProcessConfig(configPath, contents, options);
|
|
163
163
|
if (options.additionalReporters.length > 0) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
var _config$reporters;
|
|
165
|
+
const reporterMap = new Map();
|
|
166
|
+
options.additionalReporters.forEach(({
|
|
167
|
+
packageName,
|
|
168
|
+
resolveFrom
|
|
169
|
+
}) => {
|
|
170
|
+
reporterMap.set(packageName, {
|
|
168
171
|
packageName,
|
|
169
172
|
resolveFrom
|
|
170
|
-
}) => {
|
|
171
|
-
reporterMap.set(packageName, {
|
|
172
|
-
packageName,
|
|
173
|
-
resolveFrom
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
(_config$reporters = config.reporters) === null || _config$reporters === void 0 || _config$reporters.forEach(reporter => {
|
|
177
|
-
if (!reporterMap.has(reporter.packageName)) {
|
|
178
|
-
reporterMap.set(reporter.packageName, reporter);
|
|
179
|
-
}
|
|
180
173
|
});
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
packageName,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
resolveFrom
|
|
189
|
-
})), ...(config.reporters ?? [])];
|
|
190
|
-
}
|
|
174
|
+
});
|
|
175
|
+
(_config$reporters = config.reporters) === null || _config$reporters === void 0 || _config$reporters.forEach(reporter => {
|
|
176
|
+
if (!reporterMap.has(reporter.packageName)) {
|
|
177
|
+
reporterMap.set(reporter.packageName, reporter);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
config.reporters = Array.from(reporterMap.values());
|
|
191
181
|
}
|
|
192
182
|
return {
|
|
193
183
|
config,
|
|
@@ -152,8 +152,10 @@ function createBundleGraphRequest(input) {
|
|
|
152
152
|
assetGraph,
|
|
153
153
|
changedAssets,
|
|
154
154
|
assetRequests
|
|
155
|
-
} = await
|
|
156
|
-
|
|
155
|
+
} = await (0, _logger().instrumentAsync)('asset-graph-request', () => {
|
|
156
|
+
return api.runRequest(request, {
|
|
157
|
+
force: Boolean(input.rustAtlaspack) || options.shouldBuildLazily && requestedAssetIds.size > 0
|
|
158
|
+
});
|
|
157
159
|
});
|
|
158
160
|
if ((_input$options$featur = input.options.featureFlags) !== null && _input$options$featur !== void 0 && _input$options$featur.loadableSideEffects) {
|
|
159
161
|
applySideEffectsForLoadableImports(assetGraph);
|
package/lib/resolveOptions.js
CHANGED
|
@@ -219,6 +219,7 @@ async function resolveOptions(initialOptions) {
|
|
|
219
219
|
} : false,
|
|
220
220
|
shouldDisableCache: initialOptions.shouldDisableCache ?? false,
|
|
221
221
|
shouldProfile: initialOptions.shouldProfile ?? false,
|
|
222
|
+
nativeProfiler: initialOptions.nativeProfiler,
|
|
222
223
|
shouldTrace: initialOptions.shouldTrace ?? false,
|
|
223
224
|
cacheDir,
|
|
224
225
|
watchDir,
|
|
@@ -129,6 +129,8 @@ export default class BundleGraph {
|
|
|
129
129
|
getDependencies(asset: Asset): Array<Dependency>;
|
|
130
130
|
traverseAssets<TContext>(bundle: Bundle, visit: GraphVisitor<Asset, TContext>, startAsset?: Asset): TContext | null | undefined;
|
|
131
131
|
isAssetReferenced(bundle: Bundle, asset: Asset): boolean;
|
|
132
|
+
isAssetReferencedFastCheck(bundle: Bundle, asset: Asset): boolean | null;
|
|
133
|
+
getReferencedAssets(bundle: Bundle): Set<Asset>;
|
|
132
134
|
hasParentBundleOfType(bundle: Bundle, type: string): boolean;
|
|
133
135
|
getParentBundles(bundle: Bundle): Array<Bundle>;
|
|
134
136
|
isAssetReachableFromBundle(asset: Asset, bundle: Bundle): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Readable } from 'stream';
|
|
2
2
|
import type { AST, Blob } from '@atlaspack/types';
|
|
3
|
-
import SourceMap from '@
|
|
3
|
+
import SourceMap from '@atlaspack/source-map';
|
|
4
4
|
import type { Asset, Dependency, AtlaspackOptions } from './types';
|
|
5
5
|
export default class CommittedAsset {
|
|
6
6
|
key: string | null | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Blob, FilePath, BundleResult, Async } from '@atlaspack/types';
|
|
2
|
-
import type SourceMap from '@
|
|
2
|
+
import type SourceMap from '@atlaspack/source-map';
|
|
3
3
|
import type { Bundle as InternalBundle, Config, DevDepRequest, AtlaspackOptions, ReportFn, RequestInvalidation, DevDepRequestRef } from './types';
|
|
4
4
|
import type { AtlaspackConfig, LoadedPlugin } from './AtlaspackConfig';
|
|
5
5
|
import type InternalBundleGraph from './BundleGraph';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AST, Blob, DependencyOptions, FileCreateInvalidation, GenerateOutput, PackageName, TransformerResult } from '@atlaspack/types';
|
|
2
2
|
import type { Asset, Dependency, AtlaspackOptions, Invalidations } from './types';
|
|
3
3
|
import { Readable } from 'stream';
|
|
4
|
-
import SourceMap from '@
|
|
4
|
+
import SourceMap from '@atlaspack/source-map';
|
|
5
5
|
import { ProjectPath } from './projectPath';
|
|
6
6
|
type UncommittedAssetOptions = {
|
|
7
7
|
value: Asset;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { BundleBehavior, DependencyPriority, SpecifierType } from '@atlaspack/types';
|
|
2
|
-
export declare class BitFlags<K
|
|
2
|
+
export declare class BitFlags<K> {
|
|
3
3
|
#private;
|
|
4
|
-
constructor(source: Partial<Record<K,
|
|
5
|
-
into(key: K):
|
|
6
|
-
intoNullable(key?: K | null):
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
fromArray(keys: V[]): K[];
|
|
4
|
+
constructor(source: Partial<Record<K, number>>);
|
|
5
|
+
into(key: K): number;
|
|
6
|
+
intoNullable(key?: K | null): number | null | undefined;
|
|
7
|
+
from(key: number): K;
|
|
8
|
+
fromNullable(key?: number | null): K | null | undefined;
|
|
9
|
+
toArray(keys: number): K[];
|
|
11
10
|
}
|
|
12
|
-
export declare const bundleBehaviorMap: BitFlags<BundleBehavior
|
|
13
|
-
export declare const dependencyPriorityMap: BitFlags<DependencyPriority
|
|
14
|
-
export declare const packageConditionsMap: BitFlags<string
|
|
15
|
-
export declare const specifierTypeMap: BitFlags<SpecifierType
|
|
11
|
+
export declare const bundleBehaviorMap: BitFlags<BundleBehavior>;
|
|
12
|
+
export declare const dependencyPriorityMap: BitFlags<DependencyPriority>;
|
|
13
|
+
export declare const packageConditionsMap: BitFlags<string>;
|
|
14
|
+
export declare const specifierTypeMap: BitFlags<SpecifierType>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import SourceMap from '@
|
|
1
|
+
import SourceMap from '@atlaspack/source-map';
|
|
2
2
|
import * as napi from '@atlaspack/rust';
|
|
3
3
|
import { Readable } from 'stream';
|
|
4
4
|
import type { MutableAsset as IMutableAsset, Stats, FileSystem, FilePath, Environment, Meta, BundleBehavior, ASTGenerator, AST, Dependency, DependencyOptions, FileCreateInvalidation, EnvironmentOptions } from '@atlaspack/types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type SourceMap from '@
|
|
1
|
+
import type SourceMap from '@atlaspack/source-map';
|
|
2
2
|
import type { Readable } from 'stream';
|
|
3
3
|
import type { FileSystem } from '@atlaspack/fs';
|
|
4
4
|
import type { Asset as IAsset, AST, ASTGenerator, Dependency as IDependency, DependencyOptions, Environment as IEnvironment, EnvironmentOptions, FileCreateInvalidation, FilePath, Meta, MutableAsset as IMutableAsset, Stats, MutableAssetSymbols as IMutableAssetSymbols, AssetSymbols as IAssetSymbols, BundleBehavior } from '@atlaspack/types';
|
|
@@ -30,6 +30,8 @@ export default class BundleGraph<TBundle extends IBundle> implements IBundleGrap
|
|
|
30
30
|
getDependencies(asset: IAsset): Array<IDependency>;
|
|
31
31
|
isAssetReachableFromBundle(asset: IAsset, bundle: IBundle): boolean;
|
|
32
32
|
isAssetReferenced(bundle: IBundle, asset: IAsset): boolean;
|
|
33
|
+
isAssetReferencedFastCheck(bundle: IBundle, asset: IAsset): boolean | null;
|
|
34
|
+
getReferencedAssets(bundle: IBundle): Set<IAsset>;
|
|
33
35
|
hasParentBundleOfType(bundle: IBundle, type: string): boolean;
|
|
34
36
|
getBundlesInBundleGroup(bundleGroup: IBundleGroup, opts?: {
|
|
35
37
|
includeInline: boolean;
|
|
@@ -14,7 +14,7 @@ type AssetGraphRequest = {
|
|
|
14
14
|
input: AssetGraphRequestInput;
|
|
15
15
|
};
|
|
16
16
|
export declare function createAssetGraphRequestRust(rustAtlaspack: AtlaspackV3): (input: AssetGraphRequestInput) => AssetGraphRequest;
|
|
17
|
-
export declare function getAssetGraph(serializedGraph: any): {
|
|
17
|
+
export declare function getAssetGraph(serializedGraph: any, prevAssetGraph?: AssetGraph): {
|
|
18
18
|
assetGraph: AssetGraph;
|
|
19
19
|
changedAssets: Map<string, Asset>;
|
|
20
20
|
};
|
package/lib/types/types.d.ts
CHANGED
|
@@ -241,6 +241,7 @@ export type AtlaspackOptions = {
|
|
|
241
241
|
logLevel: LogLevel;
|
|
242
242
|
projectRoot: FilePath;
|
|
243
243
|
shouldProfile: boolean;
|
|
244
|
+
nativeProfiler: 'instruments' | 'samply' | undefined;
|
|
244
245
|
shouldTrace: boolean;
|
|
245
246
|
shouldPatchConsole: boolean;
|
|
246
247
|
detailedReport?: DetailedReportOptions | null | undefined;
|
package/lib/worker.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.28.0",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -22,23 +22,23 @@
|
|
|
22
22
|
"build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@atlaspack/build-cache": "2.13.7-dev-compiled-hash-e5f8a1735.0",
|
|
26
|
-
"@atlaspack/cache": "3.2.33-dev-compiled-hash-e5f8a1735.0",
|
|
27
|
-
"@atlaspack/diagnostic": "2.14.5-dev-compiled-hash-e5f8a1735.0",
|
|
28
|
-
"@atlaspack/events": "2.14.5-dev-compiled-hash-e5f8a1735.0",
|
|
29
|
-
"@atlaspack/feature-flags": "2.26.2-dev-compiled-hash-e5f8a1735.0",
|
|
30
|
-
"@atlaspack/fs": "2.15.33-dev-compiled-hash-e5f8a1735.0",
|
|
31
|
-
"@atlaspack/graph": "3.5.27-dev-compiled-hash-e5f8a1735.0",
|
|
32
|
-
"@atlaspack/logger": "2.14.30-dev-compiled-hash-e5f8a1735.0",
|
|
33
|
-
"@atlaspack/package-manager": "2.14.38-dev-compiled-hash-e5f8a1735.0",
|
|
34
|
-
"@atlaspack/plugin": "2.14.38-dev-compiled-hash-e5f8a1735.0",
|
|
35
|
-
"@atlaspack/profiler": "2.14.35-dev-compiled-hash-e5f8a1735.0",
|
|
36
|
-
"@atlaspack/rust": "3.9.2-dev-compiled-hash-e5f8a1735.0",
|
|
37
|
-
"@atlaspack/types": "2.15.28-dev-compiled-hash-e5f8a1735.0",
|
|
38
|
-
"@atlaspack/utils": "3.1.2-dev-compiled-hash-e5f8a1735.0",
|
|
39
|
-
"@atlaspack/workers": "2.14.38-dev-compiled-hash-e5f8a1735.0",
|
|
40
25
|
"@mischnic/json-sourcemap": "^0.1.0",
|
|
41
|
-
"@
|
|
26
|
+
"@atlaspack/build-cache": "2.13.6",
|
|
27
|
+
"@atlaspack/cache": "3.2.34",
|
|
28
|
+
"@atlaspack/diagnostic": "2.14.4",
|
|
29
|
+
"@atlaspack/events": "2.14.4",
|
|
30
|
+
"@atlaspack/feature-flags": "2.27.0",
|
|
31
|
+
"@atlaspack/fs": "2.15.34",
|
|
32
|
+
"@atlaspack/graph": "3.6.1",
|
|
33
|
+
"@atlaspack/logger": "2.14.31",
|
|
34
|
+
"@atlaspack/package-manager": "2.14.39",
|
|
35
|
+
"@atlaspack/plugin": "2.14.39",
|
|
36
|
+
"@atlaspack/profiler": "2.15.0",
|
|
37
|
+
"@atlaspack/rust": "3.11.0",
|
|
38
|
+
"@atlaspack/types": "2.15.29",
|
|
39
|
+
"@atlaspack/utils": "3.2.0",
|
|
40
|
+
"@atlaspack/workers": "2.14.39",
|
|
41
|
+
"@atlaspack/source-map": "3.1.0",
|
|
42
42
|
"base-x": "^3.0.8",
|
|
43
43
|
"browserslist": "^4.6.6",
|
|
44
44
|
"clone": "^2.1.1",
|
|
@@ -50,16 +50,15 @@
|
|
|
50
50
|
"semver": "^7.5.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@atlaspack/babel-register": "2.14.
|
|
53
|
+
"@atlaspack/babel-register": "2.14.4",
|
|
54
54
|
"@types/node": ">= 18",
|
|
55
|
-
"graphviz": "^0.0.9",
|
|
56
|
-
"jest-diff": "*",
|
|
57
55
|
"rfdc": "1",
|
|
56
|
+
"jest-diff": "*",
|
|
57
|
+
"graphviz": "^0.0.9",
|
|
58
58
|
"tempy": "^0.2.1"
|
|
59
59
|
},
|
|
60
60
|
"browser": {
|
|
61
61
|
"./src/serializerCore.js": "./src/serializerCore.browser.js"
|
|
62
62
|
},
|
|
63
|
-
"type": "commonjs"
|
|
64
|
-
"gitHead": "e5f8a173505611c1fafafd6e7dddb2f6b483f67c"
|
|
63
|
+
"type": "commonjs"
|
|
65
64
|
}
|
package/src/Atlaspack.ts
CHANGED
|
@@ -43,7 +43,7 @@ import createPathRequest from './requests/PathRequest';
|
|
|
43
43
|
import {createEnvironment} from './Environment';
|
|
44
44
|
import {createDependency} from './Dependency';
|
|
45
45
|
import {Disposable} from '@atlaspack/events';
|
|
46
|
-
import {init as initSourcemaps} from '@
|
|
46
|
+
import {init as initSourcemaps} from '@atlaspack/source-map';
|
|
47
47
|
import {LMDBLiteCache} from '@atlaspack/cache';
|
|
48
48
|
import {
|
|
49
49
|
// @ts-expect-error TS2305
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
toProjectPath,
|
|
58
58
|
fromProjectPathRelative,
|
|
59
59
|
} from './projectPath';
|
|
60
|
-
import {tracer} from '@atlaspack/profiler';
|
|
60
|
+
import {tracer, NativeProfiler} from '@atlaspack/profiler';
|
|
61
61
|
import {setFeatureFlags, DEFAULT_FEATURE_FLAGS} from '@atlaspack/feature-flags';
|
|
62
62
|
import {AtlaspackV3, FileSystemV3} from './atlaspack-v3';
|
|
63
63
|
import createAssetGraphRequestJS from './requests/AssetGraphRequest';
|
|
@@ -407,6 +407,10 @@ export default class Atlaspack {
|
|
|
407
407
|
if (options.shouldProfile) {
|
|
408
408
|
await this.startProfiling();
|
|
409
409
|
}
|
|
410
|
+
if (options.nativeProfiler) {
|
|
411
|
+
const nativeProfiler = new NativeProfiler();
|
|
412
|
+
await nativeProfiler.startProfiling(options.nativeProfiler);
|
|
413
|
+
}
|
|
410
414
|
if (options.shouldTrace) {
|
|
411
415
|
tracer.enable();
|
|
412
416
|
// We need to ensure the tracer is disabled when Atlaspack is disposed as it is a module level object.
|