@atlaspack/transformer-compiled 0.3.2-canary.4190 → 0.3.2-canary.4191

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.
@@ -205,7 +205,7 @@ exports.default = new plugin_1.Transformer({
205
205
  const originalSourceMap = await asset.getMap();
206
206
  const sourceFileName = (0, utils_1.relativeUrl)(config.projectRoot, asset.filePath);
207
207
  (0, assert_1.default)(result?.ast, 'Babel transform returned no AST');
208
- const { code: generatedCode, rawMappings } = (0, generator_1.default)(result.ast.program, {
208
+ let { code: generatedCode, rawMappings } = (0, generator_1.default)(result.ast.program, {
209
209
  sourceFileName,
210
210
  sourceMaps: !!asset.env.sourceMap,
211
211
  comments: true,
@@ -216,15 +216,12 @@ exports.default = new plugin_1.Transformer({
216
216
  map.addIndexedMappings(rawMappings);
217
217
  }
218
218
  if (originalSourceMap) {
219
- // The babel AST already contains the correct mappings, but not the source contents.
220
- // We need to copy over the source contents from the original map.
221
- const sourcesContent = originalSourceMap.getSourcesContentMap();
222
- for (const filePath in sourcesContent) {
223
- const content = sourcesContent[filePath];
224
- if (content != null) {
225
- map.setSourceContent(filePath, content);
226
- }
227
- }
219
+ // Compose the new mappings (generated intermediate) with the previous map
220
+ // (intermediate original) so the final map traces back to the original source.
221
+ map.extends(originalSourceMap);
222
+ }
223
+ if (asset.env.sourceMap) {
224
+ asset.setMap(map);
228
225
  }
229
226
  return [asset];
230
227
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/transformer-compiled",
3
- "version": "0.3.2-canary.4190+4c1f39a91",
3
+ "version": "0.3.2-canary.4191+d8e984b7f",
4
4
  "description": "Atlaspack transformer for Compiled CSS-in-JS (insourced from @compiled/parcel-transformer)",
5
5
  "license": "(MIT OR Apache-2.0)",
6
6
  "publishConfig": {
@@ -21,9 +21,9 @@
21
21
  "src"
22
22
  ],
23
23
  "dependencies": {
24
- "@atlaspack/plugin": "2.14.5-canary.411+4c1f39a91",
25
- "@atlaspack/source-map": "3.2.9-canary.4190+4c1f39a91",
26
- "@atlaspack/utils": "2.14.5-canary.411+4c1f39a91",
24
+ "@atlaspack/plugin": "2.14.5-canary.412+d8e984b7f",
25
+ "@atlaspack/source-map": "3.2.9-canary.4191+d8e984b7f",
26
+ "@atlaspack/utils": "2.14.5-canary.412+d8e984b7f",
27
27
  "@babel/core": "7.24.9",
28
28
  "@babel/generator": "^7.22.10",
29
29
  "@babel/plugin-syntax-jsx": "^7.27.1",
@@ -35,11 +35,11 @@
35
35
  "enhanced-resolve": "^5.18.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@atlaspack/types": "2.14.5-canary.411+4c1f39a91"
38
+ "@atlaspack/types": "2.14.5-canary.412+d8e984b7f"
39
39
  },
40
40
  "type": "commonjs",
41
41
  "scripts": {
42
42
  "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
43
43
  },
44
- "gitHead": "4c1f39a911acaefd630d877af1ae5a039931662f"
44
+ "gitHead": "d8e984b7f6d04fa03707fa299bfd8b8bf9f58280"
45
45
  }
@@ -270,7 +270,7 @@ export default new Transformer<Config>({
270
270
 
271
271
  assert(result?.ast, 'Babel transform returned no AST');
272
272
 
273
- const {code: generatedCode, rawMappings} = generate(result.ast.program, {
273
+ let {code: generatedCode, rawMappings} = generate(result.ast.program, {
274
274
  sourceFileName,
275
275
  sourceMaps: !!asset.env.sourceMap,
276
276
  comments: true,
@@ -292,15 +292,13 @@ export default new Transformer<Config>({
292
292
  }
293
293
 
294
294
  if (originalSourceMap) {
295
- // The babel AST already contains the correct mappings, but not the source contents.
296
- // We need to copy over the source contents from the original map.
297
- const sourcesContent = originalSourceMap.getSourcesContentMap();
298
- for (const filePath in sourcesContent) {
299
- const content = sourcesContent[filePath];
300
- if (content != null) {
301
- map.setSourceContent(filePath, content);
302
- }
303
- }
295
+ // Compose the new mappings (generated intermediate) with the previous map
296
+ // (intermediate original) so the final map traces back to the original source.
297
+ map.extends(originalSourceMap);
298
+ }
299
+
300
+ if (asset.env.sourceMap) {
301
+ asset.setMap(map);
304
302
  }
305
303
 
306
304
  return [asset];