apollo-codegen
Advanced tools
Comparing version 0.9.4 to 0.9.5
@@ -143,3 +143,3 @@ #!/usr/bin/env node | ||
describe: 'Code generation target language', | ||
choices: ['swift', 'json'], | ||
choices: ['swift', 'json', 'ts', 'typescript'], | ||
default: 'swift' | ||
@@ -146,0 +146,0 @@ }, |
@@ -8,6 +8,2 @@ 'use strict'; | ||
var _stringify = require('babel-runtime/core-js/json/stringify'); | ||
var _stringify2 = _interopRequireDefault(_stringify); | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
@@ -70,3 +66,2 @@ | ||
exports.compileToIR = compileToIR; | ||
exports.stringifyIR = stringifyIR; | ||
exports.printIR = printIR; | ||
@@ -727,14 +722,2 @@ | ||
function stringifyIR(ast, space) { | ||
return (0, _stringify2.default)(ast, function (key, value) { | ||
if (value === undefined) { | ||
return null; | ||
} else if ((0, _graphql.isType)(value)) { | ||
return String(value); | ||
} else { | ||
return value; | ||
} | ||
}, space); | ||
} | ||
function printIR(_ref5) { | ||
@@ -741,0 +724,0 @@ var fields = _ref5.fields; |
@@ -7,6 +7,2 @@ 'use strict'; | ||
var _values = require('babel-runtime/core-js/object/values'); | ||
var _values2 = _interopRequireDefault(_values); | ||
var _assign = require('babel-runtime/core-js/object/assign'); | ||
@@ -30,4 +26,10 @@ | ||
var _serializeToJSON = require('./serializeToJSON'); | ||
var _serializeToJSON2 = _interopRequireDefault(_serializeToJSON); | ||
var _swift = require('./swift'); | ||
var _typescript = require('./typescript'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -48,4 +50,9 @@ | ||
case 'json': | ||
output = generateIR(context); | ||
output = (0, _serializeToJSON2.default)(context); | ||
break; | ||
case 'ts': | ||
case 'typescript': | ||
output = (0, _typescript.generateSource)(context); | ||
break; | ||
case 'swift': | ||
default: | ||
@@ -62,10 +69,2 @@ output = (0, _swift.generateSource)(context); | ||
} | ||
function generateIR(context) { | ||
return (0, _compilation.stringifyIR)({ | ||
operations: (0, _values2.default)(context.operations), | ||
fragments: (0, _values2.default)(context.fragments), | ||
typesUsed: context.typesUsed | ||
}, '\t'); | ||
} | ||
//# sourceMappingURL=generate.js.map |
@@ -151,2 +151,4 @@ 'use strict'; | ||
})(); | ||
} else { | ||
initializerDeclarationForProperties(generator, []); | ||
} | ||
@@ -153,0 +155,0 @@ |
{ | ||
"name": "apollo-codegen", | ||
"version": "0.9.4", | ||
"version": "0.9.5", | ||
"description": "Generate client code based on a GraphQL schema and query documents", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -18,3 +18,4 @@ import chai, { expect } from 'chai' | ||
import { compileToIR, stringifyIR, printIR } from '../src/compilation' | ||
import { compileToIR } from '../src/compilation' | ||
import { serializeAST } from '../src/serializeToJSON' | ||
@@ -1145,3 +1146,3 @@ const schema = loadSchema(require.resolve('./starwars/schema.json')); | ||
function filteredIR(ir) { | ||
return JSON.parse(stringifyIR(ir), function(key, value) { | ||
return JSON.parse(serializeAST(ir), function(key, value) { | ||
if (key === 'source') { | ||
@@ -1148,0 +1149,0 @@ return undefined; |
@@ -29,3 +29,3 @@ import { expect } from 'chai'; | ||
import { compileToIR, printIR } from '../../src/compilation'; | ||
import { compileToIR } from '../../src/compilation'; | ||
@@ -114,2 +114,4 @@ describe('Swift code generation', function() { | ||
public static let queryDocument = operationDefinition.appending(HeroDetails.fragmentDefinition) | ||
public init() { | ||
} | ||
@@ -169,2 +171,4 @@ public struct Data: GraphQLMappable { | ||
public static let queryDocument = operationDefinition.appending(DroidDetails.fragmentDefinition) | ||
public init() { | ||
} | ||
@@ -228,2 +232,4 @@ public struct Data: GraphQLMappable { | ||
public static let queryDocument = operationDefinition.appending(HeroDetails.fragmentDefinition) | ||
public init() { | ||
} | ||
@@ -230,0 +236,0 @@ public struct Data: GraphQLMappable { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
376544
64
7495