hypertune
Advanced tools
Comparing version 2.3.7 to 2.3.8
# Changelog | ||
## 2.3.8 | ||
- Added `mjs` and `cjs` as `language` options for code generation. | ||
## 2.3.7 | ||
@@ -4,0 +8,0 @@ |
import { CAC } from "cac"; | ||
import { JsLanguage } from "../../shared"; | ||
import { Schema } from "../helpers"; | ||
@@ -13,3 +14,3 @@ export type GenerateOptions = { | ||
includeInitData?: boolean; | ||
language?: "ts" | "js"; | ||
language?: JsLanguage; | ||
edgeBaseUrl?: string; | ||
@@ -16,0 +17,0 @@ getHypertuneImportPath?: string; |
@@ -65,3 +65,3 @@ "use strict"; | ||
}) | ||
.option("--language [value]", "Target language (ts or js)", { | ||
.option("--language [value]", "Target language (ts, js (uses ESM), mjs or cjs)", { | ||
default: exports.defaultOptions.language, | ||
@@ -77,5 +77,8 @@ }) | ||
console.log("Starting Hypertune code generation..."); | ||
if (options.outputFilePath) { | ||
console.warn("Warning: --outputFilePath option is deprecated, please use --outputDirectoryPath instead"); | ||
} | ||
try { | ||
const outputDirectory = (_a = options.outputDirectoryPath) !== null && _a !== void 0 ? _a : exports.defaultOptions.outputDirectoryPath; | ||
const language = (_b = options.language) !== null && _b !== void 0 ? _b : exports.defaultOptions.language; | ||
const language = (_a = options.language) !== null && _a !== void 0 ? _a : exports.defaultOptions.language; | ||
const outputFilePath = node_path_1.default.join((_b = options.outputDirectoryPath) !== null && _b !== void 0 ? _b : exports.defaultOptions.outputDirectoryPath, `hypertune.${language}`); | ||
yield generateCode({ | ||
@@ -85,3 +88,5 @@ token: (0, helpers_1.throwIfOptionIsUndefined)("token", options.token), | ||
queryCode: getQueryCode((_d = options.queryFilePath) !== null && _d !== void 0 ? _d : exports.defaultOptions.queryFilePath), | ||
outputFilePath: (_e = options.outputFilePath) !== null && _e !== void 0 ? _e : node_path_1.default.join(outputDirectory, `hypertune.${language}`), | ||
outputFilePath: options.outputDirectoryPath | ||
? outputFilePath | ||
: (_e = options.outputFilePath) !== null && _e !== void 0 ? _e : outputFilePath, | ||
includeToken: (_f = options.includeToken) !== null && _f !== void 0 ? _f : exports.defaultOptions.includeToken, | ||
@@ -109,2 +114,5 @@ includeFallback: (_g = options.includeInitData) !== null && _g !== void 0 ? _g : exports.defaultOptions.includeInitData, | ||
} | ||
if (framework && language !== "js" && language !== "ts") { | ||
console.warn(`Warning: framework option is not supported for language: ${language}`); | ||
} | ||
const extension = node_path_1.default.extname(outputFilePath); | ||
@@ -111,0 +119,0 @@ const clientFileName = node_path_1.default.basename(outputFilePath.slice(0, outputFilePath.length - extension.length)); |
@@ -1,2 +0,2 @@ | ||
import { CodegenRequestBody, CodegenResponseBody, GraphqlRequestBody, HashResponseBody, InitRequestBody, InitData, RequestType, TracedFetch, ObjectValue } from "../shared"; | ||
import { CodegenRequestBody, CodegenResponseBody, GraphqlRequestBody, HashResponseBody, InitRequestBody, InitData, RequestType, TracedFetch, ObjectValue, JsLanguage } from "../shared"; | ||
export declare function codegenRequest({ traceId, token, branchName, body, language, edgeBaseUrl, tracedFetch, }: { | ||
@@ -7,3 +7,3 @@ traceId: string; | ||
body: Omit<CodegenRequestBody, "sdkType" | "sdkVersion" | "language">; | ||
language: "ts" | "js"; | ||
language: JsLanguage; | ||
edgeBaseUrl: string; | ||
@@ -10,0 +10,0 @@ tracedFetch: TracedFetch; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** Replaced by the value in package.json on build */ | ||
exports.default = "2.3.7"; | ||
exports.default = "2.3.8"; | ||
//# sourceMappingURL=sdkVersion.js.map |
@@ -480,3 +480,4 @@ import { isQueryVariableKey } from "./constants"; | ||
export type SdkType = "js" | "python" | "rust"; | ||
export type Language = "ts" | "js" | "python" | "rust"; | ||
export type JsLanguage = "ts" | "js" | "mjs" | "cjs"; | ||
export type Language = JsLanguage | "python" | "rust"; | ||
export type CodegenFramework = "nextApp" | "nextPages" | "react" | "remix" | "gatsby" | "vue"; | ||
@@ -483,0 +484,0 @@ export type CodegenPlatform = "vercel"; |
{ | ||
"name": "hypertune", | ||
"version": "2.3.7", | ||
"version": "2.3.8", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -9,2 +9,3 @@ import { CAC } from "cac"; | ||
CodegenPlatform, | ||
JsLanguage, | ||
prodEdgeCdnBaseUrl, | ||
@@ -30,3 +31,3 @@ uniqueId, | ||
includeInitData?: boolean; | ||
language?: "ts" | "js"; | ||
language?: JsLanguage; | ||
edgeBaseUrl?: string; | ||
@@ -100,6 +101,10 @@ getHypertuneImportPath?: string; | ||
) | ||
.option("--language [value]", "Target language (ts or js)", { | ||
default: defaultOptions.language, | ||
}) | ||
.option( | ||
"--language [value]", | ||
"Target language (ts, js (uses ESM), mjs or cjs)", | ||
{ | ||
default: defaultOptions.language, | ||
} | ||
) | ||
.option( | ||
"--framework [value]", | ||
@@ -119,7 +124,14 @@ "Framework (nextApp, nextPages, react, vue, remix or gatsby)" | ||
console.log("Starting Hypertune code generation..."); | ||
if (options.outputFilePath) { | ||
console.warn( | ||
"Warning: --outputFilePath option is deprecated, please use --outputDirectoryPath instead" | ||
); | ||
} | ||
try { | ||
const outputDirectory = | ||
options.outputDirectoryPath ?? defaultOptions.outputDirectoryPath; | ||
const language = | ||
options.language ?? (defaultOptions.language as "ts" | "js"); | ||
options.language ?? (defaultOptions.language as JsLanguage); | ||
const outputFilePath = path.join( | ||
options.outputDirectoryPath ?? defaultOptions.outputDirectoryPath, | ||
`hypertune.${language}` | ||
); | ||
@@ -133,5 +145,5 @@ await generateCode({ | ||
), | ||
outputFilePath: | ||
options.outputFilePath ?? | ||
path.join(outputDirectory, `hypertune.${language}`), | ||
outputFilePath: options.outputDirectoryPath | ||
? outputFilePath | ||
: options.outputFilePath ?? outputFilePath, | ||
includeToken: options.includeToken ?? defaultOptions.includeToken, | ||
@@ -176,3 +188,3 @@ includeFallback: | ||
edgeBaseUrl: string; | ||
language: "ts" | "js"; | ||
language: JsLanguage; | ||
framework: string | undefined; | ||
@@ -191,2 +203,7 @@ platform: string | undefined; | ||
} | ||
if (framework && language !== "js" && language !== "ts") { | ||
console.warn( | ||
`Warning: framework option is not supported for language: ${language}` | ||
); | ||
} | ||
@@ -193,0 +210,0 @@ const extension = path.extname(outputFilePath); |
@@ -12,2 +12,3 @@ import { | ||
ObjectValue, | ||
JsLanguage, | ||
} from "../shared"; | ||
@@ -28,3 +29,3 @@ | ||
body: Omit<CodegenRequestBody, "sdkType" | "sdkVersion" | "language">; | ||
language: "ts" | "js"; | ||
language: JsLanguage; | ||
edgeBaseUrl: string; | ||
@@ -31,0 +32,0 @@ tracedFetch: TracedFetch; |
@@ -672,3 +672,4 @@ /* eslint-disable capitalized-comments */ | ||
export type Language = "ts" | "js" | "python" | "rust"; | ||
export type JsLanguage = "ts" | "js" | "mjs" | "cjs"; | ||
export type Language = JsLanguage | "python" | "rust"; | ||
@@ -675,0 +676,0 @@ export type CodegenFramework = |
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
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
730206
13281