Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tsc sourcemaps metadata #8734

Merged
merged 3 commits into from
Jan 3, 2023
Merged

Fix tsc sourcemaps metadata #8734

merged 3 commits into from
Jan 3, 2023

Conversation

mischnic
Copy link
Member

@mischnic mischnic commented Jan 1, 2023

"Closes" #7570, #7655
Closes #7876

  1. In sources, tsc would only list the filename, not the relative path (like everything else in Parcel). So e.g. index.ts instead of packages/foo/src/index.ts. This also caused some duplicated entries because the JS transformer correctly used the complete path. Setting the mapRoot fixes this
  2. The sourcecontent was missing for tsc. Apparently this is an unfortunate difference between return [{content, map}] and asset.setMap(); return [asset]; where the latter uses this code to automatically apply the sourcecontent
    setMap(map: ?SourceMap): void {
    // If we have sourceContent available, it means this asset is source code without
    // a previous source map. Ensure that the map set by the transformer has the original
    // source content available.
    if (map != null && this.sourceContent != null) {
    map.setSourceContent(
    fromProjectPath(this.options.projectRoot, this.value.filePath),
    // $FlowFixMe
    this.sourceContent,
    );
    this.sourceContent = null;
    }
    this.map = map;
    this.mapBuffer = this.map?.toBuffer();
    }

    (Furthermore, it now calls map.extends just like the JS transformer does)

@parcel-benchmark
Copy link

parcel-benchmark commented Jan 1, 2023

Benchmark Results

Kitchen Sink ✅

Timings

Description Time Difference
Cold 1.39s -23.00ms
Cached 319.00ms -22.00ms 🚀

Cold Bundles

No bundle changes detected.

Cached Bundles

Bundle Size Difference Time Difference
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 80.00ms -4.00ms

React HackerNews ✅

Timings

Description Time Difference
Cold 9.03s +101.00ms
Cached 417.00ms +12.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

AtlasKit Editor ✅

Timings

Description Time Difference
Cold 1.47m -447.00ms
Cached 1.98s +1.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

Three.js ✅

Timings

Description Time Difference
Cold 6.56s +13.00ms
Cached 255.00ms +4.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

Click here to view a detailed benchmark overview.

@mischnic mischnic merged commit ea61ad9 into v2 Jan 3, 2023
@mischnic mischnic deleted the tsc-sourcemap-root branch January 3, 2023 18:24
marcins pushed a commit to marcins/parcel that referenced this pull request Jul 14, 2023
* upstream/v2: (33 commits)
  v2.8.3
  Changelog for v2.8.3
  Address bug by updating an asset reference and merge conditions (parcel-bundler#8762)
  Fix CSS order when merging type change bundles (parcel-bundler#8766)
  fixing failing build for contributors on Linux using Node 18 (parcel-bundler#8763)
  Extension: Importers View and separate LSP protocol package (parcel-bundler#8747)
  Bump swc to fix sourcemaps with Windows line endings (parcel-bundler#8756)
  Apply HMR updates in topological order (parcel-bundler#8752)
  Make extension packaging work (parcel-bundler#8730)
  Typed api.storeResult (parcel-bundler#8732)
  Refactor LSP to use vscode-jsonrpc (parcel-bundler#8728)
  Bump swc (parcel-bundler#8742)
  Recursively check reachability when removing asset graphs from bundles in deduplication (parcel-bundler#6004)
  Fix tsc sourcemaps metadata (parcel-bundler#8734)
  Assigning to `this` in CommonJS (parcel-bundler#8737)
  Don't retarget dependencies if a symbol is imported multiple times with different local names (parcel-bundler#8738)
  Add a note about using flow in CONTRIBUTING.md (parcel-bundler#8731)
  filter out title execArgv to workers (parcel-bundler#8719)
  Document more of the BundleGraph class (parcel-bundler#8711)
  Fixed the hmr connection with host 0.0.0.0 (parcel-bundler#7357)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parcel 2: Both flat and heirarchical source files showing for Typescript project
3 participants