@atlaspack/core 2.25.0 → 2.25.2-dev-af891f2f6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.25.0",
3
+ "version": "2.25.2-dev-af891f2f6.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-af891f2f6.0",
26
+ "@atlaspack/cache": "3.2.30-dev-af891f2f6.0",
27
+ "@atlaspack/diagnostic": "2.14.5-dev-af891f2f6.0",
28
+ "@atlaspack/events": "2.14.5-dev-af891f2f6.0",
29
+ "@atlaspack/feature-flags": "2.25.5-dev-af891f2f6.0",
30
+ "@atlaspack/fs": "2.15.30-dev-af891f2f6.0",
31
+ "@atlaspack/graph": "3.5.24-dev-af891f2f6.0",
32
+ "@atlaspack/logger": "2.14.27-dev-af891f2f6.0",
33
+ "@atlaspack/package-manager": "2.14.35-dev-af891f2f6.0",
34
+ "@atlaspack/plugin": "2.14.35-dev-af891f2f6.0",
35
+ "@atlaspack/profiler": "2.14.32-dev-af891f2f6.0",
36
+ "@atlaspack/rust": "3.8.3-dev-af891f2f6.0",
37
+ "@atlaspack/source-map": "3.0.1-dev-af891f2f6.0",
38
+ "@atlaspack/types": "2.15.25-dev-af891f2f6.0",
39
+ "@atlaspack/utils": "3.0.3-dev-af891f2f6.0",
40
+ "@atlaspack/workers": "2.14.35-dev-af891f2f6.0",
25
41
  "@mischnic/json-sourcemap": "^0.1.0",
26
- "@atlaspack/build-cache": "2.13.6",
27
- "@atlaspack/cache": "3.2.28",
28
- "@atlaspack/diagnostic": "2.14.4",
29
- "@atlaspack/events": "2.14.4",
30
- "@atlaspack/feature-flags": "2.25.3",
31
- "@atlaspack/fs": "2.15.28",
32
- "@atlaspack/graph": "3.5.22",
33
- "@atlaspack/logger": "2.14.25",
34
- "@atlaspack/package-manager": "2.14.33",
35
- "@atlaspack/plugin": "2.14.33",
36
- "@atlaspack/profiler": "2.14.30",
37
- "@atlaspack/rust": "3.8.2",
38
- "@atlaspack/types": "2.15.23",
39
- "@atlaspack/utils": "3.0.1",
40
- "@atlaspack/workers": "2.14.33",
41
- "@parcel/source-map": "^2.1.1",
42
42
  "base-x": "^3.0.8",
43
43
  "browserslist": "^4.6.6",
44
44
  "clone": "^2.1.1",
@@ -50,15 +50,16 @@
50
50
  "semver": "^7.5.2"
51
51
  },
52
52
  "devDependencies": {
53
- "@atlaspack/babel-register": "2.14.4",
53
+ "@atlaspack/babel-register": "2.14.5-dev-af891f2f6.0",
54
54
  "@types/node": ">= 18",
55
- "rfdc": "1",
56
- "jest-diff": "*",
57
55
  "graphviz": "^0.0.9",
56
+ "jest-diff": "*",
57
+ "rfdc": "1",
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"
63
+ "type": "commonjs",
64
+ "gitHead": "af891f2f68edf62c81b19d349331cf4a07ac458d"
64
65
  }
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 '@parcel/source-map';
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
@@ -391,17 +391,28 @@ export default class BundleGraph {
391
391
  local,
392
392
  loc: reexportAllLoc,
393
393
  });
