mirror of
https://github.com/facebookarchive/prepack.git
synced 2024-09-11 14:46:37 +03:00
Fix source maps output option in CLI (#536)
This commit is contained in:
parent
eb8268a7e0
commit
2e0ff63a69
9
flow-typed/npm/babel-generator_vx.x.x.js
vendored
9
flow-typed/npm/babel-generator_vx.x.x.js
vendored
@ -15,8 +15,15 @@
|
||||
|
||||
import { BabelNode } from "babel-types";
|
||||
|
||||
type SourceMap = {
|
||||
sources: Array<string>,
|
||||
names: Array<string>,
|
||||
mappings: string,
|
||||
sourcesContent: Array<string>
|
||||
};
|
||||
|
||||
declare module 'babel-generator' {
|
||||
declare module.exports: (ast: BabelNode, opts: Object, code: string) => { code: string, map?: string };
|
||||
declare module.exports: (ast: BabelNode, opts: Object, code: string) => { code: string, map?: SourceMap };
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,7 +101,7 @@ if (!inputFilename) {
|
||||
}
|
||||
|
||||
if (outputSourceMap) {
|
||||
fs.writeFileSync(outputSourceMap, serialized.map || "");
|
||||
fs.writeFileSync(outputSourceMap, serialized.map ? JSON.stringify(serialized.map) : '');
|
||||
}
|
||||
} catch (x) {
|
||||
if (x instanceof InitializationError) {
|
||||
|
@ -31,6 +31,13 @@ import { Logger } from "./logger.js";
|
||||
import { Modules } from "./modules.js";
|
||||
import { LoggingTracer } from "./LoggingTracer.js";
|
||||
|
||||
type SourceMap = {
|
||||
sources: Array<string>,
|
||||
names: Array<string>,
|
||||
mappings: string,
|
||||
sourcesContent: Array<string>
|
||||
};
|
||||
|
||||
function isSameNode(left, right) {
|
||||
let type = left.type;
|
||||
|
||||
@ -1367,7 +1374,7 @@ export class Serializer {
|
||||
return false;
|
||||
}
|
||||
|
||||
serialize(filename: string, code: string, sourceMaps: boolean): { generated?: { code: string, map?: string } } {
|
||||
serialize(filename: string, code: string, sourceMaps: boolean): { generated?: { code: string, map?: SourceMap } } {
|
||||
this._emitGenerator(this.generator);
|
||||
invariant(this.declaredDerivedIds.size <= this.preludeGenerator.derivedIds.size);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user