conjure-lite
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -0,3 +1,8 @@ | ||
"use strict"; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __esm = (fn, res) => function __init() { | ||
@@ -10,2 +15,19 @@ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
@@ -75,3 +97,2 @@ // src/util/findCommonPrefix.ts | ||
// src/util/writeCodeFile.ts | ||
import * as fs from "node:fs"; | ||
async function writeCodeFile(path3, code) { | ||
@@ -84,5 +105,7 @@ return await fs.promises.writeFile( | ||
} | ||
var fs; | ||
var init_writeCodeFile = __esm({ | ||
"src/util/writeCodeFile.ts"() { | ||
"use strict"; | ||
fs = __toESM(require("fs")); | ||
} | ||
@@ -92,7 +115,7 @@ }); | ||
// src/codegen/BaseFileGenerator.ts | ||
import * as path from "node:path"; | ||
var BaseFileGenerator; | ||
var path, BaseFileGenerator; | ||
var init_BaseFileGenerator = __esm({ | ||
"src/codegen/BaseFileGenerator.ts"() { | ||
"use strict"; | ||
path = __toESM(require("path")); | ||
init_writeCodeFile(); | ||
@@ -244,3 +267,2 @@ BaseFileGenerator = class { | ||
// src/codegen/EndpointCodeFile.ts | ||
import dedent from "dedent"; | ||
function getContentType(arg) { | ||
@@ -252,6 +274,7 @@ return arg && (isBinary(arg) || arg.type === "optional" && isBinary(arg.optional.itemType)) ? "application/octet-stream" : "application/json"; | ||
} | ||
var endpointCodeGenerator; | ||
var import_dedent, endpointCodeGenerator; | ||
var init_EndpointCodeFile = __esm({ | ||
"src/codegen/EndpointCodeFile.ts"() { | ||
"use strict"; | ||
import_dedent = __toESM(require("dedent")); | ||
init_calculateTemplatedUrlForEndpoint(); | ||
@@ -285,3 +308,3 @@ init_generatorFactory(); | ||
} | ||
const functionSource = getDocs(this.def.docs) + dedent` | ||
const functionSource = getDocs(this.def.docs) + import_dedent.default` | ||
export async function ${this.def.endpointName}(ctx: ConjureContext, ${(this.def.args ?? []).map((a) => `${a.argName}: ${this.getTypeForCode(a.type)}`).join(`, `)}): Promise<${this.def.returns ? this.getTypeForCode(this.def.returns) : "void"}> { | ||
@@ -298,7 +321,7 @@ return conjureFetch(${conjureFetchArgs.join(", ")}) | ||
// src/codegen/EnumCodeFile.ts | ||
import dedent2 from "dedent"; | ||
var enumCodeGenerator; | ||
var import_dedent2, enumCodeGenerator; | ||
var init_EnumCodeFile = __esm({ | ||
"src/codegen/EnumCodeFile.ts"() { | ||
"use strict"; | ||
import_dedent2 = __toESM(require("dedent")); | ||
init_generatorFactory(); | ||
@@ -309,3 +332,3 @@ init_getDocs(); | ||
const { typeName: { name }, values, docs } = this.def; | ||
const source = getDocs(docs) + dedent2` | ||
const source = getDocs(docs) + import_dedent2.default` | ||
export type ${name} = ${values.map(({ value }) => `"${value}"`).join("|")};\n`; | ||
@@ -319,7 +342,7 @@ await this.writeFile(source); | ||
// src/codegen/ObjectCodeFile.ts | ||
import dedent3 from "dedent"; | ||
var objectCodeGenerator; | ||
var import_dedent3, objectCodeGenerator; | ||
var init_ObjectCodeFile = __esm({ | ||
"src/codegen/ObjectCodeFile.ts"() { | ||
"use strict"; | ||
import_dedent3 = __toESM(require("dedent")); | ||
init_generatorFactory(); | ||
@@ -333,3 +356,3 @@ init_getDocs(); | ||
); | ||
const source = getDocs(docs) + dedent3` | ||
const source = getDocs(docs) + import_dedent3.default` | ||
export interface ${name} { | ||
@@ -412,7 +435,7 @@ ${fields} | ||
// src/codegen/TypeAliasCodeFile.ts | ||
import dedent4 from "dedent"; | ||
var typeAliasCodeGenerator; | ||
var import_dedent4, typeAliasCodeGenerator; | ||
var init_TypeAliasCodeFile = __esm({ | ||
"src/codegen/TypeAliasCodeFile.ts"() { | ||
"use strict"; | ||
import_dedent4 = __toESM(require("dedent")); | ||
init_generatorFactory(); | ||
@@ -423,3 +446,3 @@ init_getDocs(); | ||
const { typeName: { name }, alias, docs } = this.def; | ||
const source = getDocs(docs) + dedent4` | ||
const source = getDocs(docs) + import_dedent4.default` | ||
export type ${name} = ${this.getTypeForCode(alias)};\n`; | ||
@@ -433,7 +456,7 @@ await this.writeFile(source); | ||
// src/codegen/UnionCodeFile.ts | ||
import dedent5 from "dedent"; | ||
var unionCodeGenerator; | ||
var import_dedent5, unionCodeGenerator; | ||
var init_UnionCodeFile = __esm({ | ||
"src/codegen/UnionCodeFile.ts"() { | ||
"use strict"; | ||
import_dedent5 = __toESM(require("dedent")); | ||
init_generatorFactory(); | ||
@@ -445,3 +468,3 @@ init_getDocs(); | ||
const createUnionInterface = (u) => { | ||
return dedent5` | ||
return import_dedent5.default` | ||
export interface ${name}_${u.fieldName} { | ||
@@ -452,5 +475,5 @@ type: "${u.fieldName}"; | ||
}; | ||
const source = dedent5` | ||
const source = import_dedent5.default` | ||
${union.map(createUnionInterface).join("\n")} | ||
` + getDocs(docs) + dedent5` | ||
` + getDocs(docs) + import_dedent5.default` | ||
export type ${name} = ${union.map((u) => `${name}_${u.fieldName}`).join(" | ")} | ||
@@ -465,8 +488,8 @@ `; | ||
// src/codegen/CodeGen.ts | ||
import * as fs2 from "node:fs"; | ||
import * as path2 from "node:path"; | ||
var typeGenerators, CodeGen; | ||
var fs2, path2, typeGenerators, CodeGen; | ||
var init_CodeGen = __esm({ | ||
"src/codegen/CodeGen.ts"() { | ||
"use strict"; | ||
fs2 = __toESM(require("fs")); | ||
path2 = __toESM(require("path")); | ||
init_findCommonPrefix(); | ||
@@ -593,3 +616,2 @@ init_EndpointCodeFile(); | ||
}); | ||
import * as fs3 from "node:fs"; | ||
async function handleGenerate(args) { | ||
@@ -602,5 +624,7 @@ const ir = JSON.parse( | ||
} | ||
var fs3; | ||
var init_handleGenerate = __esm({ | ||
"src/cli/handleGenerate.ts"() { | ||
"use strict"; | ||
fs3 = __toESM(require("fs")); | ||
init_CodeGen(); | ||
@@ -611,4 +635,9 @@ } | ||
// src/cli.ts | ||
import yargs from "yargs"; | ||
import { hideBin } from "yargs/helpers"; | ||
var cli_exports = {}; | ||
__export(cli_exports, { | ||
cli: () => cli | ||
}); | ||
module.exports = __toCommonJS(cli_exports); | ||
var import_yargs = __toESM(require("yargs")); | ||
var import_helpers = require("yargs/helpers"); | ||
async function cli() { | ||
@@ -636,7 +665,8 @@ const generate = { | ||
}; | ||
await yargs(hideBin(process.argv)).command(generate).demandCommand().parseAsync(); | ||
await (0, import_yargs.default)((0, import_helpers.hideBin)(process.argv)).command(generate).demandCommand().parseAsync(); | ||
} | ||
export { | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
cli | ||
}; | ||
}); | ||
//# sourceMappingURL=cli.js.map |
@@ -0,1 +1,27 @@ | ||
"use strict"; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
conjureFetch: () => conjureFetch | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
// src/conjureFetch.ts | ||
@@ -76,5 +102,6 @@ async function conjureFetch({ fetchFn, baseUrl, servicePath, tokenProvider }, url, method, body, contentType, accept) { | ||
}; | ||
export { | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
conjureFetch | ||
}; | ||
}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "conjure-lite", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs" | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
} | ||
}, | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"bin": { | ||
"conjure-lite": "bin/conjure-lite.mjs" | ||
}, | ||
"type": "module", | ||
"files": [ | ||
@@ -16,0 +18,0 @@ "package.json", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
126596
No