@types/sourcemap-validator
TypeScript icon, indicating that this package has built-in type declarations

2.1.2 • Public • Published

Installation

npm install --save @types/sourcemap-validator

Summary

This package contains type definitions for sourcemap-validator (https://github.com/ben-ng/sourcemap-validator#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sourcemap-validator.

index.d.ts

export = validate;

/**
 * Validate source maps.
 *
 * @param minifiedCode Your minified code.
 * @param sourceMap Your sourcemap as a JSON string. If left empty, the inline sourcemap in `minifiedCode` will be used.
 * @param sourceContent A map to the raw source files. If left empty, the inline `sourceContent` in `sourceMap` will be used.
 *
 * @example
 * import validate = require('sourcemap-validator');
 * import * as fs from 'fs';
 * import * as assert from 'assert';
 *
 * const min = fs.readFileSync('jquery.min.js', 'utf-8');
 * const map = fs.readFileSync('jquery.min.map', 'utf-8');
 * const raw = fs.readFileSync('jquery.js', 'utf-8');
 *
 * assert.doesNotThrow(() => {
 *   validate(min, map, {'jquery.js': raw});
 * }, 'The sourcemap is not valid');
 *
 * const browserifyBundleMin = fs.readFileSync('bundle.min.js', 'utf-8');
 * const browserifyBundleMap = fs.readFileSync('bundle.min.map', 'utf-8');
 *
 * // Browserify bundles have inline sourceContent in their maps
 * // so no need to pass a `sourceContent` object.
 * assert.doesNotThrow(() => {
 *   validate(browserifyBundleMin, browserifyBundleMap);
 * }, 'The sourcemap is not valid');
 */
declare function validate(minifiedCode: string, sourceMap?: string, sourceContent?: Record<string, string>): void;

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: none

Credits

These definitions were written by BendingBender.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/sourcemap-validator

Weekly Downloads

143

Version

2.1.2

License

MIT

Unpacked Size

5.21 kB

Total Files

5

Last publish

Collaborators

  • types