@atlaspack/core 2.12.1-canary.3522 → 2.12.1-canary.3530

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.
@@ -27,7 +27,6 @@ function _rust() {
27
27
  }
28
28
  var _AssetGraph = _interopRequireWildcard(require("../AssetGraph"));
29
29
  var _constants = require("../constants");
30
- var _projectPath = require("../projectPath");
31
30
  var _RequestTracker = require("../RequestTracker");
32
31
  var _SymbolPropagation = require("../SymbolPropagation");
33
32
  function _sourceMap() {
@@ -89,7 +88,8 @@ function createAssetGraphRequestRust(rustAtlaspack) {
89
88
  function getAssetGraph(serializedGraph, options) {
90
89
  let graph = new _AssetGraph.default({
91
90
  _contentKeyToNodeId: new Map(),
92
- _nodeIdToContentKey: new Map()
91
+ _nodeIdToContentKey: new Map(),
92
+ initialCapacity: serializedGraph.edges.length
93
93
  });
94
94
  graph.safeToIncrementallyBundle = false;
95
95
  function mapSymbols({
@@ -147,33 +147,13 @@ function getAssetGraph(serializedGraph, options) {
147
147
  } else if (node.type === 'asset') {
148
148
  let asset = node.value;
149
149
  let id = asset.id;
150
+ asset.committed = true;
151
+ asset.contentKey = id;
152
+ asset.env.id = getEnvId(asset.env);
150
153
  asset.meta.id = id;
151
- asset = {
152
- ...asset,
153
- uniqueKey: asset.uniqueKey ?? undefined,
154
- pipeline: asset.pipeline ?? undefined,
155
- range: asset.range ?? undefined,
156
- resolveFrom: asset.resolveFrom ?? undefined,
157
- target: asset.target ?? undefined,
158
- plugin: asset.plugin ?? undefined,
159
- query: asset.query ?? undefined,
160
- configPath: asset.configPath ?? undefined,
161
- configKeyPath: asset.configKeyPath ?? undefined,
162
- isLargeBlob: asset.isLargeBlob ?? false,
163
- isSource: asset.isSource ?? false,
164
- sourcePath: asset.sourcePath ?? undefined,
165
- env: {
166
- ...asset.env,
167
- loc: asset.env.loc ?? undefined,
168
- id: getEnvId(asset.env),
169
- sourceType: asset.env.sourceType
170
- },
171
- bundleBehavior: asset.bundleBehavior === 255 ? null : asset.bundleBehavior,
172
- committed: true,
173
- contentKey: id,
174
- filePath: (0, _projectPath.toProjectPath)(options.projectRoot, asset.filePath),
175
- symbols: asset.symbols != null ? new Map(asset.symbols.map(mapSymbols)) : null
176
- };
154
+ if (asset.symbols != null) {
155
+ asset.symbols = new Map(asset.symbols.map(mapSymbols));
156
+ }
177
157
  if (asset.map) {
178
158
  let mapKey = (0, _rust().hashString)(`${_constants.ATLASPACK_VERSION}:map:${asset.id}`);
179
159
  let sourceMap = new (_sourceMap().default)(options.projectRoot);
@@ -193,35 +173,18 @@ function getAssetGraph(serializedGraph, options) {
193
173
  value: asset
194
174
  });
195
175
  } else if (node.type === 'dependency') {
196
- var _dependency$symbols;
197
176
  let id = node.value.id;
198
177
  let dependency = node.value.dependency;
199
- dependency = {
200
- ...dependency,
201
- id,
202
- env: {
203
- ...dependency.env,
204
- id: getEnvId(dependency.env),
205
- sourceType: dependency.env.sourceType,
206
- loc: dependency.env.loc ?? undefined
207
- },
208
- pipeline: dependency.pipeline ?? undefined,
209
- range: dependency.range ?? undefined,
210
- resolveFrom: dependency.resolveFrom ?? undefined,
211
- target: dependency.target ?? undefined,
212
- bundleBehavior: dependency.bundleBehavior === 255 ? null : dependency.bundleBehavior,
213
- contentKey: id,
214
- loc: dependency.loc ? {
215
- ...dependency.loc,
216
- filePath: (0, _projectPath.toProjectPath)(options.projectRoot, dependency.loc.filePath)
217
- } : undefined,
218
- sourcePath: dependency.sourcePath ? (0, _projectPath.toProjectPath)(options.projectRoot, dependency.sourcePath) : undefined,
219
- symbols:
220
- // Dependency.symbols are always set to an empty map when scope hoisting
221
- // is enabled. Some tests will fail if this is not the case. We should
222
- // make this consistant when we re-visit packaging.
223
- dependency.symbols != null || dependency.env.shouldScopeHoist ? new Map((_dependency$symbols = dependency.symbols) === null || _dependency$symbols === void 0 ? void 0 : _dependency$symbols.map(mapSymbols)) : undefined
224
- };
178
+ dependency.id = id;
179
+ dependency.env.id = getEnvId(dependency.env);
180
+
181
+ // Dependency.symbols are always set to an empty map when scope hoisting
182
+ // is enabled. Some tests will fail if this is not the case. We should
183
+ // make this consistant when we re-visit packaging.
184
+ if (dependency.symbols != null || dependency.env.shouldScopeHoist) {
185
+ var _dependency$symbols;
186
+ dependency.symbols = new Map((_dependency$symbols = dependency.symbols) === null || _dependency$symbols === void 0 ? void 0 : _dependency$symbols.map(mapSymbols));
187
+ }
225
188
  let usedSymbolsDown = new Set();
226
189
  let usedSymbolsUp = new Map();
227
190
  if (dependency.isEntry && dependency.isLibrary) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.12.1-canary.3522+56e3e234a",
3
+ "version": "2.12.1-canary.3530+52a1243ea",
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.3522+56e3e234a",
24
- "@atlaspack/cache": "2.12.1-canary.3522+56e3e234a",
25
- "@atlaspack/diagnostic": "2.12.1-canary.3522+56e3e234a",
26
- "@atlaspack/events": "2.12.1-canary.3522+56e3e234a",
27
- "@atlaspack/feature-flags": "2.12.1-canary.3522+56e3e234a",
28
- "@atlaspack/fs": "2.12.1-canary.3522+56e3e234a",
29
- "@atlaspack/graph": "3.2.1-canary.3522+56e3e234a",
30
- "@atlaspack/logger": "2.12.1-canary.3522+56e3e234a",
31
- "@atlaspack/package-manager": "2.12.1-canary.3522+56e3e234a",
32
- "@atlaspack/plugin": "2.12.1-canary.3522+56e3e234a",
33
- "@atlaspack/profiler": "2.12.1-canary.3522+56e3e234a",
34
- "@atlaspack/rust": "2.12.1-canary.3522+56e3e234a",
35
- "@atlaspack/types": "2.12.1-canary.3522+56e3e234a",
36
- "@atlaspack/utils": "2.12.1-canary.3522+56e3e234a",
37
- "@atlaspack/workers": "2.12.1-canary.3522+56e3e234a",
23
+ "@atlaspack/build-cache": "2.12.1-canary.3530+52a1243ea",
24
+ "@atlaspack/cache": "2.12.1-canary.3530+52a1243ea",
25
+ "@atlaspack/diagnostic": "2.12.1-canary.3530+52a1243ea",
26
+ "@atlaspack/events": "2.12.1-canary.3530+52a1243ea",
27
+ "@atlaspack/feature-flags": "2.12.1-canary.3530+52a1243ea",
28
+ "@atlaspack/fs": "2.12.1-canary.3530+52a1243ea",
29
+ "@atlaspack/graph": "3.2.1-canary.3530+52a1243ea",
30
+ "@atlaspack/logger": "2.12.1-canary.3530+52a1243ea",
31
+ "@atlaspack/package-manager": "2.12.1-canary.3530+52a1243ea",
32
+ "@atlaspack/plugin": "2.12.1-canary.3530+52a1243ea",
33
+ "@atlaspack/profiler": "2.12.1-canary.3530+52a1243ea",
34
+ "@atlaspack/rust": "2.12.1-canary.3530+52a1243ea",
35
+ "@atlaspack/types": "2.12.1-canary.3530+52a1243ea",
36
+ "@atlaspack/utils": "2.12.1-canary.3530+52a1243ea",
37
+ "@atlaspack/workers": "2.12.1-canary.3530+52a1243ea",
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": "56e3e234a88ec4681a542477d38e3a7e1f300844"
69
+ "gitHead": "52a1243ea1791fd2d7682e32947ffa894ca9668e"
70
70
  }
@@ -9,7 +9,6 @@ import type {Async} from '@atlaspack/types';
9
9
  import AssetGraph, {nodeFromAssetGroup} from '../AssetGraph';
10
10
  import type {AtlaspackV3} from '../atlaspack-v3';
11
11
  import {ATLASPACK_VERSION} from '../constants';
12
- import {toProjectPath} from '../projectPath';
13
12
  import {requestTypes, type StaticRunOpts} from '../RequestTracker';
14
13
  import {propagateSymbols} from '../SymbolPropagation';
15
14
  import type {Environment} from '../types';
@@ -88,6 +87,7 @@ function getAssetGraph(serializedGraph, options) {
88
87
  let graph = new AssetGraph({
89
88
  _contentKeyToNodeId: new Map(),
90
89
  _nodeIdToContentKey: new Map(),
90
+ initialCapacity: serializedGraph.edges.length,
91
91
  });
92
92
 
93
93
  graph.safeToIncrementallyBundle = false;
@@ -165,36 +165,13 @@ function getAssetGraph(serializedGraph, options) {
165
165
  let asset = node.value;
166
166
  let id = asset.id;
167
167
 
168
+ asset.committed = true;
169
+ asset.contentKey = id;
170
+ asset.env.id = getEnvId(asset.env);
168
171
  asset.meta.id = id;
169
-
170
- asset = {
171
- ...asset,
172
- uniqueKey: asset.uniqueKey ?? undefined,
173
- pipeline: asset.pipeline ?? undefined,
174
- range: asset.range ?? undefined,
175
- resolveFrom: asset.resolveFrom ?? undefined,
176
- target: asset.target ?? undefined,
177
- plugin: asset.plugin ?? undefined,
178
- query: asset.query ?? undefined,
179
- configPath: asset.configPath ?? undefined,
180
- configKeyPath: asset.configKeyPath ?? undefined,
181
- isLargeBlob: asset.isLargeBlob ?? false,
182
- isSource: asset.isSource ?? false,
183
- sourcePath: asset.sourcePath ?? undefined,
184
- env: {
185
- ...asset.env,
186
- loc: asset.env.loc ?? undefined,
187
- id: getEnvId(asset.env),
188
- sourceType: asset.env.sourceType,
189
- },
190
- bundleBehavior:
191
- asset.bundleBehavior === 255 ? null : asset.bundleBehavior,
192
- committed: true,
193
- contentKey: id,
194
- filePath: toProjectPath(options.projectRoot, asset.filePath),
195
- symbols:
196
- asset.symbols != null ? new Map(asset.symbols.map(mapSymbols)) : null,
197
- };
172
+ if (asset.symbols != null) {
173
+ asset.symbols = new Map(asset.symbols.map(mapSymbols));
174
+ }
198
175
 
199
176
  if (asset.map) {
200
177
  let mapKey = hashString(`${ATLASPACK_VERSION}:map:${asset.id}`);
@@ -221,42 +198,16 @@ function getAssetGraph(serializedGraph, options) {
221
198
  let id = node.value.id;
222
199
  let dependency = node.value.dependency;
223
200
 
224
- dependency = {
225
- ...dependency,
226
- id,
227
- env: {
228
- ...dependency.env,
229
- id: getEnvId(dependency.env),
230
- sourceType: dependency.env.sourceType,
231
- loc: dependency.env.loc ?? undefined,
232
- },
233
- pipeline: dependency.pipeline ?? undefined,
234
- range: dependency.range ?? undefined,
235
- resolveFrom: dependency.resolveFrom ?? undefined,
236
- target: dependency.target ?? undefined,
237
- bundleBehavior:
238
- dependency.bundleBehavior === 255 ? null : dependency.bundleBehavior,
239
- contentKey: id,
240
- loc: dependency.loc
241
- ? {
242
- ...dependency.loc,
243
- filePath: toProjectPath(
244
- options.projectRoot,
245
- dependency.loc.filePath,
246
- ),
247
- }
248
- : undefined,
249
- sourcePath: dependency.sourcePath
250
- ? toProjectPath(options.projectRoot, dependency.sourcePath)
251
- : undefined,
252
- symbols:
253
- // Dependency.symbols are always set to an empty map when scope hoisting
254
- // is enabled. Some tests will fail if this is not the case. We should
255
- // make this consistant when we re-visit packaging.
256
- dependency.symbols != null || dependency.env.shouldScopeHoist
257
- ? new Map(dependency.symbols?.map(mapSymbols))
258
- : undefined,
259
- };
201
+ dependency.id = id;
202
+ dependency.env.id = getEnvId(dependency.env);
203
+
204
+ // Dependency.symbols are always set to an empty map when scope hoisting
205
+ // is enabled. Some tests will fail if this is not the case. We should
206
+ // make this consistant when we re-visit packaging.
207
+ if (dependency.symbols != null || dependency.env.shouldScopeHoist) {
208
+ dependency.symbols = new Map(dependency.symbols?.map(mapSymbols));
209
+ }
210
+
260
211
  let usedSymbolsDown = new Set();
261
212
  let usedSymbolsUp = new Map();
262
213
  if (dependency.isEntry && dependency.isLibrary) {