@atlaspack/core 2.25.1 → 2.25.2-dev-c116bd0a6.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.
@@ -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,
@@ -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';
package/tsconfig.json CHANGED
@@ -52,6 +52,9 @@
52
52
  },
53
53
  {
54
54
  "path": "../workers/tsconfig.json"
55
+ },
56
+ {
57
+ "path": "../source-map/tsconfig.json"
55
58
  }
56
59
  ]
57
60
  }