394
+
394
395
  if (node.value.sourceAssetId != null) {
395
- let sourceAssetId = nullthrows(
396
- assetGraphNodeIdToBundleGraphNodeId.get(
397
- assetGraph.getNodeIdByContentKey(
398
- node.value.sourceAssetId,
396
+ let sourceAssetId: NodeId;
397
+
398
+ if (getFeatureFlag('sourceAssetIdBundleGraphFix')) {
399
+ [sourceAssetId] =
400
+ assetGraph.getNodeIdsConnectedTo(nodeId);
401
+ } else {
402
+ sourceAssetId = assetGraph.getNodeIdByContentKey(
403
+ node.value.sourceAssetId,
404
+ );
405
+ }
406
+
407
+ let sourceAsset = nullthrows(
408
+ graph.getNode(
409
+ nullthrows(
410
+ assetGraphNodeIdToBundleGraphNodeId.get(
411
+ sourceAssetId,
412
+ ),
399
413
  ),
400
414
  ),
401
415
  );
402
- let sourceAsset = nullthrows(
403
- graph.getNode(sourceAssetId),
404
- );
405
416
  invariant(sourceAsset.type === 'asset');
406
417
  let sourceAssetSymbols = sourceAsset.value.symbols;
407
418
  if (sourceAssetSymbols) {
@@ -3,7 +3,7 @@ import {Readable} from 'stream';
3
3
  import {deserializeRaw} from '@atlaspack/build-cache';
4
4
  import type {AST, Blob} from '@atlaspack/types';
5
5
  import {bufferStream, blobToStream, streamFromPromise} from '@atlaspack/utils';
6
- import SourceMap from '@parcel/source-map';
6
+ import SourceMap from '@atlaspack/source-map';
7
7
 
8
8
  import {generateFromAST} from './assetUtils';
9
9
  import type {Asset, Dependency, AtlaspackOptions} from './types';
@@ -7,7 +7,7 @@ import type {
7
7
  NamedBundle as NamedBundleType,
8
8
  Async,
9
9
  } from '@atlaspack/types';
10
- import type SourceMap from '@parcel/source-map';
10
+ import type SourceMap from '@atlaspack/source-map';
11
11
  import type {
12
12
  Bundle as InternalBundle,
13
13
  Config,
@@ -1943,28 +1943,21 @@ async function loadRequestGraph(
1943
1943
  },
1944
1944
  });
1945
1945
 
1946
- if (getFeatureFlag('verboseRequestInvalidationStats')) {
1947
- const invalidationStats = await invalidateRequestGraph(
1948
- requestGraph,
1949
- options,
1950
- events,
1951
- );
1946
+ const invalidationStats = await invalidateRequestGraph(
1947
+ requestGraph,
1948
+ options,
1949
+ events,
1950
+ );
1952
1951
 
1953
- logger.verbose({
1954
- origin: '@atlaspack/core',
1955
- message: 'Request track loaded from cache',
1956
- meta: {
1957
- ...commonMeta,
1958
- trackableEvent: 'request_tracker_cache_key_hit',
1959
- invalidationStats,
1960
- },
1961
- });
1962
- } else {
1963
- requestGraph.invalidateUnpredictableNodes();
1964
- requestGraph.invalidateOnBuildNodes();
1965
- requestGraph.invalidateEnvNodes(options.env);
1966
- requestGraph.invalidateOptionNodes(options);
1967
- }
1952
+ logger.verbose({
1953
+ origin: '@atlaspack/core',
1954
+ message: 'Request track loaded from cache',
1955
+ meta: {
1956
+ ...commonMeta,
1957
+ trackableEvent: 'request_tracker_cache_key_hit',
1958
+ invalidationStats,
1959
+ },
1960
+ });
1968
1961
 
1969
1962
  return requestGraph;
1970
1963
  } catch (e: any) {
@@ -69,6 +69,7 @@ import {
69
69
  import {invalidateOnFileCreateToInternal, createInvalidations} from './utils';
70
70
  import invariant from 'assert';
71
71
  import {tracer, PluginTracer} from '@atlaspack/profiler';
72
+ import SourceMap from '@atlaspack/source-map';
72
73
  import {getFeatureFlag} from '@atlaspack/feature-flags';
73
74
 
74
75
  type GenerateFunc = (input: UncommittedAsset) => Promise<GenerateOutput>;
@@ -460,7 +461,7 @@ export default class Transformation {
460
461
  if (asset.isASTDirty && asset.generate) {
461
462
  let output = await asset.generate();
462
463
  asset.content = output.content;
463
- asset.mapBuffer = output.map?.toBuffer();
464
+ asset.mapBuffer = SourceMap.safeToBuffer(output.map);
464
465
  }
465
466
 
466
467
  asset.clearAST();
@@ -634,7 +635,7 @@ export default class Transformation {
634
635
  ) {
635
636
  let output = await asset.generate();
636
637
  asset.content = output.content;
637
- asset.mapBuffer = output.map?.toBuffer();
638
+ asset.mapBuffer = SourceMap.safeToBuffer(output.map);
638
639
  }
639
640
 
640
641
  // Load config for the transformer.
@@ -11,7 +11,7 @@ import type {Asset, Dependency, AtlaspackOptions, Invalidations} from './types';
11
11
 
12
12
  import invariant from 'assert';
13
13
  import {Readable} from 'stream';
14
- import SourceMap from '@parcel/source-map';
14
+ import SourceMap from '@atlaspack/source-map';
15
15
  import {serializeRaw} from '@atlaspack/build-cache';
16
16
  import {
17
17
  blobToStream,
@@ -249,7 +249,7 @@ export default class UncommittedAsset {
249
249
 
250
250
  if (map) {
251
251
  this.map = map;
252
- this.mapBuffer = map.toBuffer();
252
+ this.mapBuffer = SourceMap.safeToBuffer(map);
253
253
  this.setCode(code.replace(SOURCEMAP_RE, ''));
254
254
  }
255
255
 
@@ -425,7 +425,7 @@ export default class UncommittedAsset {
425
425
  content,
426
426
  ast: result.ast,
427
427
  isASTDirty: result.ast === this.ast ? this.isASTDirty : true,
428
- mapBuffer: result.map ? result.map.toBuffer() : null,
428
+ mapBuffer: SourceMap.safeToBuffer(result.map),
429
429
  code: this.code,
430
430
  invalidations: this.invalidations,
431
431
  });
package/src/assetUtils.ts CHANGED
@@ -39,6 +39,7 @@ import {PluginTracer} from '@atlaspack/profiler';
39
39
  import {identifierRegistry} from './IdentifierRegistry';
40
40
  import type {EnvironmentRef} from './EnvironmentManager';
41
41
  import {toEnvironmentId} from './EnvironmentManager';
42
+ import SourceMap from '@atlaspack/source-map';
42
43
 
43
44
  export type AssetOptions = {
44
45
  id?: string;
@@ -180,7 +181,7 @@ async function _generateFromAST(asset: CommittedAsset | UncommittedAsset) {
180
181
  tracer: new PluginTracer({origin: pluginName, category: 'asset-generate'}),
181
182
  });
182
183
 
183
- let mapBuffer = map?.toBuffer();
184
+ let mapBuffer = SourceMap.safeToBuffer(map);
184
185
  // Store the results in the cache so we can avoid generating again next time
185
186
  await Promise.all([
186
187
  asset.options.cache.setStream(
@@ -1,4 +1,4 @@
1
- import SourceMap from '@parcel/source-map';
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 {
@@ -1,4 +1,4 @@
1
- import type SourceMap from '@parcel/source-map';
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
 
package/src/worker.ts CHANGED
@@ -21,7 +21,7 @@ import Validation, {ValidationOpts} from './Validation';
21
21
  import {AtlaspackConfig} from './AtlaspackConfig';
22
22
  import {registerCoreWithSerializer} from './registerCoreWithSerializer';
23
23
  import {clearBuildCaches} from '@atlaspack/build-cache';
24
- import {init as initSourcemaps} from '@parcel/source-map';
24
+ import {init as initSourcemaps} from '@atlaspack/source-map';
25
25
  // @ts-expect-error TS2305
26
26
  import {init as initRust} from '@atlaspack/rust';
27
27
  import WorkerFarm from '@atlaspack/workers';