UNPKG

@kpi4me/golden-layout

Version:

A multi-screen javascript Layout manager https://golden-layout.com

112 lines (111 loc) 3.35 kB
// Generated by CoffeeScript 2.0.0-beta8 var CoffeeScript, Compiler, cscodegen, escodegen, escodegenFormat, formatParserError, Nodes, Optimiser, Parser, pkg, Preprocessor; formatParserError = require('./helpers').formatParserError; Nodes = require('./nodes'); Preprocessor = require('./preprocessor').Preprocessor; Parser = require('./parser'); Optimiser = require('./optimiser').Optimiser; Compiler = require('./compiler').Compiler; cscodegen = function () { try { return require('cscodegen'); } catch (e$) { return; } }.call(this); escodegen = function () { try { return require('escodegen'); } catch (e$1) { return; } }.call(this); pkg = require('./../package.json'); escodegenFormat = { indent: { style: ' ', base: 0 }, renumber: true, hexadecimal: true, quotes: 'auto', parentheses: false }; CoffeeScript = { CoffeeScript: CoffeeScript, Compiler: Compiler, Optimiser: Optimiser, Parser: Parser, Preprocessor: Preprocessor, Nodes: Nodes, VERSION: pkg.version, parse: function (coffee, options) { var e, parsed, preprocessed; if (null == options) options = {}; try { preprocessed = Preprocessor.process(coffee, { literate: options.literate }); parsed = Parser.parse(preprocessed, { raw: options.raw, inputSource: options.inputSource }); if (options.optimise) { return Optimiser.optimise(parsed); } else { return parsed; } } catch (e$2) { e = e$2; if (!(e instanceof Parser.SyntaxError)) throw e; throw new Error(formatParserError(preprocessed, e)); } }, compile: function (csAst, options) { return Compiler.compile(csAst, options).toBasicObject(); }, cs: function (csAst, options) { }, jsWithSourceMap: function (jsAst, name, options) { var targetName; if (null == name) name = 'unknown'; if (null == options) options = {}; if (!(null != escodegen)) throw new Error('escodegen not found: run `npm install escodegen`'); if (!{}.hasOwnProperty.call(jsAst, 'type')) jsAst = jsAst.toBasicObject(); targetName = options.sourceMapFile || options.sourceMap && options.output.match(/^.*[\\\/]([^\\\/]+)$/)[1]; return escodegen.generate(jsAst, { comment: !options.compact, sourceMapWithCode: true, sourceMap: name, file: targetName || 'unknown', format: options.compact ? escodegen.FORMAT_MINIFY : null != options.format ? options.format : escodegenFormat }); }, js: function (jsAst, options) { return this.jsWithSourceMap(jsAst, null, options).code; }, sourceMap: function (jsAst, name, options) { return this.jsWithSourceMap(jsAst, name, options).map; }, cs2js: function (input, options) { var csAST, jsAST; if (null == options) options = {}; if (null != options.optimise) options.optimise; else options.optimise = true; csAST = CoffeeScript.parse(input, options); jsAST = CoffeeScript.compile(csAST, { bare: options.bare }); return CoffeeScript.js(jsAST, { compact: options.compact || options.minify }); } }; module.exports = CoffeeScript; if (null != (null != require.extensions ? require.extensions['.node'] : void 0)) CoffeeScript.register = function () { return require('./register'); };