-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(all): handle base64 inline source maps (#283)
Pulls in Source Map handling logic from Node.js
- Loading branch information
Showing
6 changed files
with
115 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
/* global describe, it */ | ||
const getSourceMapFromFile = require('../lib/source-map-from-file') | ||
const assert = require('assert') | ||
const path = require('path') | ||
const { readFileSync } = require('fs') | ||
describe('source-map-from-file', () => { | ||
it('should parse source maps from compiled targets', () => { | ||
const sourceMap = getSourceMapFromFile('./test/fixtures/all/ts-compiled/main.js') | ||
assert.strictEqual(sourceMap, ['test', 'fixtures', 'all', 'ts-compiled', 'main.js.map'].join(path.sep)) | ||
const expected = JSON.parse(readFileSync(require.resolve('./fixtures/all/ts-compiled/main.js.map'), 'utf8')) | ||
assert.deepStrictEqual(sourceMap, expected) | ||
}) | ||
it('should handle extra whitespace characters', () => { | ||
const sourceMap = getSourceMapFromFile('./test/fixtures/source-maps/padded.js') | ||
assert.strictEqual(sourceMap, ['test', 'fixtures', 'source-maps', 'padded.js.map'].join(path.sep)) | ||
assert.deepStrictEqual(sourceMap, { version: 3 }) | ||
}) | ||
it('should support base64 encoded inline source maps', () => { | ||
const sourceMap = getSourceMapFromFile('./test/fixtures/source-maps/inline.js') | ||
assert.strictEqual(sourceMap.version, 3) | ||
}) | ||
}) |